OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 7583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7594 { | 7594 { |
7595 "", // unused | 7595 "", // unused |
7596 "http://host.with.alternate/direct", | 7596 "http://host.with.alternate/direct", |
7597 "ssl/host.with.alternate:443", | 7597 "ssl/host.with.alternate:443", |
7598 true, | 7598 true, |
7599 }, | 7599 }, |
7600 }; | 7600 }; |
7601 | 7601 |
7602 session_deps_.use_alternate_protocols = true; | 7602 session_deps_.use_alternate_protocols = true; |
7603 | 7603 |
7604 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 7604 for (size_t i = 0; i < arraysize(tests); ++i) { |
7605 session_deps_.proxy_service.reset( | 7605 session_deps_.proxy_service.reset( |
7606 ProxyService::CreateFixed(tests[i].proxy_server)); | 7606 ProxyService::CreateFixed(tests[i].proxy_server)); |
7607 scoped_refptr<HttpNetworkSession> session( | 7607 scoped_refptr<HttpNetworkSession> session( |
7608 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); | 7608 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); |
7609 | 7609 |
7610 HttpNetworkSessionPeer peer(session); | 7610 HttpNetworkSessionPeer peer(session); |
7611 CaptureGroupNameTransportSocketPool* transport_conn_pool = | 7611 CaptureGroupNameTransportSocketPool* transport_conn_pool = |
7612 new CaptureGroupNameTransportSocketPool(NULL, NULL); | 7612 new CaptureGroupNameTransportSocketPool(NULL, NULL); |
7613 CaptureGroupNameSSLSocketPool* ssl_conn_pool = | 7613 CaptureGroupNameSSLSocketPool* ssl_conn_pool = |
7614 new CaptureGroupNameSSLSocketPool(NULL, NULL); | 7614 new CaptureGroupNameSSLSocketPool(NULL, NULL); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7658 { | 7658 { |
7659 "http_proxy", | 7659 "http_proxy", |
7660 "ftp://ftp.google.com/http_proxy_normal", | 7660 "ftp://ftp.google.com/http_proxy_normal", |
7661 "ftp/ftp.google.com:21", | 7661 "ftp/ftp.google.com:21", |
7662 false, | 7662 false, |
7663 }, | 7663 }, |
7664 }; | 7664 }; |
7665 | 7665 |
7666 session_deps_.use_alternate_protocols = true; | 7666 session_deps_.use_alternate_protocols = true; |
7667 | 7667 |
7668 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 7668 for (size_t i = 0; i < arraysize(tests); ++i) { |
7669 session_deps_.proxy_service.reset( | 7669 session_deps_.proxy_service.reset( |
7670 ProxyService::CreateFixed(tests[i].proxy_server)); | 7670 ProxyService::CreateFixed(tests[i].proxy_server)); |
7671 scoped_refptr<HttpNetworkSession> session( | 7671 scoped_refptr<HttpNetworkSession> session( |
7672 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); | 7672 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); |
7673 | 7673 |
7674 HttpNetworkSessionPeer peer(session); | 7674 HttpNetworkSessionPeer peer(session); |
7675 | 7675 |
7676 HostPortPair proxy_host("http_proxy", 80); | 7676 HostPortPair proxy_host("http_proxy", 80); |
7677 CaptureGroupNameHttpProxySocketPool* http_proxy_pool = | 7677 CaptureGroupNameHttpProxySocketPool* http_proxy_pool = |
7678 new CaptureGroupNameHttpProxySocketPool(NULL, NULL); | 7678 new CaptureGroupNameHttpProxySocketPool(NULL, NULL); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7729 { | 7729 { |
7730 "socks4://socks_proxy:1080", | 7730 "socks4://socks_proxy:1080", |
7731 "http://host.with.alternate/direct", | 7731 "http://host.with.alternate/direct", |
7732 "socks4/ssl/host.with.alternate:443", | 7732 "socks4/ssl/host.with.alternate:443", |
7733 true, | 7733 true, |
7734 }, | 7734 }, |
7735 }; | 7735 }; |
7736 | 7736 |
7737 session_deps_.use_alternate_protocols = true; | 7737 session_deps_.use_alternate_protocols = true; |
7738 | 7738 |
7739 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 7739 for (size_t i = 0; i < arraysize(tests); ++i) { |
7740 session_deps_.proxy_service.reset( | 7740 session_deps_.proxy_service.reset( |
7741 ProxyService::CreateFixed(tests[i].proxy_server)); | 7741 ProxyService::CreateFixed(tests[i].proxy_server)); |
7742 scoped_refptr<HttpNetworkSession> session( | 7742 scoped_refptr<HttpNetworkSession> session( |
7743 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); | 7743 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); |
7744 | 7744 |
7745 HttpNetworkSessionPeer peer(session); | 7745 HttpNetworkSessionPeer peer(session); |
7746 | 7746 |
7747 HostPortPair proxy_host("socks_proxy", 1080); | 7747 HostPortPair proxy_host("socks_proxy", 1080); |
7748 CaptureGroupNameSOCKSSocketPool* socks_conn_pool = | 7748 CaptureGroupNameSOCKSSocketPool* socks_conn_pool = |
7749 new CaptureGroupNameSOCKSSocketPool(NULL, NULL); | 7749 new CaptureGroupNameSOCKSSocketPool(NULL, NULL); |
(...skipping 1898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9648 TestRound(kConnectProxyAuth, kProxyConnected, OK, | 9648 TestRound(kConnectProxyAuth, kProxyConnected, OK, |
9649 &kGet, &kServerChallenge), | 9649 &kGet, &kServerChallenge), |
9650 TestRound(kGetAuth, kSuccess, OK)}}, | 9650 TestRound(kGetAuth, kSuccess, OK)}}, |
9651 { kProxy, AUTH_ASYNC, OK, kSecureServer, AUTH_ASYNC, kAuthErr, 3, 1, | 9651 { kProxy, AUTH_ASYNC, OK, kSecureServer, AUTH_ASYNC, kAuthErr, 3, 1, |
9652 { TestRound(kConnect, kProxyChallenge, OK), | 9652 { TestRound(kConnect, kProxyChallenge, OK), |
9653 TestRound(kConnectProxyAuth, kProxyConnected, OK, | 9653 TestRound(kConnectProxyAuth, kProxyConnected, OK, |
9654 &kGet, &kServerChallenge), | 9654 &kGet, &kServerChallenge), |
9655 TestRound(kGetAuth, kFailure, kAuthErr)}}, | 9655 TestRound(kGetAuth, kFailure, kAuthErr)}}, |
9656 }; | 9656 }; |
9657 | 9657 |
9658 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_configs); ++i) { | 9658 for (size_t i = 0; i < arraysize(test_configs); ++i) { |
9659 HttpAuthHandlerMock::Factory* auth_factory( | 9659 HttpAuthHandlerMock::Factory* auth_factory( |
9660 new HttpAuthHandlerMock::Factory()); | 9660 new HttpAuthHandlerMock::Factory()); |
9661 session_deps_.http_auth_handler_factory.reset(auth_factory); | 9661 session_deps_.http_auth_handler_factory.reset(auth_factory); |
9662 const TestConfig& test_config = test_configs[i]; | 9662 const TestConfig& test_config = test_configs[i]; |
9663 | 9663 |
9664 // Set up authentication handlers as necessary. | 9664 // Set up authentication handlers as necessary. |
9665 if (test_config.proxy_auth_timing != AUTH_NONE) { | 9665 if (test_config.proxy_auth_timing != AUTH_NONE) { |
9666 for (int n = 0; n < 2; n++) { | 9666 for (int n = 0; n < 2; n++) { |
9667 HttpAuthHandlerMock* auth_handler(new HttpAuthHandlerMock()); | 9667 HttpAuthHandlerMock* auth_handler(new HttpAuthHandlerMock()); |
9668 std::string auth_challenge = "Mock realm=proxy"; | 9668 std::string auth_challenge = "Mock realm=proxy"; |
(...skipping 3537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13206 EXPECT_EQ(ERR_IO_PENDING, rv); | 13206 EXPECT_EQ(ERR_IO_PENDING, rv); |
13207 | 13207 |
13208 rv = callback.WaitForResult(); | 13208 rv = callback.WaitForResult(); |
13209 EXPECT_EQ(ERR_CONNECTION_RESET, rv); | 13209 EXPECT_EQ(ERR_CONNECTION_RESET, rv); |
13210 | 13210 |
13211 const HttpResponseInfo* response = trans->GetResponseInfo(); | 13211 const HttpResponseInfo* response = trans->GetResponseInfo(); |
13212 EXPECT_TRUE(response == NULL); | 13212 EXPECT_TRUE(response == NULL); |
13213 } | 13213 } |
13214 | 13214 |
13215 } // namespace net | 13215 } // namespace net |
OLD | NEW |