| 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 <cstdarg> | 7 #include <cstdarg> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "net/log/net_log_with_source.h" | 22 #include "net/log/net_log_with_source.h" |
| 23 #include "net/log/test_net_log.h" | 23 #include "net/log/test_net_log.h" |
| 24 #include "net/log/test_net_log_entry.h" | 24 #include "net/log/test_net_log_entry.h" |
| 25 #include "net/log/test_net_log_util.h" | 25 #include "net/log/test_net_log_util.h" |
| 26 #include "net/proxy/dhcp_proxy_script_fetcher.h" | 26 #include "net/proxy/dhcp_proxy_script_fetcher.h" |
| 27 #include "net/proxy/mock_proxy_resolver.h" | 27 #include "net/proxy/mock_proxy_resolver.h" |
| 28 #include "net/proxy/mock_proxy_script_fetcher.h" | 28 #include "net/proxy/mock_proxy_script_fetcher.h" |
| 29 #include "net/proxy/proxy_config_service.h" | 29 #include "net/proxy/proxy_config_service.h" |
| 30 #include "net/proxy/proxy_resolver.h" | 30 #include "net/proxy/proxy_resolver.h" |
| 31 #include "net/proxy/proxy_script_fetcher.h" | 31 #include "net/proxy/proxy_script_fetcher.h" |
| 32 #include "net/proxy/proxy_server.h" |
| 32 #include "net/test/gtest_util.h" | 33 #include "net/test/gtest_util.h" |
| 33 #include "testing/gmock/include/gmock/gmock.h" | 34 #include "testing/gmock/include/gmock/gmock.h" |
| 34 #include "testing/gtest/include/gtest/gtest.h" | 35 #include "testing/gtest/include/gtest/gtest.h" |
| 35 #include "url/gurl.h" | 36 #include "url/gurl.h" |
| 36 | 37 |
| 37 using net::test::IsError; | 38 using net::test::IsError; |
| 38 using net::test::IsOk; | 39 using net::test::IsOk; |
| 39 | 40 |
| 40 using base::ASCIIToUTF16; | 41 using base::ASCIIToUTF16; |
| 41 | 42 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 const HttpResponseHeaders& response_headers) override {} | 224 const HttpResponseHeaders& response_headers) override {} |
| 224 bool IsTrustedSpdyProxy(const net::ProxyServer& proxy_server) override { | 225 bool IsTrustedSpdyProxy(const net::ProxyServer& proxy_server) override { |
| 225 return true; | 226 return true; |
| 226 } | 227 } |
| 227 void GetAlternativeProxy( | 228 void GetAlternativeProxy( |
| 228 const GURL& url, | 229 const GURL& url, |
| 229 const ProxyServer& resolved_proxy_server, | 230 const ProxyServer& resolved_proxy_server, |
| 230 ProxyServer* alternative_proxy_server) const override {} | 231 ProxyServer* alternative_proxy_server) const override {} |
| 231 void OnAlternativeProxyBroken( | 232 void OnAlternativeProxyBroken( |
| 232 const ProxyServer& alternative_proxy_server) override {} | 233 const ProxyServer& alternative_proxy_server) override {} |
| 234 ProxyServer GetDefaultAlternativeProxy() const override { |
| 235 return ProxyServer(); |
| 236 } |
| 233 | 237 |
| 234 private: | 238 private: |
| 235 bool on_resolve_proxy_called_; | 239 bool on_resolve_proxy_called_; |
| 236 bool add_proxy_; | 240 bool add_proxy_; |
| 237 bool remove_proxy_; | 241 bool remove_proxy_; |
| 238 std::string method_; | 242 std::string method_; |
| 239 const ProxyService* proxy_service_; | 243 const ProxyService* proxy_service_; |
| 240 }; | 244 }; |
| 241 | 245 |
| 242 // A test network delegate that exercises the OnProxyFallback callback. | 246 // A test network delegate that exercises the OnProxyFallback callback. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 266 const HttpResponseHeaders& response_headers) override {} | 270 const HttpResponseHeaders& response_headers) override {} |
| 267 bool IsTrustedSpdyProxy(const net::ProxyServer& proxy_server) override { | 271 bool IsTrustedSpdyProxy(const net::ProxyServer& proxy_server) override { |
| 268 return true; | 272 return true; |
| 269 } | 273 } |
| 270 void GetAlternativeProxy( | 274 void GetAlternativeProxy( |
| 271 const GURL& url, | 275 const GURL& url, |
| 272 const ProxyServer& resolved_proxy_server, | 276 const ProxyServer& resolved_proxy_server, |
| 273 ProxyServer* alternative_proxy_server) const override {} | 277 ProxyServer* alternative_proxy_server) const override {} |
| 274 void OnAlternativeProxyBroken( | 278 void OnAlternativeProxyBroken( |
| 275 const ProxyServer& alternative_proxy_server) override {} | 279 const ProxyServer& alternative_proxy_server) override {} |
| 280 ProxyServer GetDefaultAlternativeProxy() const override { |
| 281 return ProxyServer(); |
| 282 } |
| 276 | 283 |
| 277 bool on_proxy_fallback_called() const { | 284 bool on_proxy_fallback_called() const { |
| 278 return on_proxy_fallback_called_; | 285 return on_proxy_fallback_called_; |
| 279 } | 286 } |
| 280 | 287 |
| 281 const ProxyServer& proxy_server() const { | 288 const ProxyServer& proxy_server() const { |
| 282 return proxy_server_; | 289 return proxy_server_; |
| 283 } | 290 } |
| 284 | 291 |
| 285 int proxy_fallback_net_error() const { | 292 int proxy_fallback_net_error() const { |
| (...skipping 3376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3662 GURL(test.sanitized_url_unstripped), | 3669 GURL(test.sanitized_url_unstripped), |
| 3663 helper.SanitizeUrl(raw_url, ProxyService::SanitizeUrlPolicy::UNSAFE)); | 3670 helper.SanitizeUrl(raw_url, ProxyService::SanitizeUrlPolicy::UNSAFE)); |
| 3664 | 3671 |
| 3665 EXPECT_EQ( | 3672 EXPECT_EQ( |
| 3666 GURL(test.sanitized_url), | 3673 GURL(test.sanitized_url), |
| 3667 helper.SanitizeUrl(raw_url, ProxyService::SanitizeUrlPolicy::SAFE)); | 3674 helper.SanitizeUrl(raw_url, ProxyService::SanitizeUrlPolicy::SAFE)); |
| 3668 } | 3675 } |
| 3669 } | 3676 } |
| 3670 | 3677 |
| 3671 } // namespace net | 3678 } // namespace net |
| OLD | NEW |