| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef NET_SPDY_SPDY_TEST_UTIL_H_ | 5 #ifndef NET_SPDY_SPDY_TEST_UTIL_H_ |
| 6 #define NET_SPDY_SPDY_TEST_UTIL_H_ | 6 #define NET_SPDY_SPDY_TEST_UTIL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "net/base/mock_host_resolver.h" | 10 #include "net/base/mock_host_resolver.h" |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 scoped_refptr<ProxyService> proxy_service; | 347 scoped_refptr<ProxyService> proxy_service; |
| 348 scoped_refptr<SSLConfigService> ssl_config_service; | 348 scoped_refptr<SSLConfigService> ssl_config_service; |
| 349 scoped_ptr<MockClientSocketFactory> socket_factory; | 349 scoped_ptr<MockClientSocketFactory> socket_factory; |
| 350 scoped_ptr<DeterministicMockClientSocketFactory> deterministic_socket_factory; | 350 scoped_ptr<DeterministicMockClientSocketFactory> deterministic_socket_factory; |
| 351 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory; | 351 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory; |
| 352 | 352 |
| 353 static HttpNetworkSession* SpdyCreateSession( | 353 static HttpNetworkSession* SpdyCreateSession( |
| 354 SpdySessionDependencies* session_deps) { | 354 SpdySessionDependencies* session_deps) { |
| 355 return new HttpNetworkSession(session_deps->host_resolver.get(), | 355 return new HttpNetworkSession(session_deps->host_resolver.get(), |
| 356 NULL /* dnsrr_resolver */, | 356 NULL /* dnsrr_resolver */, |
| 357 NULL /* ssl_host_info_factory */, | |
| 358 session_deps->proxy_service, | 357 session_deps->proxy_service, |
| 359 session_deps->socket_factory.get(), | 358 session_deps->socket_factory.get(), |
| 360 session_deps->ssl_config_service, | 359 session_deps->ssl_config_service, |
| 361 new SpdySessionPool(NULL), | 360 new SpdySessionPool(NULL), |
| 362 session_deps->http_auth_handler_factory.get(), | 361 session_deps->http_auth_handler_factory.get(), |
| 363 NULL, | 362 NULL, |
| 364 NULL); | 363 NULL); |
| 365 } | 364 } |
| 366 static HttpNetworkSession* SpdyCreateSessionDeterministic( | 365 static HttpNetworkSession* SpdyCreateSessionDeterministic( |
| 367 SpdySessionDependencies* session_deps) { | 366 SpdySessionDependencies* session_deps) { |
| 368 return new HttpNetworkSession(session_deps->host_resolver.get(), | 367 return new HttpNetworkSession(session_deps->host_resolver.get(), |
| 369 NULL /* dnsrr_resolver */, | 368 NULL /* dnsrr_resolver */, |
| 370 NULL /* ssl_host_info_factory */, | |
| 371 session_deps->proxy_service, | 369 session_deps->proxy_service, |
| 372 session_deps-> | 370 session_deps-> |
| 373 deterministic_socket_factory.get(), | 371 deterministic_socket_factory.get(), |
| 374 session_deps->ssl_config_service, | 372 session_deps->ssl_config_service, |
| 375 new SpdySessionPool(NULL), | 373 new SpdySessionPool(NULL), |
| 376 session_deps->http_auth_handler_factory.get(), | 374 session_deps->http_auth_handler_factory.get(), |
| 377 NULL, | 375 NULL, |
| 378 NULL); | 376 NULL); |
| 379 } | 377 } |
| 380 }; | 378 }; |
| 381 | 379 |
| 382 class SpdyURLRequestContext : public URLRequestContext { | 380 class SpdyURLRequestContext : public URLRequestContext { |
| 383 public: | 381 public: |
| 384 SpdyURLRequestContext() { | 382 SpdyURLRequestContext() { |
| 385 host_resolver_ = new MockHostResolver(); | 383 host_resolver_ = new MockHostResolver(); |
| 386 proxy_service_ = ProxyService::CreateDirect(); | 384 proxy_service_ = ProxyService::CreateDirect(); |
| 387 ssl_config_service_ = new SSLConfigServiceDefaults; | 385 ssl_config_service_ = new SSLConfigServiceDefaults; |
| 388 http_auth_handler_factory_ = HttpAuthHandlerFactory::CreateDefault( | 386 http_auth_handler_factory_ = HttpAuthHandlerFactory::CreateDefault( |
| 389 host_resolver_); | 387 host_resolver_); |
| 390 http_transaction_factory_ = new net::HttpCache( | 388 http_transaction_factory_ = new net::HttpCache( |
| 391 new HttpNetworkLayer(&socket_factory_, | 389 new HttpNetworkLayer(&socket_factory_, |
| 392 host_resolver_, | 390 host_resolver_, |
| 393 NULL /* dnsrr_resolver */, | 391 NULL /* dnsrr_resolver */, |
| 394 NULL /* ssl_host_info_factory */, | |
| 395 proxy_service_, | 392 proxy_service_, |
| 396 ssl_config_service_, | 393 ssl_config_service_, |
| 397 new SpdySessionPool(NULL), | 394 new SpdySessionPool(NULL), |
| 398 http_auth_handler_factory_, | 395 http_auth_handler_factory_, |
| 399 network_delegate_, | 396 network_delegate_, |
| 400 NULL), | 397 NULL), |
| 401 net::HttpCache::DefaultBackend::InMemory(0)); | 398 net::HttpCache::DefaultBackend::InMemory(0)); |
| 402 } | 399 } |
| 403 | 400 |
| 404 MockClientSocketFactory& socket_factory() { return socket_factory_; } | 401 MockClientSocketFactory& socket_factory() { return socket_factory_; } |
| 405 | 402 |
| 406 protected: | 403 protected: |
| 407 virtual ~SpdyURLRequestContext() { | 404 virtual ~SpdyURLRequestContext() { |
| 408 delete http_transaction_factory_; | 405 delete http_transaction_factory_; |
| 409 delete http_auth_handler_factory_; | 406 delete http_auth_handler_factory_; |
| 410 delete host_resolver_; | 407 delete host_resolver_; |
| 411 } | 408 } |
| 412 | 409 |
| 413 private: | 410 private: |
| 414 MockClientSocketFactory socket_factory_; | 411 MockClientSocketFactory socket_factory_; |
| 415 }; | 412 }; |
| 416 | 413 |
| 417 const SpdyHeaderInfo make_spdy_header(spdy::SpdyControlType type); | 414 const SpdyHeaderInfo make_spdy_header(spdy::SpdyControlType type); |
| 418 } // namespace net | 415 } // namespace net |
| 419 | 416 |
| 420 #endif // NET_SPDY_SPDY_TEST_UTIL_H_ | 417 #endif // NET_SPDY_SPDY_TEST_UTIL_H_ |
| OLD | NEW |