Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: net/spdy/spdy_session_unittest.cc

Issue 1615005: Flush socket pools and SPDY session pool properly on explicit requests and network changes. (Closed)
Patch Set: Fix minor leak. Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/spdy/spdy_network_transaction_unittest.cc ('k') | net/spdy/spdy_stream_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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) {
33 } 32 }
34 33
35 scoped_refptr<MockHostResolverBase> host_resolver; 34 scoped_refptr<MockHostResolverBase> host_resolver;
36 scoped_refptr<ProxyService> proxy_service; 35 scoped_refptr<ProxyService> proxy_service;
37 scoped_refptr<SSLConfigService> ssl_config_service; 36 scoped_refptr<SSLConfigService> ssl_config_service;
38 MockClientSocketFactory socket_factory; 37 MockClientSocketFactory socket_factory;
39 scoped_refptr<SpdySessionPool> spdy_session_pool;
40 }; 38 };
41 39
42 HttpNetworkSession* CreateSession(SessionDependencies* session_deps) { 40 HttpNetworkSession* CreateSession(SessionDependencies* session_deps) {
43 return new HttpNetworkSession(NULL, 41 return new HttpNetworkSession(NULL,
44 session_deps->host_resolver, 42 session_deps->host_resolver,
45 session_deps->proxy_service, 43 session_deps->proxy_service,
46 &session_deps->socket_factory, 44 &session_deps->socket_factory,
47 session_deps->ssl_config_service, 45 session_deps->ssl_config_service,
48 session_deps->spdy_session_pool,
49 NULL); 46 NULL);
50 } 47 }
51 48
52 typedef PlatformTest SpdySessionTest; 49 typedef PlatformTest SpdySessionTest;
53 50
54 // Test the SpdyIOBuffer class. 51 // Test the SpdyIOBuffer class.
55 TEST_F(SpdySessionTest, SpdyIOBuffer) { 52 TEST_F(SpdySessionTest, SpdyIOBuffer) {
56 std::priority_queue<SpdyIOBuffer> queue_; 53 std::priority_queue<SpdyIOBuffer> queue_;
57 const size_t kQueueSize = 100; 54 const size_t kQueueSize = 100;
58 55
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 129
133 // Flush the SpdySession::OnReadComplete() task. 130 // Flush the SpdySession::OnReadComplete() task.
134 MessageLoop::current()->RunAllPending(); 131 MessageLoop::current()->RunAllPending();
135 132
136 EXPECT_FALSE(spdy_session_pool->HasSession(test_host_port_pair)); 133 EXPECT_FALSE(spdy_session_pool->HasSession(test_host_port_pair));
137 } 134 }
138 135
139 } // namespace 136 } // namespace
140 137
141 } // namespace net 138 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_network_transaction_unittest.cc ('k') | net/spdy/spdy_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698