| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/spdy/chromium/spdy_test_util_common.h" | 5 #include "net/spdy/chromium/spdy_test_util_common.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <cstddef> | 9 #include <cstddef> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 return ConstructSpdyHeaders(stream_id, std::move(block), priority, false); | 866 return ConstructSpdyHeaders(stream_id, std::move(block), priority, false); |
| 867 } | 867 } |
| 868 | 868 |
| 869 SpdySerializedFrame SpdyTestUtil::ConstructSpdyPush( | 869 SpdySerializedFrame SpdyTestUtil::ConstructSpdyPush( |
| 870 const char* const extra_headers[], | 870 const char* const extra_headers[], |
| 871 int extra_header_count, | 871 int extra_header_count, |
| 872 int stream_id, | 872 int stream_id, |
| 873 int associated_stream_id, | 873 int associated_stream_id, |
| 874 const char* url) { | 874 const char* url) { |
| 875 SpdyHeaderBlock push_promise_header_block; | 875 SpdyHeaderBlock push_promise_header_block; |
| 876 push_promise_header_block[GetMethodKey()] = "GET"; |
| 876 AddUrlToHeaderBlock(url, &push_promise_header_block); | 877 AddUrlToHeaderBlock(url, &push_promise_header_block); |
| 877 SpdyPushPromiseIR push_promise(associated_stream_id, stream_id, | 878 SpdyPushPromiseIR push_promise(associated_stream_id, stream_id, |
| 878 std::move(push_promise_header_block)); | 879 std::move(push_promise_header_block)); |
| 879 SpdySerializedFrame push_promise_frame( | 880 SpdySerializedFrame push_promise_frame( |
| 880 response_spdy_framer_.SerializeFrame(push_promise)); | 881 response_spdy_framer_.SerializeFrame(push_promise)); |
| 881 | 882 |
| 882 SpdyHeaderBlock headers_header_block; | 883 SpdyHeaderBlock headers_header_block; |
| 883 headers_header_block[GetStatusKey()] = "200"; | 884 headers_header_block[GetStatusKey()] = "200"; |
| 884 headers_header_block["hello"] = "bye"; | 885 headers_header_block["hello"] = "bye"; |
| 885 AppendToHeaderBlock(extra_headers, extra_header_count, &headers_header_block); | 886 AppendToHeaderBlock(extra_headers, extra_header_count, &headers_header_block); |
| 886 SpdyHeadersIR headers(stream_id, std::move(headers_header_block)); | 887 SpdyHeadersIR headers(stream_id, std::move(headers_header_block)); |
| 887 SpdySerializedFrame headers_frame( | 888 SpdySerializedFrame headers_frame( |
| 888 response_spdy_framer_.SerializeFrame(headers)); | 889 response_spdy_framer_.SerializeFrame(headers)); |
| 889 | 890 |
| 890 return CombineFrames({&push_promise_frame, &headers_frame}); | 891 return CombineFrames({&push_promise_frame, &headers_frame}); |
| 891 } | 892 } |
| 892 | 893 |
| 893 SpdySerializedFrame SpdyTestUtil::ConstructSpdyPush( | 894 SpdySerializedFrame SpdyTestUtil::ConstructSpdyPush( |
| 894 const char* const extra_headers[], | 895 const char* const extra_headers[], |
| 895 int extra_header_count, | 896 int extra_header_count, |
| 896 int stream_id, | 897 int stream_id, |
| 897 int associated_stream_id, | 898 int associated_stream_id, |
| 898 const char* url, | 899 const char* url, |
| 899 const char* status, | 900 const char* status, |
| 900 const char* location) { | 901 const char* location) { |
| 901 SpdyHeaderBlock push_promise_header_block; | 902 SpdyHeaderBlock push_promise_header_block; |
| 903 push_promise_header_block[GetMethodKey()] = "GET"; |
| 902 AddUrlToHeaderBlock(url, &push_promise_header_block); | 904 AddUrlToHeaderBlock(url, &push_promise_header_block); |
| 903 SpdyPushPromiseIR push_promise(associated_stream_id, stream_id, | 905 SpdyPushPromiseIR push_promise(associated_stream_id, stream_id, |
| 904 std::move(push_promise_header_block)); | 906 std::move(push_promise_header_block)); |
| 905 SpdySerializedFrame push_promise_frame( | 907 SpdySerializedFrame push_promise_frame( |
| 906 response_spdy_framer_.SerializeFrame(push_promise)); | 908 response_spdy_framer_.SerializeFrame(push_promise)); |
| 907 | 909 |
| 908 SpdyHeaderBlock headers_header_block; | 910 SpdyHeaderBlock headers_header_block; |
| 909 headers_header_block["hello"] = "bye"; | 911 headers_header_block["hello"] = "bye"; |
| 910 headers_header_block[GetStatusKey()] = status; | 912 headers_header_block[GetStatusKey()] = status; |
| 911 headers_header_block["location"] = location; | 913 headers_header_block["location"] = location; |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 headers[GetSchemeKey()] = scheme.c_str(); | 1134 headers[GetSchemeKey()] = scheme.c_str(); |
| 1133 headers[GetPathKey()] = path.c_str(); | 1135 headers[GetPathKey()] = path.c_str(); |
| 1134 if (content_length) { | 1136 if (content_length) { |
| 1135 SpdyString length_str = base::Int64ToString(*content_length); | 1137 SpdyString length_str = base::Int64ToString(*content_length); |
| 1136 headers["content-length"] = length_str; | 1138 headers["content-length"] = length_str; |
| 1137 } | 1139 } |
| 1138 return headers; | 1140 return headers; |
| 1139 } | 1141 } |
| 1140 | 1142 |
| 1141 } // namespace net | 1143 } // namespace net |
| OLD | NEW |