| 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 #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 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "net/base/cert_verifier.h" | 9 #include "net/base/cert_verifier.h" |
| 10 #include "net/base/host_port_pair.h" | 10 #include "net/base/host_port_pair.h" |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 | 332 |
| 333 MockRead CreateMockRead(const SpdyFrame& resp, int seq, IoMode mode); | 333 MockRead CreateMockRead(const SpdyFrame& resp, int seq, IoMode mode); |
| 334 | 334 |
| 335 // Combines the given SpdyFrames into the given char array and returns | 335 // Combines the given SpdyFrames into the given char array and returns |
| 336 // the total length. | 336 // the total length. |
| 337 int CombineFrames(const SpdyFrame** frames, int num_frames, | 337 int CombineFrames(const SpdyFrame** frames, int num_frames, |
| 338 char* buff, int buff_len); | 338 char* buff, int buff_len); |
| 339 | 339 |
| 340 // Helper to manage the lifetimes of the dependencies for a | 340 // Helper to manage the lifetimes of the dependencies for a |
| 341 // HttpNetworkTransaction. | 341 // HttpNetworkTransaction. |
| 342 class SpdySessionDependencies { | 342 struct SpdySessionDependencies { |
| 343 public: | |
| 344 // Default set of dependencies -- "null" proxy service. | 343 // Default set of dependencies -- "null" proxy service. |
| 345 SpdySessionDependencies(); | 344 SpdySessionDependencies(); |
| 346 | 345 |
| 347 // Custom proxy service dependency. | 346 // Custom proxy service dependency. |
| 348 explicit SpdySessionDependencies(ProxyService* proxy_service); | 347 explicit SpdySessionDependencies(ProxyService* proxy_service); |
| 349 | 348 |
| 350 ~SpdySessionDependencies(); | 349 ~SpdySessionDependencies(); |
| 351 | 350 |
| 352 static HttpNetworkSession* SpdyCreateSession( | 351 static HttpNetworkSession* SpdyCreateSession( |
| 353 SpdySessionDependencies* session_deps); | 352 SpdySessionDependencies* session_deps); |
| 354 static HttpNetworkSession* SpdyCreateSessionDeterministic( | 353 static HttpNetworkSession* SpdyCreateSessionDeterministic( |
| 355 SpdySessionDependencies* session_deps); | 354 SpdySessionDependencies* session_deps); |
| 355 static HttpNetworkSession::Params CreateSessionParams( |
| 356 SpdySessionDependencies* session_deps); |
| 356 | 357 |
| 357 // NOTE: host_resolver must be ordered before http_auth_handler_factory. | 358 // NOTE: host_resolver must be ordered before http_auth_handler_factory. |
| 358 scoped_ptr<MockHostResolverBase> host_resolver; | 359 scoped_ptr<MockHostResolverBase> host_resolver; |
| 359 scoped_ptr<CertVerifier> cert_verifier; | 360 scoped_ptr<CertVerifier> cert_verifier; |
| 360 scoped_ptr<ProxyService> proxy_service; | 361 scoped_ptr<ProxyService> proxy_service; |
| 361 scoped_refptr<SSLConfigService> ssl_config_service; | 362 scoped_refptr<SSLConfigService> ssl_config_service; |
| 362 scoped_ptr<MockClientSocketFactory> socket_factory; | 363 scoped_ptr<MockClientSocketFactory> socket_factory; |
| 363 scoped_ptr<DeterministicMockClientSocketFactory> deterministic_socket_factory; | 364 scoped_ptr<DeterministicMockClientSocketFactory> deterministic_socket_factory; |
| 364 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory; | 365 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory; |
| 365 HttpServerPropertiesImpl http_server_properties; | 366 HttpServerPropertiesImpl http_server_properties; |
| 366 std::string trusted_spdy_proxy; | 367 std::string trusted_spdy_proxy; |
| 368 NetLog* net_log; |
| 367 }; | 369 }; |
| 368 | 370 |
| 369 class SpdyURLRequestContext : public URLRequestContext { | 371 class SpdyURLRequestContext : public URLRequestContext { |
| 370 public: | 372 public: |
| 371 SpdyURLRequestContext(); | 373 SpdyURLRequestContext(); |
| 372 virtual ~SpdyURLRequestContext(); | 374 virtual ~SpdyURLRequestContext(); |
| 373 | 375 |
| 374 MockClientSocketFactory& socket_factory() { return socket_factory_; } | 376 MockClientSocketFactory& socket_factory() { return socket_factory_; } |
| 375 | 377 |
| 376 private: | 378 private: |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 | 421 |
| 420 private: | 422 private: |
| 421 DISALLOW_COPY_AND_ASSIGN(SpdyTestStateHelper); | 423 DISALLOW_COPY_AND_ASSIGN(SpdyTestStateHelper); |
| 422 }; | 424 }; |
| 423 | 425 |
| 424 } // namespace test_spdy2 | 426 } // namespace test_spdy2 |
| 425 | 427 |
| 426 } // namespace net | 428 } // namespace net |
| 427 | 429 |
| 428 #endif // NET_SPDY_SPDY_TEST_UTIL_H_ | 430 #endif // NET_SPDY_SPDY_TEST_UTIL_H_ |
| OLD | NEW |