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 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 ProxyRetryInfoMap::const_iterator iter = retry_info.find("bad:99"); | 612 ProxyRetryInfoMap::const_iterator iter = retry_info.find("bad:99"); |
613 EXPECT_TRUE(iter != retry_info.end()); | 613 EXPECT_TRUE(iter != retry_info.end()); |
614 } | 614 } |
615 | 615 |
616 TEST_P(HttpStreamFactoryTest, UnreachableQuicProxyMarkedAsBad) { | 616 TEST_P(HttpStreamFactoryTest, UnreachableQuicProxyMarkedAsBad) { |
617 for (int i = 1; i <= 2; i++) { | 617 for (int i = 1; i <= 2; i++) { |
618 int mock_error = | 618 int mock_error = |
619 i == 1 ? ERR_QUIC_PROTOCOL_ERROR : ERR_QUIC_HANDSHAKE_FAILED; | 619 i == 1 ? ERR_QUIC_PROTOCOL_ERROR : ERR_QUIC_HANDSHAKE_FAILED; |
620 | 620 |
621 scoped_ptr<ProxyService> proxy_service; | 621 scoped_ptr<ProxyService> proxy_service; |
622 proxy_service.reset( | 622 proxy_service = |
623 ProxyService::CreateFixedFromPacResult("QUIC bad:99; DIRECT")); | 623 ProxyService::CreateFixedFromPacResult("QUIC bad:99; DIRECT"); |
624 | 624 |
625 HttpNetworkSession::Params params; | 625 HttpNetworkSession::Params params; |
626 params.enable_quic = true; | 626 params.enable_quic = true; |
627 params.enable_quic_for_proxies = true; | 627 params.enable_quic_for_proxies = true; |
628 scoped_refptr<SSLConfigServiceDefaults> ssl_config_service( | 628 scoped_refptr<SSLConfigServiceDefaults> ssl_config_service( |
629 new SSLConfigServiceDefaults); | 629 new SSLConfigServiceDefaults); |
630 HttpServerPropertiesImpl http_server_properties; | 630 HttpServerPropertiesImpl http_server_properties; |
631 MockClientSocketFactory socket_factory; | 631 MockClientSocketFactory socket_factory; |
632 params.client_socket_factory = &socket_factory; | 632 params.client_socket_factory = &socket_factory; |
633 MockHostResolver host_resolver; | 633 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"); | 674 ProxyRetryInfoMap::const_iterator iter = retry_info.find("quic://bad:99"); |
675 EXPECT_TRUE(iter != retry_info.end()) << i; | 675 EXPECT_TRUE(iter != retry_info.end()) << i; |
676 } | 676 } |
677 } | 677 } |
678 | 678 |
679 } // namespace | 679 } // namespace |
680 | 680 |
681 TEST_P(HttpStreamFactoryTest, QuicLossyProxyMarkedAsBad) { | 681 TEST_P(HttpStreamFactoryTest, QuicLossyProxyMarkedAsBad) { |
682 // Checks if a | 682 // Checks if a |
683 scoped_ptr<ProxyService> proxy_service; | 683 scoped_ptr<ProxyService> proxy_service; |
684 proxy_service.reset( | 684 proxy_service = ProxyService::CreateFixedFromPacResult("QUIC bad:99; DIRECT"); |
685 ProxyService::CreateFixedFromPacResult("QUIC bad:99; DIRECT")); | |
686 | 685 |
687 HttpNetworkSession::Params params; | 686 HttpNetworkSession::Params params; |
688 params.enable_quic = true; | 687 params.enable_quic = true; |
689 params.enable_quic_for_proxies = true; | 688 params.enable_quic_for_proxies = true; |
690 scoped_refptr<SSLConfigServiceDefaults> ssl_config_service( | 689 scoped_refptr<SSLConfigServiceDefaults> ssl_config_service( |
691 new SSLConfigServiceDefaults); | 690 new SSLConfigServiceDefaults); |
692 HttpServerPropertiesImpl http_server_properties; | 691 HttpServerPropertiesImpl http_server_properties; |
693 MockClientSocketFactory socket_factory; | 692 MockClientSocketFactory socket_factory; |
694 params.client_socket_factory = &socket_factory; | 693 params.client_socket_factory = &socket_factory; |
695 MockHostResolver host_resolver; | 694 MockHostResolver host_resolver; |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1428 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); | 1427 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); |
1429 | 1428 |
1430 // Make sure there is no orphaned job. it is already canceled. | 1429 // Make sure there is no orphaned job. it is already canceled. |
1431 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>( | 1430 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>( |
1432 session->http_stream_factory_for_websocket())->num_orphaned_jobs()); | 1431 session->http_stream_factory_for_websocket())->num_orphaned_jobs()); |
1433 } | 1432 } |
1434 | 1433 |
1435 } // namespace | 1434 } // namespace |
1436 | 1435 |
1437 } // namespace net | 1436 } // namespace net |
OLD | NEW |