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

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

Issue 16501002: Give more request types a TransportSecurityState. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Enforce CalledOnValidThread in all non-static methods. Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « net/http/transport_security_state.cc ('k') | net/quic/quic_network_transaction_unittest.cc » ('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"
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/load_flags.h" 13 #include "net/base/load_flags.h"
14 #include "net/base/net_util.h" 14 #include "net/base/net_util.h"
15 #include "net/base/test_completion_callback.h" 15 #include "net/base/test_completion_callback.h"
16 #include "net/cert/mock_cert_verifier.h" 16 #include "net/cert/mock_cert_verifier.h"
17 #include "net/disk_cache/disk_cache.h" 17 #include "net/disk_cache/disk_cache.h"
18 #include "net/dns/mock_host_resolver.h" 18 #include "net/dns/mock_host_resolver.h"
19 #include "net/http/http_cache.h" 19 #include "net/http/http_cache.h"
20 #include "net/http/http_network_session.h" 20 #include "net/http/http_network_session.h"
21 #include "net/http/http_server_properties_impl.h" 21 #include "net/http/http_server_properties_impl.h"
22 #include "net/http/transport_security_state.h"
22 #include "net/ssl/ssl_config_service_defaults.h" 23 #include "net/ssl/ssl_config_service_defaults.h"
23 #include "net/test/spawned_test_server/spawned_test_server.h" 24 #include "net/test/spawned_test_server/spawned_test_server.h"
24 #include "net/url_request/file_protocol_handler.h" 25 #include "net/url_request/file_protocol_handler.h"
25 #include "net/url_request/url_request_context_storage.h" 26 #include "net/url_request/url_request_context_storage.h"
26 #include "net/url_request/url_request_file_job.h" 27 #include "net/url_request/url_request_file_job.h"
27 #include "net/url_request/url_request_job_factory_impl.h" 28 #include "net/url_request/url_request_job_factory_impl.h"
28 #include "net/url_request/url_request_test_util.h" 29 #include "net/url_request/url_request_test_util.h"
29 #include "testing/gtest/include/gtest/gtest.h" 30 #include "testing/gtest/include/gtest/gtest.h"
30 #include "testing/platform_test.h" 31 #include "testing/platform_test.h"
31 32
(...skipping 13 matching lines...) Expand all
45 base::string16 text; 46 base::string16 text;
46 }; 47 };
47 48
48 // A non-mock URL request which can access http:// and file:// urls. 49 // A non-mock URL request which can access http:// and file:// urls.
49 class RequestContext : public URLRequestContext { 50 class RequestContext : public URLRequestContext {
50 public: 51 public:
51 RequestContext() : storage_(this) { 52 RequestContext() : storage_(this) {
52 ProxyConfig no_proxy; 53 ProxyConfig no_proxy;
53 storage_.set_host_resolver(scoped_ptr<HostResolver>(new MockHostResolver)); 54 storage_.set_host_resolver(scoped_ptr<HostResolver>(new MockHostResolver));
54 storage_.set_cert_verifier(new MockCertVerifier); 55 storage_.set_cert_verifier(new MockCertVerifier);
56 storage_.set_transport_security_state(new TransportSecurityState);
55 storage_.set_proxy_service(ProxyService::CreateFixed(no_proxy)); 57 storage_.set_proxy_service(ProxyService::CreateFixed(no_proxy));
56 storage_.set_ssl_config_service(new SSLConfigServiceDefaults); 58 storage_.set_ssl_config_service(new SSLConfigServiceDefaults);
57 storage_.set_http_server_properties(new HttpServerPropertiesImpl); 59 storage_.set_http_server_properties(new HttpServerPropertiesImpl);
58 60
59 HttpNetworkSession::Params params; 61 HttpNetworkSession::Params params;
60 params.host_resolver = host_resolver(); 62 params.host_resolver = host_resolver();
61 params.cert_verifier = cert_verifier(); 63 params.cert_verifier = cert_verifier();
64 params.transport_security_state = transport_security_state();
62 params.proxy_service = proxy_service(); 65 params.proxy_service = proxy_service();
63 params.ssl_config_service = ssl_config_service(); 66 params.ssl_config_service = ssl_config_service();
64 params.http_server_properties = http_server_properties(); 67 params.http_server_properties = http_server_properties();
65 scoped_refptr<HttpNetworkSession> network_session( 68 scoped_refptr<HttpNetworkSession> network_session(
66 new HttpNetworkSession(params)); 69 new HttpNetworkSession(params));
67 storage_.set_http_transaction_factory(new HttpCache( 70 storage_.set_http_transaction_factory(new HttpCache(
68 network_session.get(), HttpCache::DefaultBackend::InMemory(0))); 71 network_session.get(), HttpCache::DefaultBackend::InMemory(0)));
69 URLRequestJobFactoryImpl* job_factory = new URLRequestJobFactoryImpl(); 72 URLRequestJobFactoryImpl* job_factory = new URLRequestJobFactoryImpl();
70 job_factory->SetProtocolHandler("file", new FileProtocolHandler()); 73 job_factory->SetProtocolHandler("file", new FileProtocolHandler());
71 storage_.set_job_factory(job_factory); 74 storage_.set_job_factory(job_factory);
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 { 478 {
476 GURL url(kEncodedUrlBroken); 479 GURL url(kEncodedUrlBroken);
477 base::string16 text; 480 base::string16 text;
478 TestCompletionCallback callback; 481 TestCompletionCallback callback;
479 int result = pac_fetcher.Fetch(url, &text, callback.callback()); 482 int result = pac_fetcher.Fetch(url, &text, callback.callback());
480 EXPECT_EQ(ERR_FAILED, result); 483 EXPECT_EQ(ERR_FAILED, result);
481 } 484 }
482 } 485 }
483 486
484 } // namespace net 487 } // namespace net
OLDNEW
« no previous file with comments | « net/http/transport_security_state.cc ('k') | net/quic/quic_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698