diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-20 23:30:37 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-20 23:30:37 +0000 |
commit | 66627408337e26285ae1849b251b27018d0f91ea (patch) | |
tree | 7f2e4092f701ae24f0afa029ef8b7218ad90c47d /net | |
parent | a3ba3289219898411b3f3d9aea4a316a0bea19d7 (diff) | |
download | chromium_src-66627408337e26285ae1849b251b27018d0f91ea.zip chromium_src-66627408337e26285ae1849b251b27018d0f91ea.tar.gz chromium_src-66627408337e26285ae1849b251b27018d0f91ea.tar.bz2 |
More fixes for bad reference counting.
TBR=erikkay
Review URL: http://codereview.chromium.org/27021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10130 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/url_request/url_request_unittest.h | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/net/url_request/url_request_unittest.h b/net/url_request/url_request_unittest.h index d880367..53b137b 100644 --- a/net/url_request/url_request_unittest.h +++ b/net/url_request/url_request_unittest.h @@ -419,15 +419,14 @@ class HTTPSTestServer : public HTTPTestServer { // Create a server with a valid certificate // TODO(dkegel): HTTPSTestServer should not require an instance to specify // stock test certificates - static HTTPSTestServer* CreateGoodServer(const std::wstring& document_root) { - HTTPSTestServer* test_server = new HTTPSTestServer(); + static scoped_refptr<HTTPSTestServer> CreateGoodServer(const std::wstring& document_root) { + scoped_refptr<HTTPSTestServer> test_server = new HTTPSTestServer(); FilePath docroot = FilePath::FromWStringHack(document_root); FilePath certpath = test_server->launcher_.GetOKCertPath(); if (!test_server->Start(net::TestServerLauncher::ProtoHTTP, net::TestServerLauncher::kHostName, net::TestServerLauncher::kOKHTTPSPort, docroot, certpath)) { - test_server->Release(); return NULL; } return test_server; @@ -435,23 +434,22 @@ class HTTPSTestServer : public HTTPTestServer { // Create a server with an up to date certificate for the wrong hostname // for this host - static HTTPSTestServer* CreateMismatchedServer( + static scoped_refptr<HTTPSTestServer> CreateMismatchedServer( const std::wstring& document_root) { - HTTPSTestServer* test_server = new HTTPSTestServer(); + scoped_refptr<HTTPSTestServer> test_server = new HTTPSTestServer(); FilePath docroot = FilePath::FromWStringHack(document_root); FilePath certpath = test_server->launcher_.GetOKCertPath(); if (!test_server->Start(net::TestServerLauncher::ProtoHTTP, net::TestServerLauncher::kMismatchedHostName, net::TestServerLauncher::kOKHTTPSPort, docroot, certpath)) { - test_server->Release(); return NULL; - } + } return test_server; } // Create a server with an expired certificate - static HTTPSTestServer* CreateExpiredServer( + static scoped_refptr<HTTPSTestServer> CreateExpiredServer( const std::wstring& document_root) { HTTPSTestServer* test_server = new HTTPSTestServer(); FilePath docroot = FilePath::FromWStringHack(document_root); @@ -460,22 +458,21 @@ class HTTPSTestServer : public HTTPTestServer { net::TestServerLauncher::kHostName, net::TestServerLauncher::kBadHTTPSPort, docroot, certpath)) { - test_server->Release(); return NULL; } return test_server; } // Create a server with an arbitrary certificate - static HTTPSTestServer* CreateServer(const std::string& host_name, int port, - const std::wstring& document_root, - const std::wstring& cert_path) { - HTTPSTestServer* test_server = new HTTPSTestServer(); + static scoped_refptr<HTTPSTestServer> CreateServer( + const std::string& host_name, int port, + const std::wstring& document_root, + const std::wstring& cert_path) { + scoped_refptr<HTTPSTestServer> test_server = new HTTPSTestServer(); FilePath docroot = FilePath::FromWStringHack(document_root); FilePath certpath = FilePath::FromWStringHack(cert_path); if (!test_server->Start(net::TestServerLauncher::ProtoHTTP, host_name, port, docroot, certpath)) { - test_server->Release(); return NULL; } return test_server; @@ -494,21 +491,22 @@ class FTPTestServer : public BaseTestServer { FTPTestServer() { } - static FTPTestServer* CreateServer(const std::wstring& document_root) { + static scoped_refptr<FTPTestServer> CreateServer( + const std::wstring& document_root) { std::string blank; return CreateServer(document_root, blank, blank); } - static FTPTestServer* CreateServer(const std::wstring& document_root, - const std::string& url_user, - const std::string& url_password) { - FTPTestServer* test_server = new FTPTestServer(); + static scoped_refptr<FTPTestServer> CreateServer( + const std::wstring& document_root, + const std::string& url_user, + const std::string& url_password) { + scoped_refptr<FTPTestServer> test_server = new FTPTestServer(); FilePath docroot = FilePath::FromWStringHack(document_root); FilePath no_cert; if (!test_server->Start(net::TestServerLauncher::ProtoFTP, kDefaultHostName, kFTPDefaultPort, docroot, no_cert, url_user, url_password)) { - test_server->Release(); return NULL; } return test_server; |