Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: net/proxy/proxy_script_fetcher_impl_unittest.cc

Issue 1290243007: Shift URLRequestContextStorage over to taking scoped_ptrs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Paul_BuilderGrab
Patch Set: Sync'd to revision p349162. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http/http_stream_factory_impl_unittest.cc ('k') | net/proxy/proxy_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 base::string16 text; 54 base::string16 text;
55 }; 55 };
56 56
57 // A non-mock URL request which can access http:// and file:// urls, in the case 57 // A non-mock URL request which can access http:// and file:// urls, in the case
58 // the tests were built with file support. 58 // the tests were built with file support.
59 class RequestContext : public URLRequestContext { 59 class RequestContext : public URLRequestContext {
60 public: 60 public:
61 RequestContext() : storage_(this) { 61 RequestContext() : storage_(this) {
62 ProxyConfig no_proxy; 62 ProxyConfig no_proxy;
63 storage_.set_host_resolver(scoped_ptr<HostResolver>(new MockHostResolver)); 63 storage_.set_host_resolver(scoped_ptr<HostResolver>(new MockHostResolver));
64 storage_.set_cert_verifier(new MockCertVerifier); 64 storage_.set_cert_verifier(make_scoped_ptr(new MockCertVerifier).Pass());
65 storage_.set_transport_security_state(new TransportSecurityState); 65 storage_.set_transport_security_state(
66 make_scoped_ptr(new TransportSecurityState));
66 storage_.set_proxy_service(ProxyService::CreateFixed(no_proxy)); 67 storage_.set_proxy_service(ProxyService::CreateFixed(no_proxy));
67 storage_.set_ssl_config_service(new SSLConfigServiceDefaults); 68 storage_.set_ssl_config_service(new SSLConfigServiceDefaults);
68 storage_.set_http_server_properties( 69 storage_.set_http_server_properties(
69 scoped_ptr<HttpServerProperties>(new HttpServerPropertiesImpl())); 70 scoped_ptr<HttpServerProperties>(new HttpServerPropertiesImpl()));
70 71
71 HttpNetworkSession::Params params; 72 HttpNetworkSession::Params params;
72 params.host_resolver = host_resolver(); 73 params.host_resolver = host_resolver();
73 params.cert_verifier = cert_verifier(); 74 params.cert_verifier = cert_verifier();
74 params.transport_security_state = transport_security_state(); 75 params.transport_security_state = transport_security_state();
75 params.proxy_service = proxy_service(); 76 params.proxy_service = proxy_service();
76 params.ssl_config_service = ssl_config_service(); 77 params.ssl_config_service = ssl_config_service();
77 params.http_server_properties = http_server_properties(); 78 params.http_server_properties = http_server_properties();
78 scoped_refptr<HttpNetworkSession> network_session( 79 scoped_refptr<HttpNetworkSession> network_session(
79 new HttpNetworkSession(params)); 80 new HttpNetworkSession(params));
80 storage_.set_http_transaction_factory(new HttpCache( 81 storage_.set_http_transaction_factory(
81 network_session.get(), HttpCache::DefaultBackend::InMemory(0))); 82 make_scoped_ptr(new HttpCache(network_session.get(),
82 URLRequestJobFactoryImpl* job_factory = new URLRequestJobFactoryImpl(); 83 HttpCache::DefaultBackend::InMemory(0)))
84 .Pass());
85 scoped_ptr<URLRequestJobFactoryImpl> job_factory =
86 make_scoped_ptr(new URLRequestJobFactoryImpl());
83 #if !defined(DISABLE_FILE_SUPPORT) 87 #if !defined(DISABLE_FILE_SUPPORT)
84 job_factory->SetProtocolHandler("file", 88 job_factory->SetProtocolHandler("file",
85 make_scoped_ptr(new FileProtocolHandler( 89 make_scoped_ptr(new FileProtocolHandler(
86 base::ThreadTaskRunnerHandle::Get()))); 90 base::ThreadTaskRunnerHandle::Get())));
87 #endif 91 #endif
88 storage_.set_job_factory(job_factory); 92 storage_.set_job_factory(job_factory.Pass());
89 } 93 }
90 94
91 ~RequestContext() override { AssertNoURLRequests(); } 95 ~RequestContext() override { AssertNoURLRequests(); }
92 96
93 private: 97 private:
94 URLRequestContextStorage storage_; 98 URLRequestContextStorage storage_;
95 }; 99 };
96 100
97 #if !defined(DISABLE_FILE_SUPPORT) 101 #if !defined(DISABLE_FILE_SUPPORT)
98 // Get a file:// url relative to net/data/proxy/proxy_script_fetcher_unittest. 102 // Get a file:// url relative to net/data/proxy/proxy_script_fetcher_unittest.
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 base::string16 text; 478 base::string16 text;
475 TestCompletionCallback callback; 479 TestCompletionCallback callback;
476 int result = pac_fetcher.Fetch(url, &text, callback.callback()); 480 int result = pac_fetcher.Fetch(url, &text, callback.callback());
477 EXPECT_EQ(ERR_FAILED, result); 481 EXPECT_EQ(ERR_FAILED, result);
478 } 482 }
479 } 483 }
480 484
481 } // namespace 485 } // namespace
482 486
483 } // namespace net 487 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl_unittest.cc ('k') | net/proxy/proxy_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698