summaryrefslogtreecommitdiffstats
path: root/net/spdy/spdy_test_util.cc
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-21 18:40:55 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-21 18:40:55 +0000
commitad74a59d383e658187ae48d084c7a65145d84449 (patch)
treea60b8e2f9abf54efab891fcb589c7c865ecc7a17 /net/spdy/spdy_test_util.cc
parent9cf72aecda4f6c4279cbe397e6c133bbebb8c642 (diff)
downloadchromium_src-ad74a59d383e658187ae48d084c7a65145d84449.zip
chromium_src-ad74a59d383e658187ae48d084c7a65145d84449.tar.gz
chromium_src-ad74a59d383e658187ae48d084c7a65145d84449.tar.bz2
More net/ reordering.
In addition to the normal method reordering, this patch also deinlines net/base/test_completion_callback.h and places the compiled code in the net_test_support target. Minimization of that header also required adding includes in a few unit tests. BUG=68682 TEST=compiles Review URL: http://codereview.chromium.org/6341004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72162 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy/spdy_test_util.cc')
-rw-r--r--net/spdy/spdy_test_util.cc96
1 files changed, 96 insertions, 0 deletions
diff --git a/net/spdy/spdy_test_util.cc b/net/spdy/spdy_test_util.cc
index 3a7f771..07a5980 100644
--- a/net/spdy/spdy_test_util.cc
+++ b/net/spdy/spdy_test_util.cc
@@ -852,6 +852,102 @@ int CombineFrames(const spdy::SpdyFrame** frames, int num_frames,
return total_len;
}
+SpdySessionDependencies::SpdySessionDependencies()
+ : host_resolver(new MockHostResolver),
+ cert_verifier(new CertVerifier),
+ proxy_service(ProxyService::CreateDirect()),
+ ssl_config_service(new SSLConfigServiceDefaults),
+ socket_factory(new MockClientSocketFactory),
+ deterministic_socket_factory(new DeterministicMockClientSocketFactory),
+ http_auth_handler_factory(
+ HttpAuthHandlerFactory::CreateDefault(host_resolver.get())) {
+ // Note: The CancelledTransaction test does cleanup by running all
+ // tasks in the message loop (RunAllPending). Unfortunately, that
+ // doesn't clean up tasks on the host resolver thread; and
+ // TCPConnectJob is currently not cancellable. Using synchronous
+ // lookups allows the test to shutdown cleanly. Until we have
+ // cancellable TCPConnectJobs, use synchronous lookups.
+ host_resolver->set_synchronous_mode(true);
+}
+
+SpdySessionDependencies::SpdySessionDependencies(ProxyService* proxy_service)
+ : host_resolver(new MockHostResolver),
+ cert_verifier(new CertVerifier),
+ proxy_service(proxy_service),
+ ssl_config_service(new SSLConfigServiceDefaults),
+ socket_factory(new MockClientSocketFactory),
+ deterministic_socket_factory(new DeterministicMockClientSocketFactory),
+ http_auth_handler_factory(
+ HttpAuthHandlerFactory::CreateDefault(host_resolver.get())) {}
+
+SpdySessionDependencies::~SpdySessionDependencies() {}
+
+// static
+HttpNetworkSession* SpdySessionDependencies::SpdyCreateSession(
+ SpdySessionDependencies* session_deps) {
+ return new HttpNetworkSession(session_deps->host_resolver.get(),
+ session_deps->cert_verifier.get(),
+ NULL /* dnsrr_resolver */,
+ NULL /* dns_cert_checker */,
+ NULL /* ssl_host_info_factory */,
+ session_deps->proxy_service,
+ session_deps->socket_factory.get(),
+ session_deps->ssl_config_service,
+ new SpdySessionPool(NULL),
+ session_deps->http_auth_handler_factory.get(),
+ NULL,
+ NULL);
+}
+
+// static
+HttpNetworkSession* SpdySessionDependencies::SpdyCreateSessionDeterministic(
+ SpdySessionDependencies* session_deps) {
+ return new HttpNetworkSession(session_deps->host_resolver.get(),
+ session_deps->cert_verifier.get(),
+ NULL /* dnsrr_resolver */,
+ NULL /* dns_cert_checker */,
+ NULL /* ssl_host_info_factory */,
+ session_deps->proxy_service,
+ session_deps->
+ deterministic_socket_factory.get(),
+ session_deps->ssl_config_service,
+ new SpdySessionPool(NULL),
+ session_deps->http_auth_handler_factory.get(),
+ NULL,
+ NULL);
+}
+
+SpdyURLRequestContext::SpdyURLRequestContext() {
+ host_resolver_ = new MockHostResolver();
+ cert_verifier_ = new CertVerifier;
+ proxy_service_ = ProxyService::CreateDirect();
+ ssl_config_service_ = new SSLConfigServiceDefaults;
+ http_auth_handler_factory_ = HttpAuthHandlerFactory::CreateDefault(
+ host_resolver_);
+ http_transaction_factory_ = new HttpCache(
+ new HttpNetworkLayer(&socket_factory_,
+ host_resolver_,
+ cert_verifier_,
+ NULL /* dnsrr_resolver */,
+ NULL /* dns_cert_checker */,
+ NULL /* ssl_host_info_factory */,
+ proxy_service_,
+ ssl_config_service_,
+ new SpdySessionPool(NULL),
+ http_auth_handler_factory_,
+ network_delegate_,
+ NULL),
+ NULL /* net_log */,
+ HttpCache::DefaultBackend::InMemory(0));
+}
+
+SpdyURLRequestContext::~SpdyURLRequestContext() {
+ delete http_transaction_factory_;
+ delete http_auth_handler_factory_;
+ delete cert_verifier_;
+ delete host_resolver_;
+}
+
const SpdyHeaderInfo make_spdy_header(spdy::SpdyControlType type) {
const SpdyHeaderInfo kHeader = {
type, // Kind = Syn