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