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

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

Issue 2802015: Massively simplify the NetworkChangeNotifier infrastructure:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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 | Annotate | Revision Log
OLDNEW
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 #include "net/spdy/spdy_http_stream.h" 5 #include "net/spdy/spdy_http_stream.h"
6 #include "base/ref_counted.h" 6 #include "base/ref_counted.h"
7 #include "base/time.h" 7 #include "base/time.h"
8 #include "net/base/mock_host_resolver.h" 8 #include "net/base/mock_host_resolver.h"
9 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
10 #include "net/base/net_log.h" 10 #include "net/base/net_log.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // Helper to manage the lifetimes of the dependencies for a 48 // Helper to manage the lifetimes of the dependencies for a
49 // SpdyNetworkTransaction. 49 // SpdyNetworkTransaction.
50 class SessionDependencies { 50 class SessionDependencies {
51 public: 51 public:
52 // Default set of dependencies -- "null" proxy service. 52 // Default set of dependencies -- "null" proxy service.
53 SessionDependencies() 53 SessionDependencies()
54 : host_resolver(new MockHostResolver), 54 : host_resolver(new MockHostResolver),
55 proxy_service(CreateNullProxyService()), 55 proxy_service(CreateNullProxyService()),
56 ssl_config_service(new SSLConfigServiceDefaults), 56 ssl_config_service(new SSLConfigServiceDefaults),
57 http_auth_handler_factory(HttpAuthHandlerFactory::CreateDefault()), 57 http_auth_handler_factory(HttpAuthHandlerFactory::CreateDefault()),
58 spdy_session_pool(new SpdySessionPool(NULL)) {} 58 spdy_session_pool(new SpdySessionPool()) {}
59 59
60 // Custom proxy service dependency. 60 // Custom proxy service dependency.
61 explicit SessionDependencies(ProxyService* proxy_service) 61 explicit SessionDependencies(ProxyService* proxy_service)
62 : host_resolver(new MockHostResolver), 62 : host_resolver(new MockHostResolver),
63 proxy_service(proxy_service), 63 proxy_service(proxy_service),
64 ssl_config_service(new SSLConfigServiceDefaults), 64 ssl_config_service(new SSLConfigServiceDefaults),
65 http_auth_handler_factory(HttpAuthHandlerFactory::CreateDefault()), 65 http_auth_handler_factory(HttpAuthHandlerFactory::CreateDefault()),
66 spdy_session_pool(new SpdySessionPool(NULL)) {} 66 spdy_session_pool(new SpdySessionPool()) {}
67 67
68 scoped_refptr<MockHostResolverBase> host_resolver; 68 scoped_refptr<MockHostResolverBase> host_resolver;
69 scoped_refptr<ProxyService> proxy_service; 69 scoped_refptr<ProxyService> proxy_service;
70 scoped_refptr<SSLConfigService> ssl_config_service; 70 scoped_refptr<SSLConfigService> ssl_config_service;
71 MockClientSocketFactory socket_factory; 71 MockClientSocketFactory socket_factory;
72 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory; 72 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory;
73 scoped_refptr<SpdySessionPool> spdy_session_pool; 73 scoped_refptr<SpdySessionPool> spdy_session_pool;
74 }; 74 };
75 75
76 HttpNetworkSession* CreateSession(SessionDependencies* session_deps) { 76 HttpNetworkSession* CreateSession(SessionDependencies* session_deps) {
77 return new HttpNetworkSession(NULL, 77 return new HttpNetworkSession(session_deps->host_resolver,
78 session_deps->host_resolver,
79 session_deps->proxy_service, 78 session_deps->proxy_service,
80 &session_deps->socket_factory, 79 &session_deps->socket_factory,
81 session_deps->ssl_config_service, 80 session_deps->ssl_config_service,
82 session_deps->spdy_session_pool, 81 session_deps->spdy_session_pool,
83 session_deps->http_auth_handler_factory.get(), 82 session_deps->http_auth_handler_factory.get(),
84 NULL, 83 NULL,
85 NULL); 84 NULL);
86 } 85 }
87 86
88 class SpdyHttpStreamTest : public testing::Test { 87 class SpdyHttpStreamTest : public testing::Test {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // socket close/error, but we aren't communicating over a socket here. 128 // socket close/error, but we aren't communicating over a socket here.
130 pool_peer_.RemoveSpdySession(session); 129 pool_peer_.RemoveSpdySession(session);
131 } 130 }
132 131
133 // TODO(willchan): Write a longer test for SpdyStream that exercises all 132 // TODO(willchan): Write a longer test for SpdyStream that exercises all
134 // methods. 133 // methods.
135 134
136 } // namespace 135 } // namespace
137 136
138 } // namespace net 137 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698