OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/spdy/spdy_test_util_common.h" | 5 #include "net/spdy/spdy_test_util_common.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 } | 323 } |
324 | 324 |
325 crypto::ECSignatureCreator* MockECSignatureCreatorFactory::Create( | 325 crypto::ECSignatureCreator* MockECSignatureCreatorFactory::Create( |
326 crypto::ECPrivateKey* key) { | 326 crypto::ECPrivateKey* key) { |
327 return new MockECSignatureCreator(key); | 327 return new MockECSignatureCreator(key); |
328 } | 328 } |
329 | 329 |
330 SpdySessionDependencies::SpdySessionDependencies(NextProto protocol) | 330 SpdySessionDependencies::SpdySessionDependencies(NextProto protocol) |
331 : host_resolver(new MockCachingHostResolver), | 331 : host_resolver(new MockCachingHostResolver), |
332 cert_verifier(new MockCertVerifier), | 332 cert_verifier(new MockCertVerifier), |
| 333 transport_security_state(new TransportSecurityState), |
333 proxy_service(ProxyService::CreateDirect()), | 334 proxy_service(ProxyService::CreateDirect()), |
334 ssl_config_service(new SSLConfigServiceDefaults), | 335 ssl_config_service(new SSLConfigServiceDefaults), |
335 socket_factory(new MockClientSocketFactory), | 336 socket_factory(new MockClientSocketFactory), |
336 deterministic_socket_factory(new DeterministicMockClientSocketFactory), | 337 deterministic_socket_factory(new DeterministicMockClientSocketFactory), |
337 http_auth_handler_factory( | 338 http_auth_handler_factory( |
338 HttpAuthHandlerFactory::CreateDefault(host_resolver.get())), | 339 HttpAuthHandlerFactory::CreateDefault(host_resolver.get())), |
339 enable_ip_pooling(true), | 340 enable_ip_pooling(true), |
340 enable_compression(false), | 341 enable_compression(false), |
341 enable_ping(false), | 342 enable_ping(false), |
342 enable_user_alternate_protocol_ports(false), | 343 enable_user_alternate_protocol_ports(false), |
343 protocol(protocol), | 344 protocol(protocol), |
344 stream_initial_recv_window_size(kSpdyStreamInitialWindowSize), | 345 stream_initial_recv_window_size(kSpdyStreamInitialWindowSize), |
345 time_func(&base::TimeTicks::Now), | 346 time_func(&base::TimeTicks::Now), |
346 net_log(NULL) { | 347 net_log(NULL) { |
347 DCHECK(next_proto_is_spdy(protocol)) << "Invalid protocol: " << protocol; | 348 DCHECK(next_proto_is_spdy(protocol)) << "Invalid protocol: " << protocol; |
348 | 349 |
349 // Note: The CancelledTransaction test does cleanup by running all | 350 // Note: The CancelledTransaction test does cleanup by running all |
350 // tasks in the message loop (RunAllPending). Unfortunately, that | 351 // tasks in the message loop (RunAllPending). Unfortunately, that |
351 // doesn't clean up tasks on the host resolver thread; and | 352 // doesn't clean up tasks on the host resolver thread; and |
352 // TCPConnectJob is currently not cancellable. Using synchronous | 353 // TCPConnectJob is currently not cancellable. Using synchronous |
353 // lookups allows the test to shutdown cleanly. Until we have | 354 // lookups allows the test to shutdown cleanly. Until we have |
354 // cancellable TCPConnectJobs, use synchronous lookups. | 355 // cancellable TCPConnectJobs, use synchronous lookups. |
355 host_resolver->set_synchronous_mode(true); | 356 host_resolver->set_synchronous_mode(true); |
356 } | 357 } |
357 | 358 |
358 SpdySessionDependencies::SpdySessionDependencies( | 359 SpdySessionDependencies::SpdySessionDependencies( |
359 NextProto protocol, ProxyService* proxy_service) | 360 NextProto protocol, ProxyService* proxy_service) |
360 : host_resolver(new MockHostResolver), | 361 : host_resolver(new MockHostResolver), |
361 cert_verifier(new MockCertVerifier), | 362 cert_verifier(new MockCertVerifier), |
| 363 transport_security_state(new TransportSecurityState), |
362 proxy_service(proxy_service), | 364 proxy_service(proxy_service), |
363 ssl_config_service(new SSLConfigServiceDefaults), | 365 ssl_config_service(new SSLConfigServiceDefaults), |
364 socket_factory(new MockClientSocketFactory), | 366 socket_factory(new MockClientSocketFactory), |
365 deterministic_socket_factory(new DeterministicMockClientSocketFactory), | 367 deterministic_socket_factory(new DeterministicMockClientSocketFactory), |
366 http_auth_handler_factory( | 368 http_auth_handler_factory( |
367 HttpAuthHandlerFactory::CreateDefault(host_resolver.get())), | 369 HttpAuthHandlerFactory::CreateDefault(host_resolver.get())), |
368 enable_ip_pooling(true), | 370 enable_ip_pooling(true), |
369 enable_compression(false), | 371 enable_compression(false), |
370 enable_ping(false), | 372 enable_ping(false), |
371 enable_user_alternate_protocol_ports(false), | 373 enable_user_alternate_protocol_ports(false), |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 | 405 |
404 // static | 406 // static |
405 net::HttpNetworkSession::Params SpdySessionDependencies::CreateSessionParams( | 407 net::HttpNetworkSession::Params SpdySessionDependencies::CreateSessionParams( |
406 SpdySessionDependencies* session_deps) { | 408 SpdySessionDependencies* session_deps) { |
407 DCHECK(next_proto_is_spdy(session_deps->protocol)) << | 409 DCHECK(next_proto_is_spdy(session_deps->protocol)) << |
408 "Invalid protocol: " << session_deps->protocol; | 410 "Invalid protocol: " << session_deps->protocol; |
409 | 411 |
410 net::HttpNetworkSession::Params params; | 412 net::HttpNetworkSession::Params params; |
411 params.host_resolver = session_deps->host_resolver.get(); | 413 params.host_resolver = session_deps->host_resolver.get(); |
412 params.cert_verifier = session_deps->cert_verifier.get(); | 414 params.cert_verifier = session_deps->cert_verifier.get(); |
| 415 params.transport_security_state = |
| 416 session_deps->transport_security_state.get(); |
413 params.proxy_service = session_deps->proxy_service.get(); | 417 params.proxy_service = session_deps->proxy_service.get(); |
414 params.ssl_config_service = session_deps->ssl_config_service.get(); | 418 params.ssl_config_service = session_deps->ssl_config_service.get(); |
415 params.http_auth_handler_factory = | 419 params.http_auth_handler_factory = |
416 session_deps->http_auth_handler_factory.get(); | 420 session_deps->http_auth_handler_factory.get(); |
417 params.http_server_properties = &session_deps->http_server_properties; | 421 params.http_server_properties = &session_deps->http_server_properties; |
418 params.enable_spdy_compression = session_deps->enable_compression; | 422 params.enable_spdy_compression = session_deps->enable_compression; |
419 params.enable_spdy_ping_based_connection_checking = session_deps->enable_ping; | 423 params.enable_spdy_ping_based_connection_checking = session_deps->enable_ping; |
420 params.enable_user_alternate_protocol_ports = | 424 params.enable_user_alternate_protocol_ports = |
421 session_deps->enable_user_alternate_protocol_ports; | 425 session_deps->enable_user_alternate_protocol_ports; |
422 params.spdy_default_protocol = session_deps->protocol; | 426 params.spdy_default_protocol = session_deps->protocol; |
423 params.spdy_stream_initial_recv_window_size = | 427 params.spdy_stream_initial_recv_window_size = |
424 session_deps->stream_initial_recv_window_size; | 428 session_deps->stream_initial_recv_window_size; |
425 params.time_func = session_deps->time_func; | 429 params.time_func = session_deps->time_func; |
426 params.trusted_spdy_proxy = session_deps->trusted_spdy_proxy; | 430 params.trusted_spdy_proxy = session_deps->trusted_spdy_proxy; |
427 params.net_log = session_deps->net_log; | 431 params.net_log = session_deps->net_log; |
428 return params; | 432 return params; |
429 } | 433 } |
430 | 434 |
431 SpdyURLRequestContext::SpdyURLRequestContext(NextProto protocol) | 435 SpdyURLRequestContext::SpdyURLRequestContext(NextProto protocol) |
432 : storage_(this) { | 436 : storage_(this) { |
433 DCHECK(next_proto_is_spdy(protocol)) << "Invalid protocol: " << protocol; | 437 DCHECK(next_proto_is_spdy(protocol)) << "Invalid protocol: " << protocol; |
434 | 438 |
435 storage_.set_host_resolver(scoped_ptr<HostResolver>(new MockHostResolver)); | 439 storage_.set_host_resolver(scoped_ptr<HostResolver>(new MockHostResolver)); |
436 storage_.set_cert_verifier(new MockCertVerifier); | 440 storage_.set_cert_verifier(new MockCertVerifier); |
| 441 storage_.set_transport_security_state(new TransportSecurityState); |
437 storage_.set_proxy_service(ProxyService::CreateDirect()); | 442 storage_.set_proxy_service(ProxyService::CreateDirect()); |
438 storage_.set_ssl_config_service(new SSLConfigServiceDefaults); | 443 storage_.set_ssl_config_service(new SSLConfigServiceDefaults); |
439 storage_.set_http_auth_handler_factory(HttpAuthHandlerFactory::CreateDefault( | 444 storage_.set_http_auth_handler_factory(HttpAuthHandlerFactory::CreateDefault( |
440 host_resolver())); | 445 host_resolver())); |
441 storage_.set_http_server_properties(new HttpServerPropertiesImpl); | 446 storage_.set_http_server_properties(new HttpServerPropertiesImpl); |
442 net::HttpNetworkSession::Params params; | 447 net::HttpNetworkSession::Params params; |
443 params.client_socket_factory = &socket_factory_; | 448 params.client_socket_factory = &socket_factory_; |
444 params.host_resolver = host_resolver(); | 449 params.host_resolver = host_resolver(); |
445 params.cert_verifier = cert_verifier(); | 450 params.cert_verifier = cert_verifier(); |
| 451 params.transport_security_state = transport_security_state(); |
446 params.proxy_service = proxy_service(); | 452 params.proxy_service = proxy_service(); |
447 params.ssl_config_service = ssl_config_service(); | 453 params.ssl_config_service = ssl_config_service(); |
448 params.http_auth_handler_factory = http_auth_handler_factory(); | 454 params.http_auth_handler_factory = http_auth_handler_factory(); |
449 params.network_delegate = network_delegate(); | 455 params.network_delegate = network_delegate(); |
450 params.enable_spdy_compression = false; | 456 params.enable_spdy_compression = false; |
451 params.enable_spdy_ping_based_connection_checking = false; | 457 params.enable_spdy_ping_based_connection_checking = false; |
452 params.spdy_default_protocol = protocol; | 458 params.spdy_default_protocol = protocol; |
453 params.http_server_properties = http_server_properties(); | 459 params.http_server_properties = http_server_properties(); |
454 scoped_refptr<HttpNetworkSession> network_session( | 460 scoped_refptr<HttpNetworkSession> network_session( |
455 new HttpNetworkSession(params)); | 461 new HttpNetworkSession(params)); |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 | 1069 |
1064 const char* SpdyTestUtil::GetVersionKey() const { | 1070 const char* SpdyTestUtil::GetVersionKey() const { |
1065 return is_spdy2() ? "version" : ":version"; | 1071 return is_spdy2() ? "version" : ":version"; |
1066 } | 1072 } |
1067 | 1073 |
1068 const char* SpdyTestUtil::GetPathKey() const { | 1074 const char* SpdyTestUtil::GetPathKey() const { |
1069 return is_spdy2() ? "url" : ":path"; | 1075 return is_spdy2() ? "url" : ":path"; |
1070 } | 1076 } |
1071 | 1077 |
1072 } // namespace net | 1078 } // namespace net |
OLD | NEW |