| 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/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
| 6 | 6 |
| 7 #include <math.h> // ceil | 7 #include <math.h> // ceil |
| 8 #include <stdarg.h> | 8 #include <stdarg.h> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 ret.push_back(value); | 90 ret.push_back(value); |
| 91 } | 91 } |
| 92 va_end(args); | 92 va_end(args); |
| 93 | 93 |
| 94 return ret; | 94 return ret; |
| 95 } | 95 } |
| 96 | 96 |
| 97 // SpdyNextProtos returns a vector of NPN protocol strings for negotiating | 97 // SpdyNextProtos returns a vector of NPN protocol strings for negotiating |
| 98 // SPDY. | 98 // SPDY. |
| 99 std::vector<std::string> SpdyNextProtos() { | 99 std::vector<std::string> SpdyNextProtos() { |
| 100 return MakeNextProtos("http/1.1", "spdy/2", "spdy/2.1", NULL); | 100 return MakeNextProtos("http/1.1", "spdy/2", "spdy/2.1", "spdy/3", NULL); |
| 101 } | 101 } |
| 102 | 102 |
| 103 } // namespace | 103 } // namespace |
| 104 | 104 |
| 105 namespace net { | 105 namespace net { |
| 106 | 106 |
| 107 namespace { | 107 namespace { |
| 108 | 108 |
| 109 // Helper to manage the lifetimes of the dependencies for a | 109 // Helper to manage the lifetimes of the dependencies for a |
| 110 // HttpNetworkTransaction. | 110 // HttpNetworkTransaction. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 class HttpNetworkTransactionSpdy3Test : public PlatformTest { | 158 class HttpNetworkTransactionSpdy3Test : public PlatformTest { |
| 159 protected: | 159 protected: |
| 160 struct SimpleGetHelperResult { | 160 struct SimpleGetHelperResult { |
| 161 int rv; | 161 int rv; |
| 162 std::string status_line; | 162 std::string status_line; |
| 163 std::string response_data; | 163 std::string response_data; |
| 164 }; | 164 }; |
| 165 | 165 |
| 166 virtual void SetUp() { | 166 virtual void SetUp() { |
| 167 SpdySession::set_default_protocol(SSLClientSocket::kProtoSPDY3); |
| 167 NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); | 168 NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); |
| 168 MessageLoop::current()->RunAllPending(); | 169 MessageLoop::current()->RunAllPending(); |
| 169 spdy::SpdyFramer::set_enable_compression_default(false); | 170 spdy::SpdyFramer::set_enable_compression_default(false); |
| 170 } | 171 } |
| 171 | 172 |
| 172 virtual void TearDown() { | 173 virtual void TearDown() { |
| 173 NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); | 174 NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); |
| 174 MessageLoop::current()->RunAllPending(); | 175 MessageLoop::current()->RunAllPending(); |
| 175 spdy::SpdyFramer::set_enable_compression_default(true); | 176 spdy::SpdyFramer::set_enable_compression_default(true); |
| 176 // Empty the current queue. | 177 // Empty the current queue. |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 CaptureGroupNameSSLSocketPool::CaptureGroupNameSocketPool( | 379 CaptureGroupNameSSLSocketPool::CaptureGroupNameSocketPool( |
| 379 HostResolver* host_resolver, | 380 HostResolver* host_resolver, |
| 380 CertVerifier* cert_verifier) | 381 CertVerifier* cert_verifier) |
| 381 : SSLClientSocketPool(0, 0, NULL, host_resolver, cert_verifier, NULL, | 382 : SSLClientSocketPool(0, 0, NULL, host_resolver, cert_verifier, NULL, |
| 382 NULL, NULL, "", NULL, NULL, NULL, NULL, NULL, NULL) {} | 383 NULL, NULL, "", NULL, NULL, NULL, NULL, NULL, NULL) {} |
| 383 | 384 |
| 384 //----------------------------------------------------------------------------- | 385 //----------------------------------------------------------------------------- |
| 385 | 386 |
| 386 // This is the expected return from a current server advertising SPDY. | 387 // This is the expected return from a current server advertising SPDY. |
| 387 static const char kAlternateProtocolHttpHeader[] = | 388 static const char kAlternateProtocolHttpHeader[] = |
| 388 "Alternate-Protocol: 443:npn-spdy/2.1\r\n\r\n"; | 389 "Alternate-Protocol: 443:npn-spdy/3\r\n\r\n"; |
| 389 | 390 |
| 390 // Helper functions for validating that AuthChallengeInfo's are correctly | 391 // Helper functions for validating that AuthChallengeInfo's are correctly |
| 391 // configured for common cases. | 392 // configured for common cases. |
| 392 bool CheckBasicServerAuth(const AuthChallengeInfo* auth_challenge) { | 393 bool CheckBasicServerAuth(const AuthChallengeInfo* auth_challenge) { |
| 393 if (!auth_challenge) | 394 if (!auth_challenge) |
| 394 return false; | 395 return false; |
| 395 EXPECT_FALSE(auth_challenge->is_proxy); | 396 EXPECT_FALSE(auth_challenge->is_proxy); |
| 396 EXPECT_EQ("www.google.com:80", auth_challenge->challenger.ToString()); | 397 EXPECT_EQ("www.google.com:80", auth_challenge->challenger.ToString()); |
| 397 EXPECT_EQ("MyRealm1", auth_challenge->realm); | 398 EXPECT_EQ("MyRealm1", auth_challenge->realm); |
| 398 EXPECT_EQ("basic", auth_challenge->scheme); | 399 EXPECT_EQ("basic", auth_challenge->scheme); |
| (...skipping 1763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2162 }; | 2163 }; |
| 2163 | 2164 |
| 2164 scoped_ptr<DelayedSocketData> spdy_data( | 2165 scoped_ptr<DelayedSocketData> spdy_data( |
| 2165 new DelayedSocketData( | 2166 new DelayedSocketData( |
| 2166 1, // wait for one write to finish before reading. | 2167 1, // wait for one write to finish before reading. |
| 2167 spdy_reads, arraysize(spdy_reads), | 2168 spdy_reads, arraysize(spdy_reads), |
| 2168 spdy_writes, arraysize(spdy_writes))); | 2169 spdy_writes, arraysize(spdy_writes))); |
| 2169 session_deps.socket_factory.AddSocketDataProvider(spdy_data.get()); | 2170 session_deps.socket_factory.AddSocketDataProvider(spdy_data.get()); |
| 2170 | 2171 |
| 2171 SSLSocketDataProvider ssl(ASYNC, OK); | 2172 SSLSocketDataProvider ssl(ASYNC, OK); |
| 2172 ssl.SetNextProto(SSLClientSocket::kProtoSPDY21); | 2173 ssl.SetNextProto(SSLClientSocket::kProtoSPDY3); |
| 2173 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); | 2174 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
| 2174 | 2175 |
| 2175 TestCompletionCallback callback1; | 2176 TestCompletionCallback callback1; |
| 2176 | 2177 |
| 2177 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); | 2178 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
| 2178 | 2179 |
| 2179 int rv = trans->Start(&request, callback1.callback(), log.bound()); | 2180 int rv = trans->Start(&request, callback1.callback(), log.bound()); |
| 2180 EXPECT_EQ(ERR_IO_PENDING, rv); | 2181 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2181 | 2182 |
| 2182 rv = callback1.WaitForResult(); | 2183 rv = callback1.WaitForResult(); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2246 CreateMockRead(*body_data, 6), | 2247 CreateMockRead(*body_data, 6), |
| 2247 MockRead(ASYNC, 0, 7), | 2248 MockRead(ASYNC, 0, 7), |
| 2248 }; | 2249 }; |
| 2249 | 2250 |
| 2250 scoped_ptr<OrderedSocketData> data( | 2251 scoped_ptr<OrderedSocketData> data( |
| 2251 new OrderedSocketData(spdy_reads, arraysize(spdy_reads), | 2252 new OrderedSocketData(spdy_reads, arraysize(spdy_reads), |
| 2252 spdy_writes, arraysize(spdy_writes))); | 2253 spdy_writes, arraysize(spdy_writes))); |
| 2253 session_deps.socket_factory.AddSocketDataProvider(data.get()); | 2254 session_deps.socket_factory.AddSocketDataProvider(data.get()); |
| 2254 | 2255 |
| 2255 SSLSocketDataProvider ssl(ASYNC, OK); | 2256 SSLSocketDataProvider ssl(ASYNC, OK); |
| 2256 ssl.SetNextProto(SSLClientSocket::kProtoSPDY21); | 2257 ssl.SetNextProto(SSLClientSocket::kProtoSPDY3); |
| 2257 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); | 2258 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
| 2258 | 2259 |
| 2259 TestCompletionCallback callback1; | 2260 TestCompletionCallback callback1; |
| 2260 | 2261 |
| 2261 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); | 2262 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
| 2262 | 2263 |
| 2263 int rv = trans->Start(&request, callback1.callback(), log.bound()); | 2264 int rv = trans->Start(&request, callback1.callback(), log.bound()); |
| 2264 EXPECT_EQ(ERR_IO_PENDING, rv); | 2265 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2265 | 2266 |
| 2266 rv = callback1.WaitForResult(); | 2267 rv = callback1.WaitForResult(); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2341 MockRead(ASYNC, 0, 8), | 2342 MockRead(ASYNC, 0, 8), |
| 2342 }; | 2343 }; |
| 2343 | 2344 |
| 2344 scoped_ptr<OrderedSocketData> spdy_data( | 2345 scoped_ptr<OrderedSocketData> spdy_data( |
| 2345 new OrderedSocketData( | 2346 new OrderedSocketData( |
| 2346 spdy_reads, arraysize(spdy_reads), | 2347 spdy_reads, arraysize(spdy_reads), |
| 2347 spdy_writes, arraysize(spdy_writes))); | 2348 spdy_writes, arraysize(spdy_writes))); |
| 2348 session_deps.socket_factory.AddSocketDataProvider(spdy_data.get()); | 2349 session_deps.socket_factory.AddSocketDataProvider(spdy_data.get()); |
| 2349 | 2350 |
| 2350 SSLSocketDataProvider ssl(ASYNC, OK); | 2351 SSLSocketDataProvider ssl(ASYNC, OK); |
| 2351 ssl.SetNextProto(SSLClientSocket::kProtoSPDY21); | 2352 ssl.SetNextProto(SSLClientSocket::kProtoSPDY3); |
| 2352 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); | 2353 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
| 2353 SSLSocketDataProvider ssl2(ASYNC, OK); | 2354 SSLSocketDataProvider ssl2(ASYNC, OK); |
| 2354 ssl2.was_npn_negotiated = false; | 2355 ssl2.was_npn_negotiated = false; |
| 2355 ssl2.protocol_negotiated = SSLClientSocket::kProtoUnknown; | 2356 ssl2.protocol_negotiated = SSLClientSocket::kProtoUnknown; |
| 2356 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl2); | 2357 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl2); |
| 2357 | 2358 |
| 2358 TestCompletionCallback callback1; | 2359 TestCompletionCallback callback1; |
| 2359 | 2360 |
| 2360 int rv = trans->Start(&request, callback1.callback(), log.bound()); | 2361 int rv = trans->Start(&request, callback1.callback(), log.bound()); |
| 2361 EXPECT_EQ(ERR_IO_PENDING, rv); | 2362 EXPECT_EQ(ERR_IO_PENDING, rv); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2420 MockRead(ASYNC, 0, 8), | 2421 MockRead(ASYNC, 0, 8), |
| 2421 }; | 2422 }; |
| 2422 | 2423 |
| 2423 scoped_ptr<OrderedSocketData> spdy_data( | 2424 scoped_ptr<OrderedSocketData> spdy_data( |
| 2424 new OrderedSocketData( | 2425 new OrderedSocketData( |
| 2425 spdy_reads, arraysize(spdy_reads), | 2426 spdy_reads, arraysize(spdy_reads), |
| 2426 spdy_writes, arraysize(spdy_writes))); | 2427 spdy_writes, arraysize(spdy_writes))); |
| 2427 session_deps.socket_factory.AddSocketDataProvider(spdy_data.get()); | 2428 session_deps.socket_factory.AddSocketDataProvider(spdy_data.get()); |
| 2428 | 2429 |
| 2429 SSLSocketDataProvider ssl(ASYNC, OK); | 2430 SSLSocketDataProvider ssl(ASYNC, OK); |
| 2430 ssl.SetNextProto(SSLClientSocket::kProtoSPDY21); | 2431 ssl.SetNextProto(SSLClientSocket::kProtoSPDY3); |
| 2431 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); | 2432 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
| 2432 SSLSocketDataProvider ssl2(ASYNC, OK); | 2433 SSLSocketDataProvider ssl2(ASYNC, OK); |
| 2433 ssl2.SetNextProto(SSLClientSocket::kProtoSPDY21); | 2434 ssl2.SetNextProto(SSLClientSocket::kProtoSPDY3); |
| 2434 ssl2.protocol_negotiated = SSLClientSocket::kProtoSPDY21; | 2435 ssl2.protocol_negotiated = SSLClientSocket::kProtoSPDY3; |
| 2435 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl2); | 2436 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl2); |
| 2436 | 2437 |
| 2437 TestCompletionCallback callback1; | 2438 TestCompletionCallback callback1; |
| 2438 | 2439 |
| 2439 int rv = trans->Start(&request, callback1.callback(), log.bound()); | 2440 int rv = trans->Start(&request, callback1.callback(), log.bound()); |
| 2440 EXPECT_EQ(ERR_IO_PENDING, rv); | 2441 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2441 | 2442 |
| 2442 rv = callback1.WaitForResult(); | 2443 rv = callback1.WaitForResult(); |
| 2443 EXPECT_EQ(OK, rv); | 2444 EXPECT_EQ(OK, rv); |
| 2444 | 2445 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2484 MockRead(ASYNC, 0, 4), | 2485 MockRead(ASYNC, 0, 4), |
| 2485 }; | 2486 }; |
| 2486 | 2487 |
| 2487 scoped_ptr<OrderedSocketData> spdy_data( | 2488 scoped_ptr<OrderedSocketData> spdy_data( |
| 2488 new OrderedSocketData( | 2489 new OrderedSocketData( |
| 2489 spdy_reads, arraysize(spdy_reads), | 2490 spdy_reads, arraysize(spdy_reads), |
| 2490 spdy_writes, arraysize(spdy_writes))); | 2491 spdy_writes, arraysize(spdy_writes))); |
| 2491 session_deps.socket_factory.AddSocketDataProvider(spdy_data.get()); | 2492 session_deps.socket_factory.AddSocketDataProvider(spdy_data.get()); |
| 2492 | 2493 |
| 2493 SSLSocketDataProvider ssl(ASYNC, OK); | 2494 SSLSocketDataProvider ssl(ASYNC, OK); |
| 2494 ssl.SetNextProto(SSLClientSocket::kProtoSPDY21); | 2495 ssl.SetNextProto(SSLClientSocket::kProtoSPDY3); |
| 2495 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); | 2496 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
| 2496 SSLSocketDataProvider ssl2(ASYNC, OK); | 2497 SSLSocketDataProvider ssl2(ASYNC, OK); |
| 2497 ssl2.SetNextProto(SSLClientSocket::kProtoSPDY21); | 2498 ssl2.SetNextProto(SSLClientSocket::kProtoSPDY3); |
| 2498 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl2); | 2499 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl2); |
| 2499 | 2500 |
| 2500 TestCompletionCallback callback1; | 2501 TestCompletionCallback callback1; |
| 2501 | 2502 |
| 2502 int rv = trans->Start(&request, callback1.callback(), log.bound()); | 2503 int rv = trans->Start(&request, callback1.callback(), log.bound()); |
| 2503 EXPECT_EQ(ERR_IO_PENDING, rv); | 2504 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2504 | 2505 |
| 2505 rv = callback1.WaitForResult(); | 2506 rv = callback1.WaitForResult(); |
| 2506 EXPECT_EQ(OK, rv); | 2507 EXPECT_EQ(OK, rv); |
| 2507 | 2508 |
| (...skipping 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4589 CreateMockRead(*resp.get(), 1, SYNCHRONOUS), | 4590 CreateMockRead(*resp.get(), 1, SYNCHRONOUS), |
| 4590 MockRead(ASYNC, 0, 2), // EOF | 4591 MockRead(ASYNC, 0, 2), // EOF |
| 4591 }; | 4592 }; |
| 4592 | 4593 |
| 4593 scoped_ptr<DelayedSocketData> data( | 4594 scoped_ptr<DelayedSocketData> data( |
| 4594 new DelayedSocketData( | 4595 new DelayedSocketData( |
| 4595 1, // wait for one write to finish before reading. | 4596 1, // wait for one write to finish before reading. |
| 4596 data_reads, arraysize(data_reads), | 4597 data_reads, arraysize(data_reads), |
| 4597 data_writes, arraysize(data_writes))); | 4598 data_writes, arraysize(data_writes))); |
| 4598 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy | 4599 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy |
| 4599 proxy_ssl.SetNextProto(SSLClientSocket::kProtoSPDY21); | 4600 proxy_ssl.SetNextProto(SSLClientSocket::kProtoSPDY3); |
| 4600 | 4601 |
| 4601 session_deps.socket_factory.AddSocketDataProvider(data.get()); | 4602 session_deps.socket_factory.AddSocketDataProvider(data.get()); |
| 4602 session_deps.socket_factory.AddSSLSocketDataProvider(&proxy_ssl); | 4603 session_deps.socket_factory.AddSSLSocketDataProvider(&proxy_ssl); |
| 4603 | 4604 |
| 4604 TestCompletionCallback callback; | 4605 TestCompletionCallback callback; |
| 4605 | 4606 |
| 4606 scoped_ptr<HttpTransaction> trans( | 4607 scoped_ptr<HttpTransaction> trans( |
| 4607 new HttpNetworkTransaction(CreateSession(&session_deps))); | 4608 new HttpNetworkTransaction(CreateSession(&session_deps))); |
| 4608 | 4609 |
| 4609 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 4610 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4708 CreateMockRead(*body.get(), 2, SYNCHRONOUS), | 4709 CreateMockRead(*body.get(), 2, SYNCHRONOUS), |
| 4709 MockRead(ASYNC, 0, 3), // EOF | 4710 MockRead(ASYNC, 0, 3), // EOF |
| 4710 }; | 4711 }; |
| 4711 | 4712 |
| 4712 scoped_ptr<DelayedSocketData> data( | 4713 scoped_ptr<DelayedSocketData> data( |
| 4713 new DelayedSocketData( | 4714 new DelayedSocketData( |
| 4714 1, // wait for one write to finish before reading. | 4715 1, // wait for one write to finish before reading. |
| 4715 data_reads, arraysize(data_reads), | 4716 data_reads, arraysize(data_reads), |
| 4716 data_writes, arraysize(data_writes))); | 4717 data_writes, arraysize(data_writes))); |
| 4717 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy | 4718 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy |
| 4718 proxy_ssl.SetNextProto(SSLClientSocket::kProtoSPDY21); | 4719 proxy_ssl.SetNextProto(SSLClientSocket::kProtoSPDY3); |
| 4719 | 4720 |
| 4720 session_deps.socket_factory.AddSocketDataProvider(data.get()); | 4721 session_deps.socket_factory.AddSocketDataProvider(data.get()); |
| 4721 session_deps.socket_factory.AddSSLSocketDataProvider(&proxy_ssl); | 4722 session_deps.socket_factory.AddSSLSocketDataProvider(&proxy_ssl); |
| 4722 | 4723 |
| 4723 TestCompletionCallback callback; | 4724 TestCompletionCallback callback; |
| 4724 | 4725 |
| 4725 scoped_ptr<HttpTransaction> trans( | 4726 scoped_ptr<HttpTransaction> trans( |
| 4726 new HttpNetworkTransaction(CreateSession(&session_deps))); | 4727 new HttpNetworkTransaction(CreateSession(&session_deps))); |
| 4727 | 4728 |
| 4728 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 4729 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4818 MockRead(SYNCHRONOUS, ERR_IO_PENDING), | 4819 MockRead(SYNCHRONOUS, ERR_IO_PENDING), |
| 4819 }; | 4820 }; |
| 4820 | 4821 |
| 4821 scoped_ptr<OrderedSocketData> spdy_data( | 4822 scoped_ptr<OrderedSocketData> spdy_data( |
| 4822 new OrderedSocketData( | 4823 new OrderedSocketData( |
| 4823 spdy_reads, arraysize(spdy_reads), | 4824 spdy_reads, arraysize(spdy_reads), |
| 4824 spdy_writes, arraysize(spdy_writes))); | 4825 spdy_writes, arraysize(spdy_writes))); |
| 4825 session_deps.socket_factory.AddSocketDataProvider(spdy_data.get()); | 4826 session_deps.socket_factory.AddSocketDataProvider(spdy_data.get()); |
| 4826 // Negotiate SPDY to the proxy | 4827 // Negotiate SPDY to the proxy |
| 4827 SSLSocketDataProvider proxy(ASYNC, OK); | 4828 SSLSocketDataProvider proxy(ASYNC, OK); |
| 4828 proxy.SetNextProto(SSLClientSocket::kProtoSPDY21); | 4829 proxy.SetNextProto(SSLClientSocket::kProtoSPDY3); |
| 4829 session_deps.socket_factory.AddSSLSocketDataProvider(&proxy); | 4830 session_deps.socket_factory.AddSSLSocketDataProvider(&proxy); |
| 4830 // Vanilla SSL to the server | 4831 // Vanilla SSL to the server |
| 4831 SSLSocketDataProvider server(ASYNC, OK); | 4832 SSLSocketDataProvider server(ASYNC, OK); |
| 4832 session_deps.socket_factory.AddSSLSocketDataProvider(&server); | 4833 session_deps.socket_factory.AddSSLSocketDataProvider(&server); |
| 4833 | 4834 |
| 4834 TestCompletionCallback callback1; | 4835 TestCompletionCallback callback1; |
| 4835 | 4836 |
| 4836 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); | 4837 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
| 4837 | 4838 |
| 4838 int rv = trans->Start(&request, callback1.callback(), log.bound()); | 4839 int rv = trans->Start(&request, callback1.callback(), log.bound()); |
| (...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5618 }; | 5619 }; |
| 5619 | 5620 |
| 5620 scoped_refptr<HttpNetworkSession> SetupSessionForGroupNameTests( | 5621 scoped_refptr<HttpNetworkSession> SetupSessionForGroupNameTests( |
| 5621 SessionDependencies* session_deps) { | 5622 SessionDependencies* session_deps) { |
| 5622 scoped_refptr<HttpNetworkSession> session(CreateSession(session_deps)); | 5623 scoped_refptr<HttpNetworkSession> session(CreateSession(session_deps)); |
| 5623 | 5624 |
| 5624 HttpServerProperties* http_server_properties = | 5625 HttpServerProperties* http_server_properties = |
| 5625 session->http_server_properties(); | 5626 session->http_server_properties(); |
| 5626 http_server_properties->SetAlternateProtocol( | 5627 http_server_properties->SetAlternateProtocol( |
| 5627 HostPortPair("host.with.alternate", 80), 443, | 5628 HostPortPair("host.with.alternate", 80), 443, |
| 5628 NPN_SPDY_21); | 5629 NPN_SPDY_3); |
| 5629 | 5630 |
| 5630 return session; | 5631 return session; |
| 5631 } | 5632 } |
| 5632 | 5633 |
| 5633 int GroupNameTransactionHelper( | 5634 int GroupNameTransactionHelper( |
| 5634 const std::string& url, | 5635 const std::string& url, |
| 5635 const scoped_refptr<HttpNetworkSession>& session) { | 5636 const scoped_refptr<HttpNetworkSession>& session) { |
| 5636 HttpRequestInfo request; | 5637 HttpRequestInfo request; |
| 5637 request.method = "GET"; | 5638 request.method = "GET"; |
| 5638 request.url = GURL(url); | 5639 request.url = GURL(url); |
| (...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6565 | 6566 |
| 6566 std::string response_data; | 6567 std::string response_data; |
| 6567 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 6568 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| 6568 EXPECT_EQ("hello world", response_data); | 6569 EXPECT_EQ("hello world", response_data); |
| 6569 | 6570 |
| 6570 ASSERT_TRUE(http_server_properties.HasAlternateProtocol(http_host_port_pair)); | 6571 ASSERT_TRUE(http_server_properties.HasAlternateProtocol(http_host_port_pair)); |
| 6571 const PortAlternateProtocolPair alternate = | 6572 const PortAlternateProtocolPair alternate = |
| 6572 http_server_properties.GetAlternateProtocol(http_host_port_pair); | 6573 http_server_properties.GetAlternateProtocol(http_host_port_pair); |
| 6573 PortAlternateProtocolPair expected_alternate; | 6574 PortAlternateProtocolPair expected_alternate; |
| 6574 expected_alternate.port = 443; | 6575 expected_alternate.port = 443; |
| 6575 expected_alternate.protocol = NPN_SPDY_21; | 6576 expected_alternate.protocol = NPN_SPDY_3; |
| 6576 EXPECT_TRUE(expected_alternate.Equals(alternate)); | 6577 EXPECT_TRUE(expected_alternate.Equals(alternate)); |
| 6577 | 6578 |
| 6578 HttpStreamFactory::set_use_alternate_protocols(false); | 6579 HttpStreamFactory::set_use_alternate_protocols(false); |
| 6579 HttpStreamFactory::SetNextProtos(std::vector<std::string>()); | 6580 HttpStreamFactory::SetNextProtos(std::vector<std::string>()); |
| 6580 } | 6581 } |
| 6581 | 6582 |
| 6582 TEST_F(HttpNetworkTransactionSpdy3Test, | 6583 TEST_F(HttpNetworkTransactionSpdy3Test, |
| 6583 MarkBrokenAlternateProtocolAndFallback) { | 6584 MarkBrokenAlternateProtocolAndFallback) { |
| 6584 HttpStreamFactory::set_use_alternate_protocols(true); | 6585 HttpStreamFactory::set_use_alternate_protocols(true); |
| 6585 SessionDependencies session_deps; | 6586 SessionDependencies session_deps; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 6605 | 6606 |
| 6606 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); | 6607 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); |
| 6607 | 6608 |
| 6608 HttpServerProperties* http_server_properties = | 6609 HttpServerProperties* http_server_properties = |
| 6609 session->http_server_properties(); | 6610 session->http_server_properties(); |
| 6610 // Port must be < 1024, or the header will be ignored (since initial port was | 6611 // Port must be < 1024, or the header will be ignored (since initial port was |
| 6611 // port 80 (another restricted port). | 6612 // port 80 (another restricted port). |
| 6612 http_server_properties->SetAlternateProtocol( | 6613 http_server_properties->SetAlternateProtocol( |
| 6613 HostPortPair::FromURL(request.url), | 6614 HostPortPair::FromURL(request.url), |
| 6614 666 /* port is ignored by MockConnect anyway */, | 6615 666 /* port is ignored by MockConnect anyway */, |
| 6615 NPN_SPDY_21); | 6616 NPN_SPDY_3); |
| 6616 | 6617 |
| 6617 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); | 6618 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
| 6618 TestCompletionCallback callback; | 6619 TestCompletionCallback callback; |
| 6619 | 6620 |
| 6620 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 6621 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 6621 EXPECT_EQ(ERR_IO_PENDING, rv); | 6622 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6622 EXPECT_EQ(OK, callback.WaitForResult()); | 6623 EXPECT_EQ(OK, callback.WaitForResult()); |
| 6623 | 6624 |
| 6624 const HttpResponseInfo* response = trans->GetResponseInfo(); | 6625 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 6625 ASSERT_TRUE(response != NULL); | 6626 ASSERT_TRUE(response != NULL); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6668 session_deps.socket_factory.AddSocketDataProvider(&second_data); | 6669 session_deps.socket_factory.AddSocketDataProvider(&second_data); |
| 6669 | 6670 |
| 6670 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); | 6671 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); |
| 6671 | 6672 |
| 6672 HttpServerProperties* http_server_properties = | 6673 HttpServerProperties* http_server_properties = |
| 6673 session->http_server_properties(); | 6674 session->http_server_properties(); |
| 6674 const int kUnrestrictedAlternatePort = 1024; | 6675 const int kUnrestrictedAlternatePort = 1024; |
| 6675 http_server_properties->SetAlternateProtocol( | 6676 http_server_properties->SetAlternateProtocol( |
| 6676 HostPortPair::FromURL(restricted_port_request.url), | 6677 HostPortPair::FromURL(restricted_port_request.url), |
| 6677 kUnrestrictedAlternatePort, | 6678 kUnrestrictedAlternatePort, |
| 6678 NPN_SPDY_21); | 6679 NPN_SPDY_3); |
| 6679 | 6680 |
| 6680 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); | 6681 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
| 6681 TestCompletionCallback callback; | 6682 TestCompletionCallback callback; |
| 6682 | 6683 |
| 6683 int rv = trans->Start( | 6684 int rv = trans->Start( |
| 6684 &restricted_port_request, callback.callback(), BoundNetLog()); | 6685 &restricted_port_request, callback.callback(), BoundNetLog()); |
| 6685 EXPECT_EQ(ERR_IO_PENDING, rv); | 6686 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6686 // Invalid change to unrestricted port should fail. | 6687 // Invalid change to unrestricted port should fail. |
| 6687 EXPECT_EQ(ERR_CONNECTION_REFUSED, callback.WaitForResult()); | 6688 EXPECT_EQ(ERR_CONNECTION_REFUSED, callback.WaitForResult()); |
| 6688 | 6689 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 6718 session_deps.socket_factory.AddSocketDataProvider(&second_data); | 6719 session_deps.socket_factory.AddSocketDataProvider(&second_data); |
| 6719 | 6720 |
| 6720 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); | 6721 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); |
| 6721 | 6722 |
| 6722 HttpServerProperties* http_server_properties = | 6723 HttpServerProperties* http_server_properties = |
| 6723 session->http_server_properties(); | 6724 session->http_server_properties(); |
| 6724 const int kRestrictedAlternatePort = 80; | 6725 const int kRestrictedAlternatePort = 80; |
| 6725 http_server_properties->SetAlternateProtocol( | 6726 http_server_properties->SetAlternateProtocol( |
| 6726 HostPortPair::FromURL(restricted_port_request.url), | 6727 HostPortPair::FromURL(restricted_port_request.url), |
| 6727 kRestrictedAlternatePort, | 6728 kRestrictedAlternatePort, |
| 6728 NPN_SPDY_21); | 6729 NPN_SPDY_3); |
| 6729 | 6730 |
| 6730 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); | 6731 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
| 6731 TestCompletionCallback callback; | 6732 TestCompletionCallback callback; |
| 6732 | 6733 |
| 6733 int rv = trans->Start( | 6734 int rv = trans->Start( |
| 6734 &restricted_port_request, callback.callback(), BoundNetLog()); | 6735 &restricted_port_request, callback.callback(), BoundNetLog()); |
| 6735 EXPECT_EQ(ERR_IO_PENDING, rv); | 6736 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6736 // Valid change to restricted port should pass. | 6737 // Valid change to restricted port should pass. |
| 6737 EXPECT_EQ(OK, callback.WaitForResult()); | 6738 EXPECT_EQ(OK, callback.WaitForResult()); |
| 6738 | 6739 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 6768 session_deps.socket_factory.AddSocketDataProvider(&second_data); | 6769 session_deps.socket_factory.AddSocketDataProvider(&second_data); |
| 6769 | 6770 |
| 6770 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); | 6771 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); |
| 6771 | 6772 |
| 6772 HttpServerProperties* http_server_properties = | 6773 HttpServerProperties* http_server_properties = |
| 6773 session->http_server_properties(); | 6774 session->http_server_properties(); |
| 6774 const int kRestrictedAlternatePort = 80; | 6775 const int kRestrictedAlternatePort = 80; |
| 6775 http_server_properties->SetAlternateProtocol( | 6776 http_server_properties->SetAlternateProtocol( |
| 6776 HostPortPair::FromURL(unrestricted_port_request.url), | 6777 HostPortPair::FromURL(unrestricted_port_request.url), |
| 6777 kRestrictedAlternatePort, | 6778 kRestrictedAlternatePort, |
| 6778 NPN_SPDY_21); | 6779 NPN_SPDY_3); |
| 6779 | 6780 |
| 6780 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); | 6781 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
| 6781 TestCompletionCallback callback; | 6782 TestCompletionCallback callback; |
| 6782 | 6783 |
| 6783 int rv = trans->Start( | 6784 int rv = trans->Start( |
| 6784 &unrestricted_port_request, callback.callback(), BoundNetLog()); | 6785 &unrestricted_port_request, callback.callback(), BoundNetLog()); |
| 6785 EXPECT_EQ(ERR_IO_PENDING, rv); | 6786 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6786 // Valid change to restricted port should pass. | 6787 // Valid change to restricted port should pass. |
| 6787 EXPECT_EQ(OK, callback.WaitForResult()); | 6788 EXPECT_EQ(OK, callback.WaitForResult()); |
| 6788 | 6789 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 6818 session_deps.socket_factory.AddSocketDataProvider(&second_data); | 6819 session_deps.socket_factory.AddSocketDataProvider(&second_data); |
| 6819 | 6820 |
| 6820 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); | 6821 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); |
| 6821 | 6822 |
| 6822 HttpServerProperties* http_server_properties = | 6823 HttpServerProperties* http_server_properties = |
| 6823 session->http_server_properties(); | 6824 session->http_server_properties(); |
| 6824 const int kUnrestrictedAlternatePort = 1024; | 6825 const int kUnrestrictedAlternatePort = 1024; |
| 6825 http_server_properties->SetAlternateProtocol( | 6826 http_server_properties->SetAlternateProtocol( |
| 6826 HostPortPair::FromURL(unrestricted_port_request.url), | 6827 HostPortPair::FromURL(unrestricted_port_request.url), |
| 6827 kUnrestrictedAlternatePort, | 6828 kUnrestrictedAlternatePort, |
| 6828 NPN_SPDY_21); | 6829 NPN_SPDY_3); |
| 6829 | 6830 |
| 6830 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); | 6831 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
| 6831 TestCompletionCallback callback; | 6832 TestCompletionCallback callback; |
| 6832 | 6833 |
| 6833 int rv = trans->Start( | 6834 int rv = trans->Start( |
| 6834 &unrestricted_port_request, callback.callback(), BoundNetLog()); | 6835 &unrestricted_port_request, callback.callback(), BoundNetLog()); |
| 6835 EXPECT_EQ(ERR_IO_PENDING, rv); | 6836 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6836 // Valid change to an unrestricted port should pass. | 6837 // Valid change to an unrestricted port should pass. |
| 6837 EXPECT_EQ(OK, callback.WaitForResult()); | 6838 EXPECT_EQ(OK, callback.WaitForResult()); |
| 6838 | 6839 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 6863 session_deps.socket_factory.AddSocketDataProvider(&data); | 6864 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 6864 | 6865 |
| 6865 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); | 6866 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); |
| 6866 | 6867 |
| 6867 HttpServerProperties* http_server_properties = | 6868 HttpServerProperties* http_server_properties = |
| 6868 session->http_server_properties(); | 6869 session->http_server_properties(); |
| 6869 const int kUnsafePort = 7; | 6870 const int kUnsafePort = 7; |
| 6870 http_server_properties->SetAlternateProtocol( | 6871 http_server_properties->SetAlternateProtocol( |
| 6871 HostPortPair::FromURL(request.url), | 6872 HostPortPair::FromURL(request.url), |
| 6872 kUnsafePort, | 6873 kUnsafePort, |
| 6873 NPN_SPDY_2); | 6874 NPN_SPDY_3); |
| 6874 | 6875 |
| 6875 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); | 6876 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
| 6876 TestCompletionCallback callback; | 6877 TestCompletionCallback callback; |
| 6877 | 6878 |
| 6878 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 6879 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 6879 EXPECT_EQ(ERR_IO_PENDING, rv); | 6880 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6880 // The HTTP request should succeed. | 6881 // The HTTP request should succeed. |
| 6881 EXPECT_EQ(OK, callback.WaitForResult()); | 6882 EXPECT_EQ(OK, callback.WaitForResult()); |
| 6882 | 6883 |
| 6883 // Disable alternate protocol before the asserts. | 6884 // Disable alternate protocol before the asserts. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 6908 MockRead(kAlternateProtocolHttpHeader), | 6909 MockRead(kAlternateProtocolHttpHeader), |
| 6909 MockRead("hello world"), | 6910 MockRead("hello world"), |
| 6910 MockRead(ASYNC, OK), | 6911 MockRead(ASYNC, OK), |
| 6911 }; | 6912 }; |
| 6912 | 6913 |
| 6913 StaticSocketDataProvider first_transaction( | 6914 StaticSocketDataProvider first_transaction( |
| 6914 data_reads, arraysize(data_reads), NULL, 0); | 6915 data_reads, arraysize(data_reads), NULL, 0); |
| 6915 session_deps.socket_factory.AddSocketDataProvider(&first_transaction); | 6916 session_deps.socket_factory.AddSocketDataProvider(&first_transaction); |
| 6916 | 6917 |
| 6917 SSLSocketDataProvider ssl(ASYNC, OK); | 6918 SSLSocketDataProvider ssl(ASYNC, OK); |
| 6918 ssl.SetNextProto(SSLClientSocket::kProtoSPDY21); | 6919 ssl.SetNextProto(SSLClientSocket::kProtoSPDY3); |
| 6919 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); | 6920 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
| 6920 | 6921 |
| 6921 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); | 6922 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); |
| 6922 MockWrite spdy_writes[] = { CreateMockWrite(*req) }; | 6923 MockWrite spdy_writes[] = { CreateMockWrite(*req) }; |
| 6923 | 6924 |
| 6924 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); | 6925 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); |
| 6925 scoped_ptr<spdy::SpdyFrame> data(ConstructSpdyBodyFrame(1, true)); | 6926 scoped_ptr<spdy::SpdyFrame> data(ConstructSpdyBodyFrame(1, true)); |
| 6926 MockRead spdy_reads[] = { | 6927 MockRead spdy_reads[] = { |
| 6927 CreateMockRead(*resp), | 6928 CreateMockRead(*resp), |
| 6928 CreateMockRead(*data), | 6929 CreateMockRead(*data), |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7007 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); | 7008 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); |
| 7008 StaticSocketDataProvider hanging_socket( | 7009 StaticSocketDataProvider hanging_socket( |
| 7009 NULL, 0, NULL, 0); | 7010 NULL, 0, NULL, 0); |
| 7010 hanging_socket.set_connect_data(never_finishing_connect); | 7011 hanging_socket.set_connect_data(never_finishing_connect); |
| 7011 // Socket 2 and 3 are the hanging Alternate-Protocol and | 7012 // Socket 2 and 3 are the hanging Alternate-Protocol and |
| 7012 // non-Alternate-Protocol jobs from the 2nd transaction. | 7013 // non-Alternate-Protocol jobs from the 2nd transaction. |
| 7013 session_deps.socket_factory.AddSocketDataProvider(&hanging_socket); | 7014 session_deps.socket_factory.AddSocketDataProvider(&hanging_socket); |
| 7014 session_deps.socket_factory.AddSocketDataProvider(&hanging_socket); | 7015 session_deps.socket_factory.AddSocketDataProvider(&hanging_socket); |
| 7015 | 7016 |
| 7016 SSLSocketDataProvider ssl(ASYNC, OK); | 7017 SSLSocketDataProvider ssl(ASYNC, OK); |
| 7017 ssl.SetNextProto(SSLClientSocket::kProtoSPDY21); | 7018 ssl.SetNextProto(SSLClientSocket::kProtoSPDY3); |
| 7018 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); | 7019 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
| 7019 | 7020 |
| 7020 scoped_ptr<spdy::SpdyFrame> req1(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); | 7021 scoped_ptr<spdy::SpdyFrame> req1(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); |
| 7021 scoped_ptr<spdy::SpdyFrame> req2(ConstructSpdyGet(NULL, 0, false, 3, LOWEST)); | 7022 scoped_ptr<spdy::SpdyFrame> req2(ConstructSpdyGet(NULL, 0, false, 3, LOWEST)); |
| 7022 MockWrite spdy_writes[] = { | 7023 MockWrite spdy_writes[] = { |
| 7023 CreateMockWrite(*req1), | 7024 CreateMockWrite(*req1), |
| 7024 CreateMockWrite(*req2), | 7025 CreateMockWrite(*req2), |
| 7025 }; | 7026 }; |
| 7026 scoped_ptr<spdy::SpdyFrame> resp1(ConstructSpdyGetSynReply(NULL, 0, 1)); | 7027 scoped_ptr<spdy::SpdyFrame> resp1(ConstructSpdyGetSynReply(NULL, 0, 1)); |
| 7027 scoped_ptr<spdy::SpdyFrame> data1(ConstructSpdyBodyFrame(1, true)); | 7028 scoped_ptr<spdy::SpdyFrame> data1(ConstructSpdyBodyFrame(1, true)); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7113 MockRead(kAlternateProtocolHttpHeader), | 7114 MockRead(kAlternateProtocolHttpHeader), |
| 7114 MockRead("hello world"), | 7115 MockRead("hello world"), |
| 7115 MockRead(ASYNC, OK), | 7116 MockRead(ASYNC, OK), |
| 7116 }; | 7117 }; |
| 7117 | 7118 |
| 7118 StaticSocketDataProvider first_transaction( | 7119 StaticSocketDataProvider first_transaction( |
| 7119 data_reads, arraysize(data_reads), NULL, 0); | 7120 data_reads, arraysize(data_reads), NULL, 0); |
| 7120 session_deps.socket_factory.AddSocketDataProvider(&first_transaction); | 7121 session_deps.socket_factory.AddSocketDataProvider(&first_transaction); |
| 7121 | 7122 |
| 7122 SSLSocketDataProvider ssl(ASYNC, OK); | 7123 SSLSocketDataProvider ssl(ASYNC, OK); |
| 7123 ssl.SetNextProto(SSLClientSocket::kProtoSPDY21); | 7124 ssl.SetNextProto(SSLClientSocket::kProtoSPDY3); |
| 7124 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); | 7125 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
| 7125 | 7126 |
| 7126 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); | 7127 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); |
| 7127 StaticSocketDataProvider hanging_alternate_protocol_socket( | 7128 StaticSocketDataProvider hanging_alternate_protocol_socket( |
| 7128 NULL, 0, NULL, 0); | 7129 NULL, 0, NULL, 0); |
| 7129 hanging_alternate_protocol_socket.set_connect_data( | 7130 hanging_alternate_protocol_socket.set_connect_data( |
| 7130 never_finishing_connect); | 7131 never_finishing_connect); |
| 7131 session_deps.socket_factory.AddSocketDataProvider( | 7132 session_deps.socket_factory.AddSocketDataProvider( |
| 7132 &hanging_alternate_protocol_socket); | 7133 &hanging_alternate_protocol_socket); |
| 7133 | 7134 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7246 MockRead(kAlternateProtocolHttpHeader), | 7247 MockRead(kAlternateProtocolHttpHeader), |
| 7247 MockRead("hello world"), | 7248 MockRead("hello world"), |
| 7248 MockRead(ASYNC, OK), | 7249 MockRead(ASYNC, OK), |
| 7249 }; | 7250 }; |
| 7250 | 7251 |
| 7251 StaticSocketDataProvider first_transaction( | 7252 StaticSocketDataProvider first_transaction( |
| 7252 data_reads, arraysize(data_reads), NULL, 0); | 7253 data_reads, arraysize(data_reads), NULL, 0); |
| 7253 session_deps.socket_factory.AddSocketDataProvider(&first_transaction); | 7254 session_deps.socket_factory.AddSocketDataProvider(&first_transaction); |
| 7254 | 7255 |
| 7255 SSLSocketDataProvider ssl(ASYNC, OK); | 7256 SSLSocketDataProvider ssl(ASYNC, OK); |
| 7256 ssl.SetNextProto(SSLClientSocket::kProtoSPDY21); | 7257 ssl.SetNextProto(SSLClientSocket::kProtoSPDY3); |
| 7257 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); | 7258 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
| 7258 | 7259 |
| 7259 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); | 7260 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); |
| 7260 MockWrite spdy_writes[] = { | 7261 MockWrite spdy_writes[] = { |
| 7261 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" | 7262 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" |
| 7262 "Host: www.google.com\r\n" | 7263 "Host: www.google.com\r\n" |
| 7263 "Proxy-Connection: keep-alive\r\n\r\n"), // 0 | 7264 "Proxy-Connection: keep-alive\r\n\r\n"), // 0 |
| 7264 CreateMockWrite(*req) // 3 | 7265 CreateMockWrite(*req) // 3 |
| 7265 }; | 7266 }; |
| 7266 | 7267 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7350 MockRead(kAlternateProtocolHttpHeader), | 7351 MockRead(kAlternateProtocolHttpHeader), |
| 7351 MockRead("hello world"), | 7352 MockRead("hello world"), |
| 7352 MockRead(ASYNC, OK), | 7353 MockRead(ASYNC, OK), |
| 7353 }; | 7354 }; |
| 7354 | 7355 |
| 7355 StaticSocketDataProvider first_transaction( | 7356 StaticSocketDataProvider first_transaction( |
| 7356 data_reads, arraysize(data_reads), NULL, 0); | 7357 data_reads, arraysize(data_reads), NULL, 0); |
| 7357 session_deps.socket_factory.AddSocketDataProvider(&first_transaction); | 7358 session_deps.socket_factory.AddSocketDataProvider(&first_transaction); |
| 7358 | 7359 |
| 7359 SSLSocketDataProvider ssl(ASYNC, OK); | 7360 SSLSocketDataProvider ssl(ASYNC, OK); |
| 7360 ssl.SetNextProto(SSLClientSocket::kProtoSPDY21); | 7361 ssl.SetNextProto(SSLClientSocket::kProtoSPDY3); |
| 7361 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); | 7362 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
| 7362 // Make sure we use ssl for spdy here. | 7363 // Make sure we use ssl for spdy here. |
| 7363 SpdySession::SetSSLMode(true); | 7364 SpdySession::SetSSLMode(true); |
| 7364 | 7365 |
| 7365 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); | 7366 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); |
| 7366 MockWrite spdy_writes[] = { CreateMockWrite(*req) }; | 7367 MockWrite spdy_writes[] = { CreateMockWrite(*req) }; |
| 7367 | 7368 |
| 7368 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); | 7369 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); |
| 7369 scoped_ptr<spdy::SpdyFrame> data(ConstructSpdyBodyFrame(1, true)); | 7370 scoped_ptr<spdy::SpdyFrame> data(ConstructSpdyBodyFrame(1, true)); |
| 7370 MockRead spdy_reads[] = { | 7371 MockRead spdy_reads[] = { |
| (...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8234 HttpStreamFactory::set_use_alternate_protocols(true); | 8235 HttpStreamFactory::set_use_alternate_protocols(true); |
| 8235 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); | 8236 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); |
| 8236 SessionDependencies session_deps; | 8237 SessionDependencies session_deps; |
| 8237 | 8238 |
| 8238 HttpRequestInfo request; | 8239 HttpRequestInfo request; |
| 8239 request.method = "GET"; | 8240 request.method = "GET"; |
| 8240 request.url = GURL("https://www.google.com/"); | 8241 request.url = GURL("https://www.google.com/"); |
| 8241 request.load_flags = 0; | 8242 request.load_flags = 0; |
| 8242 | 8243 |
| 8243 SSLSocketDataProvider ssl(ASYNC, OK); | 8244 SSLSocketDataProvider ssl(ASYNC, OK); |
| 8244 ssl.SetNextProto(SSLClientSocket::kProtoSPDY21); | 8245 ssl.SetNextProto(SSLClientSocket::kProtoSPDY3); |
| 8245 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); | 8246 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
| 8246 | 8247 |
| 8247 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); | 8248 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); |
| 8248 MockWrite spdy_writes[] = { CreateMockWrite(*req) }; | 8249 MockWrite spdy_writes[] = { CreateMockWrite(*req) }; |
| 8249 | 8250 |
| 8250 MockRead spdy_reads[] = { | 8251 MockRead spdy_reads[] = { |
| 8251 MockRead(SYNCHRONOUS, 0, 0) // Not async - return 0 immediately. | 8252 MockRead(SYNCHRONOUS, 0, 0) // Not async - return 0 immediately. |
| 8252 }; | 8253 }; |
| 8253 | 8254 |
| 8254 scoped_ptr<DelayedSocketData> spdy_data( | 8255 scoped_ptr<DelayedSocketData> spdy_data( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 8270 HttpStreamFactory::SetNextProtos(std::vector<std::string>()); | 8271 HttpStreamFactory::SetNextProtos(std::vector<std::string>()); |
| 8271 HttpStreamFactory::set_use_alternate_protocols(false); | 8272 HttpStreamFactory::set_use_alternate_protocols(false); |
| 8272 } | 8273 } |
| 8273 | 8274 |
| 8274 TEST_F(HttpNetworkTransactionSpdy3Test, SpdyAlternateProtocolThroughProxy) { | 8275 TEST_F(HttpNetworkTransactionSpdy3Test, SpdyAlternateProtocolThroughProxy) { |
| 8275 // This test ensures that the URL passed into the proxy is upgraded | 8276 // This test ensures that the URL passed into the proxy is upgraded |
| 8276 // to https when doing an Alternate Protocol upgrade. | 8277 // to https when doing an Alternate Protocol upgrade. |
| 8277 HttpStreamFactory::set_use_alternate_protocols(true); | 8278 HttpStreamFactory::set_use_alternate_protocols(true); |
| 8278 HttpStreamFactory::SetNextProtos( | 8279 HttpStreamFactory::SetNextProtos( |
| 8279 MakeNextProtos( | 8280 MakeNextProtos( |
| 8280 "http/1.1", "http1.1", "spdy/2.1", "spdy/2", "spdy", NULL)); | 8281 "http/1.1", "http1.1", "spdy/2", "spdy/2.1", "spdy/3", "spdy", NULL)); |
| 8281 | 8282 |
| 8282 SessionDependencies session_deps(ProxyService::CreateFixed("myproxy:70")); | 8283 SessionDependencies session_deps(ProxyService::CreateFixed("myproxy:70")); |
| 8283 HttpAuthHandlerMock::Factory* auth_factory = | 8284 HttpAuthHandlerMock::Factory* auth_factory = |
| 8284 new HttpAuthHandlerMock::Factory(); | 8285 new HttpAuthHandlerMock::Factory(); |
| 8285 HttpAuthHandlerMock* auth_handler = new HttpAuthHandlerMock(); | 8286 HttpAuthHandlerMock* auth_handler = new HttpAuthHandlerMock(); |
| 8286 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_PROXY); | 8287 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_PROXY); |
| 8287 auth_factory->set_do_init_from_challenge(true); | 8288 auth_factory->set_do_init_from_challenge(true); |
| 8288 session_deps.http_auth_handler_factory.reset(auth_factory); | 8289 session_deps.http_auth_handler_factory.reset(auth_factory); |
| 8289 | 8290 |
| 8290 HttpRequestInfo request; | 8291 HttpRequestInfo request; |
| 8291 request.method = "GET"; | 8292 request.method = "GET"; |
| 8292 request.url = GURL("http://www.google.com"); | 8293 request.url = GURL("http://www.google.com"); |
| 8293 request.load_flags = 0; | 8294 request.load_flags = 0; |
| 8294 | 8295 |
| 8295 // First round goes unauthenticated through the proxy. | 8296 // First round goes unauthenticated through the proxy. |
| 8296 MockWrite data_writes_1[] = { | 8297 MockWrite data_writes_1[] = { |
| 8297 MockWrite("GET http://www.google.com/ HTTP/1.1\r\n" | 8298 MockWrite("GET http://www.google.com/ HTTP/1.1\r\n" |
| 8298 "Host: www.google.com\r\n" | 8299 "Host: www.google.com\r\n" |
| 8299 "Proxy-Connection: keep-alive\r\n" | 8300 "Proxy-Connection: keep-alive\r\n" |
| 8300 "\r\n"), | 8301 "\r\n"), |
| 8301 }; | 8302 }; |
| 8302 MockRead data_reads_1[] = { | 8303 MockRead data_reads_1[] = { |
| 8303 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), | 8304 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), |
| 8304 MockRead("HTTP/1.1 200 OK\r\n" | 8305 MockRead("HTTP/1.1 200 OK\r\n" |
| 8305 "Alternate-Protocol: 443:npn-spdy/2.1\r\n" | 8306 "Alternate-Protocol: 443:npn-spdy/3\r\n" |
| 8306 "Proxy-Connection: close\r\n" | 8307 "Proxy-Connection: close\r\n" |
| 8307 "\r\n"), | 8308 "\r\n"), |
| 8308 }; | 8309 }; |
| 8309 StaticSocketDataProvider data_1(data_reads_1, arraysize(data_reads_1), | 8310 StaticSocketDataProvider data_1(data_reads_1, arraysize(data_reads_1), |
| 8310 data_writes_1, arraysize(data_writes_1)); | 8311 data_writes_1, arraysize(data_writes_1)); |
| 8311 | 8312 |
| 8312 // Second round tries to tunnel to www.google.com due to the | 8313 // Second round tries to tunnel to www.google.com due to the |
| 8313 // Alternate-Protocol announcement in the first round. It fails due | 8314 // Alternate-Protocol announcement in the first round. It fails due |
| 8314 // to a proxy authentication challenge. | 8315 // to a proxy authentication challenge. |
| 8315 // After the failure, a tunnel is established to www.google.com using | 8316 // After the failure, a tunnel is established to www.google.com using |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8365 // SPDY response | 8366 // SPDY response |
| 8366 CreateMockRead(*resp.get(), 6), | 8367 CreateMockRead(*resp.get(), 6), |
| 8367 CreateMockRead(*data.get(), 6), | 8368 CreateMockRead(*data.get(), 6), |
| 8368 MockRead(ASYNC, 0, 0, 6), | 8369 MockRead(ASYNC, 0, 0, 6), |
| 8369 }; | 8370 }; |
| 8370 scoped_ptr<OrderedSocketData> data_2( | 8371 scoped_ptr<OrderedSocketData> data_2( |
| 8371 new OrderedSocketData(data_reads_2, arraysize(data_reads_2), | 8372 new OrderedSocketData(data_reads_2, arraysize(data_reads_2), |
| 8372 data_writes_2, arraysize(data_writes_2))); | 8373 data_writes_2, arraysize(data_writes_2))); |
| 8373 | 8374 |
| 8374 SSLSocketDataProvider ssl(ASYNC, OK); | 8375 SSLSocketDataProvider ssl(ASYNC, OK); |
| 8375 ssl.SetNextProto(SSLClientSocket::kProtoSPDY21); | 8376 ssl.SetNextProto(SSLClientSocket::kProtoSPDY3); |
| 8376 | 8377 |
| 8377 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); | 8378 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); |
| 8378 StaticSocketDataProvider hanging_non_alternate_protocol_socket( | 8379 StaticSocketDataProvider hanging_non_alternate_protocol_socket( |
| 8379 NULL, 0, NULL, 0); | 8380 NULL, 0, NULL, 0); |
| 8380 hanging_non_alternate_protocol_socket.set_connect_data( | 8381 hanging_non_alternate_protocol_socket.set_connect_data( |
| 8381 never_finishing_connect); | 8382 never_finishing_connect); |
| 8382 | 8383 |
| 8383 session_deps.socket_factory.AddSocketDataProvider(&data_1); | 8384 session_deps.socket_factory.AddSocketDataProvider(&data_1); |
| 8384 session_deps.socket_factory.AddSocketDataProvider(data_2.get()); | 8385 session_deps.socket_factory.AddSocketDataProvider(data_2.get()); |
| 8385 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); | 8386 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8646 }; | 8647 }; |
| 8647 | 8648 |
| 8648 scoped_ptr<DelayedSocketData> spdy_data( | 8649 scoped_ptr<DelayedSocketData> spdy_data( |
| 8649 new DelayedSocketData( | 8650 new DelayedSocketData( |
| 8650 1, // wait for one write to finish before reading. | 8651 1, // wait for one write to finish before reading. |
| 8651 spdy_reads, arraysize(spdy_reads), | 8652 spdy_reads, arraysize(spdy_reads), |
| 8652 spdy_writes, arraysize(spdy_writes))); | 8653 spdy_writes, arraysize(spdy_writes))); |
| 8653 session_deps.socket_factory.AddSocketDataProvider(spdy_data.get()); | 8654 session_deps.socket_factory.AddSocketDataProvider(spdy_data.get()); |
| 8654 | 8655 |
| 8655 SSLSocketDataProvider ssl(ASYNC, OK); | 8656 SSLSocketDataProvider ssl(ASYNC, OK); |
| 8656 ssl.SetNextProto(SSLClientSocket::kProtoSPDY21); | 8657 ssl.SetNextProto(SSLClientSocket::kProtoSPDY3); |
| 8657 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); | 8658 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
| 8658 | 8659 |
| 8659 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); | 8660 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); |
| 8660 | 8661 |
| 8661 // Set up an initial SpdySession in the pool to reuse. | 8662 // Set up an initial SpdySession in the pool to reuse. |
| 8662 HostPortPair host_port_pair("www.google.com", 443); | 8663 HostPortPair host_port_pair("www.google.com", 443); |
| 8663 HostPortProxyPair pair(host_port_pair, ProxyServer::Direct()); | 8664 HostPortProxyPair pair(host_port_pair, ProxyServer::Direct()); |
| 8664 scoped_refptr<SpdySession> spdy_session = | 8665 scoped_refptr<SpdySession> spdy_session = |
| 8665 session->spdy_session_pool()->Get(pair, BoundNetLog()); | 8666 session->spdy_session_pool()->Get(pair, BoundNetLog()); |
| 8666 scoped_refptr<TransportSocketParams> transport_params( | 8667 scoped_refptr<TransportSocketParams> transport_params( |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9078 params.ssl_config_service = session_deps.ssl_config_service; | 9079 params.ssl_config_service = session_deps.ssl_config_service; |
| 9079 params.http_auth_handler_factory = | 9080 params.http_auth_handler_factory = |
| 9080 session_deps.http_auth_handler_factory.get(); | 9081 session_deps.http_auth_handler_factory.get(); |
| 9081 params.http_server_properties = &session_deps.http_server_properties; | 9082 params.http_server_properties = &session_deps.http_server_properties; |
| 9082 params.net_log = session_deps.net_log; | 9083 params.net_log = session_deps.net_log; |
| 9083 scoped_refptr<HttpNetworkSession> session(new HttpNetworkSession(params)); | 9084 scoped_refptr<HttpNetworkSession> session(new HttpNetworkSession(params)); |
| 9084 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); | 9085 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); |
| 9085 pool_peer.DisableDomainAuthenticationVerification(); | 9086 pool_peer.DisableDomainAuthenticationVerification(); |
| 9086 | 9087 |
| 9087 SSLSocketDataProvider ssl(ASYNC, OK); | 9088 SSLSocketDataProvider ssl(ASYNC, OK); |
| 9088 ssl.SetNextProto(SSLClientSocket::kProtoSPDY21); | 9089 ssl.SetNextProto(SSLClientSocket::kProtoSPDY3); |
| 9089 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); | 9090 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
| 9090 | 9091 |
| 9091 scoped_ptr<spdy::SpdyFrame> host1_req(ConstructSpdyGet( | 9092 scoped_ptr<spdy::SpdyFrame> host1_req(ConstructSpdyGet( |
| 9092 "https://www.google.com", false, 1, LOWEST)); | 9093 "https://www.google.com", false, 1, LOWEST)); |
| 9093 scoped_ptr<spdy::SpdyFrame> host2_req(ConstructSpdyGet( | 9094 scoped_ptr<spdy::SpdyFrame> host2_req(ConstructSpdyGet( |
| 9094 "https://www.gmail.com", false, 3, LOWEST)); | 9095 "https://www.gmail.com", false, 3, LOWEST)); |
| 9095 MockWrite spdy_writes[] = { | 9096 MockWrite spdy_writes[] = { |
| 9096 CreateMockWrite(*host1_req, 1), | 9097 CreateMockWrite(*host1_req, 1), |
| 9097 CreateMockWrite(*host2_req, 4), | 9098 CreateMockWrite(*host2_req, 4), |
| 9098 }; | 9099 }; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9229 params.ssl_config_service = session_deps.ssl_config_service; | 9230 params.ssl_config_service = session_deps.ssl_config_service; |
| 9230 params.http_auth_handler_factory = | 9231 params.http_auth_handler_factory = |
| 9231 session_deps.http_auth_handler_factory.get(); | 9232 session_deps.http_auth_handler_factory.get(); |
| 9232 params.http_server_properties = &session_deps.http_server_properties; | 9233 params.http_server_properties = &session_deps.http_server_properties; |
| 9233 params.net_log = session_deps.net_log; | 9234 params.net_log = session_deps.net_log; |
| 9234 scoped_refptr<HttpNetworkSession> session(new HttpNetworkSession(params)); | 9235 scoped_refptr<HttpNetworkSession> session(new HttpNetworkSession(params)); |
| 9235 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); | 9236 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); |
| 9236 pool_peer.DisableDomainAuthenticationVerification(); | 9237 pool_peer.DisableDomainAuthenticationVerification(); |
| 9237 | 9238 |
| 9238 SSLSocketDataProvider ssl(ASYNC, OK); | 9239 SSLSocketDataProvider ssl(ASYNC, OK); |
| 9239 ssl.SetNextProto(SSLClientSocket::kProtoSPDY21); | 9240 ssl.SetNextProto(SSLClientSocket::kProtoSPDY3); |
| 9240 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); | 9241 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
| 9241 | 9242 |
| 9242 scoped_ptr<spdy::SpdyFrame> host1_req(ConstructSpdyGet( | 9243 scoped_ptr<spdy::SpdyFrame> host1_req(ConstructSpdyGet( |
| 9243 "https://www.google.com", false, 1, LOWEST)); | 9244 "https://www.google.com", false, 1, LOWEST)); |
| 9244 scoped_ptr<spdy::SpdyFrame> host2_req(ConstructSpdyGet( | 9245 scoped_ptr<spdy::SpdyFrame> host2_req(ConstructSpdyGet( |
| 9245 "https://www.gmail.com", false, 3, LOWEST)); | 9246 "https://www.gmail.com", false, 3, LOWEST)); |
| 9246 MockWrite spdy_writes[] = { | 9247 MockWrite spdy_writes[] = { |
| 9247 CreateMockWrite(*host1_req, 1), | 9248 CreateMockWrite(*host1_req, 1), |
| 9248 CreateMockWrite(*host2_req, 4), | 9249 CreateMockWrite(*host2_req, 4), |
| 9249 }; | 9250 }; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9364 StaticSocketDataProvider* data[] = { &data1, &data2 }; | 9365 StaticSocketDataProvider* data[] = { &data1, &data2 }; |
| 9365 | 9366 |
| 9366 SimpleGetHelperResult out = SimpleGetHelperForData(data, arraysize(data)); | 9367 SimpleGetHelperResult out = SimpleGetHelperForData(data, arraysize(data)); |
| 9367 | 9368 |
| 9368 EXPECT_EQ(OK, out.rv); | 9369 EXPECT_EQ(OK, out.rv); |
| 9369 EXPECT_EQ("HTTP/1.0 200 OK", out.status_line); | 9370 EXPECT_EQ("HTTP/1.0 200 OK", out.status_line); |
| 9370 EXPECT_EQ("hello world", out.response_data); | 9371 EXPECT_EQ("hello world", out.response_data); |
| 9371 } | 9372 } |
| 9372 | 9373 |
| 9373 } // namespace net | 9374 } // namespace net |
| OLD | NEW |