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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "net/base/capturing_net_log.h" | 9 #include "net/base/capturing_net_log.h" |
10 #include "net/base/net_log_unittest.h" | 10 #include "net/base/net_log_unittest.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_transaction.h" | 16 #include "net/http/http_network_transaction.h" |
17 #include "net/http/http_server_properties_impl.h" | 17 #include "net/http/http_server_properties_impl.h" |
18 #include "net/http/http_stream.h" | 18 #include "net/http/http_stream.h" |
19 #include "net/http/http_stream_factory.h" | 19 #include "net/http/http_stream_factory.h" |
20 #include "net/http/http_transaction_unittest.h" | 20 #include "net/http/http_transaction_unittest.h" |
| 21 #include "net/http/transport_security_state.h" |
21 #include "net/proxy/proxy_config_service_fixed.h" | 22 #include "net/proxy/proxy_config_service_fixed.h" |
22 #include "net/proxy/proxy_resolver.h" | 23 #include "net/proxy/proxy_resolver.h" |
23 #include "net/proxy/proxy_service.h" | 24 #include "net/proxy/proxy_service.h" |
24 #include "net/quic/crypto/quic_decrypter.h" | 25 #include "net/quic/crypto/quic_decrypter.h" |
25 #include "net/quic/crypto/quic_encrypter.h" | 26 #include "net/quic/crypto/quic_encrypter.h" |
26 #include "net/quic/quic_framer.h" | 27 #include "net/quic/quic_framer.h" |
27 #include "net/quic/test_tools/crypto_test_utils.h" | 28 #include "net/quic/test_tools/crypto_test_utils.h" |
28 #include "net/quic/test_tools/mock_clock.h" | 29 #include "net/quic/test_tools/mock_clock.h" |
29 #include "net/quic/test_tools/mock_crypto_client_stream_factory.h" | 30 #include "net/quic/test_tools/mock_crypto_client_stream_factory.h" |
30 #include "net/quic/test_tools/mock_random.h" | 31 #include "net/quic/test_tools/mock_random.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 } | 219 } |
219 | 220 |
220 void CreateSession() { | 221 void CreateSession() { |
221 params_.enable_quic = true; | 222 params_.enable_quic = true; |
222 params_.quic_clock = clock_; | 223 params_.quic_clock = clock_; |
223 params_.quic_random = &random_generator_; | 224 params_.quic_random = &random_generator_; |
224 params_.client_socket_factory = &socket_factory_; | 225 params_.client_socket_factory = &socket_factory_; |
225 params_.quic_crypto_client_stream_factory = &crypto_client_stream_factory_; | 226 params_.quic_crypto_client_stream_factory = &crypto_client_stream_factory_; |
226 params_.host_resolver = &host_resolver_; | 227 params_.host_resolver = &host_resolver_; |
227 params_.cert_verifier = &cert_verifier_; | 228 params_.cert_verifier = &cert_verifier_; |
| 229 params_.transport_security_state = &transport_security_state_; |
228 params_.proxy_service = proxy_service_.get(); | 230 params_.proxy_service = proxy_service_.get(); |
229 params_.ssl_config_service = ssl_config_service_.get(); | 231 params_.ssl_config_service = ssl_config_service_.get(); |
230 params_.http_auth_handler_factory = auth_handler_factory_.get(); | 232 params_.http_auth_handler_factory = auth_handler_factory_.get(); |
231 params_.http_server_properties = &http_server_properties; | 233 params_.http_server_properties = &http_server_properties; |
232 | 234 |
233 session_ = new HttpNetworkSession(params_); | 235 session_ = new HttpNetworkSession(params_); |
234 } | 236 } |
235 | 237 |
236 void CheckWasQuicResponse(const scoped_ptr<HttpNetworkTransaction>& trans) { | 238 void CheckWasQuicResponse(const scoped_ptr<HttpNetworkTransaction>& trans) { |
237 const HttpResponseInfo* response = trans->GetResponseInfo(); | 239 const HttpResponseInfo* response = trans->GetResponseInfo(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 socket_factory_.AddSocketDataProvider(&data); | 310 socket_factory_.AddSocketDataProvider(&data); |
309 } | 311 } |
310 | 312 |
311 QuicPacketHeader header_; | 313 QuicPacketHeader header_; |
312 scoped_refptr<HttpNetworkSession> session_; | 314 scoped_refptr<HttpNetworkSession> session_; |
313 MockClientSocketFactory socket_factory_; | 315 MockClientSocketFactory socket_factory_; |
314 MockCryptoClientStreamFactory crypto_client_stream_factory_; | 316 MockCryptoClientStreamFactory crypto_client_stream_factory_; |
315 MockClock* clock_; // Owned by QuicStreamFactory after CreateSession. | 317 MockClock* clock_; // Owned by QuicStreamFactory after CreateSession. |
316 MockHostResolver host_resolver_; | 318 MockHostResolver host_resolver_; |
317 MockCertVerifier cert_verifier_; | 319 MockCertVerifier cert_verifier_; |
| 320 TransportSecurityState transport_security_state_; |
318 scoped_refptr<SSLConfigServiceDefaults> ssl_config_service_; | 321 scoped_refptr<SSLConfigServiceDefaults> ssl_config_service_; |
319 scoped_ptr<ProxyService> proxy_service_; | 322 scoped_ptr<ProxyService> proxy_service_; |
320 scoped_ptr<QuicSpdyCompressor> compressor_; | 323 scoped_ptr<QuicSpdyCompressor> compressor_; |
321 scoped_ptr<HttpAuthHandlerFactory> auth_handler_factory_; | 324 scoped_ptr<HttpAuthHandlerFactory> auth_handler_factory_; |
322 MockRandom random_generator_; | 325 MockRandom random_generator_; |
323 HttpServerPropertiesImpl http_server_properties; | 326 HttpServerPropertiesImpl http_server_properties; |
324 HttpNetworkSession::Params params_; | 327 HttpNetworkSession::Params params_; |
325 HttpRequestInfo request_; | 328 HttpRequestInfo request_; |
326 CapturingBoundNetLog net_log_; | 329 CapturingBoundNetLog net_log_; |
327 }; | 330 }; |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 | 616 |
614 CreateSession(); | 617 CreateSession(); |
615 | 618 |
616 AddQuicAlternateProtocolMapping(MockCryptoClientStream::COLD_START); | 619 AddQuicAlternateProtocolMapping(MockCryptoClientStream::COLD_START); |
617 SendRequestAndExpectHttpResponse("hello from http"); | 620 SendRequestAndExpectHttpResponse("hello from http"); |
618 ExpectBrokenAlternateProtocolMapping(); | 621 ExpectBrokenAlternateProtocolMapping(); |
619 } | 622 } |
620 | 623 |
621 } // namespace test | 624 } // namespace test |
622 } // namespace net | 625 } // namespace net |
OLD | NEW |