summaryrefslogtreecommitdiffstats
path: root/net/proxy
diff options
context:
space:
mode:
authornsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-30 23:29:54 +0000
committernsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-30 23:29:54 +0000
commit5d9c52a60b5e91819c2664572a6e0ef343a3ea28 (patch)
tree30406e4c144cf8d036a4ef1e4dabebcc1b6a8e05 /net/proxy
parent997c8ca739b3f79ff76adbbf421c7056af8ccdcb (diff)
downloadchromium_src-5d9c52a60b5e91819c2664572a6e0ef343a3ea28.zip
chromium_src-5d9c52a60b5e91819c2664572a6e0ef343a3ea28.tar.gz
chromium_src-5d9c52a60b5e91819c2664572a6e0ef343a3ea28.tar.bz2
Revert 7508.7509 and 7510
Review URL: http://codereview.chromium.org/17030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7514 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy')
-rw-r--r--net/proxy/proxy_script_fetcher_unittest.cc40
1 files changed, 15 insertions, 25 deletions
diff --git a/net/proxy/proxy_script_fetcher_unittest.cc b/net/proxy/proxy_script_fetcher_unittest.cc
index 2139b6c..8507a86 100644
--- a/net/proxy/proxy_script_fetcher_unittest.cc
+++ b/net/proxy/proxy_script_fetcher_unittest.cc
@@ -181,25 +181,23 @@ TEST_F(ProxyScriptFetcherTest, FileUrl) {
// Note that all mime types are allowed for PAC file, to be consistent
// with other browsers.
TEST_F(ProxyScriptFetcherTest, HttpMimeType) {
- scoped_refptr<HTTPTestServer> server =
- HTTPTestServer::CreateServer(kDocRoot);
- ASSERT_TRUE(NULL != server.get());
+ TestServer server(kDocRoot);
SynchFetcher pac_fetcher;
{ // Fetch a PAC with mime type "text/plain"
- GURL url = server->TestServerPage("files/pac.txt");
+ GURL url = server.TestServerPage("files/pac.txt");
FetchResult result = pac_fetcher.Fetch(url);
EXPECT_EQ(net::OK, result.code);
EXPECT_EQ("-pac.txt-\n", result.bytes);
}
{ // Fetch a PAC with mime type "text/html"
- GURL url = server->TestServerPage("files/pac.html");
+ GURL url = server.TestServerPage("files/pac.html");
FetchResult result = pac_fetcher.Fetch(url);
EXPECT_EQ(net::OK, result.code);
EXPECT_EQ("-pac.html-\n", result.bytes);
}
{ // Fetch a PAC with mime type "application/x-ns-proxy-autoconfig"
- GURL url = server->TestServerPage("files/pac.nsproxy");
+ GURL url = server.TestServerPage("files/pac.nsproxy");
FetchResult result = pac_fetcher.Fetch(url);
EXPECT_EQ(net::OK, result.code);
EXPECT_EQ("-pac.nsproxy-\n", result.bytes);
@@ -207,19 +205,17 @@ TEST_F(ProxyScriptFetcherTest, HttpMimeType) {
}
TEST_F(ProxyScriptFetcherTest, HttpStatusCode) {
- scoped_refptr<HTTPTestServer> server =
- HTTPTestServer::CreateServer(kDocRoot);
- ASSERT_TRUE(NULL != server.get());
+ TestServer server(kDocRoot);
SynchFetcher pac_fetcher;
{ // Fetch a PAC which gives a 500 -- FAIL
- GURL url = server->TestServerPage("files/500.pac");
+ GURL url = server.TestServerPage("files/500.pac");
FetchResult result = pac_fetcher.Fetch(url);
EXPECT_EQ(net::ERR_PAC_STATUS_NOT_OK, result.code);
EXPECT_TRUE(result.bytes.empty());
}
{ // Fetch a PAC which gives a 404 -- FAIL
- GURL url = server->TestServerPage("files/404.pac");
+ GURL url = server.TestServerPage("files/404.pac");
FetchResult result = pac_fetcher.Fetch(url);
EXPECT_EQ(net::ERR_PAC_STATUS_NOT_OK, result.code);
EXPECT_TRUE(result.bytes.empty());
@@ -227,23 +223,19 @@ TEST_F(ProxyScriptFetcherTest, HttpStatusCode) {
}
TEST_F(ProxyScriptFetcherTest, ContentDisposition) {
- scoped_refptr<HTTPTestServer> server =
- HTTPTestServer::CreateServer(kDocRoot);
- ASSERT_TRUE(NULL != server.get());
+ TestServer server(kDocRoot);
SynchFetcher pac_fetcher;
// Fetch PAC scripts via HTTP with a Content-Disposition header -- should
// have no effect.
- GURL url = server->TestServerPage("files/downloadable.pac");
+ GURL url = server.TestServerPage("files/downloadable.pac");
FetchResult result = pac_fetcher.Fetch(url);
EXPECT_EQ(net::OK, result.code);
EXPECT_EQ("-downloadable.pac-\n", result.bytes);
}
TEST_F(ProxyScriptFetcherTest, TooLarge) {
- scoped_refptr<HTTPTestServer> server =
- HTTPTestServer::CreateServer(kDocRoot);
- ASSERT_TRUE(NULL != server.get());
+ TestServer server(kDocRoot);
SynchFetcher pac_fetcher;
// Set the maximum response size to 50 bytes.
@@ -251,7 +243,7 @@ TEST_F(ProxyScriptFetcherTest, TooLarge) {
// These two URLs are the same file, but are http:// vs file://
GURL urls[] = {
- server->TestServerPage("files/large-pac.nsproxy"),
+ server.TestServerPage("files/large-pac.nsproxy"),
GetTestFileUrl("large-pac.nsproxy")
};
@@ -268,7 +260,7 @@ TEST_F(ProxyScriptFetcherTest, TooLarge) {
net::ProxyScriptFetcher::SetSizeConstraintForUnittest(prev_size);
{ // Make sure we can still fetch regular URLs.
- GURL url = server->TestServerPage("files/pac.nsproxy");
+ GURL url = server.TestServerPage("files/pac.nsproxy");
FetchResult result = pac_fetcher.Fetch(url);
EXPECT_EQ(net::OK, result.code);
EXPECT_EQ("-pac.nsproxy-\n", result.bytes);
@@ -276,9 +268,7 @@ TEST_F(ProxyScriptFetcherTest, TooLarge) {
}
TEST_F(ProxyScriptFetcherTest, Hang) {
- scoped_refptr<HTTPTestServer> server =
- HTTPTestServer::CreateServer(kDocRoot);
- ASSERT_TRUE(NULL != server.get());
+ TestServer server(kDocRoot);
SynchFetcher pac_fetcher;
// Set the timeout period to 0.5 seconds.
@@ -287,7 +277,7 @@ TEST_F(ProxyScriptFetcherTest, Hang) {
// Try fetching a URL which takes 1.2 seconds. We should abort the request
// after 500 ms, and fail with a timeout error.
- { GURL url = server->TestServerPage("slow/proxy.pac?1.2");
+ { GURL url = server.TestServerPage("slow/proxy.pac?1.2");
FetchResult result = pac_fetcher.Fetch(url);
EXPECT_EQ(net::ERR_TIMED_OUT, result.code);
EXPECT_TRUE(result.bytes.empty());
@@ -297,7 +287,7 @@ TEST_F(ProxyScriptFetcherTest, Hang) {
net::ProxyScriptFetcher::SetTimeoutConstraintForUnittest(prev_timeout);
{ // Make sure we can still fetch regular URLs.
- GURL url = server->TestServerPage("files/pac.nsproxy");
+ GURL url = server.TestServerPage("files/pac.nsproxy");
FetchResult result = pac_fetcher.Fetch(url);
EXPECT_EQ(net::OK, result.code);
EXPECT_EQ("-pac.nsproxy-\n", result.bytes);