diff options
author | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-13 04:52:01 +0000 |
---|---|---|
committer | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-13 04:52:01 +0000 |
commit | db8f44cb41f402a9145bace60f6097410f46881d (patch) | |
tree | e1a403ae9c38a7b5671133185ddc1ac936a89edf /net/url_request | |
parent | d49801990067e7fe9a3caf141f31c6e6ba58fcfc (diff) | |
download | chromium_src-db8f44cb41f402a9145bace60f6097410f46881d.zip chromium_src-db8f44cb41f402a9145bace60f6097410f46881d.tar.gz chromium_src-db8f44cb41f402a9145bace60f6097410f46881d.tar.bz2 |
Reverting 6966.
this failed UI tests catastrophically
Review URL: http://codereview.chromium.org/14103
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6968 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request')
-rw-r--r-- | net/url_request/url_request_context.cc | 14 | ||||
-rw-r--r-- | net/url_request/url_request_context.h | 24 | ||||
-rw-r--r-- | net/url_request/url_request_unittest.cc | 12 | ||||
-rw-r--r-- | net/url_request/url_request_unittest.h | 12 |
4 files changed, 33 insertions, 29 deletions
diff --git a/net/url_request/url_request_context.cc b/net/url_request/url_request_context.cc deleted file mode 100644 index 84c2229..0000000 --- a/net/url_request/url_request_context.cc +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) 2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "net/url_request/url_request_context.h" - -// These headers are used implicitly by the destructor when destroying the -// scoped_[ref]ptr. - -#include "net/proxy/proxy_service.h" -#include "net/base/cookie_monster.h" - -URLRequestContext::URLRequestContext() : is_off_the_record_(false) {} -URLRequestContext::~URLRequestContext() {} diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h index 7b7d392..5ea25db 100644 --- a/net/url_request/url_request_context.h +++ b/net/url_request/url_request_context.h @@ -28,8 +28,13 @@ class ProxyService; class URLRequestContext : public base::RefCountedThreadSafe<URLRequestContext> { public: - URLRequestContext(); - + URLRequestContext() + : proxy_service_(NULL), + http_transaction_factory_(NULL), + cookie_store_(NULL), + is_off_the_record_(false) { + } + // Get the proxy service for this context. net::ProxyService* proxy_service() const { return proxy_service_; @@ -37,11 +42,11 @@ class URLRequestContext : // Gets the http transaction factory for this context. net::HttpTransactionFactory* http_transaction_factory() { - return http_transaction_factory_.get(); + return http_transaction_factory_; } // Gets the cookie store for this context. - net::CookieMonster* cookie_store() { return cookie_store_.get(); } + net::CookieMonster* cookie_store() { return cookie_store_; } // Gets the cookie policy for this context. net::CookiePolicy* cookie_policy() { return &cookie_policy_; } @@ -63,13 +68,14 @@ class URLRequestContext : // Do not call this directly. TODO(darin): extending from RefCounted* should // not require a public destructor! - virtual ~URLRequestContext(); + virtual ~URLRequestContext() {} protected: - // The following members are expected to be initialized by subclasses. - scoped_refptr<net::ProxyService> proxy_service_; - scoped_ptr<net::HttpTransactionFactory> http_transaction_factory_; - scoped_ptr<net::CookieMonster> cookie_store_; + // The following members are expected to be initialized and owned by + // subclasses. + net::ProxyService* proxy_service_; + net::HttpTransactionFactory* http_transaction_factory_; + net::CookieMonster* cookie_store_; net::CookiePolicy cookie_policy_; net::AuthCache ftp_auth_cache_; std::string user_agent_; diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index 193cc21..d344319 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc @@ -29,6 +29,7 @@ #include "net/disk_cache/disk_cache.h" #include "net/http/http_cache.h" #include "net/http/http_network_layer.h" +#include "net/proxy/proxy_resolver_null.h" #include "net/proxy/proxy_service.h" #include "net/url_request/url_request.h" #include "testing/gtest/include/gtest/gtest.h" @@ -41,10 +42,15 @@ namespace { class URLRequestHttpCacheContext : public URLRequestContext { public: URLRequestHttpCacheContext() { - proxy_service_ = net::ProxyService::CreateNull(); - http_transaction_factory_.reset( + proxy_service_ = new net::ProxyService(new net::ProxyResolverNull); + http_transaction_factory_ = new net::HttpCache(net::HttpNetworkLayer::CreateFactory(proxy_service_), - disk_cache::CreateInMemoryCacheBackend(0))); + disk_cache::CreateInMemoryCacheBackend(0)); + } + + virtual ~URLRequestHttpCacheContext() { + delete http_transaction_factory_; + delete proxy_service_; } }; diff --git a/net/url_request/url_request_unittest.h b/net/url_request/url_request_unittest.h index 58b3f606d..e2b8ca3 100644 --- a/net/url_request/url_request_unittest.h +++ b/net/url_request/url_request_unittest.h @@ -23,6 +23,7 @@ #include "net/base/net_errors.h" #include "net/http/http_network_layer.h" #include "net/url_request/url_request.h" +#include "net/proxy/proxy_resolver_null.h" #include "net/proxy/proxy_service.h" #include "testing/gtest/include/gtest/gtest.h" #include "googleurl/src/url_util.h" @@ -34,9 +35,14 @@ const std::string kDefaultHostName("localhost"); class TestURLRequestContext : public URLRequestContext { public: TestURLRequestContext() { - proxy_service_ = net::ProxyService::CreateNull(); - http_transaction_factory_.reset( - net::HttpNetworkLayer::CreateFactory(proxy_service_)); + proxy_service_ = new net::ProxyService(new net::ProxyResolverNull); + http_transaction_factory_ = + net::HttpNetworkLayer::CreateFactory(proxy_service_); + } + + virtual ~TestURLRequestContext() { + delete http_transaction_factory_; + delete proxy_service_; } }; |