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

Side by Side Diff: chrome/browser/net/connection_tester_unittest.cc

Issue 6338002: net: Remove typedef net::URLRequestContext URLRequestContext; (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for real Created 9 years, 11 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) 2011 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 "chrome/browser/net/connection_tester.h" 5 #include "chrome/browser/net/connection_tester.h"
6 6
7 #include "chrome/browser/browser_thread.h" 7 #include "chrome/browser/browser_thread.h"
8 #include "chrome/test/testing_pref_service.h" 8 #include "chrome/test/testing_pref_service.h"
9 #include "net/base/cert_verifier.h" 9 #include "net/base/cert_verifier.h"
10 #include "net/base/cookie_monster.h" 10 #include "net/base/cookie_monster.h"
11 #include "net/base/dnsrr_resolver.h" 11 #include "net/base/dnsrr_resolver.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // The test fixture is responsible for: 81 // The test fixture is responsible for:
82 // - Making sure each test has an IO loop running 82 // - Making sure each test has an IO loop running
83 // - Catching any host resolve requests and mapping them to localhost 83 // - Catching any host resolve requests and mapping them to localhost
84 // (so the test doesn't use any external network dependencies). 84 // (so the test doesn't use any external network dependencies).
85 class ConnectionTesterTest : public PlatformTest { 85 class ConnectionTesterTest : public PlatformTest {
86 public: 86 public:
87 ConnectionTesterTest() 87 ConnectionTesterTest()
88 : test_server_(net::TestServer::TYPE_HTTP, 88 : test_server_(net::TestServer::TYPE_HTTP,
89 FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))), 89 FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))),
90 client_socket_factory_(net::ClientSocketFactory::GetDefaultFactory()), 90 client_socket_factory_(net::ClientSocketFactory::GetDefaultFactory()),
91 proxy_script_fetcher_context_(new URLRequestContext), 91 proxy_script_fetcher_context_(new net::URLRequestContext),
92 message_loop_(MessageLoop::TYPE_IO), 92 message_loop_(MessageLoop::TYPE_IO),
93 io_thread_(BrowserThread::IO, &message_loop_) { 93 io_thread_(BrowserThread::IO, &message_loop_) {
94 InitializeRequestContext(); 94 InitializeRequestContext();
95 } 95 }
96 96
97 protected: 97 protected:
98 net::TestServer test_server_; 98 net::TestServer test_server_;
99 ConnectionTesterDelegate test_delegate_; 99 ConnectionTesterDelegate test_delegate_;
100 net::ClientSocketFactory* const client_socket_factory_; 100 net::ClientSocketFactory* const client_socket_factory_;
101 net::MockHostResolver host_resolver_; 101 net::MockHostResolver host_resolver_;
102 net::CertVerifier cert_verifier_; 102 net::CertVerifier cert_verifier_;
103 net::DnsRRResolver dnsrr_resolver_; 103 net::DnsRRResolver dnsrr_resolver_;
104 scoped_refptr<net::ProxyService> proxy_service_; 104 scoped_refptr<net::ProxyService> proxy_service_;
105 scoped_refptr<net::SSLConfigService> ssl_config_service_; 105 scoped_refptr<net::SSLConfigService> ssl_config_service_;
106 scoped_ptr<net::HttpTransactionFactory> http_transaction_factory_; 106 scoped_ptr<net::HttpTransactionFactory> http_transaction_factory_;
107 net::HttpAuthHandlerRegistryFactory http_auth_handler_factory_; 107 net::HttpAuthHandlerRegistryFactory http_auth_handler_factory_;
108 scoped_refptr<URLRequestContext> proxy_script_fetcher_context_; 108 scoped_refptr<net::URLRequestContext> proxy_script_fetcher_context_;
109 109
110 private: 110 private:
111 void InitializeRequestContext() { 111 void InitializeRequestContext() {
112 proxy_script_fetcher_context_->set_host_resolver(&host_resolver_); 112 proxy_script_fetcher_context_->set_host_resolver(&host_resolver_);
113 proxy_script_fetcher_context_->set_cert_verifier(&cert_verifier_); 113 proxy_script_fetcher_context_->set_cert_verifier(&cert_verifier_);
114 proxy_script_fetcher_context_->set_dnsrr_resolver(&dnsrr_resolver_); 114 proxy_script_fetcher_context_->set_dnsrr_resolver(&dnsrr_resolver_);
115 proxy_script_fetcher_context_->set_http_auth_handler_factory( 115 proxy_script_fetcher_context_->set_http_auth_handler_factory(
116 &http_auth_handler_factory_); 116 &http_auth_handler_factory_);
117 proxy_service_ = net::ProxyService::CreateDirect(); 117 proxy_service_ = net::ProxyService::CreateDirect();
118 proxy_script_fetcher_context_->set_proxy_service(proxy_service_); 118 proxy_script_fetcher_context_->set_proxy_service(proxy_service_);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // any pending tasks instead of running them. This causes a problem with 192 // any pending tasks instead of running them. This causes a problem with
193 // net::ClientSocketPoolBaseHelper, since the "Group" holds a pointer 193 // net::ClientSocketPoolBaseHelper, since the "Group" holds a pointer
194 // |backup_task| that it will try to deref during the destructor, but 194 // |backup_task| that it will try to deref during the destructor, but
195 // depending on the order that pending tasks were deleted in, it might 195 // depending on the order that pending tasks were deleted in, it might
196 // already be invalid! See http://crbug.com/43291. 196 // already be invalid! See http://crbug.com/43291.
197 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); 197 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
198 MessageLoop::current()->Run(); 198 MessageLoop::current()->Run();
199 } 199 }
200 200
201 } // namespace 201 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698