Chromium Code Reviews| 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 <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 509 EXPECT_EQ(kTests[i].num_streams, ssl_conn_pool->last_num_streams()); | 509 EXPECT_EQ(kTests[i].num_streams, ssl_conn_pool->last_num_streams()); |
| 510 else | 510 else |
| 511 EXPECT_EQ(kTests[i].num_streams, socks_proxy_pool->last_num_streams()); | 511 EXPECT_EQ(kTests[i].num_streams, socks_proxy_pool->last_num_streams()); |
| 512 } | 512 } |
| 513 } | 513 } |
| 514 | 514 |
| 515 TEST_P(HttpStreamFactoryTest, PreconnectDirectWithExistingSpdySession) { | 515 TEST_P(HttpStreamFactoryTest, PreconnectDirectWithExistingSpdySession) { |
| 516 for (size_t i = 0; i < arraysize(kTests); ++i) { | 516 for (size_t i = 0; i < arraysize(kTests); ++i) { |
| 517 SpdySessionDependencies session_deps( | 517 SpdySessionDependencies session_deps( |
| 518 GetParam(), ProxyService::CreateDirect()); | 518 GetParam(), ProxyService::CreateDirect()); |
| 519 | |
|
pauljensen
2015/08/28 13:38:02
unnecessary whitespace change?
Randy Smith (Not in Mondays)
2015/09/02 23:42:19
Done.
| |
| 519 scoped_refptr<HttpNetworkSession> session( | 520 scoped_refptr<HttpNetworkSession> session( |
| 520 SpdySessionDependencies::SpdyCreateSession(&session_deps)); | 521 SpdySessionDependencies::SpdyCreateSession(&session_deps)); |
| 521 HttpNetworkSessionPeer peer(session); | 522 HttpNetworkSessionPeer peer(session); |
| 522 | 523 |
| 523 // Put a SpdySession in the pool. | 524 // Put a SpdySession in the pool. |
| 524 HostPortPair host_port_pair("www.google.com", 443); | 525 HostPortPair host_port_pair("www.google.com", 443); |
| 525 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), | 526 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), |
| 526 PRIVACY_MODE_DISABLED); | 527 PRIVACY_MODE_DISABLED); |
| 527 ignore_result(CreateFakeSpdySession(session->spdy_session_pool(), key)); | 528 ignore_result(CreateFakeSpdySession(session->spdy_session_pool(), key)); |
| 528 | 529 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 612 ProxyRetryInfoMap::const_iterator iter = retry_info.find("bad:99"); | 613 ProxyRetryInfoMap::const_iterator iter = retry_info.find("bad:99"); |
| 613 EXPECT_TRUE(iter != retry_info.end()); | 614 EXPECT_TRUE(iter != retry_info.end()); |
| 614 } | 615 } |
| 615 | 616 |
| 616 TEST_P(HttpStreamFactoryTest, UnreachableQuicProxyMarkedAsBad) { | 617 TEST_P(HttpStreamFactoryTest, UnreachableQuicProxyMarkedAsBad) { |
| 617 for (int i = 1; i <= 2; i++) { | 618 for (int i = 1; i <= 2; i++) { |
| 618 int mock_error = | 619 int mock_error = |
| 619 i == 1 ? ERR_QUIC_PROTOCOL_ERROR : ERR_QUIC_HANDSHAKE_FAILED; | 620 i == 1 ? ERR_QUIC_PROTOCOL_ERROR : ERR_QUIC_HANDSHAKE_FAILED; |
| 620 | 621 |
| 621 scoped_ptr<ProxyService> proxy_service; | 622 scoped_ptr<ProxyService> proxy_service; |
| 622 proxy_service.reset( | 623 proxy_service = |
| 623 ProxyService::CreateFixedFromPacResult("QUIC bad:99; DIRECT")); | 624 ProxyService::CreateFixedFromPacResult("QUIC bad:99; DIRECT"); |
| 624 | 625 |
| 625 HttpNetworkSession::Params params; | 626 HttpNetworkSession::Params params; |
| 626 params.enable_quic = true; | 627 params.enable_quic = true; |
| 627 params.enable_quic_for_proxies = true; | 628 params.enable_quic_for_proxies = true; |
| 628 scoped_refptr<SSLConfigServiceDefaults> ssl_config_service( | 629 scoped_refptr<SSLConfigServiceDefaults> ssl_config_service( |
| 629 new SSLConfigServiceDefaults); | 630 new SSLConfigServiceDefaults); |
| 630 HttpServerPropertiesImpl http_server_properties; | 631 HttpServerPropertiesImpl http_server_properties; |
| 631 MockClientSocketFactory socket_factory; | 632 MockClientSocketFactory socket_factory; |
| 632 params.client_socket_factory = &socket_factory; | 633 params.client_socket_factory = &socket_factory; |
| 633 MockHostResolver host_resolver; | 634 MockHostResolver host_resolver; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 674 ProxyRetryInfoMap::const_iterator iter = retry_info.find("quic://bad:99"); | 675 ProxyRetryInfoMap::const_iterator iter = retry_info.find("quic://bad:99"); |
| 675 EXPECT_TRUE(iter != retry_info.end()) << i; | 676 EXPECT_TRUE(iter != retry_info.end()) << i; |
| 676 } | 677 } |
| 677 } | 678 } |
| 678 | 679 |
| 679 } // namespace | 680 } // namespace |
| 680 | 681 |
| 681 TEST_P(HttpStreamFactoryTest, QuicLossyProxyMarkedAsBad) { | 682 TEST_P(HttpStreamFactoryTest, QuicLossyProxyMarkedAsBad) { |
| 682 // Checks if a | 683 // Checks if a |
| 683 scoped_ptr<ProxyService> proxy_service; | 684 scoped_ptr<ProxyService> proxy_service; |
| 684 proxy_service.reset( | 685 proxy_service = ProxyService::CreateFixedFromPacResult("QUIC bad:99; DIRECT"); |
| 685 ProxyService::CreateFixedFromPacResult("QUIC bad:99; DIRECT")); | |
| 686 | 686 |
| 687 HttpNetworkSession::Params params; | 687 HttpNetworkSession::Params params; |
| 688 params.enable_quic = true; | 688 params.enable_quic = true; |
| 689 params.enable_quic_for_proxies = true; | 689 params.enable_quic_for_proxies = true; |
| 690 scoped_refptr<SSLConfigServiceDefaults> ssl_config_service( | 690 scoped_refptr<SSLConfigServiceDefaults> ssl_config_service( |
| 691 new SSLConfigServiceDefaults); | 691 new SSLConfigServiceDefaults); |
| 692 HttpServerPropertiesImpl http_server_properties; | 692 HttpServerPropertiesImpl http_server_properties; |
| 693 MockClientSocketFactory socket_factory; | 693 MockClientSocketFactory socket_factory; |
| 694 params.client_socket_factory = &socket_factory; | 694 params.client_socket_factory = &socket_factory; |
| 695 MockHostResolver host_resolver; | 695 MockHostResolver host_resolver; |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1413 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); | 1413 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); |
| 1414 | 1414 |
| 1415 // Make sure there is no orphaned job. it is already canceled. | 1415 // Make sure there is no orphaned job. it is already canceled. |
| 1416 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>( | 1416 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>( |
| 1417 session->http_stream_factory_for_websocket())->num_orphaned_jobs()); | 1417 session->http_stream_factory_for_websocket())->num_orphaned_jobs()); |
| 1418 } | 1418 } |
| 1419 | 1419 |
| 1420 } // namespace | 1420 } // namespace |
| 1421 | 1421 |
| 1422 } // namespace net | 1422 } // namespace net |
| OLD | NEW |