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 <cmath> | 5 #include <cmath> |
6 #include <memory> | 6 #include <memory> |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 output_.response_info = *response; // Make a copy so we can verify. | 273 output_.response_info = *response; // Make a copy so we can verify. |
274 output_.rv = ReadTransaction(trans_.get(), &output_.response_data); | 274 output_.rv = ReadTransaction(trans_.get(), &output_.response_data); |
275 } | 275 } |
276 | 276 |
277 void FinishDefaultTestWithoutVerification() { | 277 void FinishDefaultTestWithoutVerification() { |
278 output_.rv = callback_.WaitForResult(); | 278 output_.rv = callback_.WaitForResult(); |
279 if (output_.rv != OK) | 279 if (output_.rv != OK) |
280 session_->spdy_session_pool()->CloseCurrentSessions(ERR_ABORTED); | 280 session_->spdy_session_pool()->CloseCurrentSessions(ERR_ABORTED); |
281 } | 281 } |
282 | 282 |
283 void WaitForHeaders() { output_.rv = callback_.WaitForResult(); } | 283 void WaitForCallbackToComplete() { output_.rv = callback_.WaitForResult(); } |
284 | 284 |
285 // Most tests will want to call this function. In particular, the MockReads | 285 // Most tests will want to call this function. In particular, the MockReads |
286 // should end with an empty read, and that read needs to be processed to | 286 // should end with an empty read, and that read needs to be processed to |
287 // ensure proper deletion of the spdy_session_pool. | 287 // ensure proper deletion of the spdy_session_pool. |
288 void VerifyDataConsumed() { | 288 void VerifyDataConsumed() { |
289 for (const SocketDataProvider* provider : data_vector_) { | 289 for (const SocketDataProvider* provider : data_vector_) { |
290 EXPECT_TRUE(provider->AllReadDataConsumed()); | 290 EXPECT_TRUE(provider->AllReadDataConsumed()); |
291 EXPECT_TRUE(provider->AllWriteDataConsumed()); | 291 EXPECT_TRUE(provider->AllWriteDataConsumed()); |
292 } | 292 } |
293 } | 293 } |
(...skipping 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2044 // while still waiting for chunked request data. | 2044 // while still waiting for chunked request data. |
2045 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); | 2045 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); |
2046 NormalSpdyTransactionHelper helper(CreateChunkedPostRequest(), | 2046 NormalSpdyTransactionHelper helper(CreateChunkedPostRequest(), |
2047 DEFAULT_PRIORITY, | 2047 DEFAULT_PRIORITY, |
2048 BoundNetLog(), GetParam(), NULL); | 2048 BoundNetLog(), GetParam(), NULL); |
2049 helper.RunPreTestSetup(); | 2049 helper.RunPreTestSetup(); |
2050 helper.AddData(&data); | 2050 helper.AddData(&data); |
2051 | 2051 |
2052 ASSERT_TRUE(helper.StartDefaultTest()); | 2052 ASSERT_TRUE(helper.StartDefaultTest()); |
2053 | 2053 |
2054 helper.WaitForHeaders(); | 2054 base::RunLoop().RunUntilIdle(); |
2055 EXPECT_EQ(OK, helper.output().rv); | |
2056 | 2055 |
2057 // Process the request headers, SYN_REPLY, and response body. | 2056 // Process the request headers, SYN_REPLY, and response body. |
2058 // The request body is still in flight. | 2057 // The request body is still in flight. |
2059 const HttpResponseInfo* response = helper.trans()->GetResponseInfo(); | 2058 const HttpResponseInfo* response = helper.trans()->GetResponseInfo(); |
2060 EXPECT_EQ("HTTP/1.1 200", response->headers->GetStatusLine()); | 2059 EXPECT_EQ("HTTP/1.1 200", response->headers->GetStatusLine()); |
2061 | 2060 |
2062 // Finish sending the request body. | 2061 // Finish sending the request body. |
2063 upload_chunked_data_stream()->AppendData(kUploadData, kUploadDataSize, true); | 2062 upload_chunked_data_stream()->AppendData(kUploadData, kUploadDataSize, true); |
| 2063 helper.WaitForCallbackToComplete(); |
| 2064 EXPECT_EQ(OK, helper.output().rv); |
2064 | 2065 |
2065 std::string response_body; | 2066 std::string response_body; |
2066 EXPECT_EQ(OK, ReadTransaction(helper.trans(), &response_body)); | 2067 EXPECT_EQ(OK, ReadTransaction(helper.trans(), &response_body)); |
2067 EXPECT_EQ(kUploadData, response_body); | 2068 EXPECT_EQ(kUploadData, response_body); |
2068 helper.VerifyDataConsumed(); | 2069 helper.VerifyDataConsumed(); |
2069 } | 2070 } |
2070 | 2071 |
2071 // The client upon cancellation tries to send a RST_STREAM frame. The mock | 2072 // The client upon cancellation tries to send a RST_STREAM frame. The mock |
2072 // socket causes the TCP write to return zero. This test checks that the client | 2073 // socket causes the TCP write to return zero. This test checks that the client |
2073 // tries to queue up the RST_STREAM frame again. | 2074 // tries to queue up the RST_STREAM frame again. |
(...skipping 5182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7256 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { | 7257 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { |
7257 std::unique_ptr<SSLSocketDataProvider> ssl_provider( | 7258 std::unique_ptr<SSLSocketDataProvider> ssl_provider( |
7258 new SSLSocketDataProvider(ASYNC, OK)); | 7259 new SSLSocketDataProvider(ASYNC, OK)); |
7259 // Set to TLS_RSA_WITH_NULL_MD5 | 7260 // Set to TLS_RSA_WITH_NULL_MD5 |
7260 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); | 7261 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); |
7261 | 7262 |
7262 RunTLSUsageCheckTest(std::move(ssl_provider)); | 7263 RunTLSUsageCheckTest(std::move(ssl_provider)); |
7263 } | 7264 } |
7264 | 7265 |
7265 } // namespace net | 7266 } // namespace net |
OLD | NEW |