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 */, |
357 session_deps->proxy_service, | 358 session_deps->proxy_service, |
358 session_deps->socket_factory.get(), | 359 session_deps->socket_factory.get(), |
359 session_deps->ssl_config_service, | 360 session_deps->ssl_config_service, |
360 new SpdySessionPool(NULL), | 361 new SpdySessionPool(NULL), |
361 session_deps->http_auth_handler_factory.get(), | 362 session_deps->http_auth_handler_factory.get(), |
362 NULL, | 363 NULL, |
363 NULL); | 364 NULL); |
364 } | 365 } |
365 static HttpNetworkSession* SpdyCreateSessionDeterministic( | 366 static HttpNetworkSession* SpdyCreateSessionDeterministic( |
366 SpdySessionDependencies* session_deps) { | 367 SpdySessionDependencies* session_deps) { |
367 return new HttpNetworkSession(session_deps->host_resolver.get(), | 368 return new HttpNetworkSession(session_deps->host_resolver.get(), |
368 NULL /* dnsrr_resolver */, | 369 NULL /* dnsrr_resolver */, |
| 370 NULL /* ssl_host_info_factory */, |
369 session_deps->proxy_service, | 371 session_deps->proxy_service, |
370 session_deps-> | 372 session_deps-> |
371 deterministic_socket_factory.get(), | 373 deterministic_socket_factory.get(), |
372 session_deps->ssl_config_service, | 374 session_deps->ssl_config_service, |
373 new SpdySessionPool(NULL), | 375 new SpdySessionPool(NULL), |
374 session_deps->http_auth_handler_factory.get(), | 376 session_deps->http_auth_handler_factory.get(), |
375 NULL, | 377 NULL, |
376 NULL); | 378 NULL); |
377 } | 379 } |
378 }; | 380 }; |
379 | 381 |
380 class SpdyURLRequestContext : public URLRequestContext { | 382 class SpdyURLRequestContext : public URLRequestContext { |
381 public: | 383 public: |
382 SpdyURLRequestContext() { | 384 SpdyURLRequestContext() { |
383 host_resolver_ = new MockHostResolver(); | 385 host_resolver_ = new MockHostResolver(); |
384 proxy_service_ = ProxyService::CreateDirect(); | 386 proxy_service_ = ProxyService::CreateDirect(); |
385 ssl_config_service_ = new SSLConfigServiceDefaults; | 387 ssl_config_service_ = new SSLConfigServiceDefaults; |
386 http_auth_handler_factory_ = HttpAuthHandlerFactory::CreateDefault( | 388 http_auth_handler_factory_ = HttpAuthHandlerFactory::CreateDefault( |
387 host_resolver_); | 389 host_resolver_); |
388 http_transaction_factory_ = new net::HttpCache( | 390 http_transaction_factory_ = new net::HttpCache( |
389 new HttpNetworkLayer(&socket_factory_, | 391 new HttpNetworkLayer(&socket_factory_, |
390 host_resolver_, | 392 host_resolver_, |
391 NULL /* dnsrr_resolver */, | 393 NULL /* dnsrr_resolver */, |
| 394 NULL /* ssl_host_info_factory */, |
392 proxy_service_, | 395 proxy_service_, |
393 ssl_config_service_, | 396 ssl_config_service_, |
394 new SpdySessionPool(NULL), | 397 new SpdySessionPool(NULL), |
395 http_auth_handler_factory_, | 398 http_auth_handler_factory_, |
396 network_delegate_, | 399 network_delegate_, |
397 NULL), | 400 NULL), |
398 net::HttpCache::DefaultBackend::InMemory(0)); | 401 net::HttpCache::DefaultBackend::InMemory(0)); |
399 } | 402 } |
400 | 403 |
401 MockClientSocketFactory& socket_factory() { return socket_factory_; } | 404 MockClientSocketFactory& socket_factory() { return socket_factory_; } |
402 | 405 |
403 protected: | 406 protected: |
404 virtual ~SpdyURLRequestContext() { | 407 virtual ~SpdyURLRequestContext() { |
405 delete http_transaction_factory_; | 408 delete http_transaction_factory_; |
406 delete http_auth_handler_factory_; | 409 delete http_auth_handler_factory_; |
407 delete host_resolver_; | 410 delete host_resolver_; |
408 } | 411 } |
409 | 412 |
410 private: | 413 private: |
411 MockClientSocketFactory socket_factory_; | 414 MockClientSocketFactory socket_factory_; |
412 }; | 415 }; |
413 | 416 |
414 const SpdyHeaderInfo make_spdy_header(spdy::SpdyControlType type); | 417 const SpdyHeaderInfo make_spdy_header(spdy::SpdyControlType type); |
415 } // namespace net | 418 } // namespace net |
416 | 419 |
417 #endif // NET_SPDY_SPDY_TEST_UTIL_H_ | 420 #endif // NET_SPDY_SPDY_TEST_UTIL_H_ |
OLD | NEW |