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_script_fetcher_impl.h" | 5 #include "net/proxy/proxy_script_fetcher_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "net/base/filename_util.h" | 13 #include "net/base/filename_util.h" |
14 #include "net/base/load_flags.h" | 14 #include "net/base/load_flags.h" |
| 15 #include "net/base/network_delegate_impl.h" |
15 #include "net/base/test_completion_callback.h" | 16 #include "net/base/test_completion_callback.h" |
16 #include "net/cert/mock_cert_verifier.h" | 17 #include "net/cert/mock_cert_verifier.h" |
17 #include "net/disk_cache/disk_cache.h" | 18 #include "net/disk_cache/disk_cache.h" |
18 #include "net/dns/mock_host_resolver.h" | 19 #include "net/dns/mock_host_resolver.h" |
19 #include "net/http/http_cache.h" | 20 #include "net/http/http_cache.h" |
20 #include "net/http/http_network_session.h" | 21 #include "net/http/http_network_session.h" |
21 #include "net/http/http_server_properties_impl.h" | 22 #include "net/http/http_server_properties_impl.h" |
22 #include "net/http/transport_security_state.h" | 23 #include "net/http/transport_security_state.h" |
23 #include "net/ssl/ssl_config_service_defaults.h" | 24 #include "net/ssl/ssl_config_service_defaults.h" |
24 #include "net/test/spawned_test_server/spawned_test_server.h" | 25 #include "net/test/spawned_test_server/spawned_test_server.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 path = path.AppendASCII("proxy_script_fetcher_unittest"); | 101 path = path.AppendASCII("proxy_script_fetcher_unittest"); |
101 GURL base_url = FilePathToFileURL(path); | 102 GURL base_url = FilePathToFileURL(path); |
102 return GURL(base_url.spec() + "/" + relpath); | 103 return GURL(base_url.spec() + "/" + relpath); |
103 } | 104 } |
104 #endif // !defined(DISABLE_FILE_SUPPORT) | 105 #endif // !defined(DISABLE_FILE_SUPPORT) |
105 | 106 |
106 // Really simple NetworkDelegate so we can allow local file access on ChromeOS | 107 // Really simple NetworkDelegate so we can allow local file access on ChromeOS |
107 // without introducing layering violations. Also causes a test failure if a | 108 // without introducing layering violations. Also causes a test failure if a |
108 // request is seen that doesn't set a load flag to bypass revocation checking. | 109 // request is seen that doesn't set a load flag to bypass revocation checking. |
109 | 110 |
110 class BasicNetworkDelegate : public NetworkDelegate { | 111 class BasicNetworkDelegate : public NetworkDelegateImpl { |
111 public: | 112 public: |
112 BasicNetworkDelegate() {} | 113 BasicNetworkDelegate() {} |
113 ~BasicNetworkDelegate() override {} | 114 ~BasicNetworkDelegate() override {} |
114 | 115 |
115 private: | 116 private: |
116 int OnBeforeURLRequest(URLRequest* request, | 117 int OnBeforeURLRequest(URLRequest* request, |
117 const CompletionCallback& callback, | 118 const CompletionCallback& callback, |
118 GURL* new_url) override { | 119 GURL* new_url) override { |
119 EXPECT_TRUE(request->load_flags() & LOAD_DISABLE_CERT_REVOCATION_CHECKING); | 120 EXPECT_TRUE(request->load_flags() & LOAD_DISABLE_CERT_REVOCATION_CHECKING); |
120 return OK; | 121 return OK; |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 { | 476 { |
476 GURL url(kEncodedUrlBroken); | 477 GURL url(kEncodedUrlBroken); |
477 base::string16 text; | 478 base::string16 text; |
478 TestCompletionCallback callback; | 479 TestCompletionCallback callback; |
479 int result = pac_fetcher.Fetch(url, &text, callback.callback()); | 480 int result = pac_fetcher.Fetch(url, &text, callback.callback()); |
480 EXPECT_EQ(ERR_FAILED, result); | 481 EXPECT_EQ(ERR_FAILED, result); |
481 } | 482 } |
482 } | 483 } |
483 | 484 |
484 } // namespace net | 485 } // namespace net |
OLD | NEW |