OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 }; | 32 }; |
33 | 33 |
34 // A non-mock URL request which can access http:// and file:// urls. | 34 // A non-mock URL request which can access http:// and file:// urls. |
35 class RequestContext : public URLRequestContext { | 35 class RequestContext : public URLRequestContext { |
36 public: | 36 public: |
37 RequestContext() { | 37 RequestContext() { |
38 net::ProxyConfig no_proxy; | 38 net::ProxyConfig no_proxy; |
39 host_resolver_ = | 39 host_resolver_ = |
40 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, | 40 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, |
41 NULL, NULL); | 41 NULL, NULL); |
| 42 cert_verifier_ = new net::CertVerifier; |
42 proxy_service_ = net::ProxyService::CreateFixed(no_proxy); | 43 proxy_service_ = net::ProxyService::CreateFixed(no_proxy); |
43 ssl_config_service_ = new net::SSLConfigServiceDefaults; | 44 ssl_config_service_ = new net::SSLConfigServiceDefaults; |
44 | 45 |
45 http_transaction_factory_ = new net::HttpCache( | 46 http_transaction_factory_ = new net::HttpCache( |
46 net::HttpNetworkLayer::CreateFactory(host_resolver_, NULL, NULL, NULL, | 47 net::HttpNetworkLayer::CreateFactory(host_resolver_, cert_verifier_, |
47 proxy_service_, ssl_config_service_, NULL, NULL, NULL), | 48 NULL, NULL, NULL, proxy_service_, ssl_config_service_, NULL, NULL, |
| 49 NULL), |
48 net::HttpCache::DefaultBackend::InMemory(0)); | 50 net::HttpCache::DefaultBackend::InMemory(0)); |
49 } | 51 } |
50 | 52 |
51 private: | 53 private: |
52 ~RequestContext() { | 54 ~RequestContext() { |
53 delete http_transaction_factory_; | 55 delete http_transaction_factory_; |
| 56 delete cert_verifier_; |
54 delete host_resolver_; | 57 delete host_resolver_; |
55 } | 58 } |
56 }; | 59 }; |
57 | 60 |
58 // Required to be in net namespace by FRIEND_TEST. | 61 // Required to be in net namespace by FRIEND_TEST. |
59 namespace net { | 62 namespace net { |
60 | 63 |
61 // Get a file:// url relative to net/data/proxy/proxy_script_fetcher_unittest. | 64 // Get a file:// url relative to net/data/proxy/proxy_script_fetcher_unittest. |
62 GURL GetTestFileUrl(const std::string& relpath) { | 65 GURL GetTestFileUrl(const std::string& relpath) { |
63 FilePath path; | 66 FilePath path; |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 string16 text; | 325 string16 text; |
323 TestCompletionCallback callback; | 326 TestCompletionCallback callback; |
324 int result = pac_fetcher.Fetch(url, &text, &callback); | 327 int result = pac_fetcher.Fetch(url, &text, &callback); |
325 EXPECT_EQ(ERR_IO_PENDING, result); | 328 EXPECT_EQ(ERR_IO_PENDING, result); |
326 EXPECT_EQ(OK, callback.WaitForResult()); | 329 EXPECT_EQ(OK, callback.WaitForResult()); |
327 EXPECT_EQ(ASCIIToUTF16("This was encoded as UTF-16BE.\n"), text); | 330 EXPECT_EQ(ASCIIToUTF16("This was encoded as UTF-16BE.\n"), text); |
328 } | 331 } |
329 } | 332 } |
330 | 333 |
331 } // namespace net | 334 } // namespace net |
OLD | NEW |