OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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" |
(...skipping 10 matching lines...) Expand all Loading... |
21 namespace { | 21 namespace { |
22 | 22 |
23 // Helper to manage the lifetimes of the dependencies for a | 23 // Helper to manage the lifetimes of the dependencies for a |
24 // SpdyNetworkTransaction. | 24 // SpdyNetworkTransaction. |
25 class SessionDependencies { | 25 class SessionDependencies { |
26 public: | 26 public: |
27 // Default set of dependencies -- "null" proxy service. | 27 // Default set of dependencies -- "null" proxy service. |
28 SessionDependencies() | 28 SessionDependencies() |
29 : host_resolver(new MockHostResolver), | 29 : host_resolver(new MockHostResolver), |
30 proxy_service(ProxyService::CreateNull()), | 30 proxy_service(ProxyService::CreateNull()), |
31 ssl_config_service(new SSLConfigServiceDefaults) { | 31 ssl_config_service(new SSLConfigServiceDefaults), |
| 32 spdy_session_pool(new SpdySessionPool) { |
32 } | 33 } |
33 | 34 |
34 scoped_refptr<MockHostResolverBase> host_resolver; | 35 scoped_refptr<MockHostResolverBase> host_resolver; |
35 scoped_refptr<ProxyService> proxy_service; | 36 scoped_refptr<ProxyService> proxy_service; |
36 scoped_refptr<SSLConfigService> ssl_config_service; | 37 scoped_refptr<SSLConfigService> ssl_config_service; |
37 MockClientSocketFactory socket_factory; | 38 MockClientSocketFactory socket_factory; |
| 39 scoped_refptr<SpdySessionPool> spdy_session_pool; |
38 }; | 40 }; |
39 | 41 |
40 HttpNetworkSession* CreateSession(SessionDependencies* session_deps) { | 42 HttpNetworkSession* CreateSession(SessionDependencies* session_deps) { |
41 return new HttpNetworkSession(NULL, | 43 return new HttpNetworkSession(NULL, |
42 session_deps->host_resolver, | 44 session_deps->host_resolver, |
43 session_deps->proxy_service, | 45 session_deps->proxy_service, |
44 &session_deps->socket_factory, | 46 &session_deps->socket_factory, |
45 session_deps->ssl_config_service, | 47 session_deps->ssl_config_service, |
| 48 session_deps->spdy_session_pool, |
46 NULL); | 49 NULL); |
47 } | 50 } |
48 | 51 |
49 typedef PlatformTest SpdySessionTest; | 52 typedef PlatformTest SpdySessionTest; |
50 | 53 |
51 // Test the SpdyIOBuffer class. | 54 // Test the SpdyIOBuffer class. |
52 TEST_F(SpdySessionTest, SpdyIOBuffer) { | 55 TEST_F(SpdySessionTest, SpdyIOBuffer) { |
53 std::priority_queue<SpdyIOBuffer> queue_; | 56 std::priority_queue<SpdyIOBuffer> queue_; |
54 const size_t kQueueSize = 100; | 57 const size_t kQueueSize = 100; |
55 | 58 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 132 |
130 // Flush the SpdySession::OnReadComplete() task. | 133 // Flush the SpdySession::OnReadComplete() task. |
131 MessageLoop::current()->RunAllPending(); | 134 MessageLoop::current()->RunAllPending(); |
132 | 135 |
133 EXPECT_FALSE(spdy_session_pool->HasSession(test_host_port_pair)); | 136 EXPECT_FALSE(spdy_session_pool->HasSession(test_host_port_pair)); |
134 } | 137 } |
135 | 138 |
136 } // namespace | 139 } // namespace |
137 | 140 |
138 } // namespace net | 141 } // namespace net |
OLD | NEW |