Index: net/proxy/proxy_script_fetcher_impl_unittest.cc |
diff --git a/net/proxy/proxy_script_fetcher_impl_unittest.cc b/net/proxy/proxy_script_fetcher_impl_unittest.cc |
index 437d88ab6b00e4f8b1393ddcaea8d1a305c3961b..7d117ebd84237a7c92a9282bc2e13058784c1a61 100644 |
--- a/net/proxy/proxy_script_fetcher_impl_unittest.cc |
+++ b/net/proxy/proxy_script_fetcher_impl_unittest.cc |
@@ -24,7 +24,7 @@ |
#include "net/http/http_server_properties_impl.h" |
#include "net/http/transport_security_state.h" |
#include "net/ssl/ssl_config_service_defaults.h" |
-#include "net/test/spawned_test_server/spawned_test_server.h" |
+#include "net/test/embedded_test_server/embedded_test_server.h" |
#include "net/url_request/url_request_context_storage.h" |
#include "net/url_request/url_request_file_job.h" |
#include "net/url_request/url_request_job_factory_impl.h" |
@@ -186,15 +186,13 @@ class BasicNetworkDelegate : public NetworkDelegateImpl { |
class ProxyScriptFetcherImplTest : public PlatformTest { |
public: |
- ProxyScriptFetcherImplTest() |
- : test_server_(SpawnedTestServer::TYPE_HTTP, |
- SpawnedTestServer::kLocalhost, |
- base::FilePath(kDocRoot)) { |
+ ProxyScriptFetcherImplTest() { |
+ test_server_.AddDefaultHandlers(base::FilePath(kDocRoot)); |
context_.set_network_delegate(&network_delegate_); |
} |
protected: |
- SpawnedTestServer test_server_; |
+ EmbeddedTestServer test_server_; |
BasicNetworkDelegate network_delegate_; |
RequestContext context_; |
}; |
@@ -232,7 +230,7 @@ TEST_F(ProxyScriptFetcherImplTest, HttpMimeType) { |
ProxyScriptFetcherImpl pac_fetcher(&context_); |
{ // Fetch a PAC with mime type "text/plain" |
- GURL url(test_server_.GetURL("files/pac.txt")); |
+ GURL url(test_server_.GetURL("/pac.txt")); |
base::string16 text; |
TestCompletionCallback callback; |
int result = pac_fetcher.Fetch(url, &text, callback.callback()); |
@@ -241,7 +239,7 @@ TEST_F(ProxyScriptFetcherImplTest, HttpMimeType) { |
EXPECT_EQ(ASCIIToUTF16("-pac.txt-\n"), text); |
} |
{ // Fetch a PAC with mime type "text/html" |
- GURL url(test_server_.GetURL("files/pac.html")); |
+ GURL url(test_server_.GetURL("/pac.html")); |
base::string16 text; |
TestCompletionCallback callback; |
int result = pac_fetcher.Fetch(url, &text, callback.callback()); |
@@ -250,7 +248,7 @@ TEST_F(ProxyScriptFetcherImplTest, HttpMimeType) { |
EXPECT_EQ(ASCIIToUTF16("-pac.html-\n"), text); |
} |
{ // Fetch a PAC with mime type "application/x-ns-proxy-autoconfig" |
- GURL url(test_server_.GetURL("files/pac.nsproxy")); |
+ GURL url(test_server_.GetURL("/pac.nsproxy")); |
base::string16 text; |
TestCompletionCallback callback; |
int result = pac_fetcher.Fetch(url, &text, callback.callback()); |
@@ -266,7 +264,7 @@ TEST_F(ProxyScriptFetcherImplTest, HttpStatusCode) { |
ProxyScriptFetcherImpl pac_fetcher(&context_); |
{ // Fetch a PAC which gives a 500 -- FAIL |
- GURL url(test_server_.GetURL("files/500.pac")); |
+ GURL url(test_server_.GetURL("/500.pac")); |
base::string16 text; |
TestCompletionCallback callback; |
int result = pac_fetcher.Fetch(url, &text, callback.callback()); |
@@ -275,7 +273,7 @@ TEST_F(ProxyScriptFetcherImplTest, HttpStatusCode) { |
EXPECT_TRUE(text.empty()); |
} |
{ // Fetch a PAC which gives a 404 -- FAIL |
- GURL url(test_server_.GetURL("files/404.pac")); |
+ GURL url(test_server_.GetURL("/404.pac")); |
base::string16 text; |
TestCompletionCallback callback; |
int result = pac_fetcher.Fetch(url, &text, callback.callback()); |
@@ -292,7 +290,7 @@ TEST_F(ProxyScriptFetcherImplTest, ContentDisposition) { |
// Fetch PAC scripts via HTTP with a Content-Disposition header -- should |
// have no effect. |
- GURL url(test_server_.GetURL("files/downloadable.pac")); |
+ GURL url(test_server_.GetURL("/downloadable.pac")); |
base::string16 text; |
TestCompletionCallback callback; |
int result = pac_fetcher.Fetch(url, &text, callback.callback()); |
@@ -308,7 +306,7 @@ TEST_F(ProxyScriptFetcherImplTest, NoCache) { |
ProxyScriptFetcherImpl pac_fetcher(&context_); |
// Fetch a PAC script whose HTTP headers make it cacheable for 1 hour. |
- GURL url(test_server_.GetURL("files/cacheable_1hr.pac")); |
+ GURL url(test_server_.GetURL("/cacheable_1hr.pac")); |
{ |
base::string16 text; |
TestCompletionCallback callback; |
@@ -319,7 +317,7 @@ TEST_F(ProxyScriptFetcherImplTest, NoCache) { |
} |
// Kill the HTTP server. |
- ASSERT_TRUE(test_server_.Stop()); |
+ ASSERT_TRUE(test_server_.ShutdownAndWaitUntilComplete()); |
// Try to fetch the file again. Since the server is not running anymore, the |
// call should fail, thus indicating that the file was not fetched from the |
@@ -345,7 +343,7 @@ TEST_F(ProxyScriptFetcherImplTest, TooLarge) { |
// These two URLs are the same file, but are http:// vs file:// |
GURL urls[] = { |
- test_server_.GetURL("files/large-pac.nsproxy"), |
+ test_server_.GetURL("/large-pac.nsproxy"), |
#if !defined(DISABLE_FILE_SUPPORT) |
GetTestFileUrl("large-pac.nsproxy") |
#endif |
@@ -367,7 +365,7 @@ TEST_F(ProxyScriptFetcherImplTest, TooLarge) { |
pac_fetcher.SetSizeConstraint(prev_size); |
{ // Make sure we can still fetch regular URLs. |
- GURL url(test_server_.GetURL("files/pac.nsproxy")); |
+ GURL url(test_server_.GetURL("/pac.nsproxy")); |
base::string16 text; |
TestCompletionCallback callback; |
int result = pac_fetcher.Fetch(url, &text, callback.callback()); |
@@ -389,7 +387,7 @@ TEST_F(ProxyScriptFetcherImplTest, 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(test_server_.GetURL("slow/proxy.pac?1.2")); |
+ GURL url(test_server_.GetURL("/slow/proxy.pac?1.2")); |
base::string16 text; |
TestCompletionCallback callback; |
int result = pac_fetcher.Fetch(url, &text, callback.callback()); |
@@ -402,7 +400,7 @@ TEST_F(ProxyScriptFetcherImplTest, Hang) { |
pac_fetcher.SetTimeoutConstraint(prev_timeout); |
{ // Make sure we can still fetch regular URLs. |
- GURL url(test_server_.GetURL("files/pac.nsproxy")); |
+ GURL url(test_server_.GetURL("/pac.nsproxy")); |
base::string16 text; |
TestCompletionCallback callback; |
int result = pac_fetcher.Fetch(url, &text, callback.callback()); |
@@ -422,7 +420,7 @@ TEST_F(ProxyScriptFetcherImplTest, Encodings) { |
// Test a response that is gzip-encoded -- should get inflated. |
{ |
- GURL url(test_server_.GetURL("files/gzipped_pac")); |
+ GURL url(test_server_.GetURL("/gzipped_pac")); |
base::string16 text; |
TestCompletionCallback callback; |
int result = pac_fetcher.Fetch(url, &text, callback.callback()); |
@@ -434,7 +432,7 @@ TEST_F(ProxyScriptFetcherImplTest, Encodings) { |
// Test a response that was served as UTF-16 (BE). It should |
// be converted to UTF8. |
{ |
- GURL url(test_server_.GetURL("files/utf16be_pac")); |
+ GURL url(test_server_.GetURL("/utf16be_pac")); |
base::string16 text; |
TestCompletionCallback callback; |
int result = pac_fetcher.Fetch(url, &text, callback.callback()); |