Index: chrome/browser/url_fetcher_unittest.cc |
=================================================================== |
--- chrome/browser/url_fetcher_unittest.cc (revision 7499) |
+++ chrome/browser/url_fetcher_unittest.cc (working copy) |
@@ -338,15 +338,19 @@ |
// Create the fetcher on the main thread. Since IO will happen on the main |
// thread, this will test URLFetcher's ability to do everything on one |
// thread. |
- TestServer server(kDocRoot); |
+ scoped_refptr<HTTPTestServer> server = |
+ HTTPTestServer::CreateServer(kDocRoot); |
+ ASSERT_TRUE(NULL != server.get()); |
- CreateFetcher(GURL(server.TestServerPage("defaultresponse"))); |
+ CreateFetcher(GURL(server->TestServerPage("defaultresponse"))); |
MessageLoop::current()->Run(); |
} |
TEST_F(URLFetcherTest, DifferentThreadsTest) { |
- TestServer server(kDocRoot); |
+ scoped_refptr<HTTPTestServer> server = |
+ HTTPTestServer::CreateServer(kDocRoot); |
+ ASSERT_TRUE(NULL != server.get()); |
// Create a separate thread that will create the URLFetcher. The current |
// (main) thread will do the IO, and when the fetch is complete it will |
// terminate the main thread's message loop; then the other thread's |
@@ -355,27 +359,33 @@ |
base::Thread t("URLFetcher test thread"); |
t.Start(); |
t.message_loop()->PostTask(FROM_HERE, new FetcherWrapperTask(this, |
- GURL(server.TestServerPage("defaultresponse")))); |
+ GURL(server->TestServerPage("defaultresponse")))); |
MessageLoop::current()->Run(); |
} |
TEST_F(URLFetcherPostTest, Basic) { |
- TestServer server(kDocRoot); |
- CreateFetcher(GURL(server.TestServerPage("echo"))); |
+ scoped_refptr<HTTPTestServer> server = |
+ HTTPTestServer::CreateServer(kDocRoot); |
+ ASSERT_TRUE(NULL != server.get()); |
+ CreateFetcher(GURL(server->TestServerPage("echo"))); |
MessageLoop::current()->Run(); |
} |
TEST_F(URLFetcherHeadersTest, Headers) { |
- TestServer server(L"net/data/url_request_unittest"); |
- CreateFetcher(GURL(server.TestServerPage("files/with-headers.html"))); |
+ scoped_refptr<HTTPTestServer> server = |
+ HTTPTestServer::CreateServer(L"net/data/url_request_unittest"); |
+ ASSERT_TRUE(NULL != server.get()); |
+ CreateFetcher(GURL(server->TestServerPage("files/with-headers.html"))); |
MessageLoop::current()->Run(); |
// The actual tests are in the URLFetcherHeadersTest fixture. |
} |
TEST_F(URLFetcherProtectTest, Overload) { |
- TestServer server(kDocRoot); |
- GURL url = GURL(server.TestServerPage("defaultresponse")); |
+ scoped_refptr<HTTPTestServer> server = |
+ HTTPTestServer::CreateServer(kDocRoot); |
+ ASSERT_TRUE(NULL != server.get()); |
+ GURL url = GURL(server->TestServerPage("defaultresponse")); |
// Registers an entry for test url. It only allows 3 requests to be sent |
// in 200 milliseconds. |
@@ -390,8 +400,10 @@ |
} |
TEST_F(URLFetcherProtectTest, ServerUnavailable) { |
- TestServer server(L"chrome/test/data"); |
- GURL url = GURL(server.TestServerPage("files/server-unavailable.html")); |
+ scoped_refptr<HTTPTestServer> server = |
+ HTTPTestServer::CreateServer(L"chrome/test/data"); |
+ ASSERT_TRUE(NULL != server.get()); |
+ GURL url = GURL(server->TestServerPage("files/server-unavailable.html")); |
// Registers an entry for test url. The backoff time is calculated by: |
// new_backoff = 2.0 * old_backoff + 0 |
@@ -408,17 +420,21 @@ |
} |
TEST_F(URLFetcherBadHTTPSTest, BadHTTPSTest) { |
- HTTPSTestServer server(util_.kHostName, util_.kBadHTTPSPort, |
+ scoped_refptr<HTTPSTestServer> server = |
+ HTTPSTestServer::CreateServer(util_.kHostName, util_.kBadHTTPSPort, |
kDocRoot, util_.GetExpiredCertPath().ToWStringHack()); |
+ ASSERT_TRUE(NULL != server.get()); |
- CreateFetcher(GURL(server.TestServerPage("defaultresponse"))); |
+ CreateFetcher(GURL(server->TestServerPage("defaultresponse"))); |
MessageLoop::current()->Run(); |
} |
TEST_F(URLFetcherCancelTest, ReleasesContext) { |
- TestServer server(L"chrome/test/data"); |
- GURL url = GURL(server.TestServerPage("files/server-unavailable.html")); |
+ scoped_refptr<HTTPTestServer> server = |
+ HTTPTestServer::CreateServer(L"chrome/test/data"); |
+ ASSERT_TRUE(NULL != server.get()); |
+ GURL url = GURL(server->TestServerPage("files/server-unavailable.html")); |
// Registers an entry for test url. The backoff time is calculated by: |
// new_backoff = 2.0 * old_backoff + 0 |