| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 enum class FailureMode { SYNC, ASYNC }; | 116 enum class FailureMode { SYNC, ASYNC }; |
| 117 | 117 |
| 118 explicit ReadErrorUploadDataStream(FailureMode mode) | 118 explicit ReadErrorUploadDataStream(FailureMode mode) |
| 119 : UploadDataStream(true, 0), async_(mode), weak_factory_(this) {} | 119 : UploadDataStream(true, 0), async_(mode), weak_factory_(this) {} |
| 120 ~ReadErrorUploadDataStream() override {} | 120 ~ReadErrorUploadDataStream() override {} |
| 121 | 121 |
| 122 private: | 122 private: |
| 123 void CompleteRead() { UploadDataStream::OnReadCompleted(ERR_FAILED); } | 123 void CompleteRead() { UploadDataStream::OnReadCompleted(ERR_FAILED); } |
| 124 | 124 |
| 125 // UploadDataStream implementation: | 125 // UploadDataStream implementation: |
| 126 int InitInternal() override { return OK; } | 126 int InitInternal(const BoundNetLog& net_log) override { return OK; } |
| 127 | 127 |
| 128 int ReadInternal(IOBuffer* buf, int buf_len) override { | 128 int ReadInternal(IOBuffer* buf, int buf_len) override { |
| 129 if (async_ == FailureMode::ASYNC) { | 129 if (async_ == FailureMode::ASYNC) { |
| 130 base::ThreadTaskRunnerHandle::Get()->PostTask( | 130 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 131 FROM_HERE, base::Bind(&ReadErrorUploadDataStream::CompleteRead, | 131 FROM_HERE, base::Bind(&ReadErrorUploadDataStream::CompleteRead, |
| 132 weak_factory_.GetWeakPtr())); | 132 weak_factory_.GetWeakPtr())); |
| 133 return ERR_IO_PENDING; | 133 return ERR_IO_PENDING; |
| 134 } | 134 } |
| 135 return ERR_FAILED; | 135 return ERR_FAILED; |
| 136 } | 136 } |
| (...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 | 953 |
| 954 Initialize(); | 954 Initialize(); |
| 955 | 955 |
| 956 std::vector<std::unique_ptr<UploadElementReader>> element_readers; | 956 std::vector<std::unique_ptr<UploadElementReader>> element_readers; |
| 957 element_readers.push_back(base::WrapUnique( | 957 element_readers.push_back(base::WrapUnique( |
| 958 new UploadBytesElementReader(kUploadData, strlen(kUploadData)))); | 958 new UploadBytesElementReader(kUploadData, strlen(kUploadData)))); |
| 959 ElementsUploadDataStream upload_data_stream(std::move(element_readers), 0); | 959 ElementsUploadDataStream upload_data_stream(std::move(element_readers), 0); |
| 960 request_.method = "POST"; | 960 request_.method = "POST"; |
| 961 request_.url = GURL("http://www.example.org/"); | 961 request_.url = GURL("http://www.example.org/"); |
| 962 request_.upload_data_stream = &upload_data_stream; | 962 request_.upload_data_stream = &upload_data_stream; |
| 963 ASSERT_THAT(request_.upload_data_stream->Init(CompletionCallback()), IsOk()); | 963 ASSERT_THAT( |
| 964 request_.upload_data_stream->Init(CompletionCallback(), BoundNetLog()), |
| 965 IsOk()); |
| 964 | 966 |
| 965 EXPECT_EQ(OK, | 967 EXPECT_EQ(OK, |
| 966 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 968 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 967 net_log_.bound(), callback_.callback())); | 969 net_log_.bound(), callback_.callback())); |
| 968 EXPECT_EQ(OK, | 970 EXPECT_EQ(OK, |
| 969 stream_->SendRequest(headers_, &response_, callback_.callback())); | 971 stream_->SendRequest(headers_, &response_, callback_.callback())); |
| 970 | 972 |
| 971 // Ack both packets in the request. | 973 // Ack both packets in the request. |
| 972 ProcessPacket(ConstructServerAckPacket(1, 0, 0)); | 974 ProcessPacket(ConstructServerAckPacket(1, 0, 0)); |
| 973 | 975 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 AddWrite(ConstructClientAckPacket(4, 3, 1)); | 1021 AddWrite(ConstructClientAckPacket(4, 3, 1)); |
| 1020 Initialize(); | 1022 Initialize(); |
| 1021 | 1023 |
| 1022 ChunkedUploadDataStream upload_data_stream(0); | 1024 ChunkedUploadDataStream upload_data_stream(0); |
| 1023 upload_data_stream.AppendData(kUploadData, chunk_size, false); | 1025 upload_data_stream.AppendData(kUploadData, chunk_size, false); |
| 1024 | 1026 |
| 1025 request_.method = "POST"; | 1027 request_.method = "POST"; |
| 1026 request_.url = GURL("http://www.example.org/"); | 1028 request_.url = GURL("http://www.example.org/"); |
| 1027 request_.upload_data_stream = &upload_data_stream; | 1029 request_.upload_data_stream = &upload_data_stream; |
| 1028 ASSERT_EQ(OK, request_.upload_data_stream->Init( | 1030 ASSERT_EQ(OK, request_.upload_data_stream->Init( |
| 1029 TestCompletionCallback().callback())); | 1031 TestCompletionCallback().callback(), BoundNetLog())); |
| 1030 | 1032 |
| 1031 ASSERT_EQ(OK, | 1033 ASSERT_EQ(OK, |
| 1032 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1034 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1033 net_log_.bound(), callback_.callback())); | 1035 net_log_.bound(), callback_.callback())); |
| 1034 ASSERT_EQ(ERR_IO_PENDING, | 1036 ASSERT_EQ(ERR_IO_PENDING, |
| 1035 stream_->SendRequest(headers_, &response_, callback_.callback())); | 1037 stream_->SendRequest(headers_, &response_, callback_.callback())); |
| 1036 | 1038 |
| 1037 upload_data_stream.AppendData(kUploadData, chunk_size, true); | 1039 upload_data_stream.AppendData(kUploadData, chunk_size, true); |
| 1038 EXPECT_THAT(callback_.WaitForResult(), IsOk()); | 1040 EXPECT_THAT(callback_.WaitForResult(), IsOk()); |
| 1039 | 1041 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 AddWrite(ConstructClientAckPacket(4, 3, 1)); | 1091 AddWrite(ConstructClientAckPacket(4, 3, 1)); |
| 1090 Initialize(); | 1092 Initialize(); |
| 1091 | 1093 |
| 1092 ChunkedUploadDataStream upload_data_stream(0); | 1094 ChunkedUploadDataStream upload_data_stream(0); |
| 1093 upload_data_stream.AppendData(kUploadData, chunk_size, false); | 1095 upload_data_stream.AppendData(kUploadData, chunk_size, false); |
| 1094 | 1096 |
| 1095 request_.method = "POST"; | 1097 request_.method = "POST"; |
| 1096 request_.url = GURL("http://www.example.org/"); | 1098 request_.url = GURL("http://www.example.org/"); |
| 1097 request_.upload_data_stream = &upload_data_stream; | 1099 request_.upload_data_stream = &upload_data_stream; |
| 1098 ASSERT_EQ(OK, request_.upload_data_stream->Init( | 1100 ASSERT_EQ(OK, request_.upload_data_stream->Init( |
| 1099 TestCompletionCallback().callback())); | 1101 TestCompletionCallback().callback(), BoundNetLog())); |
| 1100 | 1102 |
| 1101 ASSERT_EQ(OK, | 1103 ASSERT_EQ(OK, |
| 1102 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1104 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1103 net_log_.bound(), callback_.callback())); | 1105 net_log_.bound(), callback_.callback())); |
| 1104 ASSERT_EQ(ERR_IO_PENDING, | 1106 ASSERT_EQ(ERR_IO_PENDING, |
| 1105 stream_->SendRequest(headers_, &response_, callback_.callback())); | 1107 stream_->SendRequest(headers_, &response_, callback_.callback())); |
| 1106 | 1108 |
| 1107 upload_data_stream.AppendData(nullptr, 0, true); | 1109 upload_data_stream.AppendData(nullptr, 0, true); |
| 1108 EXPECT_THAT(callback_.WaitForResult(), IsOk()); | 1110 EXPECT_THAT(callback_.WaitForResult(), IsOk()); |
| 1109 | 1111 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1153 AddWrite(ConstructClientDataPacket(2, kIncludeVersion, kFin, 0, "")); | 1155 AddWrite(ConstructClientDataPacket(2, kIncludeVersion, kFin, 0, "")); |
| 1154 AddWrite(ConstructClientAckPacket(3, 3, 1)); | 1156 AddWrite(ConstructClientAckPacket(3, 3, 1)); |
| 1155 Initialize(); | 1157 Initialize(); |
| 1156 | 1158 |
| 1157 ChunkedUploadDataStream upload_data_stream(0); | 1159 ChunkedUploadDataStream upload_data_stream(0); |
| 1158 | 1160 |
| 1159 request_.method = "POST"; | 1161 request_.method = "POST"; |
| 1160 request_.url = GURL("http://www.example.org/"); | 1162 request_.url = GURL("http://www.example.org/"); |
| 1161 request_.upload_data_stream = &upload_data_stream; | 1163 request_.upload_data_stream = &upload_data_stream; |
| 1162 ASSERT_EQ(OK, request_.upload_data_stream->Init( | 1164 ASSERT_EQ(OK, request_.upload_data_stream->Init( |
| 1163 TestCompletionCallback().callback())); | 1165 TestCompletionCallback().callback(), BoundNetLog())); |
| 1164 | 1166 |
| 1165 ASSERT_EQ(OK, | 1167 ASSERT_EQ(OK, |
| 1166 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1168 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1167 net_log_.bound(), callback_.callback())); | 1169 net_log_.bound(), callback_.callback())); |
| 1168 ASSERT_EQ(ERR_IO_PENDING, | 1170 ASSERT_EQ(ERR_IO_PENDING, |
| 1169 stream_->SendRequest(headers_, &response_, callback_.callback())); | 1171 stream_->SendRequest(headers_, &response_, callback_.callback())); |
| 1170 | 1172 |
| 1171 upload_data_stream.AppendData(nullptr, 0, true); | 1173 upload_data_stream.AppendData(nullptr, 0, true); |
| 1172 EXPECT_THAT(callback_.WaitForResult(), IsOk()); | 1174 EXPECT_THAT(callback_.WaitForResult(), IsOk()); |
| 1173 | 1175 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1343 // the session. | 1345 // the session. |
| 1344 AddWrite(SYNCHRONOUS, ERR_FAILED); | 1346 AddWrite(SYNCHRONOUS, ERR_FAILED); |
| 1345 Initialize(); | 1347 Initialize(); |
| 1346 | 1348 |
| 1347 ChunkedUploadDataStream upload_data_stream(0); | 1349 ChunkedUploadDataStream upload_data_stream(0); |
| 1348 | 1350 |
| 1349 request_.method = "POST"; | 1351 request_.method = "POST"; |
| 1350 request_.url = GURL("http://www.example.org/"); | 1352 request_.url = GURL("http://www.example.org/"); |
| 1351 request_.upload_data_stream = &upload_data_stream; | 1353 request_.upload_data_stream = &upload_data_stream; |
| 1352 ASSERT_EQ(OK, request_.upload_data_stream->Init( | 1354 ASSERT_EQ(OK, request_.upload_data_stream->Init( |
| 1353 TestCompletionCallback().callback())); | 1355 TestCompletionCallback().callback(), BoundNetLog())); |
| 1354 | 1356 |
| 1355 size_t chunk_size = strlen(kUploadData); | 1357 size_t chunk_size = strlen(kUploadData); |
| 1356 upload_data_stream.AppendData(kUploadData, chunk_size, false); | 1358 upload_data_stream.AppendData(kUploadData, chunk_size, false); |
| 1357 ASSERT_EQ(OK, | 1359 ASSERT_EQ(OK, |
| 1358 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1360 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1359 net_log_.bound(), callback_.callback())); | 1361 net_log_.bound(), callback_.callback())); |
| 1360 QuicHttpStream* stream = stream_.get(); | 1362 QuicHttpStream* stream = stream_.get(); |
| 1361 DeleteStreamCallback delete_stream_callback(std::move(stream_)); | 1363 DeleteStreamCallback delete_stream_callback(std::move(stream_)); |
| 1362 // SendRequest() completes asynchronously after the final chunk is added. | 1364 // SendRequest() completes asynchronously after the final chunk is added. |
| 1363 ASSERT_EQ(ERR_IO_PENDING, | 1365 ASSERT_EQ(ERR_IO_PENDING, |
| 1364 stream->SendRequest(headers_, &response_, callback_.callback())); | 1366 stream->SendRequest(headers_, &response_, callback_.callback())); |
| 1365 upload_data_stream.AppendData(kUploadData, chunk_size, true); | 1367 upload_data_stream.AppendData(kUploadData, chunk_size, true); |
| 1366 int rv = callback_.WaitForResult(); | 1368 int rv = callback_.WaitForResult(); |
| 1367 EXPECT_EQ(ERR_QUIC_PROTOCOL_ERROR, rv); | 1369 EXPECT_EQ(ERR_QUIC_PROTOCOL_ERROR, rv); |
| 1368 } | 1370 } |
| 1369 | 1371 |
| 1370 TEST_P(QuicHttpStreamTest, SessionClosedBeforeSendHeadersComplete) { | 1372 TEST_P(QuicHttpStreamTest, SessionClosedBeforeSendHeadersComplete) { |
| 1371 SetRequest("POST", "/", DEFAULT_PRIORITY); | 1373 SetRequest("POST", "/", DEFAULT_PRIORITY); |
| 1372 AddWrite(SYNCHRONOUS, ERR_FAILED); | 1374 AddWrite(SYNCHRONOUS, ERR_FAILED); |
| 1373 Initialize(); | 1375 Initialize(); |
| 1374 | 1376 |
| 1375 ChunkedUploadDataStream upload_data_stream(0); | 1377 ChunkedUploadDataStream upload_data_stream(0); |
| 1376 | 1378 |
| 1377 request_.method = "POST"; | 1379 request_.method = "POST"; |
| 1378 request_.url = GURL("http://www.example.org/"); | 1380 request_.url = GURL("http://www.example.org/"); |
| 1379 request_.upload_data_stream = &upload_data_stream; | 1381 request_.upload_data_stream = &upload_data_stream; |
| 1380 ASSERT_EQ(OK, request_.upload_data_stream->Init( | 1382 ASSERT_EQ(OK, request_.upload_data_stream->Init( |
| 1381 TestCompletionCallback().callback())); | 1383 TestCompletionCallback().callback(), BoundNetLog())); |
| 1382 | 1384 |
| 1383 ASSERT_EQ(OK, | 1385 ASSERT_EQ(OK, |
| 1384 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1386 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1385 net_log_.bound(), callback_.callback())); | 1387 net_log_.bound(), callback_.callback())); |
| 1386 ASSERT_EQ(ERR_QUIC_PROTOCOL_ERROR, | 1388 ASSERT_EQ(ERR_QUIC_PROTOCOL_ERROR, |
| 1387 stream_->SendRequest(headers_, &response_, callback_.callback())); | 1389 stream_->SendRequest(headers_, &response_, callback_.callback())); |
| 1388 } | 1390 } |
| 1389 | 1391 |
| 1390 TEST_P(QuicHttpStreamTest, SessionClosedBeforeSendBodyComplete) { | 1392 TEST_P(QuicHttpStreamTest, SessionClosedBeforeSendBodyComplete) { |
| 1391 SetRequest("POST", "/", DEFAULT_PRIORITY); | 1393 SetRequest("POST", "/", DEFAULT_PRIORITY); |
| 1392 size_t spdy_request_headers_frame_length; | 1394 size_t spdy_request_headers_frame_length; |
| 1393 AddWrite(ConstructRequestHeadersPacket(1, !kFin, DEFAULT_PRIORITY, | 1395 AddWrite(ConstructRequestHeadersPacket(1, !kFin, DEFAULT_PRIORITY, |
| 1394 &spdy_request_headers_frame_length)); | 1396 &spdy_request_headers_frame_length)); |
| 1395 AddWrite(SYNCHRONOUS, ERR_FAILED); | 1397 AddWrite(SYNCHRONOUS, ERR_FAILED); |
| 1396 Initialize(); | 1398 Initialize(); |
| 1397 | 1399 |
| 1398 ChunkedUploadDataStream upload_data_stream(0); | 1400 ChunkedUploadDataStream upload_data_stream(0); |
| 1399 size_t chunk_size = strlen(kUploadData); | 1401 size_t chunk_size = strlen(kUploadData); |
| 1400 upload_data_stream.AppendData(kUploadData, chunk_size, false); | 1402 upload_data_stream.AppendData(kUploadData, chunk_size, false); |
| 1401 | 1403 |
| 1402 request_.method = "POST"; | 1404 request_.method = "POST"; |
| 1403 request_.url = GURL("http://www.example.org/"); | 1405 request_.url = GURL("http://www.example.org/"); |
| 1404 request_.upload_data_stream = &upload_data_stream; | 1406 request_.upload_data_stream = &upload_data_stream; |
| 1405 ASSERT_EQ(OK, request_.upload_data_stream->Init( | 1407 ASSERT_EQ(OK, request_.upload_data_stream->Init( |
| 1406 TestCompletionCallback().callback())); | 1408 TestCompletionCallback().callback(), BoundNetLog())); |
| 1407 | 1409 |
| 1408 ASSERT_EQ(OK, | 1410 ASSERT_EQ(OK, |
| 1409 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1411 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1410 net_log_.bound(), callback_.callback())); | 1412 net_log_.bound(), callback_.callback())); |
| 1411 ASSERT_EQ(ERR_QUIC_PROTOCOL_ERROR, | 1413 ASSERT_EQ(ERR_QUIC_PROTOCOL_ERROR, |
| 1412 stream_->SendRequest(headers_, &response_, callback_.callback())); | 1414 stream_->SendRequest(headers_, &response_, callback_.callback())); |
| 1413 } | 1415 } |
| 1414 | 1416 |
| 1415 TEST_P(QuicHttpStreamTest, ServerPushGetRequest) { | 1417 TEST_P(QuicHttpStreamTest, ServerPushGetRequest) { |
| 1416 SetRequest("GET", "/", DEFAULT_PRIORITY); | 1418 SetRequest("GET", "/", DEFAULT_PRIORITY); |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1851 AddWrite(ConstructClientRstStreamErrorPacket(2, kIncludeVersion)); | 1853 AddWrite(ConstructClientRstStreamErrorPacket(2, kIncludeVersion)); |
| 1852 | 1854 |
| 1853 Initialize(); | 1855 Initialize(); |
| 1854 | 1856 |
| 1855 ReadErrorUploadDataStream upload_data_stream( | 1857 ReadErrorUploadDataStream upload_data_stream( |
| 1856 ReadErrorUploadDataStream::FailureMode::SYNC); | 1858 ReadErrorUploadDataStream::FailureMode::SYNC); |
| 1857 request_.method = "POST"; | 1859 request_.method = "POST"; |
| 1858 request_.url = GURL("http://www.example.org/"); | 1860 request_.url = GURL("http://www.example.org/"); |
| 1859 request_.upload_data_stream = &upload_data_stream; | 1861 request_.upload_data_stream = &upload_data_stream; |
| 1860 ASSERT_EQ(OK, request_.upload_data_stream->Init( | 1862 ASSERT_EQ(OK, request_.upload_data_stream->Init( |
| 1861 TestCompletionCallback().callback())); | 1863 TestCompletionCallback().callback(), BoundNetLog())); |
| 1862 | 1864 |
| 1863 EXPECT_EQ(OK, | 1865 EXPECT_EQ(OK, |
| 1864 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1866 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1865 net_log_.bound(), callback_.callback())); | 1867 net_log_.bound(), callback_.callback())); |
| 1866 | 1868 |
| 1867 int result = stream_->SendRequest(headers_, &response_, callback_.callback()); | 1869 int result = stream_->SendRequest(headers_, &response_, callback_.callback()); |
| 1868 EXPECT_THAT(result, IsError(ERR_FAILED)); | 1870 EXPECT_THAT(result, IsError(ERR_FAILED)); |
| 1869 | 1871 |
| 1870 EXPECT_TRUE(AtEof()); | 1872 EXPECT_TRUE(AtEof()); |
| 1871 | 1873 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1883 AddWrite(ConstructClientRstStreamErrorPacket(2, !kIncludeVersion)); | 1885 AddWrite(ConstructClientRstStreamErrorPacket(2, !kIncludeVersion)); |
| 1884 | 1886 |
| 1885 Initialize(); | 1887 Initialize(); |
| 1886 | 1888 |
| 1887 ReadErrorUploadDataStream upload_data_stream( | 1889 ReadErrorUploadDataStream upload_data_stream( |
| 1888 ReadErrorUploadDataStream::FailureMode::ASYNC); | 1890 ReadErrorUploadDataStream::FailureMode::ASYNC); |
| 1889 request_.method = "POST"; | 1891 request_.method = "POST"; |
| 1890 request_.url = GURL("http://www.example.org/"); | 1892 request_.url = GURL("http://www.example.org/"); |
| 1891 request_.upload_data_stream = &upload_data_stream; | 1893 request_.upload_data_stream = &upload_data_stream; |
| 1892 ASSERT_EQ(OK, request_.upload_data_stream->Init( | 1894 ASSERT_EQ(OK, request_.upload_data_stream->Init( |
| 1893 TestCompletionCallback().callback())); | 1895 TestCompletionCallback().callback(), BoundNetLog())); |
| 1894 | 1896 |
| 1895 EXPECT_EQ(OK, | 1897 EXPECT_EQ(OK, |
| 1896 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 1898 stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 1897 net_log_.bound(), callback_.callback())); | 1899 net_log_.bound(), callback_.callback())); |
| 1898 | 1900 |
| 1899 int result = stream_->SendRequest(headers_, &response_, callback_.callback()); | 1901 int result = stream_->SendRequest(headers_, &response_, callback_.callback()); |
| 1900 | 1902 |
| 1901 ProcessPacket(ConstructServerAckPacket(1, 0, 0)); | 1903 ProcessPacket(ConstructServerAckPacket(1, 0, 0)); |
| 1902 SetResponse("200 OK", string()); | 1904 SetResponse("200 OK", string()); |
| 1903 | 1905 |
| 1904 EXPECT_THAT(result, IsError(ERR_IO_PENDING)); | 1906 EXPECT_THAT(result, IsError(ERR_IO_PENDING)); |
| 1905 EXPECT_THAT(callback_.GetResult(result), IsError(ERR_FAILED)); | 1907 EXPECT_THAT(callback_.GetResult(result), IsError(ERR_FAILED)); |
| 1906 | 1908 |
| 1907 EXPECT_TRUE(AtEof()); | 1909 EXPECT_TRUE(AtEof()); |
| 1908 | 1910 |
| 1909 // QuicHttpStream::GetTotalSent/ReceivedBytes includes only headers. | 1911 // QuicHttpStream::GetTotalSent/ReceivedBytes includes only headers. |
| 1910 EXPECT_EQ(static_cast<int64_t>(spdy_request_headers_frame_length), | 1912 EXPECT_EQ(static_cast<int64_t>(spdy_request_headers_frame_length), |
| 1911 stream_->GetTotalSentBytes()); | 1913 stream_->GetTotalSentBytes()); |
| 1912 EXPECT_EQ(0, stream_->GetTotalReceivedBytes()); | 1914 EXPECT_EQ(0, stream_->GetTotalReceivedBytes()); |
| 1913 } | 1915 } |
| 1914 | 1916 |
| 1915 } // namespace test | 1917 } // namespace test |
| 1916 } // namespace net | 1918 } // namespace net |
| OLD | NEW |