| 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_stream_factory_impl.h" | 5 #include "net/http/http_stream_factory_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 { 2, true}, | 334 { 2, true}, |
| 335 }; | 335 }; |
| 336 | 336 |
| 337 void PreconnectHelperForURL(int num_streams, | 337 void PreconnectHelperForURL(int num_streams, |
| 338 const GURL& url, | 338 const GURL& url, |
| 339 HttpNetworkSession* session) { | 339 HttpNetworkSession* session) { |
| 340 HttpNetworkSessionPeer peer(session); | 340 HttpNetworkSessionPeer peer(session); |
| 341 MockHttpStreamFactoryImplForPreconnect* mock_factory = | 341 MockHttpStreamFactoryImplForPreconnect* mock_factory = |
| 342 new MockHttpStreamFactoryImplForPreconnect(session); | 342 new MockHttpStreamFactoryImplForPreconnect(session); |
| 343 peer.SetHttpStreamFactory(std::unique_ptr<HttpStreamFactory>(mock_factory)); | 343 peer.SetHttpStreamFactory(std::unique_ptr<HttpStreamFactory>(mock_factory)); |
| 344 SSLConfig ssl_config; | |
| 345 session->ssl_config_service()->GetSSLConfig(&ssl_config); | |
| 346 | 344 |
| 347 HttpRequestInfo request; | 345 HttpRequestInfo request; |
| 348 request.method = "GET"; | 346 request.method = "GET"; |
| 349 request.url = url; | 347 request.url = url; |
| 350 request.load_flags = 0; | 348 request.load_flags = 0; |
| 351 | 349 |
| 352 session->http_stream_factory()->PreconnectStreams(num_streams, request, | 350 session->http_stream_factory()->PreconnectStreams(num_streams, request); |
| 353 ssl_config, ssl_config); | |
| 354 mock_factory->WaitForPreconnects(); | 351 mock_factory->WaitForPreconnects(); |
| 355 } | 352 } |
| 356 | 353 |
| 357 void PreconnectHelper(const TestCase& test, | 354 void PreconnectHelper(const TestCase& test, |
| 358 HttpNetworkSession* session) { | 355 HttpNetworkSession* session) { |
| 359 GURL url = test.ssl ? GURL("https://www.google.com") : | 356 GURL url = test.ssl ? GURL("https://www.google.com") : |
| 360 GURL("http://www.google.com"); | 357 GURL("http://www.google.com"); |
| 361 PreconnectHelperForURL(test.num_streams, url, session); | 358 PreconnectHelperForURL(test.num_streams, url, session); |
| 362 } | 359 } |
| 363 | 360 |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 std::unique_ptr<MockClientSocketPoolManager> mock_pool_manager( | 944 std::unique_ptr<MockClientSocketPoolManager> mock_pool_manager( |
| 948 new MockClientSocketPoolManager); | 945 new MockClientSocketPoolManager); |
| 949 mock_pool_manager->SetTransportSocketPool(transport_conn_pool); | 946 mock_pool_manager->SetTransportSocketPool(transport_conn_pool); |
| 950 peer.SetClientSocketPoolManager(std::move(mock_pool_manager)); | 947 peer.SetClientSocketPoolManager(std::move(mock_pool_manager)); |
| 951 | 948 |
| 952 HttpRequestInfo request; | 949 HttpRequestInfo request; |
| 953 request.method = "GET"; | 950 request.method = "GET"; |
| 954 request.url = url; | 951 request.url = url; |
| 955 request.load_flags = 0; | 952 request.load_flags = 0; |
| 956 | 953 |
| 957 SSLConfig ssl_config; | 954 session->http_stream_factory()->PreconnectStreams(num_streams, request); |
| 958 session->ssl_config_service()->GetSSLConfig(&ssl_config); | |
| 959 session->http_stream_factory()->PreconnectStreams(num_streams, request, | |
| 960 ssl_config, ssl_config); | |
| 961 EXPECT_EQ(-1, transport_conn_pool->last_num_streams()); | 955 EXPECT_EQ(-1, transport_conn_pool->last_num_streams()); |
| 962 } | 956 } |
| 963 } | 957 } |
| 964 | 958 |
| 965 namespace { | 959 namespace { |
| 966 | 960 |
| 967 TEST_P(HttpStreamFactoryTest, PrivacyModeDisablesChannelId) { | 961 TEST_P(HttpStreamFactoryTest, PrivacyModeDisablesChannelId) { |
| 968 SpdySessionDependencies session_deps( | 962 SpdySessionDependencies session_deps( |
| 969 GetParam(), ProxyService::CreateDirect()); | 963 GetParam(), ProxyService::CreateDirect()); |
| 970 | 964 |
| (...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1999 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); | 1993 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); |
| 2000 | 1994 |
| 2001 // Make sure there is no orphaned job. it is already canceled. | 1995 // Make sure there is no orphaned job. it is already canceled. |
| 2002 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>( | 1996 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>( |
| 2003 session->http_stream_factory_for_websocket())->num_orphaned_jobs()); | 1997 session->http_stream_factory_for_websocket())->num_orphaned_jobs()); |
| 2004 } | 1998 } |
| 2005 | 1999 |
| 2006 } // namespace | 2000 } // namespace |
| 2007 | 2001 |
| 2008 } // namespace net | 2002 } // namespace net |
| OLD | NEW |