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

Side by Side Diff: net/http/http_stream_factory_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
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/http/http_stream_factory_impl.h" 5 #include "net/http/http_stream_factory_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "net/base/net_log.h" 10 #include "net/base/net_log.h"
11 #include "net/base/test_completion_callback.h" 11 #include "net/base/test_completion_callback.h"
12 #include "net/cert/mock_cert_verifier.h" 12 #include "net/cert/mock_cert_verifier.h"
13 #include "net/dns/mock_host_resolver.h" 13 #include "net/dns/mock_host_resolver.h"
14 #include "net/http/http_auth_handler_factory.h" 14 #include "net/http/http_auth_handler_factory.h"
15 #include "net/http/http_network_session.h" 15 #include "net/http/http_network_session.h"
16 #include "net/http/http_network_session_peer.h" 16 #include "net/http/http_network_session_peer.h"
17 #include "net/http/http_network_transaction.h" 17 #include "net/http/http_network_transaction.h"
18 #include "net/http/http_request_info.h" 18 #include "net/http/http_request_info.h"
19 #include "net/http/http_server_properties_impl.h" 19 #include "net/http/http_server_properties_impl.h"
20 #include "net/http/http_stream.h" 20 #include "net/http/http_stream.h"
21 #include "net/http/transport_security_state.h"
21 #include "net/proxy/proxy_info.h" 22 #include "net/proxy/proxy_info.h"
22 #include "net/proxy/proxy_service.h" 23 #include "net/proxy/proxy_service.h"
23 #include "net/socket/mock_client_socket_pool_manager.h" 24 #include "net/socket/mock_client_socket_pool_manager.h"
24 #include "net/socket/socket_test_util.h" 25 #include "net/socket/socket_test_util.h"
25 #include "net/spdy/spdy_session.h" 26 #include "net/spdy/spdy_session.h"
26 #include "net/spdy/spdy_session_pool.h" 27 #include "net/spdy/spdy_session_pool.h"
27 #include "net/ssl/ssl_config_service_defaults.h" 28 #include "net/ssl/ssl_config_service_defaults.h"
28 #include "testing/gtest/include/gtest/gtest.h" 29 #include "testing/gtest/include/gtest/gtest.h"
29 30
30 namespace net { 31 namespace net {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 SSLConfig used_ssl_config_; 125 SSLConfig used_ssl_config_;
125 126
126 DISALLOW_COPY_AND_ASSIGN(StreamRequestWaiter); 127 DISALLOW_COPY_AND_ASSIGN(StreamRequestWaiter);
127 }; 128 };
128 129
129 struct SessionDependencies { 130 struct SessionDependencies {
130 // Custom proxy service dependency. 131 // Custom proxy service dependency.
131 explicit SessionDependencies(ProxyService* proxy_service) 132 explicit SessionDependencies(ProxyService* proxy_service)
132 : host_resolver(new MockHostResolver), 133 : host_resolver(new MockHostResolver),
133 cert_verifier(new MockCertVerifier), 134 cert_verifier(new MockCertVerifier),
135 transport_security_state(new TransportSecurityState),
134 proxy_service(proxy_service), 136 proxy_service(proxy_service),
135 ssl_config_service(new SSLConfigServiceDefaults), 137 ssl_config_service(new SSLConfigServiceDefaults),
136 http_auth_handler_factory( 138 http_auth_handler_factory(
137 HttpAuthHandlerFactory::CreateDefault(host_resolver.get())), 139 HttpAuthHandlerFactory::CreateDefault(host_resolver.get())),
138 net_log(NULL) {} 140 net_log(NULL) {}
139 141
140 scoped_ptr<MockHostResolverBase> host_resolver; 142 scoped_ptr<MockHostResolverBase> host_resolver;
141 scoped_ptr<CertVerifier> cert_verifier; 143 scoped_ptr<CertVerifier> cert_verifier;
144 scoped_ptr<TransportSecurityState> transport_security_state;
142 scoped_ptr<ProxyService> proxy_service; 145 scoped_ptr<ProxyService> proxy_service;
143 scoped_refptr<SSLConfigService> ssl_config_service; 146 scoped_refptr<SSLConfigService> ssl_config_service;
144 MockClientSocketFactory socket_factory; 147 MockClientSocketFactory socket_factory;
145 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory; 148 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory;
146 HttpServerPropertiesImpl http_server_properties; 149 HttpServerPropertiesImpl http_server_properties;
147 NetLog* net_log; 150 NetLog* net_log;
148 }; 151 };
149 152
150 HttpNetworkSession* CreateSession(SessionDependencies* session_deps) { 153 HttpNetworkSession* CreateSession(SessionDependencies* session_deps) {
151 HttpNetworkSession::Params params; 154 HttpNetworkSession::Params params;
152 params.host_resolver = session_deps->host_resolver.get(); 155 params.host_resolver = session_deps->host_resolver.get();
153 params.cert_verifier = session_deps->cert_verifier.get(); 156 params.cert_verifier = session_deps->cert_verifier.get();
157 params.transport_security_state =
158 session_deps->transport_security_state.get();
154 params.proxy_service = session_deps->proxy_service.get(); 159 params.proxy_service = session_deps->proxy_service.get();
155 params.ssl_config_service = session_deps->ssl_config_service.get(); 160 params.ssl_config_service = session_deps->ssl_config_service.get();
156 params.client_socket_factory = &session_deps->socket_factory; 161 params.client_socket_factory = &session_deps->socket_factory;
157 params.http_auth_handler_factory = 162 params.http_auth_handler_factory =
158 session_deps->http_auth_handler_factory.get(); 163 session_deps->http_auth_handler_factory.get();
159 params.net_log = session_deps->net_log; 164 params.net_log = session_deps->net_log;
160 params.http_server_properties = &session_deps->http_server_properties; 165 params.http_server_properties = &session_deps->http_server_properties;
161 return new HttpNetworkSession(params); 166 return new HttpNetworkSession(params);
162 } 167 }
163 168
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 &waiter, BoundNetLog())); 611 &waiter, BoundNetLog()));
607 612
608 EXPECT_EQ(LOAD_STATE_RESOLVING_HOST, request->GetLoadState()); 613 EXPECT_EQ(LOAD_STATE_RESOLVING_HOST, request->GetLoadState());
609 614
610 waiter.WaitForStream(); 615 waiter.WaitForStream();
611 } 616 }
612 617
613 } // namespace 618 } // namespace
614 619
615 } // namespace net 620 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_transaction_spdy3_unittest.cc ('k') | net/http/transport_security_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698