| OLD | NEW |
| 1 // Copyright (c) 2009 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 #include "net/spdy/spdy_io_buffer.h" | 5 #include "net/spdy/spdy_io_buffer.h" |
| 6 | 6 |
| 7 #include "googleurl/src/gurl.h" | 7 #include "googleurl/src/gurl.h" |
| 8 #include "net/base/mock_host_resolver.h" | 8 #include "net/base/mock_host_resolver.h" |
| 9 #include "net/base/ssl_config_service_defaults.h" | 9 #include "net/base/ssl_config_service_defaults.h" |
| 10 #include "net/base/test_completion_callback.h" | 10 #include "net/base/test_completion_callback.h" |
| 11 #include "net/http/http_network_session.h" | 11 #include "net/http/http_network_session.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 // Helper to manage the lifetimes of the dependencies for a | 35 // Helper to manage the lifetimes of the dependencies for a |
| 36 // SpdyNetworkTransaction. | 36 // SpdyNetworkTransaction. |
| 37 class SessionDependencies { | 37 class SessionDependencies { |
| 38 public: | 38 public: |
| 39 // Default set of dependencies -- "null" proxy service. | 39 // Default set of dependencies -- "null" proxy service. |
| 40 SessionDependencies() | 40 SessionDependencies() |
| 41 : host_resolver(new MockHostResolver), | 41 : host_resolver(new MockHostResolver), |
| 42 proxy_service(ProxyService::CreateNull()), | 42 proxy_service(ProxyService::CreateNull()), |
| 43 ssl_config_service(new SSLConfigServiceDefaults), | 43 ssl_config_service(new SSLConfigServiceDefaults), |
| 44 spdy_session_pool(new SpdySessionPool(NULL)) { | 44 spdy_session_pool(new SpdySessionPool()) { |
| 45 } | 45 } |
| 46 | 46 |
| 47 scoped_refptr<MockHostResolverBase> host_resolver; | 47 scoped_refptr<MockHostResolverBase> host_resolver; |
| 48 scoped_refptr<ProxyService> proxy_service; | 48 scoped_refptr<ProxyService> proxy_service; |
| 49 scoped_refptr<SSLConfigService> ssl_config_service; | 49 scoped_refptr<SSLConfigService> ssl_config_service; |
| 50 MockClientSocketFactory socket_factory; | 50 MockClientSocketFactory socket_factory; |
| 51 scoped_refptr<SpdySessionPool> spdy_session_pool; | 51 scoped_refptr<SpdySessionPool> spdy_session_pool; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 HttpNetworkSession* CreateSession(SessionDependencies* session_deps) { | 54 HttpNetworkSession* CreateSession(SessionDependencies* session_deps) { |
| 55 return new HttpNetworkSession(NULL, | 55 return new HttpNetworkSession(session_deps->host_resolver, |
| 56 session_deps->host_resolver, | |
| 57 session_deps->proxy_service, | 56 session_deps->proxy_service, |
| 58 &session_deps->socket_factory, | 57 &session_deps->socket_factory, |
| 59 session_deps->ssl_config_service, | 58 session_deps->ssl_config_service, |
| 60 session_deps->spdy_session_pool, | 59 session_deps->spdy_session_pool, |
| 61 NULL, | 60 NULL, |
| 62 NULL, | 61 NULL, |
| 63 NULL); | 62 NULL); |
| 64 } | 63 } |
| 65 | 64 |
| 66 // Test the SpdyIOBuffer class. | 65 // Test the SpdyIOBuffer class. |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 session = NULL; | 243 session = NULL; |
| 245 spdy_session_pool->CloseAllSessions(); | 244 spdy_session_pool->CloseAllSessions(); |
| 246 | 245 |
| 247 // RunAllPending needs to be called here because the | 246 // RunAllPending needs to be called here because the |
| 248 // ClientSocketPoolBase posts a task to clean up and destroy the | 247 // ClientSocketPoolBase posts a task to clean up and destroy the |
| 249 // underlying socket. | 248 // underlying socket. |
| 250 MessageLoop::current()->RunAllPending(); | 249 MessageLoop::current()->RunAllPending(); |
| 251 } | 250 } |
| 252 | 251 |
| 253 } // namespace net | 252 } // namespace net |
| OLD | NEW |