| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/quic/chromium/quic_http_stream.h" | 5 #include "net/quic/chromium/quic_http_stream.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 using testing::_; | 66 using testing::_; |
| 67 using testing::AnyNumber; | 67 using testing::AnyNumber; |
| 68 using testing::Return; | 68 using testing::Return; |
| 69 | 69 |
| 70 namespace net { | 70 namespace net { |
| 71 namespace test { | 71 namespace test { |
| 72 namespace { | 72 namespace { |
| 73 | 73 |
| 74 const char kUploadData[] = "Really nifty data!"; | 74 const char kUploadData[] = "Really nifty data!"; |
| 75 const char kDefaultServerHostName[] = "www.example.org"; | 75 const char kDefaultServerHostName[] = "www.example.org"; |
| 76 const uint16_t kDefaultServerPort = 80; | 76 const uint16_t kDefaultServerPort = 443; |
| 77 | 77 |
| 78 class TestQuicConnection : public QuicConnection { | 78 class TestQuicConnection : public QuicConnection { |
| 79 public: | 79 public: |
| 80 TestQuicConnection(const QuicVersionVector& versions, | 80 TestQuicConnection(const QuicVersionVector& versions, |
| 81 QuicConnectionId connection_id, | 81 QuicConnectionId connection_id, |
| 82 IPEndPoint address, | 82 IPEndPoint address, |
| 83 QuicChromiumConnectionHelper* helper, | 83 QuicChromiumConnectionHelper* helper, |
| 84 QuicChromiumAlarmFactory* alarm_factory, | 84 QuicChromiumAlarmFactory* alarm_factory, |
| 85 QuicPacketWriter* writer) | 85 QuicPacketWriter* writer) |
| 86 : QuicConnection(connection_id, | 86 : QuicConnection(connection_id, |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 | 355 |
| 356 promise_url_ = SpdyUtils::GetUrlFromHeaderBlock(push_promise_); | 356 promise_url_ = SpdyUtils::GetUrlFromHeaderBlock(push_promise_); |
| 357 | 357 |
| 358 serialized_push_promise_ = | 358 serialized_push_promise_ = |
| 359 SpdyUtils::SerializeUncompressedHeaders(push_promise_); | 359 SpdyUtils::SerializeUncompressedHeaders(push_promise_); |
| 360 } | 360 } |
| 361 | 361 |
| 362 void SetRequest(const string& method, | 362 void SetRequest(const string& method, |
| 363 const string& path, | 363 const string& path, |
| 364 RequestPriority priority) { | 364 RequestPriority priority) { |
| 365 request_headers_ = client_maker_.GetRequestHeaders(method, "http", path); | 365 request_headers_ = client_maker_.GetRequestHeaders(method, "https", path); |
| 366 } | 366 } |
| 367 | 367 |
| 368 void SetResponse(const string& status, const string& body) { | 368 void SetResponse(const string& status, const string& body) { |
| 369 response_headers_ = server_maker_.GetResponseHeaders(status); | 369 response_headers_ = server_maker_.GetResponseHeaders(status); |
| 370 response_data_ = body; | 370 response_data_ = body; |
| 371 } | 371 } |
| 372 | 372 |
| 373 std::unique_ptr<QuicReceivedPacket> InnerConstructDataPacket( | 373 std::unique_ptr<QuicReceivedPacket> InnerConstructDataPacket( |
| 374 QuicPacketNumber packet_number, | 374 QuicPacketNumber packet_number, |
| 375 QuicStreamId stream_id, | 375 QuicStreamId stream_id, |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 AddWrite(ConstructSettingsPacket(1, SETTINGS_MAX_HEADER_LIST_SIZE, | 639 AddWrite(ConstructSettingsPacket(1, SETTINGS_MAX_HEADER_LIST_SIZE, |
| 640 kDefaultMaxUncompressedHeaderSize, | 640 kDefaultMaxUncompressedHeaderSize, |
| 641 &header_stream_offset)); | 641 &header_stream_offset)); |
| 642 AddWrite(InnerConstructRequestHeadersPacket( | 642 AddWrite(InnerConstructRequestHeadersPacket( |
| 643 2, kClientDataStreamId1, kIncludeVersion, kFin, DEFAULT_PRIORITY, | 643 2, kClientDataStreamId1, kIncludeVersion, kFin, DEFAULT_PRIORITY, |
| 644 &spdy_request_header_frame_length, &header_stream_offset)); | 644 &spdy_request_header_frame_length, &header_stream_offset)); |
| 645 | 645 |
| 646 Initialize(); | 646 Initialize(); |
| 647 | 647 |
| 648 request_.method = "GET"; | 648 request_.method = "GET"; |
| 649 request_.url = GURL("http://www.example.org/"); | 649 request_.url = GURL("https://www.example.org/"); |
| 650 | 650 |
| 651 // Make sure getting load timing from the stream early does not crash. | 651 // Make sure getting load timing from the stream early does not crash. |
| 652 LoadTimingInfo load_timing_info; | 652 LoadTimingInfo load_timing_info; |
| 653 EXPECT_TRUE(stream_->GetLoadTimingInfo(&load_timing_info)); | 653 EXPECT_TRUE(stream_->GetLoadTimingInfo(&load_timing_info)); |
| 654 | 654 |
| 655 EXPECT_EQ(OK, | 655 EXPECT_EQ(OK, |
| 656 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 656 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 657 net_log_.bound(), callback_.callback())); | 657 net_log_.bound(), callback_.callback())); |
| 658 EXPECT_EQ(OK, | 658 EXPECT_EQ(OK, |
| 659 stream_->SendRequest(headers_, &response_, callback_.callback())); | 659 stream_->SendRequest(headers_, &response_, callback_.callback())); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 // SetRequest() again for second request as |request_headers_| was moved. | 709 // SetRequest() again for second request as |request_headers_| was moved. |
| 710 SetRequest("GET", "/", DEFAULT_PRIORITY); | 710 SetRequest("GET", "/", DEFAULT_PRIORITY); |
| 711 AddWrite(InnerConstructRequestHeadersPacket( | 711 AddWrite(InnerConstructRequestHeadersPacket( |
| 712 3, kClientDataStreamId2, kIncludeVersion, kFin, DEFAULT_PRIORITY, | 712 3, kClientDataStreamId2, kIncludeVersion, kFin, DEFAULT_PRIORITY, |
| 713 &spdy_request_header_frame_length, &offset)); | 713 &spdy_request_header_frame_length, &offset)); |
| 714 AddWrite(ConstructClientAckPacket(4, 3, 1)); // Ack the responses. | 714 AddWrite(ConstructClientAckPacket(4, 3, 1)); // Ack the responses. |
| 715 | 715 |
| 716 Initialize(); | 716 Initialize(); |
| 717 | 717 |
| 718 request_.method = "GET"; | 718 request_.method = "GET"; |
| 719 request_.url = GURL("http://www.example.org/"); | 719 request_.url = GURL("https://www.example.org/"); |
| 720 // Start first request. | 720 // Start first request. |
| 721 EXPECT_EQ(OK, | 721 EXPECT_EQ(OK, |
| 722 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 722 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 723 net_log_.bound(), callback_.callback())); | 723 net_log_.bound(), callback_.callback())); |
| 724 EXPECT_EQ(OK, | 724 EXPECT_EQ(OK, |
| 725 stream_->SendRequest(headers_, &response_, callback_.callback())); | 725 stream_->SendRequest(headers_, &response_, callback_.callback())); |
| 726 | 726 |
| 727 // Start a second request. | 727 // Start a second request. |
| 728 QuicHttpStream stream2(session_->GetWeakPtr(), &http_server_properties_); | 728 QuicHttpStream stream2(session_->GetWeakPtr(), &http_server_properties_); |
| 729 TestCompletionCallback callback2; | 729 TestCompletionCallback callback2; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 kDefaultMaxUncompressedHeaderSize, | 788 kDefaultMaxUncompressedHeaderSize, |
| 789 &header_stream_offset)); | 789 &header_stream_offset)); |
| 790 AddWrite(InnerConstructRequestHeadersPacket( | 790 AddWrite(InnerConstructRequestHeadersPacket( |
| 791 2, kClientDataStreamId1, kIncludeVersion, kFin, DEFAULT_PRIORITY, | 791 2, kClientDataStreamId1, kIncludeVersion, kFin, DEFAULT_PRIORITY, |
| 792 &spdy_request_header_frame_length, &header_stream_offset)); | 792 &spdy_request_header_frame_length, &header_stream_offset)); |
| 793 AddWrite(ConstructClientAckPacket(3, 3, 1)); // Ack the data packet. | 793 AddWrite(ConstructClientAckPacket(3, 3, 1)); // Ack the data packet. |
| 794 | 794 |
| 795 Initialize(); | 795 Initialize(); |
| 796 | 796 |
| 797 request_.method = "GET"; | 797 request_.method = "GET"; |
| 798 request_.url = GURL("http://www.example.org/"); | 798 request_.url = GURL("https://www.example.org/"); |
| 799 | 799 |
| 800 EXPECT_EQ(OK, | 800 EXPECT_EQ(OK, |
| 801 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 801 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 802 net_log_.bound(), callback_.callback())); | 802 net_log_.bound(), callback_.callback())); |
| 803 | 803 |
| 804 EXPECT_EQ(OK, | 804 EXPECT_EQ(OK, |
| 805 stream_->SendRequest(headers_, &response_, callback_.callback())); | 805 stream_->SendRequest(headers_, &response_, callback_.callback())); |
| 806 // Ack the request. | 806 // Ack the request. |
| 807 ProcessPacket(ConstructServerAckPacket(1, 0, 0)); | 807 ProcessPacket(ConstructServerAckPacket(1, 0, 0)); |
| 808 | 808 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 QuicStreamOffset header_stream_offset = 0; | 882 QuicStreamOffset header_stream_offset = 0; |
| 883 AddWrite(ConstructSettingsPacket(1, SETTINGS_MAX_HEADER_LIST_SIZE, | 883 AddWrite(ConstructSettingsPacket(1, SETTINGS_MAX_HEADER_LIST_SIZE, |
| 884 kDefaultMaxUncompressedHeaderSize, | 884 kDefaultMaxUncompressedHeaderSize, |
| 885 &header_stream_offset)); | 885 &header_stream_offset)); |
| 886 AddWrite(InnerConstructRequestHeadersPacket( | 886 AddWrite(InnerConstructRequestHeadersPacket( |
| 887 2, kClientDataStreamId1, kIncludeVersion, kFin, DEFAULT_PRIORITY, | 887 2, kClientDataStreamId1, kIncludeVersion, kFin, DEFAULT_PRIORITY, |
| 888 &spdy_request_headers_frame_length, &header_stream_offset)); | 888 &spdy_request_headers_frame_length, &header_stream_offset)); |
| 889 Initialize(); | 889 Initialize(); |
| 890 | 890 |
| 891 request_.method = "GET"; | 891 request_.method = "GET"; |
| 892 request_.url = GURL("http://www.example.org/"); | 892 request_.url = GURL("https://www.example.org/"); |
| 893 | 893 |
| 894 EXPECT_EQ(OK, | 894 EXPECT_EQ(OK, |
| 895 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 895 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 896 net_log_.bound(), callback_.callback())); | 896 net_log_.bound(), callback_.callback())); |
| 897 EXPECT_EQ(OK, | 897 EXPECT_EQ(OK, |
| 898 stream_->SendRequest(headers_, &response_, callback_.callback())); | 898 stream_->SendRequest(headers_, &response_, callback_.callback())); |
| 899 | 899 |
| 900 // Ack the request. | 900 // Ack the request. |
| 901 ProcessPacket(ConstructServerAckPacket(1, 0, 0)); | 901 ProcessPacket(ConstructServerAckPacket(1, 0, 0)); |
| 902 | 902 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 932 EXPECT_EQ(static_cast<int64_t>(spdy_response_headers_frame_length), | 932 EXPECT_EQ(static_cast<int64_t>(spdy_response_headers_frame_length), |
| 933 stream_->GetTotalReceivedBytes()); | 933 stream_->GetTotalReceivedBytes()); |
| 934 } | 934 } |
| 935 | 935 |
| 936 // Regression test for http://crbug.com/409101 | 936 // Regression test for http://crbug.com/409101 |
| 937 TEST_P(QuicHttpStreamTest, SessionClosedBeforeSendRequest) { | 937 TEST_P(QuicHttpStreamTest, SessionClosedBeforeSendRequest) { |
| 938 SetRequest("GET", "/", DEFAULT_PRIORITY); | 938 SetRequest("GET", "/", DEFAULT_PRIORITY); |
| 939 Initialize(); | 939 Initialize(); |
| 940 | 940 |
| 941 request_.method = "GET"; | 941 request_.method = "GET"; |
| 942 request_.url = GURL("http://www.example.org/"); | 942 request_.url = GURL("https://www.example.org/"); |
| 943 | 943 |
| 944 EXPECT_EQ(OK, | 944 EXPECT_EQ(OK, |
| 945 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 945 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 946 net_log_.bound(), callback_.callback())); | 946 net_log_.bound(), callback_.callback())); |
| 947 | 947 |
| 948 session_->connection()->CloseConnection( | 948 session_->connection()->CloseConnection( |
| 949 QUIC_NO_ERROR, "test", ConnectionCloseBehavior::SILENT_CLOSE); | 949 QUIC_NO_ERROR, "test", ConnectionCloseBehavior::SILENT_CLOSE); |
| 950 | 950 |
| 951 EXPECT_EQ(ERR_CONNECTION_CLOSED, | 951 EXPECT_EQ(ERR_CONNECTION_CLOSED, |
| 952 stream_->SendRequest(headers_, &response_, callback_.callback())); | 952 stream_->SendRequest(headers_, &response_, callback_.callback())); |
| 953 | 953 |
| 954 EXPECT_EQ(0, stream_->GetTotalSentBytes()); | 954 EXPECT_EQ(0, stream_->GetTotalSentBytes()); |
| 955 EXPECT_EQ(0, stream_->GetTotalReceivedBytes()); | 955 EXPECT_EQ(0, stream_->GetTotalReceivedBytes()); |
| 956 } | 956 } |
| 957 | 957 |
| 958 // Regression test for http://crbug.com/584441 | 958 // Regression test for http://crbug.com/584441 |
| 959 TEST_P(QuicHttpStreamTest, GetSSLInfoAfterSessionClosed) { | 959 TEST_P(QuicHttpStreamTest, GetSSLInfoAfterSessionClosed) { |
| 960 SetRequest("GET", "/", DEFAULT_PRIORITY); | 960 SetRequest("GET", "/", DEFAULT_PRIORITY); |
| 961 Initialize(); | 961 Initialize(); |
| 962 | 962 |
| 963 request_.method = "GET"; | 963 request_.method = "GET"; |
| 964 request_.url = GURL("http://www.example.org/"); | 964 request_.url = GURL("https://www.example.org/"); |
| 965 | 965 |
| 966 EXPECT_EQ(OK, | 966 EXPECT_EQ(OK, |
| 967 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 967 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 968 net_log_.bound(), callback_.callback())); | 968 net_log_.bound(), callback_.callback())); |
| 969 | 969 |
| 970 SSLInfo ssl_info; | 970 SSLInfo ssl_info; |
| 971 EXPECT_FALSE(ssl_info.is_valid()); | 971 EXPECT_FALSE(ssl_info.is_valid()); |
| 972 stream_->GetSSLInfo(&ssl_info); | 972 stream_->GetSSLInfo(&ssl_info); |
| 973 EXPECT_TRUE(ssl_info.is_valid()); | 973 EXPECT_TRUE(ssl_info.is_valid()); |
| 974 | 974 |
| 975 session_->connection()->CloseConnection( | 975 session_->connection()->CloseConnection( |
| 976 QUIC_NO_ERROR, "test", ConnectionCloseBehavior::SILENT_CLOSE); | 976 QUIC_NO_ERROR, "test", ConnectionCloseBehavior::SILENT_CLOSE); |
| 977 | 977 |
| 978 SSLInfo ssl_info2; | 978 SSLInfo ssl_info2; |
| 979 stream_->GetSSLInfo(&ssl_info2); | 979 stream_->GetSSLInfo(&ssl_info2); |
| 980 EXPECT_TRUE(ssl_info2.is_valid()); | 980 EXPECT_TRUE(ssl_info2.is_valid()); |
| 981 } | 981 } |
| 982 | 982 |
| 983 TEST_P(QuicHttpStreamTest, GetAlternativeService) { |
| 984 SetRequest("GET", "/", DEFAULT_PRIORITY); |
| 985 Initialize(); |
| 986 |
| 987 request_.method = "GET"; |
| 988 request_.url = GURL("https://www.example.org/"); |
| 989 |
| 990 EXPECT_EQ(OK, |
| 991 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 992 net_log_.bound(), callback_.callback())); |
| 993 |
| 994 AlternativeService alternative_service; |
| 995 EXPECT_TRUE(stream_->GetAlternativeService(&alternative_service)); |
| 996 EXPECT_EQ(AlternativeService(kProtoQUIC, "www.example.org", 443), |
| 997 alternative_service); |
| 998 |
| 999 session_->connection()->CloseConnection( |
| 1000 QUIC_NO_ERROR, "test", ConnectionCloseBehavior::SILENT_CLOSE); |
| 1001 |
| 1002 AlternativeService alternative_service2; |
| 1003 EXPECT_TRUE(stream_->GetAlternativeService(&alternative_service2)); |
| 1004 EXPECT_EQ(AlternativeService(kProtoQUIC, "www.example.org", 443), |
| 1005 alternative_service2); |
| 1006 } |
| 1007 |
| 983 TEST_P(QuicHttpStreamTest, LogGranularQuicConnectionError) { | 1008 TEST_P(QuicHttpStreamTest, LogGranularQuicConnectionError) { |
| 984 SetRequest("GET", "/", DEFAULT_PRIORITY); | 1009 SetRequest("GET", "/", DEFAULT_PRIORITY); |
| 985 size_t spdy_request_headers_frame_length; | 1010 size_t spdy_request_headers_frame_length; |
| 986 QuicStreamOffset header_stream_offset = 0; | 1011 QuicStreamOffset header_stream_offset = 0; |
| 987 AddWrite(ConstructSettingsPacket(1, SETTINGS_MAX_HEADER_LIST_SIZE, | 1012 AddWrite(ConstructSettingsPacket(1, SETTINGS_MAX_HEADER_LIST_SIZE, |
| 988 kDefaultMaxUncompressedHeaderSize, | 1013 kDefaultMaxUncompressedHeaderSize, |
| 989 &header_stream_offset)); | 1014 &header_stream_offset)); |
| 990 AddWrite(InnerConstructRequestHeadersPacket( | 1015 AddWrite(InnerConstructRequestHeadersPacket( |
| 991 2, kClientDataStreamId1, kIncludeVersion, kFin, DEFAULT_PRIORITY, | 1016 2, kClientDataStreamId1, kIncludeVersion, kFin, DEFAULT_PRIORITY, |
| 992 &spdy_request_headers_frame_length, &header_stream_offset)); | 1017 &spdy_request_headers_frame_length, &header_stream_offset)); |
| 993 AddWrite(ConstructAckAndRstStreamPacket(3)); | 1018 AddWrite(ConstructAckAndRstStreamPacket(3)); |
| 994 use_closing_stream_ = true; | 1019 use_closing_stream_ = true; |
| 995 Initialize(); | 1020 Initialize(); |
| 996 | 1021 |
| 997 request_.method = "GET"; | 1022 request_.method = "GET"; |
| 998 request_.url = GURL("http://www.example.org/"); | 1023 request_.url = GURL("https://www.example.org/"); |
| 999 | 1024 |
| 1000 EXPECT_EQ(OK, | 1025 EXPECT_EQ(OK, |
| 1001 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1026 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1002 net_log_.bound(), callback_.callback())); | 1027 net_log_.bound(), callback_.callback())); |
| 1003 EXPECT_EQ(OK, | 1028 EXPECT_EQ(OK, |
| 1004 stream_->SendRequest(headers_, &response_, callback_.callback())); | 1029 stream_->SendRequest(headers_, &response_, callback_.callback())); |
| 1005 | 1030 |
| 1006 // Ack the request. | 1031 // Ack the request. |
| 1007 ProcessPacket(ConstructServerAckPacket(1, 0, 0)); | 1032 ProcessPacket(ConstructServerAckPacket(1, 0, 0)); |
| 1008 EXPECT_THAT(stream_->ReadResponseHeaders(callback_.callback()), | 1033 EXPECT_THAT(stream_->ReadResponseHeaders(callback_.callback()), |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1028 kDefaultMaxUncompressedHeaderSize, | 1053 kDefaultMaxUncompressedHeaderSize, |
| 1029 &header_stream_offset)); | 1054 &header_stream_offset)); |
| 1030 AddWrite(InnerConstructRequestHeadersPacket( | 1055 AddWrite(InnerConstructRequestHeadersPacket( |
| 1031 2, kClientDataStreamId1, kIncludeVersion, kFin, DEFAULT_PRIORITY, | 1056 2, kClientDataStreamId1, kIncludeVersion, kFin, DEFAULT_PRIORITY, |
| 1032 &spdy_request_headers_frame_length, &header_stream_offset)); | 1057 &spdy_request_headers_frame_length, &header_stream_offset)); |
| 1033 AddWrite(ConstructAckAndRstStreamPacket(3)); | 1058 AddWrite(ConstructAckAndRstStreamPacket(3)); |
| 1034 use_closing_stream_ = true; | 1059 use_closing_stream_ = true; |
| 1035 Initialize(); | 1060 Initialize(); |
| 1036 | 1061 |
| 1037 request_.method = "GET"; | 1062 request_.method = "GET"; |
| 1038 request_.url = GURL("http://www.example.org/"); | 1063 request_.url = GURL("https://www.example.org/"); |
| 1039 | 1064 |
| 1040 EXPECT_EQ(OK, | 1065 EXPECT_EQ(OK, |
| 1041 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1066 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1042 net_log_.bound(), callback_.callback())); | 1067 net_log_.bound(), callback_.callback())); |
| 1043 EXPECT_EQ(OK, | 1068 EXPECT_EQ(OK, |
| 1044 stream_->SendRequest(headers_, &response_, callback_.callback())); | 1069 stream_->SendRequest(headers_, &response_, callback_.callback())); |
| 1045 | 1070 |
| 1046 // Ack the request. | 1071 // Ack the request. |
| 1047 ProcessPacket(ConstructServerAckPacket(1, 0, 0)); | 1072 ProcessPacket(ConstructServerAckPacket(1, 0, 0)); |
| 1048 EXPECT_THAT(stream_->ReadResponseHeaders(callback_.callback()), | 1073 EXPECT_THAT(stream_->ReadResponseHeaders(callback_.callback()), |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1071 QuicStreamOffset header_stream_offset = 0; | 1096 QuicStreamOffset header_stream_offset = 0; |
| 1072 AddWrite(ConstructSettingsPacket(1, SETTINGS_MAX_HEADER_LIST_SIZE, | 1097 AddWrite(ConstructSettingsPacket(1, SETTINGS_MAX_HEADER_LIST_SIZE, |
| 1073 kDefaultMaxUncompressedHeaderSize, | 1098 kDefaultMaxUncompressedHeaderSize, |
| 1074 &header_stream_offset)); | 1099 &header_stream_offset)); |
| 1075 AddWrite(InnerConstructRequestHeadersPacket( | 1100 AddWrite(InnerConstructRequestHeadersPacket( |
| 1076 2, kClientDataStreamId1, kIncludeVersion, kFin, DEFAULT_PRIORITY, | 1101 2, kClientDataStreamId1, kIncludeVersion, kFin, DEFAULT_PRIORITY, |
| 1077 &spdy_request_headers_frame_length, &header_stream_offset)); | 1102 &spdy_request_headers_frame_length, &header_stream_offset)); |
| 1078 Initialize(); | 1103 Initialize(); |
| 1079 | 1104 |
| 1080 request_.method = "GET"; | 1105 request_.method = "GET"; |
| 1081 request_.url = GURL("http://www.example.org/"); | 1106 request_.url = GURL("https://www.example.org/"); |
| 1082 | 1107 |
| 1083 EXPECT_EQ(OK, | 1108 EXPECT_EQ(OK, |
| 1084 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1109 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1085 net_log_.bound(), callback_.callback())); | 1110 net_log_.bound(), callback_.callback())); |
| 1086 | 1111 |
| 1087 EXPECT_EQ(OK, | 1112 EXPECT_EQ(OK, |
| 1088 stream_->SendRequest(headers_, &response_, callback_.callback())); | 1113 stream_->SendRequest(headers_, &response_, callback_.callback())); |
| 1089 | 1114 |
| 1090 session_->connection()->CloseConnection( | 1115 session_->connection()->CloseConnection( |
| 1091 QUIC_NO_ERROR, "test", ConnectionCloseBehavior::SILENT_CLOSE); | 1116 QUIC_NO_ERROR, "test", ConnectionCloseBehavior::SILENT_CLOSE); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1112 AddWrite(ConstructClientDataPacket(3, kIncludeVersion, kFin, 0, kUploadData)); | 1137 AddWrite(ConstructClientDataPacket(3, kIncludeVersion, kFin, 0, kUploadData)); |
| 1113 AddWrite(ConstructClientAckPacket(4, 3, 1)); | 1138 AddWrite(ConstructClientAckPacket(4, 3, 1)); |
| 1114 | 1139 |
| 1115 Initialize(); | 1140 Initialize(); |
| 1116 | 1141 |
| 1117 std::vector<std::unique_ptr<UploadElementReader>> element_readers; | 1142 std::vector<std::unique_ptr<UploadElementReader>> element_readers; |
| 1118 element_readers.push_back(base::MakeUnique<UploadBytesElementReader>( | 1143 element_readers.push_back(base::MakeUnique<UploadBytesElementReader>( |
| 1119 kUploadData, strlen(kUploadData))); | 1144 kUploadData, strlen(kUploadData))); |
| 1120 ElementsUploadDataStream upload_data_stream(std::move(element_readers), 0); | 1145 ElementsUploadDataStream upload_data_stream(std::move(element_readers), 0); |
| 1121 request_.method = "POST"; | 1146 request_.method = "POST"; |
| 1122 request_.url = GURL("http://www.example.org/"); | 1147 request_.url = GURL("https://www.example.org/"); |
| 1123 request_.upload_data_stream = &upload_data_stream; | 1148 request_.upload_data_stream = &upload_data_stream; |
| 1124 ASSERT_THAT(request_.upload_data_stream->Init(CompletionCallback(), | 1149 ASSERT_THAT(request_.upload_data_stream->Init(CompletionCallback(), |
| 1125 NetLogWithSource()), | 1150 NetLogWithSource()), |
| 1126 IsOk()); | 1151 IsOk()); |
| 1127 | 1152 |
| 1128 EXPECT_EQ(OK, | 1153 EXPECT_EQ(OK, |
| 1129 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1154 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1130 net_log_.bound(), callback_.callback())); | 1155 net_log_.bound(), callback_.callback())); |
| 1131 EXPECT_EQ(OK, | 1156 EXPECT_EQ(OK, |
| 1132 stream_->SendRequest(headers_, &response_, callback_.callback())); | 1157 stream_->SendRequest(headers_, &response_, callback_.callback())); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 ConstructClientDataPacket(3, kIncludeVersion, !kFin, 0, kUploadData)); | 1209 ConstructClientDataPacket(3, kIncludeVersion, !kFin, 0, kUploadData)); |
| 1185 AddWrite(ConstructClientDataPacket(4, kIncludeVersion, kFin, chunk_size, | 1210 AddWrite(ConstructClientDataPacket(4, kIncludeVersion, kFin, chunk_size, |
| 1186 kUploadData)); | 1211 kUploadData)); |
| 1187 AddWrite(ConstructClientAckPacket(5, 3, 1)); | 1212 AddWrite(ConstructClientAckPacket(5, 3, 1)); |
| 1188 Initialize(); | 1213 Initialize(); |
| 1189 | 1214 |
| 1190 ChunkedUploadDataStream upload_data_stream(0); | 1215 ChunkedUploadDataStream upload_data_stream(0); |
| 1191 upload_data_stream.AppendData(kUploadData, chunk_size, false); | 1216 upload_data_stream.AppendData(kUploadData, chunk_size, false); |
| 1192 | 1217 |
| 1193 request_.method = "POST"; | 1218 request_.method = "POST"; |
| 1194 request_.url = GURL("http://www.example.org/"); | 1219 request_.url = GURL("https://www.example.org/"); |
| 1195 request_.upload_data_stream = &upload_data_stream; | 1220 request_.upload_data_stream = &upload_data_stream; |
| 1196 ASSERT_EQ(OK, request_.upload_data_stream->Init( | 1221 ASSERT_EQ(OK, request_.upload_data_stream->Init( |
| 1197 TestCompletionCallback().callback(), NetLogWithSource())); | 1222 TestCompletionCallback().callback(), NetLogWithSource())); |
| 1198 | 1223 |
| 1199 ASSERT_EQ(OK, | 1224 ASSERT_EQ(OK, |
| 1200 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1225 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1201 net_log_.bound(), callback_.callback())); | 1226 net_log_.bound(), callback_.callback())); |
| 1202 ASSERT_EQ(ERR_IO_PENDING, | 1227 ASSERT_EQ(ERR_IO_PENDING, |
| 1203 stream_->SendRequest(headers_, &response_, callback_.callback())); | 1228 stream_->SendRequest(headers_, &response_, callback_.callback())); |
| 1204 | 1229 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1259 AddWrite( | 1284 AddWrite( |
| 1260 ConstructClientDataPacket(3, kIncludeVersion, !kFin, 0, kUploadData)); | 1285 ConstructClientDataPacket(3, kIncludeVersion, !kFin, 0, kUploadData)); |
| 1261 AddWrite(ConstructClientDataPacket(4, kIncludeVersion, kFin, chunk_size, "")); | 1286 AddWrite(ConstructClientDataPacket(4, kIncludeVersion, kFin, chunk_size, "")); |
| 1262 AddWrite(ConstructClientAckPacket(5, 3, 1)); | 1287 AddWrite(ConstructClientAckPacket(5, 3, 1)); |
| 1263 Initialize(); | 1288 Initialize(); |
| 1264 | 1289 |
| 1265 ChunkedUploadDataStream upload_data_stream(0); | 1290 ChunkedUploadDataStream upload_data_stream(0); |
| 1266 upload_data_stream.AppendData(kUploadData, chunk_size, false); | 1291 upload_data_stream.AppendData(kUploadData, chunk_size, false); |
| 1267 | 1292 |
| 1268 request_.method = "POST"; | 1293 request_.method = "POST"; |
| 1269 request_.url = GURL("http://www.example.org/"); | 1294 request_.url = GURL("https://www.example.org/"); |
| 1270 request_.upload_data_stream = &upload_data_stream; | 1295 request_.upload_data_stream = &upload_data_stream; |
| 1271 ASSERT_EQ(OK, request_.upload_data_stream->Init( | 1296 ASSERT_EQ(OK, request_.upload_data_stream->Init( |
| 1272 TestCompletionCallback().callback(), NetLogWithSource())); | 1297 TestCompletionCallback().callback(), NetLogWithSource())); |
| 1273 | 1298 |
| 1274 ASSERT_EQ(OK, | 1299 ASSERT_EQ(OK, |
| 1275 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1300 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1276 net_log_.bound(), callback_.callback())); | 1301 net_log_.bound(), callback_.callback())); |
| 1277 ASSERT_EQ(ERR_IO_PENDING, | 1302 ASSERT_EQ(ERR_IO_PENDING, |
| 1278 stream_->SendRequest(headers_, &response_, callback_.callback())); | 1303 stream_->SendRequest(headers_, &response_, callback_.callback())); |
| 1279 | 1304 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1328 AddWrite(InnerConstructRequestHeadersPacket( | 1353 AddWrite(InnerConstructRequestHeadersPacket( |
| 1329 2, kClientDataStreamId1, kIncludeVersion, !kFin, DEFAULT_PRIORITY, | 1354 2, kClientDataStreamId1, kIncludeVersion, !kFin, DEFAULT_PRIORITY, |
| 1330 &spdy_request_headers_frame_length, &header_stream_offset)); | 1355 &spdy_request_headers_frame_length, &header_stream_offset)); |
| 1331 AddWrite(ConstructClientDataPacket(3, kIncludeVersion, kFin, 0, "")); | 1356 AddWrite(ConstructClientDataPacket(3, kIncludeVersion, kFin, 0, "")); |
| 1332 AddWrite(ConstructClientAckPacket(4, 3, 1)); | 1357 AddWrite(ConstructClientAckPacket(4, 3, 1)); |
| 1333 Initialize(); | 1358 Initialize(); |
| 1334 | 1359 |
| 1335 ChunkedUploadDataStream upload_data_stream(0); | 1360 ChunkedUploadDataStream upload_data_stream(0); |
| 1336 | 1361 |
| 1337 request_.method = "POST"; | 1362 request_.method = "POST"; |
| 1338 request_.url = GURL("http://www.example.org/"); | 1363 request_.url = GURL("https://www.example.org/"); |
| 1339 request_.upload_data_stream = &upload_data_stream; | 1364 request_.upload_data_stream = &upload_data_stream; |
| 1340 ASSERT_EQ(OK, request_.upload_data_stream->Init( | 1365 ASSERT_EQ(OK, request_.upload_data_stream->Init( |
| 1341 TestCompletionCallback().callback(), NetLogWithSource())); | 1366 TestCompletionCallback().callback(), NetLogWithSource())); |
| 1342 | 1367 |
| 1343 ASSERT_EQ(OK, | 1368 ASSERT_EQ(OK, |
| 1344 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1369 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1345 net_log_.bound(), callback_.callback())); | 1370 net_log_.bound(), callback_.callback())); |
| 1346 ASSERT_EQ(ERR_IO_PENDING, | 1371 ASSERT_EQ(ERR_IO_PENDING, |
| 1347 stream_->SendRequest(headers_, &response_, callback_.callback())); | 1372 stream_->SendRequest(headers_, &response_, callback_.callback())); |
| 1348 | 1373 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1395 kDefaultMaxUncompressedHeaderSize, | 1420 kDefaultMaxUncompressedHeaderSize, |
| 1396 &header_stream_offset)); | 1421 &header_stream_offset)); |
| 1397 AddWrite(InnerConstructRequestHeadersPacket( | 1422 AddWrite(InnerConstructRequestHeadersPacket( |
| 1398 2, kClientDataStreamId1, kIncludeVersion, kFin, DEFAULT_PRIORITY, | 1423 2, kClientDataStreamId1, kIncludeVersion, kFin, DEFAULT_PRIORITY, |
| 1399 &spdy_request_headers_frame_length, &header_stream_offset)); | 1424 &spdy_request_headers_frame_length, &header_stream_offset)); |
| 1400 AddWrite(ConstructAckAndRstStreamPacket(3)); | 1425 AddWrite(ConstructAckAndRstStreamPacket(3)); |
| 1401 use_closing_stream_ = true; | 1426 use_closing_stream_ = true; |
| 1402 Initialize(); | 1427 Initialize(); |
| 1403 | 1428 |
| 1404 request_.method = "GET"; | 1429 request_.method = "GET"; |
| 1405 request_.url = GURL("http://www.example.org/"); | 1430 request_.url = GURL("https://www.example.org/"); |
| 1406 | 1431 |
| 1407 EXPECT_EQ(OK, | 1432 EXPECT_EQ(OK, |
| 1408 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1433 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1409 net_log_.bound(), callback_.callback())); | 1434 net_log_.bound(), callback_.callback())); |
| 1410 EXPECT_EQ(OK, | 1435 EXPECT_EQ(OK, |
| 1411 stream_->SendRequest(headers_, &response_, callback_.callback())); | 1436 stream_->SendRequest(headers_, &response_, callback_.callback())); |
| 1412 | 1437 |
| 1413 // Ack the request. | 1438 // Ack the request. |
| 1414 ProcessPacket(ConstructServerAckPacket(1, 0, 0)); | 1439 ProcessPacket(ConstructServerAckPacket(1, 0, 0)); |
| 1415 EXPECT_THAT(stream_->ReadResponseHeaders(callback_.callback()), | 1440 EXPECT_THAT(stream_->ReadResponseHeaders(callback_.callback()), |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1440 kDefaultMaxUncompressedHeaderSize, | 1465 kDefaultMaxUncompressedHeaderSize, |
| 1441 &header_stream_offset)); | 1466 &header_stream_offset)); |
| 1442 AddWrite(InnerConstructRequestHeadersPacket( | 1467 AddWrite(InnerConstructRequestHeadersPacket( |
| 1443 2, kClientDataStreamId1, kIncludeVersion, kFin, MEDIUM, | 1468 2, kClientDataStreamId1, kIncludeVersion, kFin, MEDIUM, |
| 1444 &spdy_request_headers_frame_length, &header_stream_offset)); | 1469 &spdy_request_headers_frame_length, &header_stream_offset)); |
| 1445 AddWrite(ConstructAckAndRstStreamPacket(3)); | 1470 AddWrite(ConstructAckAndRstStreamPacket(3)); |
| 1446 use_closing_stream_ = true; | 1471 use_closing_stream_ = true; |
| 1447 Initialize(); | 1472 Initialize(); |
| 1448 | 1473 |
| 1449 request_.method = "GET"; | 1474 request_.method = "GET"; |
| 1450 request_.url = GURL("http://www.example.org/"); | 1475 request_.url = GURL("https://www.example.org/"); |
| 1451 | 1476 |
| 1452 EXPECT_EQ(OK, stream_->InitializeStream(&request_, MEDIUM, net_log_.bound(), | 1477 EXPECT_EQ(OK, stream_->InitializeStream(&request_, MEDIUM, net_log_.bound(), |
| 1453 callback_.callback())); | 1478 callback_.callback())); |
| 1454 | 1479 |
| 1455 // Check that priority is highest. | 1480 // Check that priority is highest. |
| 1456 QuicChromiumClientStream* reliable_stream = | 1481 QuicChromiumClientStream* reliable_stream = |
| 1457 QuicHttpStreamPeer::GetQuicChromiumClientStream(stream_.get()); | 1482 QuicHttpStreamPeer::GetQuicChromiumClientStream(stream_.get()); |
| 1458 DCHECK(reliable_stream); | 1483 DCHECK(reliable_stream); |
| 1459 DCHECK_EQ(kV3HighestPriority, reliable_stream->priority()); | 1484 DCHECK_EQ(kV3HighestPriority, reliable_stream->priority()); |
| 1460 | 1485 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1493 use_closing_stream_ = true; | 1518 use_closing_stream_ = true; |
| 1494 QuicStreamOffset header_stream_offset = 0; | 1519 QuicStreamOffset header_stream_offset = 0; |
| 1495 AddWrite(ConstructSettingsPacket(1, SETTINGS_MAX_HEADER_LIST_SIZE, | 1520 AddWrite(ConstructSettingsPacket(1, SETTINGS_MAX_HEADER_LIST_SIZE, |
| 1496 kDefaultMaxUncompressedHeaderSize, | 1521 kDefaultMaxUncompressedHeaderSize, |
| 1497 &header_stream_offset)); | 1522 &header_stream_offset)); |
| 1498 AddWrite(ConstructClientRstStreamPacket(2)); | 1523 AddWrite(ConstructClientRstStreamPacket(2)); |
| 1499 | 1524 |
| 1500 Initialize(); | 1525 Initialize(); |
| 1501 | 1526 |
| 1502 request_.method = "GET"; | 1527 request_.method = "GET"; |
| 1503 request_.url = GURL("http://www.example.org/"); | 1528 request_.url = GURL("https://www.example.org/"); |
| 1504 | 1529 |
| 1505 EXPECT_EQ(OK, stream_->InitializeStream(&request_, MEDIUM, net_log_.bound(), | 1530 EXPECT_EQ(OK, stream_->InitializeStream(&request_, MEDIUM, net_log_.bound(), |
| 1506 callback_.callback())); | 1531 callback_.callback())); |
| 1507 | 1532 |
| 1508 // Check that priority is highest. | 1533 // Check that priority is highest. |
| 1509 QuicChromiumClientStream* reliable_stream = | 1534 QuicChromiumClientStream* reliable_stream = |
| 1510 QuicHttpStreamPeer::GetQuicChromiumClientStream(stream_.get()); | 1535 QuicHttpStreamPeer::GetQuicChromiumClientStream(stream_.get()); |
| 1511 DCHECK(reliable_stream); | 1536 DCHECK(reliable_stream); |
| 1512 QuicChromiumClientStream::Delegate* delegate = reliable_stream->GetDelegate(); | 1537 QuicChromiumClientStream::Delegate* delegate = reliable_stream->GetDelegate(); |
| 1513 DCHECK(delegate); | 1538 DCHECK(delegate); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1536 AddWrite( | 1561 AddWrite( |
| 1537 ConstructClientDataPacket(3, kIncludeVersion, !kFin, 0, kUploadData)); | 1562 ConstructClientDataPacket(3, kIncludeVersion, !kFin, 0, kUploadData)); |
| 1538 // Second data write will result in a synchronous failure which will close | 1563 // Second data write will result in a synchronous failure which will close |
| 1539 // the session. | 1564 // the session. |
| 1540 AddWrite(SYNCHRONOUS, ERR_FAILED); | 1565 AddWrite(SYNCHRONOUS, ERR_FAILED); |
| 1541 Initialize(); | 1566 Initialize(); |
| 1542 | 1567 |
| 1543 ChunkedUploadDataStream upload_data_stream(0); | 1568 ChunkedUploadDataStream upload_data_stream(0); |
| 1544 | 1569 |
| 1545 request_.method = "POST"; | 1570 request_.method = "POST"; |
| 1546 request_.url = GURL("http://www.example.org/"); | 1571 request_.url = GURL("https://www.example.org/"); |
| 1547 request_.upload_data_stream = &upload_data_stream; | 1572 request_.upload_data_stream = &upload_data_stream; |
| 1548 ASSERT_EQ(OK, request_.upload_data_stream->Init( | 1573 ASSERT_EQ(OK, request_.upload_data_stream->Init( |
| 1549 TestCompletionCallback().callback(), NetLogWithSource())); | 1574 TestCompletionCallback().callback(), NetLogWithSource())); |
| 1550 | 1575 |
| 1551 size_t chunk_size = strlen(kUploadData); | 1576 size_t chunk_size = strlen(kUploadData); |
| 1552 upload_data_stream.AppendData(kUploadData, chunk_size, false); | 1577 upload_data_stream.AppendData(kUploadData, chunk_size, false); |
| 1553 ASSERT_EQ(OK, | 1578 ASSERT_EQ(OK, |
| 1554 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1579 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1555 net_log_.bound(), callback_.callback())); | 1580 net_log_.bound(), callback_.callback())); |
| 1556 QuicHttpStream* stream = stream_.get(); | 1581 QuicHttpStream* stream = stream_.get(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1568 QuicStreamOffset header_stream_offset = 0; | 1593 QuicStreamOffset header_stream_offset = 0; |
| 1569 AddWrite(ConstructSettingsPacket(1, SETTINGS_MAX_HEADER_LIST_SIZE, | 1594 AddWrite(ConstructSettingsPacket(1, SETTINGS_MAX_HEADER_LIST_SIZE, |
| 1570 kDefaultMaxUncompressedHeaderSize, | 1595 kDefaultMaxUncompressedHeaderSize, |
| 1571 &header_stream_offset)); | 1596 &header_stream_offset)); |
| 1572 AddWrite(SYNCHRONOUS, ERR_FAILED); | 1597 AddWrite(SYNCHRONOUS, ERR_FAILED); |
| 1573 Initialize(); | 1598 Initialize(); |
| 1574 | 1599 |
| 1575 ChunkedUploadDataStream upload_data_stream(0); | 1600 ChunkedUploadDataStream upload_data_stream(0); |
| 1576 | 1601 |
| 1577 request_.method = "POST"; | 1602 request_.method = "POST"; |
| 1578 request_.url = GURL("http://www.example.org/"); | 1603 request_.url = GURL("https://www.example.org/"); |
| 1579 request_.upload_data_stream = &upload_data_stream; | 1604 request_.upload_data_stream = &upload_data_stream; |
| 1580 ASSERT_EQ(OK, request_.upload_data_stream->Init( | 1605 ASSERT_EQ(OK, request_.upload_data_stream->Init( |
| 1581 TestCompletionCallback().callback(), NetLogWithSource())); | 1606 TestCompletionCallback().callback(), NetLogWithSource())); |
| 1582 | 1607 |
| 1583 ASSERT_EQ(OK, | 1608 ASSERT_EQ(OK, |
| 1584 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1609 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1585 net_log_.bound(), callback_.callback())); | 1610 net_log_.bound(), callback_.callback())); |
| 1586 ASSERT_EQ(ERR_QUIC_PROTOCOL_ERROR, | 1611 ASSERT_EQ(ERR_QUIC_PROTOCOL_ERROR, |
| 1587 stream_->SendRequest(headers_, &response_, callback_.callback())); | 1612 stream_->SendRequest(headers_, &response_, callback_.callback())); |
| 1588 } | 1613 } |
| 1589 | 1614 |
| 1590 TEST_P(QuicHttpStreamTest, SessionClosedBeforeSendBodyComplete) { | 1615 TEST_P(QuicHttpStreamTest, SessionClosedBeforeSendBodyComplete) { |
| 1591 SetRequest("POST", "/", DEFAULT_PRIORITY); | 1616 SetRequest("POST", "/", DEFAULT_PRIORITY); |
| 1592 size_t spdy_request_headers_frame_length; | 1617 size_t spdy_request_headers_frame_length; |
| 1593 QuicStreamOffset header_stream_offset = 0; | 1618 QuicStreamOffset header_stream_offset = 0; |
| 1594 AddWrite(ConstructSettingsPacket(1, SETTINGS_MAX_HEADER_LIST_SIZE, | 1619 AddWrite(ConstructSettingsPacket(1, SETTINGS_MAX_HEADER_LIST_SIZE, |
| 1595 kDefaultMaxUncompressedHeaderSize, | 1620 kDefaultMaxUncompressedHeaderSize, |
| 1596 &header_stream_offset)); | 1621 &header_stream_offset)); |
| 1597 AddWrite(InnerConstructRequestHeadersPacket( | 1622 AddWrite(InnerConstructRequestHeadersPacket( |
| 1598 2, kClientDataStreamId1, kIncludeVersion, !kFin, DEFAULT_PRIORITY, | 1623 2, kClientDataStreamId1, kIncludeVersion, !kFin, DEFAULT_PRIORITY, |
| 1599 &spdy_request_headers_frame_length, &header_stream_offset)); | 1624 &spdy_request_headers_frame_length, &header_stream_offset)); |
| 1600 AddWrite(SYNCHRONOUS, ERR_FAILED); | 1625 AddWrite(SYNCHRONOUS, ERR_FAILED); |
| 1601 Initialize(); | 1626 Initialize(); |
| 1602 | 1627 |
| 1603 ChunkedUploadDataStream upload_data_stream(0); | 1628 ChunkedUploadDataStream upload_data_stream(0); |
| 1604 size_t chunk_size = strlen(kUploadData); | 1629 size_t chunk_size = strlen(kUploadData); |
| 1605 upload_data_stream.AppendData(kUploadData, chunk_size, false); | 1630 upload_data_stream.AppendData(kUploadData, chunk_size, false); |
| 1606 | 1631 |
| 1607 request_.method = "POST"; | 1632 request_.method = "POST"; |
| 1608 request_.url = GURL("http://www.example.org/"); | 1633 request_.url = GURL("https://www.example.org/"); |
| 1609 request_.upload_data_stream = &upload_data_stream; | 1634 request_.upload_data_stream = &upload_data_stream; |
| 1610 ASSERT_EQ(OK, request_.upload_data_stream->Init( | 1635 ASSERT_EQ(OK, request_.upload_data_stream->Init( |
| 1611 TestCompletionCallback().callback(), NetLogWithSource())); | 1636 TestCompletionCallback().callback(), NetLogWithSource())); |
| 1612 | 1637 |
| 1613 ASSERT_EQ(OK, | 1638 ASSERT_EQ(OK, |
| 1614 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1639 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1615 net_log_.bound(), callback_.callback())); | 1640 net_log_.bound(), callback_.callback())); |
| 1616 ASSERT_EQ(ERR_QUIC_PROTOCOL_ERROR, | 1641 ASSERT_EQ(ERR_QUIC_PROTOCOL_ERROR, |
| 1617 stream_->SendRequest(headers_, &response_, callback_.callback())); | 1642 stream_->SendRequest(headers_, &response_, callback_.callback())); |
| 1618 } | 1643 } |
| 1619 | 1644 |
| 1620 TEST_P(QuicHttpStreamTest, ServerPushGetRequest) { | 1645 TEST_P(QuicHttpStreamTest, ServerPushGetRequest) { |
| 1621 SetRequest("GET", "/", DEFAULT_PRIORITY); | 1646 SetRequest("GET", "/", DEFAULT_PRIORITY); |
| 1622 Initialize(); | 1647 Initialize(); |
| 1623 | 1648 |
| 1624 // Initialize the first stream, for receiving the promise on. | 1649 // Initialize the first stream, for receiving the promise on. |
| 1625 request_.method = "GET"; | 1650 request_.method = "GET"; |
| 1626 request_.url = GURL("http://www.example.org/"); | 1651 request_.url = GURL("https://www.example.org/"); |
| 1627 | 1652 |
| 1628 EXPECT_EQ(OK, | 1653 EXPECT_EQ(OK, |
| 1629 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1654 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1630 net_log_.bound(), callback_.callback())); | 1655 net_log_.bound(), callback_.callback())); |
| 1631 | 1656 |
| 1632 // TODO(ckrasic) - could do this via constructing a PUSH_PROMISE | 1657 // TODO(ckrasic) - could do this via constructing a PUSH_PROMISE |
| 1633 // packet, but does it matter? | 1658 // packet, but does it matter? |
| 1634 ReceivePromise(promise_id_); | 1659 ReceivePromise(promise_id_); |
| 1635 EXPECT_NE(session_->GetPromisedByUrl(promise_url_), nullptr); | 1660 EXPECT_NE(session_->GetPromisedByUrl(promise_url_), nullptr); |
| 1636 | 1661 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1682 strlen(kResponseBody)), | 1707 strlen(kResponseBody)), |
| 1683 promised_stream_->GetTotalReceivedBytes()); | 1708 promised_stream_->GetTotalReceivedBytes()); |
| 1684 } | 1709 } |
| 1685 | 1710 |
| 1686 TEST_P(QuicHttpStreamTest, ServerPushGetRequestSlowResponse) { | 1711 TEST_P(QuicHttpStreamTest, ServerPushGetRequestSlowResponse) { |
| 1687 SetRequest("GET", "/", DEFAULT_PRIORITY); | 1712 SetRequest("GET", "/", DEFAULT_PRIORITY); |
| 1688 Initialize(); | 1713 Initialize(); |
| 1689 | 1714 |
| 1690 // Initialize the first stream, for receiving the promise on. | 1715 // Initialize the first stream, for receiving the promise on. |
| 1691 request_.method = "GET"; | 1716 request_.method = "GET"; |
| 1692 request_.url = GURL("http://www.example.org/"); | 1717 request_.url = GURL("https://www.example.org/"); |
| 1693 | 1718 |
| 1694 EXPECT_EQ(OK, | 1719 EXPECT_EQ(OK, |
| 1695 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1720 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1696 net_log_.bound(), callback_.callback())); | 1721 net_log_.bound(), callback_.callback())); |
| 1697 | 1722 |
| 1698 // TODO(ckrasic) - could do this via constructing a PUSH_PROMISE | 1723 // TODO(ckrasic) - could do this via constructing a PUSH_PROMISE |
| 1699 // packet, but does it matter? | 1724 // packet, but does it matter? |
| 1700 ReceivePromise(promise_id_); | 1725 ReceivePromise(promise_id_); |
| 1701 EXPECT_NE(session_->GetPromisedByUrl(promise_url_), nullptr); | 1726 EXPECT_NE(session_->GetPromisedByUrl(promise_url_), nullptr); |
| 1702 | 1727 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1756 promised_stream_->GetTotalReceivedBytes()); | 1781 promised_stream_->GetTotalReceivedBytes()); |
| 1757 } | 1782 } |
| 1758 | 1783 |
| 1759 // Verify fix for crbug.com/637349 | 1784 // Verify fix for crbug.com/637349 |
| 1760 TEST_P(QuicHttpStreamTest, ServerPushCancelHttpStreamBeforeResponse) { | 1785 TEST_P(QuicHttpStreamTest, ServerPushCancelHttpStreamBeforeResponse) { |
| 1761 SetRequest("GET", "/", DEFAULT_PRIORITY); | 1786 SetRequest("GET", "/", DEFAULT_PRIORITY); |
| 1762 Initialize(); | 1787 Initialize(); |
| 1763 | 1788 |
| 1764 // Initialize the first stream, for receiving the promise on. | 1789 // Initialize the first stream, for receiving the promise on. |
| 1765 request_.method = "GET"; | 1790 request_.method = "GET"; |
| 1766 request_.url = GURL("http://www.example.org/"); | 1791 request_.url = GURL("https://www.example.org/"); |
| 1767 | 1792 |
| 1768 EXPECT_EQ(OK, | 1793 EXPECT_EQ(OK, |
| 1769 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1794 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1770 net_log_.bound(), callback_.callback())); | 1795 net_log_.bound(), callback_.callback())); |
| 1771 | 1796 |
| 1772 // TODO(ckrasic) - could do this via constructing a PUSH_PROMISE | 1797 // TODO(ckrasic) - could do this via constructing a PUSH_PROMISE |
| 1773 // packet, but does it matter? | 1798 // packet, but does it matter? |
| 1774 ReceivePromise(promise_id_); | 1799 ReceivePromise(promise_id_); |
| 1775 EXPECT_NE(session_->GetPromisedByUrl(promise_url_), nullptr); | 1800 EXPECT_NE(session_->GetPromisedByUrl(promise_url_), nullptr); |
| 1776 | 1801 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1798 ProcessPacket(InnerConstructResponseHeadersPacket( | 1823 ProcessPacket(InnerConstructResponseHeadersPacket( |
| 1799 1, promise_id_, false, &spdy_response_headers_frame_length)); | 1824 1, promise_id_, false, &spdy_response_headers_frame_length)); |
| 1800 } | 1825 } |
| 1801 | 1826 |
| 1802 TEST_P(QuicHttpStreamTest, ServerPushCrossOriginOK) { | 1827 TEST_P(QuicHttpStreamTest, ServerPushCrossOriginOK) { |
| 1803 SetRequest("GET", "/", DEFAULT_PRIORITY); | 1828 SetRequest("GET", "/", DEFAULT_PRIORITY); |
| 1804 Initialize(); | 1829 Initialize(); |
| 1805 | 1830 |
| 1806 // Initialize the first stream, for receiving the promise on. | 1831 // Initialize the first stream, for receiving the promise on. |
| 1807 request_.method = "GET"; | 1832 request_.method = "GET"; |
| 1808 request_.url = GURL("http://www.example.org/"); | 1833 request_.url = GURL("https://www.example.org/"); |
| 1809 | 1834 |
| 1810 EXPECT_EQ(OK, | 1835 EXPECT_EQ(OK, |
| 1811 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1836 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1812 net_log_.bound(), callback_.callback())); | 1837 net_log_.bound(), callback_.callback())); |
| 1813 | 1838 |
| 1814 // TODO(ckrasic) - could do this via constructing a PUSH_PROMISE | 1839 // TODO(ckrasic) - could do this via constructing a PUSH_PROMISE |
| 1815 // packet, but does it matter? | 1840 // packet, but does it matter? |
| 1816 | 1841 |
| 1817 push_promise_[":authority"] = "mail.example.org"; | 1842 push_promise_[":authority"] = "mail.example.org"; |
| 1818 promise_url_ = SpdyUtils::GetUrlFromHeaderBlock(push_promise_); | 1843 promise_url_ = SpdyUtils::GetUrlFromHeaderBlock(push_promise_); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1870 strlen(kResponseBody)), | 1895 strlen(kResponseBody)), |
| 1871 promised_stream_->GetTotalReceivedBytes()); | 1896 promised_stream_->GetTotalReceivedBytes()); |
| 1872 } | 1897 } |
| 1873 | 1898 |
| 1874 TEST_P(QuicHttpStreamTest, ServerPushCrossOriginFail) { | 1899 TEST_P(QuicHttpStreamTest, ServerPushCrossOriginFail) { |
| 1875 SetRequest("GET", "/", DEFAULT_PRIORITY); | 1900 SetRequest("GET", "/", DEFAULT_PRIORITY); |
| 1876 Initialize(); | 1901 Initialize(); |
| 1877 | 1902 |
| 1878 // Initialize the first stream, for receiving the promise on. | 1903 // Initialize the first stream, for receiving the promise on. |
| 1879 request_.method = "GET"; | 1904 request_.method = "GET"; |
| 1880 request_.url = GURL("http://www.example.org/"); | 1905 request_.url = GURL("https://www.example.org/"); |
| 1881 | 1906 |
| 1882 EXPECT_EQ(OK, | 1907 EXPECT_EQ(OK, |
| 1883 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1908 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1884 net_log_.bound(), callback_.callback())); | 1909 net_log_.bound(), callback_.callback())); |
| 1885 | 1910 |
| 1886 // TODO(ckrasic) - could do this via constructing a PUSH_PROMISE | 1911 // TODO(ckrasic) - could do this via constructing a PUSH_PROMISE |
| 1887 // packet, but does it matter? | 1912 // packet, but does it matter? |
| 1888 push_promise_[":authority"] = "www.notexample.org"; | 1913 push_promise_[":authority"] = "www.notexample.org"; |
| 1889 promise_url_ = SpdyUtils::GetUrlFromHeaderBlock(push_promise_); | 1914 promise_url_ = SpdyUtils::GetUrlFromHeaderBlock(push_promise_); |
| 1890 serialized_push_promise_ = | 1915 serialized_push_promise_ = |
| 1891 SpdyUtils::SerializeUncompressedHeaders(push_promise_); | 1916 SpdyUtils::SerializeUncompressedHeaders(push_promise_); |
| 1892 | 1917 |
| 1893 ReceivePromise(promise_id_); | 1918 ReceivePromise(promise_id_); |
| 1894 // The promise will have been rejected because the cert doesn't | 1919 // The promise will have been rejected because the cert doesn't |
| 1895 // match. | 1920 // match. |
| 1896 EXPECT_EQ(session_->GetPromisedByUrl(promise_url_), nullptr); | 1921 EXPECT_EQ(session_->GetPromisedByUrl(promise_url_), nullptr); |
| 1897 } | 1922 } |
| 1898 | 1923 |
| 1899 TEST_P(QuicHttpStreamTest, ServerPushVaryCheckOK) { | 1924 TEST_P(QuicHttpStreamTest, ServerPushVaryCheckOK) { |
| 1900 SetRequest("GET", "/", DEFAULT_PRIORITY); | 1925 SetRequest("GET", "/", DEFAULT_PRIORITY); |
| 1901 Initialize(); | 1926 Initialize(); |
| 1902 | 1927 |
| 1903 // Initialize the first stream, for receiving the promise on. | 1928 // Initialize the first stream, for receiving the promise on. |
| 1904 request_.method = "GET"; | 1929 request_.method = "GET"; |
| 1905 request_.url = GURL("http://www.example.org/"); | 1930 request_.url = GURL("https://www.example.org/"); |
| 1906 | 1931 |
| 1907 EXPECT_EQ(OK, | 1932 EXPECT_EQ(OK, |
| 1908 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1933 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1909 net_log_.bound(), callback_.callback())); | 1934 net_log_.bound(), callback_.callback())); |
| 1910 | 1935 |
| 1911 push_promise_["accept-encoding"] = "gzip"; | 1936 push_promise_["accept-encoding"] = "gzip"; |
| 1912 serialized_push_promise_ = | 1937 serialized_push_promise_ = |
| 1913 SpdyUtils::SerializeUncompressedHeaders(push_promise_); | 1938 SpdyUtils::SerializeUncompressedHeaders(push_promise_); |
| 1914 | 1939 |
| 1915 // TODO(ckrasic) - could do this via constructing a PUSH_PROMISE | 1940 // TODO(ckrasic) - could do this via constructing a PUSH_PROMISE |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1990 AddWrite(ConstructClientRstStreamVaryMismatchPacket(2)); | 2015 AddWrite(ConstructClientRstStreamVaryMismatchPacket(2)); |
| 1991 AddWrite(InnerConstructRequestHeadersPacket( | 2016 AddWrite(InnerConstructRequestHeadersPacket( |
| 1992 3, stream_id_ + 2, !kIncludeVersion, kFin, DEFAULT_PRIORITY, | 2017 3, stream_id_ + 2, !kIncludeVersion, kFin, DEFAULT_PRIORITY, |
| 1993 &spdy_request_header_frame_length, &header_stream_offset)); | 2018 &spdy_request_header_frame_length, &header_stream_offset)); |
| 1994 AddWrite(ConstructClientAckPacket(4, 3, 1)); | 2019 AddWrite(ConstructClientAckPacket(4, 3, 1)); |
| 1995 AddWrite(ConstructClientRstStreamCancelledPacket(5)); | 2020 AddWrite(ConstructClientRstStreamCancelledPacket(5)); |
| 1996 Initialize(); | 2021 Initialize(); |
| 1997 | 2022 |
| 1998 // Initialize the first stream, for receiving the promise on. | 2023 // Initialize the first stream, for receiving the promise on. |
| 1999 request_.method = "GET"; | 2024 request_.method = "GET"; |
| 2000 request_.url = GURL("http://www.example.org/"); | 2025 request_.url = GURL("https://www.example.org/"); |
| 2001 | 2026 |
| 2002 EXPECT_EQ(OK, | 2027 EXPECT_EQ(OK, |
| 2003 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 2028 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 2004 net_log_.bound(), callback_.callback())); | 2029 net_log_.bound(), callback_.callback())); |
| 2005 | 2030 |
| 2006 push_promise_["accept-encoding"] = "gzip"; | 2031 push_promise_["accept-encoding"] = "gzip"; |
| 2007 serialized_push_promise_ = | 2032 serialized_push_promise_ = |
| 2008 SpdyUtils::SerializeUncompressedHeaders(push_promise_); | 2033 SpdyUtils::SerializeUncompressedHeaders(push_promise_); |
| 2009 | 2034 |
| 2010 // TODO(ckrasic) - could do this via constructing a PUSH_PROMISE | 2035 // TODO(ckrasic) - could do this via constructing a PUSH_PROMISE |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2105 AddWrite(InnerConstructRequestHeadersPacket( | 2130 AddWrite(InnerConstructRequestHeadersPacket( |
| 2106 2, kClientDataStreamId1, kIncludeVersion, !kFin, DEFAULT_PRIORITY, | 2131 2, kClientDataStreamId1, kIncludeVersion, !kFin, DEFAULT_PRIORITY, |
| 2107 &spdy_request_headers_frame_length, &header_stream_offset)); | 2132 &spdy_request_headers_frame_length, &header_stream_offset)); |
| 2108 AddWrite(ConstructClientRstStreamErrorPacket(3, kIncludeVersion)); | 2133 AddWrite(ConstructClientRstStreamErrorPacket(3, kIncludeVersion)); |
| 2109 | 2134 |
| 2110 Initialize(); | 2135 Initialize(); |
| 2111 | 2136 |
| 2112 ReadErrorUploadDataStream upload_data_stream( | 2137 ReadErrorUploadDataStream upload_data_stream( |
| 2113 ReadErrorUploadDataStream::FailureMode::SYNC); | 2138 ReadErrorUploadDataStream::FailureMode::SYNC); |
| 2114 request_.method = "POST"; | 2139 request_.method = "POST"; |
| 2115 request_.url = GURL("http://www.example.org/"); | 2140 request_.url = GURL("https://www.example.org/"); |
| 2116 request_.upload_data_stream = &upload_data_stream; | 2141 request_.upload_data_stream = &upload_data_stream; |
| 2117 ASSERT_EQ(OK, request_.upload_data_stream->Init( | 2142 ASSERT_EQ(OK, request_.upload_data_stream->Init( |
| 2118 TestCompletionCallback().callback(), NetLogWithSource())); | 2143 TestCompletionCallback().callback(), NetLogWithSource())); |
| 2119 | 2144 |
| 2120 EXPECT_EQ(OK, | 2145 EXPECT_EQ(OK, |
| 2121 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 2146 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 2122 net_log_.bound(), callback_.callback())); | 2147 net_log_.bound(), callback_.callback())); |
| 2123 | 2148 |
| 2124 int result = stream_->SendRequest(headers_, &response_, callback_.callback()); | 2149 int result = stream_->SendRequest(headers_, &response_, callback_.callback()); |
| 2125 EXPECT_THAT(result, IsError(ERR_FAILED)); | 2150 EXPECT_THAT(result, IsError(ERR_FAILED)); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2142 AddWrite(InnerConstructRequestHeadersPacket( | 2167 AddWrite(InnerConstructRequestHeadersPacket( |
| 2143 2, kClientDataStreamId1, kIncludeVersion, !kFin, DEFAULT_PRIORITY, | 2168 2, kClientDataStreamId1, kIncludeVersion, !kFin, DEFAULT_PRIORITY, |
| 2144 &spdy_request_headers_frame_length, &header_stream_offset)); | 2169 &spdy_request_headers_frame_length, &header_stream_offset)); |
| 2145 AddWrite(ConstructClientRstStreamErrorPacket(3, !kIncludeVersion)); | 2170 AddWrite(ConstructClientRstStreamErrorPacket(3, !kIncludeVersion)); |
| 2146 | 2171 |
| 2147 Initialize(); | 2172 Initialize(); |
| 2148 | 2173 |
| 2149 ReadErrorUploadDataStream upload_data_stream( | 2174 ReadErrorUploadDataStream upload_data_stream( |
| 2150 ReadErrorUploadDataStream::FailureMode::ASYNC); | 2175 ReadErrorUploadDataStream::FailureMode::ASYNC); |
| 2151 request_.method = "POST"; | 2176 request_.method = "POST"; |
| 2152 request_.url = GURL("http://www.example.org/"); | 2177 request_.url = GURL("https://www.example.org/"); |
| 2153 request_.upload_data_stream = &upload_data_stream; | 2178 request_.upload_data_stream = &upload_data_stream; |
| 2154 ASSERT_EQ(OK, request_.upload_data_stream->Init( | 2179 ASSERT_EQ(OK, request_.upload_data_stream->Init( |
| 2155 TestCompletionCallback().callback(), NetLogWithSource())); | 2180 TestCompletionCallback().callback(), NetLogWithSource())); |
| 2156 | 2181 |
| 2157 EXPECT_EQ(OK, | 2182 EXPECT_EQ(OK, |
| 2158 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 2183 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 2159 net_log_.bound(), callback_.callback())); | 2184 net_log_.bound(), callback_.callback())); |
| 2160 | 2185 |
| 2161 int result = stream_->SendRequest(headers_, &response_, callback_.callback()); | 2186 int result = stream_->SendRequest(headers_, &response_, callback_.callback()); |
| 2162 | 2187 |
| 2163 ProcessPacket(ConstructServerAckPacket(1, 0, 0)); | 2188 ProcessPacket(ConstructServerAckPacket(1, 0, 0)); |
| 2164 SetResponse("200 OK", string()); | 2189 SetResponse("200 OK", string()); |
| 2165 | 2190 |
| 2166 EXPECT_THAT(result, IsError(ERR_IO_PENDING)); | 2191 EXPECT_THAT(result, IsError(ERR_IO_PENDING)); |
| 2167 EXPECT_THAT(callback_.GetResult(result), IsError(ERR_FAILED)); | 2192 EXPECT_THAT(callback_.GetResult(result), IsError(ERR_FAILED)); |
| 2168 | 2193 |
| 2169 EXPECT_TRUE(AtEof()); | 2194 EXPECT_TRUE(AtEof()); |
| 2170 | 2195 |
| 2171 // QuicHttpStream::GetTotalSent/ReceivedBytes includes only headers. | 2196 // QuicHttpStream::GetTotalSent/ReceivedBytes includes only headers. |
| 2172 EXPECT_EQ(static_cast<int64_t>(spdy_request_headers_frame_length), | 2197 EXPECT_EQ(static_cast<int64_t>(spdy_request_headers_frame_length), |
| 2173 stream_->GetTotalSentBytes()); | 2198 stream_->GetTotalSentBytes()); |
| 2174 EXPECT_EQ(0, stream_->GetTotalReceivedBytes()); | 2199 EXPECT_EQ(0, stream_->GetTotalReceivedBytes()); |
| 2175 } | 2200 } |
| 2176 | 2201 |
| 2177 } // namespace test | 2202 } // namespace test |
| 2178 } // namespace net | 2203 } // namespace net |
| OLD | NEW |