| 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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 scoped_ptr<MockHostResolverBase> host_resolver; | 328 scoped_ptr<MockHostResolverBase> host_resolver; |
| 329 scoped_refptr<ProxyService> proxy_service; | 329 scoped_refptr<ProxyService> proxy_service; |
| 330 scoped_refptr<SSLConfigService> ssl_config_service; | 330 scoped_refptr<SSLConfigService> ssl_config_service; |
| 331 scoped_ptr<MockClientSocketFactory> socket_factory; | 331 scoped_ptr<MockClientSocketFactory> socket_factory; |
| 332 scoped_ptr<DeterministicMockClientSocketFactory> deterministic_socket_factory; | 332 scoped_ptr<DeterministicMockClientSocketFactory> deterministic_socket_factory; |
| 333 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory; | 333 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory; |
| 334 | 334 |
| 335 static HttpNetworkSession* SpdyCreateSession( | 335 static HttpNetworkSession* SpdyCreateSession( |
| 336 SpdySessionDependencies* session_deps) { | 336 SpdySessionDependencies* session_deps) { |
| 337 return new HttpNetworkSession(session_deps->host_resolver.get(), | 337 return new HttpNetworkSession(session_deps->host_resolver.get(), |
| 338 NULL /* dnsrr_resolver */, |
| 338 session_deps->proxy_service, | 339 session_deps->proxy_service, |
| 339 session_deps->socket_factory.get(), | 340 session_deps->socket_factory.get(), |
| 340 session_deps->ssl_config_service, | 341 session_deps->ssl_config_service, |
| 341 new SpdySessionPool(NULL), | 342 new SpdySessionPool(NULL), |
| 342 session_deps->http_auth_handler_factory.get(), | 343 session_deps->http_auth_handler_factory.get(), |
| 343 NULL, | 344 NULL, |
| 344 NULL); | 345 NULL); |
| 345 } | 346 } |
| 346 static HttpNetworkSession* SpdyCreateSessionDeterministic( | 347 static HttpNetworkSession* SpdyCreateSessionDeterministic( |
| 347 SpdySessionDependencies* session_deps) { | 348 SpdySessionDependencies* session_deps) { |
| 348 return new HttpNetworkSession(session_deps->host_resolver.get(), | 349 return new HttpNetworkSession(session_deps->host_resolver.get(), |
| 350 NULL /* dnsrr_resolver */, |
| 349 session_deps->proxy_service, | 351 session_deps->proxy_service, |
| 350 session_deps-> | 352 session_deps-> |
| 351 deterministic_socket_factory.get(), | 353 deterministic_socket_factory.get(), |
| 352 session_deps->ssl_config_service, | 354 session_deps->ssl_config_service, |
| 353 new SpdySessionPool(NULL), | 355 new SpdySessionPool(NULL), |
| 354 session_deps->http_auth_handler_factory.get(), | 356 session_deps->http_auth_handler_factory.get(), |
| 355 NULL, | 357 NULL, |
| 356 NULL); | 358 NULL); |
| 357 } | 359 } |
| 358 }; | 360 }; |
| 359 | 361 |
| 360 class SpdyURLRequestContext : public URLRequestContext { | 362 class SpdyURLRequestContext : public URLRequestContext { |
| 361 public: | 363 public: |
| 362 SpdyURLRequestContext() { | 364 SpdyURLRequestContext() { |
| 363 host_resolver_ = new MockHostResolver(); | 365 host_resolver_ = new MockHostResolver(); |
| 364 proxy_service_ = ProxyService::CreateDirect(); | 366 proxy_service_ = ProxyService::CreateDirect(); |
| 365 ssl_config_service_ = new SSLConfigServiceDefaults; | 367 ssl_config_service_ = new SSLConfigServiceDefaults; |
| 366 http_auth_handler_factory_ = HttpAuthHandlerFactory::CreateDefault( | 368 http_auth_handler_factory_ = HttpAuthHandlerFactory::CreateDefault( |
| 367 host_resolver_); | 369 host_resolver_); |
| 368 http_transaction_factory_ = new net::HttpCache( | 370 http_transaction_factory_ = new net::HttpCache( |
| 369 new HttpNetworkLayer(&socket_factory_, | 371 new HttpNetworkLayer(&socket_factory_, |
| 370 host_resolver_, | 372 host_resolver_, |
| 373 NULL /* dnsrr_resolver */, |
| 371 proxy_service_, | 374 proxy_service_, |
| 372 ssl_config_service_, | 375 ssl_config_service_, |
| 373 new SpdySessionPool(NULL), | 376 new SpdySessionPool(NULL), |
| 374 http_auth_handler_factory_, | 377 http_auth_handler_factory_, |
| 375 network_delegate_, | 378 network_delegate_, |
| 376 NULL), | 379 NULL), |
| 377 net::HttpCache::DefaultBackend::InMemory(0)); | 380 net::HttpCache::DefaultBackend::InMemory(0)); |
| 378 } | 381 } |
| 379 | 382 |
| 380 MockClientSocketFactory& socket_factory() { return socket_factory_; } | 383 MockClientSocketFactory& socket_factory() { return socket_factory_; } |
| 381 | 384 |
| 382 protected: | 385 protected: |
| 383 virtual ~SpdyURLRequestContext() { | 386 virtual ~SpdyURLRequestContext() { |
| 384 delete http_transaction_factory_; | 387 delete http_transaction_factory_; |
| 385 delete http_auth_handler_factory_; | 388 delete http_auth_handler_factory_; |
| 386 delete host_resolver_; | 389 delete host_resolver_; |
| 387 } | 390 } |
| 388 | 391 |
| 389 private: | 392 private: |
| 390 MockClientSocketFactory socket_factory_; | 393 MockClientSocketFactory socket_factory_; |
| 391 }; | 394 }; |
| 392 | 395 |
| 393 const SpdyHeaderInfo make_spdy_header(spdy::SpdyControlType type); | 396 const SpdyHeaderInfo make_spdy_header(spdy::SpdyControlType type); |
| 394 } // namespace net | 397 } // namespace net |
| 395 | 398 |
| 396 #endif // NET_SPDY_SPDY_TEST_UTIL_H_ | 399 #endif // NET_SPDY_SPDY_TEST_UTIL_H_ |
| OLD | NEW |