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/proxy/proxy_service.h" | 5 #include "net/proxy/proxy_service.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 // Proxy times should not have been modified by fallback. | 955 // Proxy times should not have been modified by fallback. |
956 EXPECT_EQ(proxy_resolve_start_time, info.proxy_resolve_start_time()); | 956 EXPECT_EQ(proxy_resolve_start_time, info.proxy_resolve_start_time()); |
957 EXPECT_EQ(proxy_resolve_end_time, info.proxy_resolve_end_time()); | 957 EXPECT_EQ(proxy_resolve_end_time, info.proxy_resolve_end_time()); |
958 | 958 |
959 // The second proxy should be specified. | 959 // The second proxy should be specified. |
960 EXPECT_EQ("foopy2:9090", info.proxy_server().ToURI()); | 960 EXPECT_EQ("foopy2:9090", info.proxy_server().ToURI()); |
961 // Report back that the second proxy worked. This will globally mark the | 961 // Report back that the second proxy worked. This will globally mark the |
962 // first proxy as bad. | 962 // first proxy as bad. |
963 TestProxyFallbackNetworkDelegate test_delegate; | 963 TestProxyFallbackNetworkDelegate test_delegate; |
964 service.ReportSuccess(info, &test_delegate); | 964 service.ReportSuccess(info, &test_delegate); |
965 EXPECT_EQ(info.proxy_server(), test_delegate.proxy_server()); | 965 EXPECT_EQ("foopy1:8080", test_delegate.proxy_server().ToURI()); |
966 EXPECT_EQ(net::ERR_PROXY_CONNECTION_FAILED, | 966 EXPECT_EQ(net::ERR_PROXY_CONNECTION_FAILED, |
967 test_delegate.proxy_fallback_net_error()); | 967 test_delegate.proxy_fallback_net_error()); |
968 | 968 |
969 TestCompletionCallback callback3; | 969 TestCompletionCallback callback3; |
970 rv = service.ResolveProxy( | 970 rv = service.ResolveProxy( |
971 url, net::LOAD_NORMAL, &info, callback3.callback(), NULL, NULL, | 971 url, net::LOAD_NORMAL, &info, callback3.callback(), NULL, NULL, |
972 BoundNetLog()); | 972 BoundNetLog()); |
973 EXPECT_EQ(ERR_IO_PENDING, rv); | 973 EXPECT_EQ(ERR_IO_PENDING, rv); |
974 | 974 |
975 ASSERT_EQ(1u, resolver->pending_requests().size()); | 975 ASSERT_EQ(1u, resolver->pending_requests().size()); |
(...skipping 2099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3075 ProxyInfo info3; | 3075 ProxyInfo info3; |
3076 TestCompletionCallback callback3; | 3076 TestCompletionCallback callback3; |
3077 rv = service.ResolveProxy( | 3077 rv = service.ResolveProxy( |
3078 GURL("http://request3"), net::LOAD_NORMAL, &info3, callback3.callback(), | 3078 GURL("http://request3"), net::LOAD_NORMAL, &info3, callback3.callback(), |
3079 NULL, NULL, BoundNetLog()); | 3079 NULL, NULL, BoundNetLog()); |
3080 EXPECT_EQ(OK, rv); | 3080 EXPECT_EQ(OK, rv); |
3081 EXPECT_TRUE(info3.is_direct()); | 3081 EXPECT_TRUE(info3.is_direct()); |
3082 } | 3082 } |
3083 | 3083 |
3084 } // namespace net | 3084 } // namespace net |
OLD | NEW |