diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-03 18:57:22 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-03 18:57:22 +0000 |
commit | ce7d0cbc07beeac9515f0343c6d56e77ee83879a (patch) | |
tree | e7fa63e776a5fa9873e735a0b1b31b7c19249945 | |
parent | 47914ce872d5e3c1901eeeb44c02dd197c01992d (diff) | |
download | chromium_src-ce7d0cbc07beeac9515f0343c6d56e77ee83879a.zip chromium_src-ce7d0cbc07beeac9515f0343c6d56e77ee83879a.tar.gz chromium_src-ce7d0cbc07beeac9515f0343c6d56e77ee83879a.tar.bz2 |
GTTF: rename net::TestServer -> net::SpawnedTestServer
This is a part of replacing most usages of the Python test server
with an in-process C++ test server that should be easier to debug.
BUG=96594
R=rch@chromium.org
Review URL: https://codereview.chromium.org/14702004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198151 0039d316-1c4b-4281-b951-d872f2087c98
97 files changed, 792 insertions, 756 deletions
diff --git a/chrome/browser/browser_keyevents_browsertest.cc b/chrome/browser/browser_keyevents_browsertest.cc index 5063e6b..20594a2 100644 --- a/chrome/browser/browser_keyevents_browsertest.cc +++ b/chrome/browser/browser_keyevents_browsertest.cc @@ -14,8 +14,8 @@ #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" -#include "chrome/test/base/interactive_test_utils.h" #include "chrome/test/base/in_process_browser_test.h" +#include "chrome/test/base/interactive_test_utils.h" #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/dom_operation_notification_details.h" #include "content/public/browser/notification_registrar.h" @@ -25,7 +25,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_view.h" #include "content/public/test/browser_test_utils.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/views/controls/textfield/textfield.h" diff --git a/chrome/browser/captive_portal/captive_portal_browsertest.cc b/chrome/browser/captive_portal/captive_portal_browsertest.cc index 90ac2b9..80fbd18 100644 --- a/chrome/browser/captive_portal/captive_portal_browsertest.cc +++ b/chrome/browser/captive_portal/captive_portal_browsertest.cc @@ -1557,8 +1557,8 @@ IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, HttpsNonTimeoutError) { // Make sure no captive portal test triggers on HTTPS timeouts of iframes. IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, HttpsIframeTimeout) { // Use an HTTPS server for the top level page. - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); @@ -1609,11 +1609,11 @@ IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, RedirectSSLCertError) { // Need an HTTP TestServer to handle a dynamically created server redirect. ASSERT_TRUE(test_server()->Start()); - net::TestServer::SSLOptions ssl_options; + net::SpawnedTestServer::SSLOptions ssl_options; ssl_options.server_certificate = - net::TestServer::SSLOptions::CERT_MISMATCHED_NAME; - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, ssl_options, + net::SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME; + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, ssl_options, base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); @@ -1697,11 +1697,11 @@ IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, SSLCertErrorLogin) { // Need an HTTP TestServer to handle a dynamically created server redirect. ASSERT_TRUE(test_server()->Start()); - net::TestServer::SSLOptions https_options; + net::SpawnedTestServer::SSLOptions https_options; https_options.server_certificate = - net::TestServer::SSLOptions::CERT_MISMATCHED_NAME; - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, https_options, + net::SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME; + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, https_options, base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); @@ -2158,8 +2158,8 @@ IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, HttpToHttpsRedirectLogin) { // An HTTPS page redirects to an HTTP page. IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, HttpsToHttpRedirect) { // Use an HTTPS server for the top level page. - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); diff --git a/chrome/browser/chrome_security_exploit_browsertest.cc b/chrome/browser/chrome_security_exploit_browsertest.cc index 2ac5cdc..2a181b8 100644 --- a/chrome/browser/chrome_security_exploit_browsertest.cc +++ b/chrome/browser/chrome_security_exploit_browsertest.cc @@ -32,9 +32,9 @@ class ChromeSecurityExploitBrowserTest : public InProcessBrowserTest { virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { ASSERT_TRUE(test_server()->Start()); - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); diff --git a/chrome/browser/chrome_switches_browsertest.cc b/chrome/browser/chrome_switches_browsertest.cc index 859b1d6..ad89341 100644 --- a/chrome/browser/chrome_switches_browsertest.cc +++ b/chrome/browser/chrome_switches_browsertest.cc @@ -10,7 +10,7 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" class HostRulesTest : public InProcessBrowserTest { protected: diff --git a/chrome/browser/collected_cookies_browsertest.cc b/chrome/browser/collected_cookies_browsertest.cc index b8548e8..2f9fce7 100644 --- a/chrome/browser/collected_cookies_browsertest.cc +++ b/chrome/browser/collected_cookies_browsertest.cc @@ -13,7 +13,7 @@ #include "chrome/common/url_constants.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" namespace { diff --git a/chrome/browser/content_settings/content_settings_browsertest.cc b/chrome/browser/content_settings/content_settings_browsertest.cc index f4105ad..120118d3 100644 --- a/chrome/browser/content_settings/content_settings_browsertest.cc +++ b/chrome/browser/content_settings/content_settings_browsertest.cc @@ -29,7 +29,7 @@ #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_utils.h" #include "content/test/net/url_request_mock_http_job.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. @@ -43,10 +43,10 @@ using content::URLRequestMockHTTPJob; class ContentSettingsTest : public InProcessBrowserTest { public: ContentSettingsTest() - : https_server_( - net::TestServer::TYPE_HTTPS, - net::TestServer::SSLOptions(net::TestServer::SSLOptions::CERT_OK), - base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))) { + : https_server_(net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::SSLOptions( + net::SpawnedTestServer::SSLOptions::CERT_OK), + base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))) { } virtual void SetUpOnMainThread() OVERRIDE { @@ -102,7 +102,7 @@ class ContentSettingsTest : public InProcessBrowserTest { ASSERT_FALSE(GetCookies(browser()->profile(), url).empty()); } - net::TestServer https_server_; + net::SpawnedTestServer https_server_; }; // Sanity check on cookies before we do other tests. While these can be written diff --git a/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chrome/browser/devtools/devtools_sanity_browsertest.cc index 5290dcb..408dc80 100644 --- a/chrome/browser/devtools/devtools_sanity_browsertest.cc +++ b/chrome/browser/devtools/devtools_sanity_browsertest.cc @@ -45,7 +45,7 @@ #include "content/public/common/content_switches.h" #include "content/public/test/browser_test_utils.h" #include "net/socket/tcp_listen_socket.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" using content::BrowserThread; using content::DevToolsManager; diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index b26b5a2..6f687a9 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc @@ -78,7 +78,7 @@ #include "content/test/net/url_request_slow_download_job.h" #include "grit/generated_resources.h" #include "net/base/net_util.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/l10n/l10n_util.h" #include "webkit/plugins/npapi/mock_plugin_list.h" diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc index d7f2ea4..75be463 100644 --- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc +++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc @@ -12,7 +12,7 @@ #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_condition.h" #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_constants.h" #include "content/public/browser/resource_request_info.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "net/url_request/url_request_test_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -109,9 +109,9 @@ TEST(WebRequestConditionAttributeTest, ContentType) { std::string error; scoped_ptr<WebRequestConditionAttribute> result; - net::TestServer test_server( - net::TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, + net::SpawnedTestServer test_server( + net::SpawnedTestServer::TYPE_HTTP, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL( "chrome/test/data/extensions/api_test/webrequest/declarative"))); ASSERT_TRUE(test_server.Start()); @@ -479,9 +479,9 @@ TEST(WebRequestConditionAttributeTest, ResponseHeaders) { // Necessary for TestURLRequest. MessageLoop message_loop(MessageLoop::TYPE_IO); - net::TestServer test_server( - net::TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, + net::SpawnedTestServer test_server( + net::SpawnedTestServer::TYPE_HTTP, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL( "chrome/test/data/extensions/api_test/webrequest/declarative"))); ASSERT_TRUE(test_server.Start()); diff --git a/chrome/browser/extensions/api/extension_action/script_badge_apitest.cc b/chrome/browser/extensions/api/extension_action/script_badge_apitest.cc index ff7fae7..78af25e 100644 --- a/chrome/browser/extensions/api/extension_action/script_badge_apitest.cc +++ b/chrome/browser/extensions/api/extension_action/script_badge_apitest.cc @@ -19,7 +19,7 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/web_contents.h" #include "net/dns/mock_host_resolver.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "testing/gmock/include/gmock/gmock.h" namespace extensions { diff --git a/chrome/browser/extensions/api/i18n/i18n_apitest.cc b/chrome/browser/extensions/api/i18n/i18n_apitest.cc index 1255946..0fb7111 100644 --- a/chrome/browser/extensions/api/i18n/i18n_apitest.cc +++ b/chrome/browser/extensions/api/i18n/i18n_apitest.cc @@ -10,7 +10,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/common/extensions/extension.h" #include "chrome/test/base/ui_test_utils.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" IN_PROC_BROWSER_TEST_F(ExtensionApiTest, I18N) { ASSERT_TRUE(StartTestServer()); diff --git a/chrome/browser/extensions/api/socket/socket_apitest.cc b/chrome/browser/extensions/api/socket/socket_apitest.cc index b9b4451..bb4e3d0 100644 --- a/chrome/browser/extensions/api/socket/socket_apitest.cc +++ b/chrome/browser/extensions/api/socket/socket_apitest.cc @@ -16,7 +16,7 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "net/dns/mock_host_resolver.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" using extensions::Extension; @@ -121,10 +121,11 @@ IN_PROC_BROWSER_TEST_F(SocketApiTest, GetNetworkList) { } IN_PROC_BROWSER_TEST_F(SocketApiTest, SocketUDPExtension) { - scoped_ptr<net::TestServer> test_server( - new net::TestServer(net::TestServer::TYPE_UDP_ECHO, - net::TestServer::kLocalhost, - base::FilePath(FILE_PATH_LITERAL("net/data")))); + scoped_ptr<net::SpawnedTestServer> test_server( + new net::SpawnedTestServer( + net::SpawnedTestServer::TYPE_UDP_ECHO, + net::SpawnedTestServer::kLocalhost, + base::FilePath(FILE_PATH_LITERAL("net/data")))); EXPECT_TRUE(test_server->Start()); net::HostPortPair host_port_pair = test_server->host_port_pair(); @@ -148,10 +149,11 @@ IN_PROC_BROWSER_TEST_F(SocketApiTest, SocketUDPExtension) { } IN_PROC_BROWSER_TEST_F(SocketApiTest, SocketTCPExtension) { - scoped_ptr<net::TestServer> test_server( - new net::TestServer(net::TestServer::TYPE_TCP_ECHO, - net::TestServer::kLocalhost, - base::FilePath(FILE_PATH_LITERAL("net/data")))); + scoped_ptr<net::SpawnedTestServer> test_server( + new net::SpawnedTestServer( + net::SpawnedTestServer::TYPE_TCP_ECHO, + net::SpawnedTestServer::kLocalhost, + base::FilePath(FILE_PATH_LITERAL("net/data")))); EXPECT_TRUE(test_server->Start()); net::HostPortPair host_port_pair = test_server->host_port_pair(); diff --git a/chrome/browser/extensions/extension_apitest.cc b/chrome/browser/extensions/extension_apitest.cc index 8d072ae..bb2279c 100644 --- a/chrome/browser/extensions/extension_apitest.cc +++ b/chrome/browser/extensions/extension_apitest.cc @@ -19,7 +19,7 @@ #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_service.h" #include "net/base/net_util.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" namespace { @@ -301,9 +301,9 @@ bool ExtensionApiTest::StartTestServer() { bool ExtensionApiTest::StartWebSocketServer( const base::FilePath& root_directory) { - websocket_server_.reset(new net::TestServer( - net::TestServer::TYPE_WS, - net::TestServer::kLocalhost, + websocket_server_.reset(new net::SpawnedTestServer( + net::SpawnedTestServer::TYPE_WS, + net::SpawnedTestServer::kLocalhost, root_directory)); if (!websocket_server_->Start()) diff --git a/chrome/browser/extensions/extension_apitest.h b/chrome/browser/extensions/extension_apitest.h index 8d3d2e0..cbfd55b 100644 --- a/chrome/browser/extensions/extension_apitest.h +++ b/chrome/browser/extensions/extension_apitest.h @@ -181,7 +181,7 @@ class ExtensionApiTest : public ExtensionBrowserTest { scoped_ptr<DictionaryValue> test_config_; // Hold the test WebSocket server. - scoped_ptr<net::TestServer> websocket_server_; + scoped_ptr<net::SpawnedTestServer> websocket_server_; }; #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_ diff --git a/chrome/browser/extensions/stubs_apitest.cc b/chrome/browser/extensions/stubs_apitest.cc index b86da70..5a41bdb 100644 --- a/chrome/browser/extensions/stubs_apitest.cc +++ b/chrome/browser/extensions/stubs_apitest.cc @@ -6,7 +6,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/test/base/ui_test_utils.h" #include "googleurl/src/gurl.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" // Tests that we throw errors when you try using extension APIs that aren't // supported in content scripts. diff --git a/chrome/browser/extensions/subscribe_page_action_browsertest.cc b/chrome/browser/extensions/subscribe_page_action_browsertest.cc index 02449a1..d1f5afa 100644 --- a/chrome/browser/extensions/subscribe_page_action_browsertest.cc +++ b/chrome/browser/extensions/subscribe_page_action_browsertest.cc @@ -59,7 +59,7 @@ static const char kScriptError[] = " \"No error\"" ");"; -GURL GetFeedUrl(net::TestServer* server, const std::string& feed_page, +GURL GetFeedUrl(net::SpawnedTestServer* server, const std::string& feed_page, bool direct_url, std::string extension_id) { GURL feed_url = server->GetURL(feed_page); if (direct_url) { @@ -96,7 +96,7 @@ bool ValidatePageElement(WebContents* tab, // extension to kick in, detect the feed and redirect to a feed preview page. // |sniff_xml_type| is generally set to true if the feed is sniffable and false // for invalid feeds. -void NavigateToFeedAndValidate(net::TestServer* server, +void NavigateToFeedAndValidate(net::SpawnedTestServer* server, const std::string& url, Browser* browser, std::string extension_id, diff --git a/chrome/browser/external_extension_browsertest.cc b/chrome/browser/external_extension_browsertest.cc index a724213..27a735a 100644 --- a/chrome/browser/external_extension_browsertest.cc +++ b/chrome/browser/external_extension_browsertest.cc @@ -13,7 +13,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/common/url_constants.h" #include "content/public/test/browser_test_utils.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" namespace { diff --git a/chrome/browser/geolocation/geolocation_browsertest.cc b/chrome/browser/geolocation/geolocation_browsertest.cc index 520cf14..147a454 100644 --- a/chrome/browser/geolocation/geolocation_browsertest.cc +++ b/chrome/browser/geolocation/geolocation_browsertest.cc @@ -31,7 +31,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" #include "net/base/net_util.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" using content::DomOperationNotificationDetails; using content::NavigationController; diff --git a/chrome/browser/history/multipart_browsertest.cc b/chrome/browser/history/multipart_browsertest.cc index 2c6d0ae7..3fe4a49 100644 --- a/chrome/browser/history/multipart_browsertest.cc +++ b/chrome/browser/history/multipart_browsertest.cc @@ -11,7 +11,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/common/frame_navigate_params.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" class MultipartResponseTest : public InProcessBrowserTest, public content::WebContentsObserver { diff --git a/chrome/browser/history/redirect_browsertest.cc b/chrome/browser/history/redirect_browsertest.cc index 0f56a71..2387fdc 100644 --- a/chrome/browser/history/redirect_browsertest.cc +++ b/chrome/browser/history/redirect_browsertest.cc @@ -29,7 +29,7 @@ #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_navigation_observer.h" #include "net/base/net_util.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "ui/base/events/event_constants.h" class RedirectTest : public InProcessBrowserTest { diff --git a/chrome/browser/infobars/infobars_browsertest.cc b/chrome/browser/infobars/infobars_browsertest.cc index ed807a0..6e4eb69 100644 --- a/chrome/browser/infobars/infobars_browsertest.cc +++ b/chrome/browser/infobars/infobars_browsertest.cc @@ -17,7 +17,7 @@ #include "chrome/test/base/ui_test_utils.h" #include "chrome/test/ui/ui_test.h" #include "content/public/browser/notification_service.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" class InfoBarsTest : public InProcessBrowserTest { public: diff --git a/chrome/browser/loadtimes_extension_bindings_browsertest.cc b/chrome/browser/loadtimes_extension_bindings_browsertest.cc index 6eaa71a..d911351 100644 --- a/chrome/browser/loadtimes_extension_bindings_browsertest.cc +++ b/chrome/browser/loadtimes_extension_bindings_browsertest.cc @@ -8,7 +8,7 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" class LoadtimesExtensionBindingsTest : public InProcessBrowserTest { public: diff --git a/chrome/browser/media/chrome_webrtc_browsertest.cc b/chrome/browser/media/chrome_webrtc_browsertest.cc index 1da711e..010b628 100644 --- a/chrome/browser/media/chrome_webrtc_browsertest.cc +++ b/chrome/browser/media/chrome_webrtc_browsertest.cc @@ -21,7 +21,7 @@ #include "chrome/test/ui/ui_test.h" #include "content/public/browser/notification_service.h" #include "content/public/test/browser_test_utils.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" static const base::FilePath::CharType kPeerConnectionServer[] = #if defined(OS_WIN) diff --git a/chrome/browser/net/connection_tester_unittest.cc b/chrome/browser/net/connection_tester_unittest.cc index 3f537b0..a56759d 100644 --- a/chrome/browser/net/connection_tester_unittest.cc +++ b/chrome/browser/net/connection_tester_unittest.cc @@ -17,7 +17,7 @@ #include "net/proxy/proxy_config_service_fixed.h" #include "net/proxy/proxy_service.h" #include "net/ssl/ssl_config_service_defaults.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "net/url_request/url_request_context.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" @@ -89,8 +89,8 @@ class ConnectionTesterTest : public PlatformTest { ConnectionTesterTest() : message_loop_(MessageLoop::TYPE_IO), io_thread_(BrowserThread::IO, &message_loop_), - test_server_(net::TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, + test_server_(net::SpawnedTestServer::TYPE_HTTP, + net::SpawnedTestServer::kLocalhost, // Nothing is read in this directory. base::FilePath(FILE_PATH_LITERAL("chrome"))), proxy_script_fetcher_context_(new net::URLRequestContext) { @@ -105,7 +105,7 @@ class ConnectionTesterTest : public PlatformTest { // no-op, and the ObserverList will contain invalid entries. MessageLoop message_loop_; content::TestBrowserThread io_thread_; - net::TestServer test_server_; + net::SpawnedTestServer test_server_; ConnectionTesterDelegate test_delegate_; net::MockHostResolver host_resolver_; scoped_ptr<net::CertVerifier> cert_verifier_; diff --git a/chrome/browser/net/cookie_policy_browsertest.cc b/chrome/browser/net/cookie_policy_browsertest.cc index 5a5ba24..499a02a 100644 --- a/chrome/browser/net/cookie_policy_browsertest.cc +++ b/chrome/browser/net/cookie_policy_browsertest.cc @@ -14,7 +14,7 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/public/test/browser_test_utils.h" #include "net/dns/mock_host_resolver.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" using content::BrowserThread; diff --git a/chrome/browser/net/ftp_browsertest.cc b/chrome/browser/net/ftp_browsertest.cc index 8e54e318..f8d2295 100644 --- a/chrome/browser/net/ftp_browsertest.cc +++ b/chrome/browser/net/ftp_browsertest.cc @@ -5,19 +5,19 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "googleurl/src/gurl.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "testing/gtest/include/gtest/gtest.h" class FtpBrowserTest : public InProcessBrowserTest { public: FtpBrowserTest() - : ftp_server_(net::TestServer::TYPE_FTP, - net::TestServer::kLocalhost, + : ftp_server_(net::SpawnedTestServer::TYPE_FTP, + net::SpawnedTestServer::kLocalhost, base::FilePath()) { } protected: - net::TestServer ftp_server_; + net::SpawnedTestServer ftp_server_; }; IN_PROC_BROWSER_TEST_F(FtpBrowserTest, DirectoryListing) { diff --git a/chrome/browser/net/http_pipelining_compatibility_client_unittest.cc b/chrome/browser/net/http_pipelining_compatibility_client_unittest.cc index f582d1b..eb177c5 100644 --- a/chrome/browser/net/http_pipelining_compatibility_client_unittest.cc +++ b/chrome/browser/net/http_pipelining_compatibility_client_unittest.cc @@ -19,9 +19,9 @@ #include "content/public/test/test_browser_thread.h" #include "net/base/net_errors.h" #include "net/base/test_completion_callback.h" +#include "net/test/spawned_test_server.h" #include "net/url_request/url_request_context_getter.h" #include "net/url_request/url_request_test_util.h" -#include "net/test/test_server.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -81,8 +81,8 @@ using testing::StrEq; class HttpPipeliningCompatibilityClientTest : public testing::Test { public: HttpPipeliningCompatibilityClientTest() - : test_server_(net::TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, + : test_server_(net::SpawnedTestServer::TYPE_HTTP, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL( "chrome/test/data/http_pipelining"))), io_thread_(BrowserThread::IO, &message_loop_) { @@ -205,7 +205,7 @@ class HttpPipeliningCompatibilityClientTest : public testing::Test { } MessageLoopForIO message_loop_; - net::TestServer test_server_; + net::SpawnedTestServer test_server_; net::TestURLRequestContextGetter* context_; content::TestBrowserThread io_thread_; diff --git a/chrome/browser/net/load_timing_browsertest.cc b/chrome/browser/net/load_timing_browsertest.cc index 6519f4e..4f8f24d 100644 --- a/chrome/browser/net/load_timing_browsertest.cc +++ b/chrome/browser/net/load_timing_browsertest.cc @@ -22,7 +22,7 @@ #include "content/public/test/browser_test_utils.h" #include "googleurl/src/gurl.h" #include "net/base/load_timing_info.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "net/url_request/url_request_file_job.h" #include "net/url_request/url_request_filter.h" #include "net/url_request/url_request_job_factory.h" diff --git a/chrome/browser/net/network_stats_unittest.cc b/chrome/browser/net/network_stats_unittest.cc index 99dffb2..81c30e8 100644 --- a/chrome/browser/net/network_stats_unittest.cc +++ b/chrome/browser/net/network_stats_unittest.cc @@ -10,7 +10,7 @@ #include "net/base/test_completion_callback.h" #include "net/dns/host_resolver.h" #include "net/dns/mock_host_resolver.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" @@ -30,8 +30,8 @@ class NetworkStatsTest : public PlatformTest { class NetworkStatsTestUDP : public NetworkStatsTest { public: NetworkStatsTestUDP() - : test_server_(net::TestServer::TYPE_UDP_ECHO, - net::TestServer::kLocalhost, + : test_server_(net::SpawnedTestServer::TYPE_UDP_ECHO, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("net/data"))) { } @@ -57,7 +57,7 @@ class NetworkStatsTestUDP : public NetworkStatsTest { EXPECT_EQ(0, rv); } - net::TestServer test_server_; + net::SpawnedTestServer test_server_; }; TEST_F(NetworkStatsTestUDP, UDPEcho100BytesHasProxy) { diff --git a/chrome/browser/net/proxy_browsertest.cc b/chrome/browser/net/proxy_browsertest.cc index 791c16ba..2f1f728 100644 --- a/chrome/browser/net/proxy_browsertest.cc +++ b/chrome/browser/net/proxy_browsertest.cc @@ -22,7 +22,7 @@ #include "content/public/browser/web_contents_observer.h" #include "content/public/test/browser_test_utils.h" #include "net/base/test_data_directory.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" namespace { @@ -58,8 +58,8 @@ class LoginPromptObserver : public content::NotificationObserver { class ProxyBrowserTest : public InProcessBrowserTest { public: ProxyBrowserTest() - : proxy_server_(net::TestServer::TYPE_BASIC_AUTH_PROXY, - net::TestServer::kLocalhost, + : proxy_server_(net::SpawnedTestServer::TYPE_BASIC_AUTH_PROXY, + net::SpawnedTestServer::kLocalhost, base::FilePath()) { } @@ -74,7 +74,7 @@ class ProxyBrowserTest : public InProcessBrowserTest { } protected: - net::TestServer proxy_server_; + net::SpawnedTestServer proxy_server_; private: @@ -91,9 +91,9 @@ class ProxyBrowserTest : public InProcessBrowserTest { // that requires basic authentication. IN_PROC_BROWSER_TEST_F(ProxyBrowserTest, MAYBE_BasicAuthWSConnect) { // Launch WebSocket server. - net::TestServer ws_server(net::TestServer::TYPE_WS, - net::TestServer::kLocalhost, - net::GetWebSocketTestDataDirectory()); + net::SpawnedTestServer ws_server(net::SpawnedTestServer::TYPE_WS, + net::SpawnedTestServer::kLocalhost, + net::GetWebSocketTestDataDirectory()); ASSERT_TRUE(ws_server.Start()); content::WebContents* tab = diff --git a/chrome/browser/net/websocket_browsertest.cc b/chrome/browser/net/websocket_browsertest.cc index bd7f8ee..06442c4 100644 --- a/chrome/browser/net/websocket_browsertest.cc +++ b/chrome/browser/net/websocket_browsertest.cc @@ -10,27 +10,27 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/public/test/browser_test_utils.h" #include "net/base/test_data_directory.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" namespace { class WebSocketBrowserTest : public InProcessBrowserTest { public: WebSocketBrowserTest() - : ws_server_(net::TestServer::TYPE_WS, - net::TestServer::kLocalhost, + : ws_server_(net::SpawnedTestServer::TYPE_WS, + net::SpawnedTestServer::kLocalhost, net::GetWebSocketTestDataDirectory()), - wss_server_(net::TestServer::TYPE_WSS, + wss_server_(net::SpawnedTestServer::TYPE_WSS, SSLOptions(SSLOptions::CERT_OK), net::GetWebSocketTestDataDirectory()) { } protected: - net::TestServer ws_server_; - net::TestServer wss_server_; + net::SpawnedTestServer ws_server_; + net::SpawnedTestServer wss_server_; private: - typedef net::TestServer::SSLOptions SSLOptions; + typedef net::SpawnedTestServer::SSLOptions SSLOptions; DISALLOW_COPY_AND_ASSIGN(WebSocketBrowserTest); }; diff --git a/chrome/browser/notifications/notification_browsertest.cc b/chrome/browser/notifications/notification_browsertest.cc index 55695c6..6ac1965 100644 --- a/chrome/browser/notifications/notification_browsertest.cc +++ b/chrome/browser/notifications/notification_browsertest.cc @@ -41,7 +41,7 @@ #include "content/public/test/test_utils.h" #include "googleurl/src/gurl.h" #include "net/base/net_util.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/window_open_disposition.h" diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc index ab942b6..2c85c34 100644 --- a/chrome/browser/prerender/prerender_browsertest.cc +++ b/chrome/browser/prerender/prerender_browsertest.cc @@ -993,24 +993,25 @@ class PrerenderBrowserTest : virtual public InProcessBrowserTest { bool prerender_should_wait_for_ready_title) { dest_url_ = destination_url; - std::vector<net::TestServer::StringPair> replacement_text; + std::vector<net::SpawnedTestServer::StringPair> replacement_text; replacement_text.push_back( make_pair("REPLACE_WITH_PRERENDER_URL", prerender_url.spec())); replacement_text.push_back( make_pair("REPLACE_WITH_DESTINATION_URL", destination_url.spec())); std::string replacement_path; - ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( + ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements( loader_path_, replacement_text, &replacement_path)); - const net::TestServer* src_server = test_server(); - scoped_ptr<net::TestServer> https_src_server; + const net::SpawnedTestServer* src_server = test_server(); + scoped_ptr<net::SpawnedTestServer> https_src_server; if (use_https_src_server_) { https_src_server.reset( - new net::TestServer( - net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, - base::FilePath(FILE_PATH_LITERAL("chrome/test/data")))); + new net::SpawnedTestServer( + net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, + base::FilePath(FILE_PATH_LITERAL("chrome/test/data")))); ASSERT_TRUE(https_src_server->Start()); src_server = https_src_server.get(); } @@ -1513,8 +1514,8 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, // Checks that a prerender for an https will prevent a prerender from happening. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHttps) { - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); @@ -1526,8 +1527,8 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHttps) { // Checks that client-issued redirects to an https page will cancel prerenders. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClientRedirectToHttps) { - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); @@ -1542,11 +1543,11 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClientRedirectToHttps) { IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClientRedirectInIframe) { std::string redirect_path = CreateClientRedirect( "/files/prerender/prerender_embedded_content.html"); - std::vector<net::TestServer::StringPair> replacement_text; + std::vector<net::SpawnedTestServer::StringPair> replacement_text; replacement_text.push_back( std::make_pair("REPLACE_WITH_URL", "/" + redirect_path)); std::string replacement_path; - ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( + ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements( "files/prerender/prerender_with_iframe.html", replacement_text, &replacement_path)); @@ -1561,17 +1562,17 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClientRedirectInIframe) { // count as an "alias" for the prerendered page. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClientRedirectToHttpsInIframe) { - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); std::string redirect_path = CreateClientRedirect(https_url.spec()); - std::vector<net::TestServer::StringPair> replacement_text; + std::vector<net::SpawnedTestServer::StringPair> replacement_text; replacement_text.push_back( std::make_pair("REPLACE_WITH_URL", "/" + redirect_path)); std::string replacement_path; - ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( + ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements( "files/prerender/prerender_with_iframe.html", replacement_text, &replacement_path)); @@ -1619,8 +1620,8 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, // location will cancel prerendering. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderServerRedirectToHttps) { - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); @@ -1635,11 +1636,11 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderServerRedirectInIframe) { std::string redirect_path = CreateServerRedirect( "/files/prerender/prerender_embedded_content.html"); - std::vector<net::TestServer::StringPair> replacement_text; + std::vector<net::SpawnedTestServer::StringPair> replacement_text; replacement_text.push_back( std::make_pair("REPLACE_WITH_URL", "/" + redirect_path)); std::string replacement_path; - ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( + ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements( "files/prerender/prerender_with_iframe.html", replacement_text, &replacement_path)); @@ -1654,17 +1655,17 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderServerRedirectInIframe) { // count as an "alias" for the prerendered page. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderServerRedirectToHttpsInIframe) { - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); std::string redirect_path = CreateServerRedirect(https_url.spec()); - std::vector<net::TestServer::StringPair> replacement_text; + std::vector<net::SpawnedTestServer::StringPair> replacement_text; replacement_text.push_back( std::make_pair("REPLACE_WITH_URL", "/" + redirect_path)); std::string replacement_path; - ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( + ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements( "files/prerender/prerender_with_iframe.html", replacement_text, &replacement_path)); @@ -2130,11 +2131,11 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderXhrDelete) { // Checks that a top-level page which would trigger an SSL error is canceled. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLErrorTopLevel) { - net::TestServer::SSLOptions ssl_options; + net::SpawnedTestServer::SSLOptions ssl_options; ssl_options.server_certificate = - net::TestServer::SSLOptions::CERT_MISMATCHED_NAME; - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, ssl_options, + net::SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME; + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, ssl_options, base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); @@ -2147,19 +2148,19 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLErrorTopLevel) { // the page. Non-main-frame requests are simply cancelled if they run into // an SSL problem. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLErrorSubresource) { - net::TestServer::SSLOptions ssl_options; + net::SpawnedTestServer::SSLOptions ssl_options; ssl_options.server_certificate = - net::TestServer::SSLOptions::CERT_MISMATCHED_NAME; - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, ssl_options, + net::SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME; + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, ssl_options, base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL https_url = https_server.GetURL("files/prerender/image.jpeg"); - std::vector<net::TestServer::StringPair> replacement_text; + std::vector<net::SpawnedTestServer::StringPair> replacement_text; replacement_text.push_back( std::make_pair("REPLACE_WITH_IMAGE_URL", https_url.spec())); std::string replacement_path; - ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( + ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements( "files/prerender/prerender_with_image.html", replacement_text, &replacement_path)); @@ -2171,20 +2172,20 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLErrorSubresource) { // the page. Non-main-frame requests are simply cancelled if they run into // an SSL problem. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLErrorIframe) { - net::TestServer::SSLOptions ssl_options; + net::SpawnedTestServer::SSLOptions ssl_options; ssl_options.server_certificate = - net::TestServer::SSLOptions::CERT_MISMATCHED_NAME; - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, ssl_options, + net::SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME; + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, ssl_options, base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL https_url = https_server.GetURL( "files/prerender/prerender_embedded_content.html"); - std::vector<net::TestServer::StringPair> replacement_text; + std::vector<net::SpawnedTestServer::StringPair> replacement_text; replacement_text.push_back( std::make_pair("REPLACE_WITH_URL", https_url.spec())); std::string replacement_path; - ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( + ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements( "files/prerender/prerender_with_iframe.html", replacement_text, &replacement_path)); @@ -2222,10 +2223,10 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, // Checks that a top-level page which would normally request an SSL client // certificate will never be seen since it's an https top-level resource. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLClientCertTopLevel) { - net::TestServer::SSLOptions ssl_options; + net::SpawnedTestServer::SSLOptions ssl_options; ssl_options.request_client_certificate = true; - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, ssl_options, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, ssl_options, base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); @@ -2236,18 +2237,18 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLClientCertTopLevel) { // subresource will cancel the prerendered page. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLClientCertSubresource) { - net::TestServer::SSLOptions ssl_options; + net::SpawnedTestServer::SSLOptions ssl_options; ssl_options.request_client_certificate = true; - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, ssl_options, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, ssl_options, base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL https_url = https_server.GetURL("files/prerender/image.jpeg"); - std::vector<net::TestServer::StringPair> replacement_text; + std::vector<net::SpawnedTestServer::StringPair> replacement_text; replacement_text.push_back( std::make_pair("REPLACE_WITH_IMAGE_URL", https_url.spec())); std::string replacement_path; - ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( + ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements( "files/prerender/prerender_with_image.html", replacement_text, &replacement_path)); @@ -2259,19 +2260,19 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, // Checks that an SSL Client Certificate request that originates from an // iframe will cancel the prerendered page. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLClientCertIframe) { - net::TestServer::SSLOptions ssl_options; + net::SpawnedTestServer::SSLOptions ssl_options; ssl_options.request_client_certificate = true; - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, ssl_options, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, ssl_options, base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL https_url = https_server.GetURL( "files/prerender/prerender_embedded_content.html"); - std::vector<net::TestServer::StringPair> replacement_text; + std::vector<net::SpawnedTestServer::StringPair> replacement_text; replacement_text.push_back( std::make_pair("REPLACE_WITH_URL", https_url.spec())); std::string replacement_path; - ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( + ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements( "files/prerender/prerender_with_iframe.html", replacement_text, &replacement_path)); @@ -2318,11 +2319,11 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSafeBrowsingSubresource) { GURL image_url = test_server()->GetURL("files/prerender/image.jpeg"); GetFakeSafeBrowsingDatabaseManager()->SetThreatTypeForUrl( image_url, SB_THREAT_TYPE_URL_MALWARE); - std::vector<net::TestServer::StringPair> replacement_text; + std::vector<net::SpawnedTestServer::StringPair> replacement_text; replacement_text.push_back( std::make_pair("REPLACE_WITH_IMAGE_URL", image_url.spec())); std::string replacement_path; - ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( + ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements( "files/prerender/prerender_with_image.html", replacement_text, &replacement_path)); @@ -2337,11 +2338,11 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSafeBrowsingIframe) { "files/prerender/prerender_embedded_content.html"); GetFakeSafeBrowsingDatabaseManager()->SetThreatTypeForUrl( iframe_url, SB_THREAT_TYPE_URL_MALWARE); - std::vector<net::TestServer::StringPair> replacement_text; + std::vector<net::SpawnedTestServer::StringPair> replacement_text; replacement_text.push_back( std::make_pair("REPLACE_WITH_URL", iframe_url.spec())); std::string replacement_path; - ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( + ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements( "files/prerender/prerender_with_iframe.html", replacement_text, &replacement_path)); @@ -2749,11 +2750,11 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTestWithExtensions, TabsApi) { IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderCancelSubresourceUnsupportedScheme) { GURL image_url = GURL("invalidscheme://www.google.com/test.jpg"); - std::vector<net::TestServer::StringPair> replacement_text; + std::vector<net::SpawnedTestServer::StringPair> replacement_text; replacement_text.push_back( std::make_pair("REPLACE_WITH_IMAGE_URL", image_url.spec())); std::string replacement_path; - ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( + ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements( "files/prerender/prerender_with_image.html", replacement_text, &replacement_path)); @@ -2766,11 +2767,11 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderCancelSubresourceRedirectUnsupportedScheme) { GURL image_url = test_server()->GetURL( CreateServerRedirect("invalidscheme://www.google.com/test.jpg")); - std::vector<net::TestServer::StringPair> replacement_text; + std::vector<net::SpawnedTestServer::StringPair> replacement_text; replacement_text.push_back( std::make_pair("REPLACE_WITH_IMAGE_URL", image_url.spec())); std::string replacement_path; - ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( + ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements( "files/prerender/prerender_with_image.html", replacement_text, &replacement_path)); diff --git a/chrome/browser/printing/printing_layout_browsertest.cc b/chrome/browser/printing/printing_layout_browsertest.cc index 73053ac..a8fc2a9 100644 --- a/chrome/browser/printing/printing_layout_browsertest.cc +++ b/chrome/browser/printing/printing_layout_browsertest.cc @@ -25,7 +25,7 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_service.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "printing/image.h" #include "printing/printing_test.h" diff --git a/chrome/browser/referrer_policy_browsertest.cc b/chrome/browser/referrer_policy_browsertest.cc index 0b9f40f..401f221 100644 --- a/chrome/browser/referrer_policy_browsertest.cc +++ b/chrome/browser/referrer_policy_browsertest.cc @@ -18,7 +18,7 @@ #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" // GTK requires a X11-level mouse event to open a context menu correctly. @@ -47,13 +47,15 @@ class ReferrerPolicyTest : public InProcessBrowserTest { virtual ~ReferrerPolicyTest() {} virtual void SetUp() OVERRIDE { - test_server_.reset(new net::TestServer(net::TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, - base::FilePath(kDocRoot))); + test_server_.reset(new net::SpawnedTestServer( + net::SpawnedTestServer::TYPE_HTTP, + net::SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot))); ASSERT_TRUE(test_server_->Start()); - ssl_test_server_.reset(new net::TestServer(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - base::FilePath(kDocRoot))); + ssl_test_server_.reset(new net::SpawnedTestServer( + net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot))); ASSERT_TRUE(ssl_test_server_->Start()); InProcessBrowserTest::SetUp(); @@ -122,7 +124,7 @@ class ReferrerPolicyTest : public InProcessBrowserTest { WebKit::WebMouseEvent::Button button, ExpectedReferrer expected_referrer) { GURL start_url; - net::TestServer* start_server = + net::SpawnedTestServer* start_server = start_on_https ? ssl_test_server_.get() : test_server_.get(); start_url = start_server->GetURL( std::string("files/referrer-policy-start.html?") + @@ -173,8 +175,8 @@ class ReferrerPolicyTest : public InProcessBrowserTest { return start_url; } - scoped_ptr<net::TestServer> test_server_; - scoped_ptr<net::TestServer> ssl_test_server_; + scoped_ptr<net::SpawnedTestServer> test_server_; + scoped_ptr<net::SpawnedTestServer> ssl_test_server_; }; // The basic behavior of referrer policies is covered by layout tests in diff --git a/chrome/browser/repost_form_warning_browsertest.cc b/chrome/browser/repost_form_warning_browsertest.cc index 25df39d..3ab6a8e 100644 --- a/chrome/browser/repost_form_warning_browsertest.cc +++ b/chrome/browser/repost_form_warning_browsertest.cc @@ -15,7 +15,7 @@ #include "content/public/browser/navigation_controller.h" #include "content/public/browser/web_contents.h" #include "content/public/test/test_navigation_observer.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" typedef InProcessBrowserTest RepostFormWarningTest; diff --git a/chrome/browser/safe_browsing/local_safebrowsing_test_server.cc b/chrome/browser/safe_browsing/local_safebrowsing_test_server.cc index 8140105..7ead024 100644 --- a/chrome/browser/safe_browsing/local_safebrowsing_test_server.cc +++ b/chrome/browser/safe_browsing/local_safebrowsing_test_server.cc @@ -9,12 +9,12 @@ #include "base/strings/string_number_conversions.h" #include "base/values.h" #include "net/test/python_utils.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" LocalSafeBrowsingTestServer::LocalSafeBrowsingTestServer( const base::FilePath& data_file) - : net::LocalTestServer(net::TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, + : net::LocalTestServer(net::SpawnedTestServer::TYPE_HTTP, + net::SpawnedTestServer::kLocalhost, base::FilePath()), data_file_(data_file) { } diff --git a/chrome/browser/safe_browsing/local_two_phase_testserver.cc b/chrome/browser/safe_browsing/local_two_phase_testserver.cc index 567bb2a..3b7ab5b 100644 --- a/chrome/browser/safe_browsing/local_two_phase_testserver.cc +++ b/chrome/browser/safe_browsing/local_two_phase_testserver.cc @@ -9,11 +9,11 @@ #include "base/strings/string_number_conversions.h" #include "base/values.h" #include "net/test/python_utils.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" LocalTwoPhaseTestServer::LocalTwoPhaseTestServer() - : net::LocalTestServer(net::TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, + : net::LocalTestServer(net::SpawnedTestServer::TYPE_HTTP, + net::SpawnedTestServer::kLocalhost, base::FilePath()) { } diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc index 9a312db..9afe945 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc @@ -747,8 +747,8 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, ReportingDisabled) { browser()->profile()->GetPrefs()->SetBoolean( prefs::kSafeBrowsingReportingEnabled, true); - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL url = https_server.GetURL(kEmptyPage); diff --git a/chrome/browser/safe_browsing/safe_browsing_test.cc b/chrome/browser/safe_browsing/safe_browsing_test.cc index d25ebe4..e96f565 100644 --- a/chrome/browser/safe_browsing/safe_browsing_test.cc +++ b/chrome/browser/safe_browsing/safe_browsing_test.cc @@ -207,7 +207,7 @@ class SafeBrowsingServerTest : public InProcessBrowserTest { return database_manager()->safe_browsing_thread_->message_loop(); } - const net::TestServer& test_server() const { + const net::SpawnedTestServer& test_server() const { return *test_server_; } @@ -264,7 +264,7 @@ class SafeBrowsingServerTest : public InProcessBrowserTest { private: SafeBrowsingService* safe_browsing_service_; - scoped_ptr<net::TestServer> test_server_; + scoped_ptr<net::SpawnedTestServer> test_server_; // Protects all variables below since they are read on UI thread // but updated on IO thread or safebrowsing thread. @@ -370,7 +370,7 @@ class SafeBrowsingServerTestHelper // Calls test server to fetch database for verification. net::URLRequestStatus::Status FetchDBToVerify( - const net::TestServer& test_server, + const net::SpawnedTestServer& test_server, int test_step) { // TODO(lzheng): Remove chunk_type=add once it is not needed by the server. std::string path = base::StringPrintf( @@ -381,7 +381,7 @@ class SafeBrowsingServerTestHelper // Calls test server to fetch URLs for verification. net::URLRequestStatus::Status FetchUrlsToVerify( - const net::TestServer& test_server, + const net::SpawnedTestServer& test_server, int test_step) { std::string path = base::StringPrintf( "%s?client=chromium&appver=1.0&pver=2.2&test_step=%d", @@ -393,7 +393,7 @@ class SafeBrowsingServerTestHelper // bad URL that server expects test to fetch full hash but the test didn't, // this verification will fail. net::URLRequestStatus::Status VerifyTestComplete( - const net::TestServer& test_server, + const net::SpawnedTestServer& test_server, int test_step) { std::string path = base::StringPrintf( "%s?test_step=%d", kTestCompletePath, test_step); diff --git a/chrome/browser/search_engines/template_url_fetcher_unittest.cc b/chrome/browser/search_engines/template_url_fetcher_unittest.cc index bdef3dd..5ace411 100644 --- a/chrome/browser/search_engines/template_url_fetcher_unittest.cc +++ b/chrome/browser/search_engines/template_url_fetcher_unittest.cc @@ -9,14 +9,14 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/search_engines/template_url_fetcher.h" -#include "chrome/browser/search_engines/template_url_fetcher_factory.h" #include "chrome/browser/search_engines/template_url_fetcher_callbacks.h" +#include "chrome/browser/search_engines/template_url_fetcher_factory.h" #include "chrome/browser/search_engines/template_url_service.h" #include "chrome/browser/search_engines/template_url_service_test_util.h" #include "chrome/common/chrome_paths.h" #include "chrome/test/base/testing_profile.h" #include "googleurl/src/gurl.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "testing/gtest/include/gtest/gtest.h" class TemplateURLFetcherTest; @@ -78,7 +78,7 @@ class TemplateURLFetcherTest : public testing::Test { void WaitForDownloadToFinish(); TemplateURLServiceTestUtil test_util_; - net::TestServer test_server_; + net::SpawnedTestServer test_server_; // The last TemplateURL to come from a callback. scoped_ptr<TemplateURL> last_callback_template_url_; @@ -108,8 +108,8 @@ void TemplateURLFetcherTestCallbacks::ConfirmAddSearchProvider( } TemplateURLFetcherTest::TemplateURLFetcherTest() - : test_server_(net::TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, + : test_server_(net::SpawnedTestServer::TYPE_HTTP, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))), callbacks_destroyed_(0), add_provider_called_(0), diff --git a/chrome/browser/sessions/tab_restore_browsertest.cc b/chrome/browser/sessions/tab_restore_browsertest.cc index d57e6c1..fae8633 100644 --- a/chrome/browser/sessions/tab_restore_browsertest.cc +++ b/chrome/browser/sessions/tab_restore_browsertest.cc @@ -28,7 +28,7 @@ #include "content/public/browser/web_contents.h" #include "googleurl/src/gurl.h" #include "net/base/net_util.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" class TabRestoreTest : public InProcessBrowserTest { diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc index d4afe0f..61d28fb 100644 --- a/chrome/browser/ssl/ssl_browser_tests.cc +++ b/chrome/browser/ssl/ssl_browser_tests.cc @@ -42,7 +42,7 @@ #include "net/base/net_errors.h" #include "net/base/test_data_directory.h" #include "net/cert/cert_status_flags.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #if defined(USE_NSS) #include "net/cert/nss_cert_database.h" @@ -94,16 +94,16 @@ class ProvisionalLoadWaiter : public content::WebContentsObserver { class SSLUITest : public InProcessBrowserTest { public: SSLUITest() - : https_server_(net::TestServer::TYPE_HTTPS, + : https_server_(net::SpawnedTestServer::TYPE_HTTPS, SSLOptions(SSLOptions::CERT_OK), base::FilePath(kDocRoot)), - https_server_expired_(net::TestServer::TYPE_HTTPS, + https_server_expired_(net::SpawnedTestServer::TYPE_HTTPS, SSLOptions(SSLOptions::CERT_EXPIRED), base::FilePath(kDocRoot)), - https_server_mismatched_(net::TestServer::TYPE_HTTPS, + https_server_mismatched_(net::SpawnedTestServer::TYPE_HTTPS, SSLOptions(SSLOptions::CERT_MISMATCHED_NAME), base::FilePath(kDocRoot)), - wss_server_expired_(net::TestServer::TYPE_WSS, + wss_server_expired_(net::SpawnedTestServer::TYPE_WSS, SSLOptions(SSLOptions::CERT_EXPIRED), net::GetWebSocketTestDataDirectory()) {} @@ -225,16 +225,16 @@ class SSLUITest : public InProcessBrowserTest { const std::string& original_file_path, const net::HostPortPair& host_port_pair, std::string* replacement_path) { - std::vector<net::TestServer::StringPair> replacement_text; + std::vector<net::SpawnedTestServer::StringPair> replacement_text; replacement_text.push_back( make_pair("REPLACE_WITH_HOST_AND_PORT", host_port_pair.ToString())); - return net::TestServer::GetFilePathWithReplacements( + return net::SpawnedTestServer::GetFilePathWithReplacements( original_file_path, replacement_text, replacement_path); } - static bool GetTopFramePath(const net::TestServer& http_server, - const net::TestServer& good_https_server, - const net::TestServer& bad_https_server, + static bool GetTopFramePath(const net::SpawnedTestServer& http_server, + const net::SpawnedTestServer& good_https_server, + const net::SpawnedTestServer& bad_https_server, std::string* top_frame_path) { // The "frame_left.html" page contained in the top_frame.html page contains // <a href>'s to three different servers. This sets up all of the @@ -245,7 +245,7 @@ class SSLUITest : public InProcessBrowserTest { GURL bad_https_url = bad_https_server.GetURL( "files/ssl/bad_iframe.html"); - std::vector<net::TestServer::StringPair> replacement_text_frame_left; + std::vector<net::SpawnedTestServer::StringPair> replacement_text_frame_left; replacement_text_frame_left.push_back( make_pair("REPLACE_WITH_HTTP_PAGE", http_url.spec())); replacement_text_frame_left.push_back( @@ -253,56 +253,57 @@ class SSLUITest : public InProcessBrowserTest { replacement_text_frame_left.push_back( make_pair("REPLACE_WITH_BAD_HTTPS_PAGE", bad_https_url.spec())); std::string frame_left_path; - if (!net::TestServer::GetFilePathWithReplacements( + if (!net::SpawnedTestServer::GetFilePathWithReplacements( "frame_left.html", replacement_text_frame_left, &frame_left_path)) return false; // Substitute the generated frame_left URL into the top_frame page. - std::vector<net::TestServer::StringPair> replacement_text_top_frame; + std::vector<net::SpawnedTestServer::StringPair> replacement_text_top_frame; replacement_text_top_frame.push_back( make_pair("REPLACE_WITH_FRAME_LEFT_PATH", frame_left_path)); - return net::TestServer::GetFilePathWithReplacements( + return net::SpawnedTestServer::GetFilePathWithReplacements( "files/ssl/top_frame.html", replacement_text_top_frame, top_frame_path); } static bool GetPageWithUnsafeWorkerPath( - const net::TestServer& expired_https_server, + const net::SpawnedTestServer& expired_https_server, std::string* page_with_unsafe_worker_path) { // Get the "imported.js" URL from the expired https server and // substitute it into the unsafe_worker.js file. GURL imported_js_url = expired_https_server.GetURL("files/ssl/imported.js"); - std::vector<net::TestServer::StringPair> replacement_text_for_unsafe_worker; + std::vector<net::SpawnedTestServer::StringPair> + replacement_text_for_unsafe_worker; replacement_text_for_unsafe_worker.push_back( make_pair("REPLACE_WITH_IMPORTED_JS_URL", imported_js_url.spec())); std::string unsafe_worker_path; - if (!net::TestServer::GetFilePathWithReplacements( + if (!net::SpawnedTestServer::GetFilePathWithReplacements( "unsafe_worker.js", replacement_text_for_unsafe_worker, &unsafe_worker_path)) return false; // Now, substitute this into the page with unsafe worker. - std::vector<net::TestServer::StringPair> + std::vector<net::SpawnedTestServer::StringPair> replacement_text_for_page_with_unsafe_worker; replacement_text_for_page_with_unsafe_worker.push_back( make_pair("REPLACE_WITH_UNSAFE_WORKER_PATH", unsafe_worker_path)); - return net::TestServer::GetFilePathWithReplacements( + return net::SpawnedTestServer::GetFilePathWithReplacements( "files/ssl/page_with_unsafe_worker.html", replacement_text_for_page_with_unsafe_worker, page_with_unsafe_worker_path); } - net::TestServer https_server_; - net::TestServer https_server_expired_; - net::TestServer https_server_mismatched_; - net::TestServer wss_server_expired_; + net::SpawnedTestServer https_server_; + net::SpawnedTestServer https_server_expired_; + net::SpawnedTestServer https_server_mismatched_; + net::SpawnedTestServer wss_server_expired_; private: - typedef net::TestServer::SSLOptions SSLOptions; + typedef net::SpawnedTestServer::SSLOptions SSLOptions; DISALLOW_COPY_AND_ASSIGN(SSLUITest); }; @@ -664,12 +665,13 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestWSSClientCert) { NULL)); // Start WebSocket test server with TLS and client cert authentication. - net::TestServer::SSLOptions options(net::TestServer::SSLOptions::CERT_OK); + net::SpawnedTestServer::SSLOptions options( + net::SpawnedTestServer::SSLOptions::CERT_OK); options.request_client_certificate = true; base::FilePath ca_path = net::GetTestCertsDirectory().Append( FILE_PATH_LITERAL("websocket_cacert.pem")); options.client_authorities.push_back(ca_path); - net::TestServer wss_server(net::TestServer::TYPE_WSS, + net::SpawnedTestServer wss_server(net::SpawnedTestServer::TYPE_WSS, options, net::GetWebSocketTestDataDirectory()); ASSERT_TRUE(wss_server.Start()); diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc index 4d0e90e..accdbfe 100644 --- a/chrome/browser/sync/test/integration/sync_test.cc +++ b/chrome/browser/sync/test/integration/sync_test.cc @@ -48,7 +48,7 @@ #include "net/proxy/proxy_config.h" #include "net/proxy/proxy_config_service_fixed.h" #include "net/proxy/proxy_service.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "net/url_request/test_url_fetcher_factory.h" #include "net/url_request/url_fetcher.h" #include "net/url_request/url_fetcher_delegate.h" diff --git a/chrome/browser/tab_contents/view_source_browsertest.cc b/chrome/browser/tab_contents/view_source_browsertest.cc index 7eb3f51..e90fd87 100644 --- a/chrome/browser/tab_contents/view_source_browsertest.cc +++ b/chrome/browser/tab_contents/view_source_browsertest.cc @@ -17,7 +17,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" #include "googleurl/src/gurl.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" namespace { const char kTestHtml[] = "files/viewsource/test.html"; diff --git a/chrome/browser/translate/translate_browsertest.cc b/chrome/browser/translate/translate_browsertest.cc index 204fd0db..450d0b3 100644 --- a/chrome/browser/translate/translate_browsertest.cc +++ b/chrome/browser/translate/translate_browsertest.cc @@ -19,7 +19,7 @@ #include "content/public/browser/notification_service.h" #include "content/public/test/browser_test_utils.h" #include "net/http/http_status_code.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "net/url_request/test_url_fetcher_factory.h" #include "net/url_request/url_fetcher_delegate.h" @@ -38,7 +38,7 @@ const char kElementMainScriptPath[] = "pseudo_element_main.js"; class TranslateBrowserTest : public InProcessBrowserTest { public: TranslateBrowserTest() - : https_server_(net::TestServer::TYPE_HTTPS, + : https_server_(net::SpawnedTestServer::TYPE_HTTPS, SSLOptions(SSLOptions::CERT_OK), base::FilePath(kTranslateRoot)) {} @@ -58,9 +58,9 @@ class TranslateBrowserTest : public InProcessBrowserTest { } private: - net::TestServer https_server_; + net::SpawnedTestServer https_server_; - typedef net::TestServer::SSLOptions SSLOptions; + typedef net::SpawnedTestServer::SSLOptions SSLOptions; DISALLOW_COPY_AND_ASSIGN(TranslateBrowserTest); }; diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index 4a4d1fc0..1083616 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -69,7 +69,7 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "net/dns/mock_host_resolver.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "ui/base/l10n/l10n_util.h" #if defined(OS_MACOSX) @@ -380,9 +380,9 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ReloadThenCancelBeforeUnload) { IN_PROC_BROWSER_TEST_F(BrowserTest, SingleBeforeUnloadAfterRedirect) { // Create HTTP and HTTPS servers for cross-site transition. ASSERT_TRUE(test_server()->Start()); - net::TestServer https_test_server(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - base::FilePath(kDocRoot)); + net::SpawnedTestServer https_test_server(net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(https_test_server.Start()); // Temporarily replace ContentBrowserClient with one that will cause a @@ -606,9 +606,9 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NullOpenerRedirectForksProcess) { // Create http and https servers for a cross-site transition. ASSERT_TRUE(test_server()->Start()); - net::TestServer https_test_server(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - base::FilePath(kDocRoot)); + net::SpawnedTestServer https_test_server(net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(https_test_server.Start()); GURL http_url(test_server()->GetURL("files/title1.html")); GURL https_url(https_test_server.GetURL(std::string())); @@ -695,9 +695,9 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, OtherRedirectsDontForkProcess) { // Create http and https servers for a cross-site transition. ASSERT_TRUE(test_server()->Start()); - net::TestServer https_test_server(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - base::FilePath(kDocRoot)); + net::SpawnedTestServer https_test_server(net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(https_test_server.Start()); GURL http_url(test_server()->GetURL("files/title1.html")); GURL https_url(https_test_server.GetURL(std::string())); @@ -810,9 +810,9 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutHttps) { CommandUpdater* command_updater = browser()->command_controller()->command_updater(); - net::TestServer test_server(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - base::FilePath(kDocRoot)); + net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); GURL https_url(test_server.GetURL("/")); ASSERT_TRUE(https_url.SchemeIs(chrome::kHttpsScheme)); @@ -824,9 +824,9 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutFtp) { CommandUpdater* command_updater = browser()->command_controller()->command_updater(); - net::TestServer test_server(net::TestServer::TYPE_FTP, - net::TestServer::kLocalhost, - base::FilePath(kDocRoot)); + net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_FTP, + net::SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); GURL ftp_url(test_server.GetURL(std::string())); ASSERT_TRUE(ftp_url.SchemeIs(chrome::kFtpScheme)); diff --git a/chrome/browser/ui/browser_focus_uitest.cc b/chrome/browser/ui/browser_focus_uitest.cc index 946f6cb..6d36146 100644 --- a/chrome/browser/ui/browser_focus_uitest.cc +++ b/chrome/browser/ui/browser_focus_uitest.cc @@ -37,7 +37,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_view.h" #include "content/public/test/browser_test_utils.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #if defined(TOOLKIT_VIEWS) #include "chrome/browser/ui/views/frame/browser_view.h" diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk_interactive_uitest.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk_interactive_uitest.cc index 09e294d..5126195 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk_interactive_uitest.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk_interactive_uitest.cc @@ -10,10 +10,10 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/gtk/view_id_util.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" -#include "chrome/test/base/interactive_test_utils.h" #include "chrome/test/base/in_process_browser_test.h" +#include "chrome/test/base/interactive_test_utils.h" #include "chrome/test/base/ui_test_utils.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" namespace { diff --git a/chrome/browser/ui/pdf/pdf_browsertest.cc b/chrome/browser/ui/pdf/pdf_browsertest.cc index 5d3de3c..70f7ca5 100644 --- a/chrome/browser/ui/pdf/pdf_browsertest.cc +++ b/chrome/browser/ui/pdf/pdf_browsertest.cc @@ -20,7 +20,7 @@ #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/clipboard/clipboard.h" #include "ui/gfx/codec/png_codec.h" @@ -44,15 +44,15 @@ class PDFBrowserTest : public InProcessBrowserTest, : snapshot_different_(true), next_dummy_search_value_(0), load_stop_notification_count_(0) { - pdf_test_server_.reset(new net::TestServer( - net::TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, + pdf_test_server_.reset(new net::SpawnedTestServer( + net::SpawnedTestServer::TYPE_HTTP, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("pdf/test")))); } protected: // Use our own TestServer so that we can serve files from the pdf directory. - net::TestServer* pdf_test_server() { return pdf_test_server_.get(); } + net::SpawnedTestServer* pdf_test_server() { return pdf_test_server_.get(); } int load_stop_notification_count() const { return load_stop_notification_count_; @@ -206,7 +206,7 @@ class PDFBrowserTest : public InProcessBrowserTest, // How many times we've seen chrome::LOAD_STOP. int load_stop_notification_count_; - scoped_ptr<net::TestServer> pdf_test_server_; + scoped_ptr<net::SpawnedTestServer> pdf_test_server_; }; #if defined(OS_CHROMEOS) diff --git a/chrome/browser/ui/search/instant_test_utils.h b/chrome/browser/ui/search/instant_test_utils.h index 2adf1ad..aa7c173 100644 --- a/chrome/browser/ui/search/instant_test_utils.h +++ b/chrome/browser/ui/search/instant_test_utils.h @@ -19,7 +19,7 @@ #include "chrome/browser/ui/search/instant_overlay_model_observer.h" #include "chrome/common/search_types.h" #include "googleurl/src/gurl.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" class InstantController; class InstantModel; @@ -57,7 +57,7 @@ class InstantTestBase { protected: InstantTestBase() : https_test_server_( - net::TestServer::TYPE_HTTPS, + net::SpawnedTestServer::TYPE_HTTPS, net::BaseTestServer::SSLOptions(), base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))) { } @@ -83,7 +83,7 @@ class InstantTestBase { const GURL& instant_url() const { return instant_url_; } - net::TestServer& https_test_server() { return https_test_server_; } + net::SpawnedTestServer& https_test_server() { return https_test_server_; } void KillInstantRenderView(); @@ -129,7 +129,7 @@ class InstantTestBase { Browser* browser_; // HTTPS Testing server, started on demand. - net::TestServer https_test_server_; + net::SpawnedTestServer https_test_server_; DISALLOW_COPY_AND_ASSIGN(InstantTestBase); }; diff --git a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc index cc55a36..e7451b7 100644 --- a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc +++ b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc @@ -15,12 +15,12 @@ #include "chrome/browser/ui/views/find_bar_host.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/common/chrome_notification_types.h" -#include "chrome/test/base/interactive_test_utils.h" #include "chrome/test/base/in_process_browser_test.h" +#include "chrome/test/base/interactive_test_utils.h" #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/web_contents.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "ui/base/clipboard/clipboard.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/views/focus/focus_manager.h" diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc index 7093cef..8c802e9 100644 --- a/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc +++ b/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc @@ -399,13 +399,13 @@ content::WebUIMessageHandler* NetInternalsTest::GetMockMessageHandler() { GURL NetInternalsTest::CreatePrerenderLoaderUrl( const GURL& prerender_url) { EXPECT_TRUE(StartTestServer()); - std::vector<net::TestServer::StringPair> replacement_text; + std::vector<net::SpawnedTestServer::StringPair> replacement_text; replacement_text.push_back( make_pair("REPLACE_WITH_PRERENDER_URL", prerender_url.spec())); replacement_text.push_back( make_pair("REPLACE_WITH_DESTINATION_URL", prerender_url.spec())); std::string replacement_path; - EXPECT_TRUE(net::TestServer::GetFilePathWithReplacements( + EXPECT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements( "files/prerender/prerender_loader.html", replacement_text, &replacement_path)); diff --git a/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc b/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc index a86d24c..bbd914a 100644 --- a/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc +++ b/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc @@ -11,7 +11,7 @@ #include "chrome/service/cloud_print/cloud_print_url_fetcher.h" #include "chrome/service/service_process.h" #include "googleurl/src/gurl.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "net/url_request/url_request_context_getter.h" #include "net/url_request/url_request_status.h" #include "net/url_request/url_request_test_util.h" @@ -328,9 +328,9 @@ void CloudPrintURLFetcherRetryBackoffTest::OnRequestGiveUp() { } TEST_F(CloudPrintURLFetcherBasicTest, HandleRawResponse) { - net::TestServer test_server(net::TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, - base::FilePath(kDocRoot)); + net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTP, + net::SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); SetHandleRawResponse(true); @@ -339,9 +339,9 @@ TEST_F(CloudPrintURLFetcherBasicTest, HandleRawResponse) { } TEST_F(CloudPrintURLFetcherBasicTest, HandleRawData) { - net::TestServer test_server(net::TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, - base::FilePath(kDocRoot)); + net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTP, + net::SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); SetHandleRawData(true); @@ -350,9 +350,9 @@ TEST_F(CloudPrintURLFetcherBasicTest, HandleRawData) { } TEST_F(CloudPrintURLFetcherOverloadTest, Protect) { - net::TestServer test_server(net::TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, - base::FilePath(kDocRoot)); + net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTP, + net::SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); GURL url(test_server.GetURL("defaultresponse")); @@ -362,9 +362,9 @@ TEST_F(CloudPrintURLFetcherOverloadTest, Protect) { } TEST_F(CloudPrintURLFetcherRetryBackoffTest, GiveUp) { - net::TestServer test_server(net::TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, - base::FilePath(kDocRoot)); + net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTP, + net::SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); GURL url(test_server.GetURL("defaultresponse")); diff --git a/chrome/test/base/in_process_browser_test.cc b/chrome/test/base/in_process_browser_test.cc index 6924052..4851360 100644 --- a/chrome/test/base/in_process_browser_test.cc +++ b/chrome/test/base/in_process_browser_test.cc @@ -45,7 +45,7 @@ #include "content/public/test/test_launcher.h" #include "content/public/test/test_navigation_observer.h" #include "net/dns/mock_host_resolver.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "ui/compositor/compositor_switches.h" #if defined(OS_CHROMEOS) diff --git a/chrome/test/nacl/nacl_browsertest_util.cc b/chrome/test/nacl/nacl_browsertest_util.cc index 14ce396..9701e66 100644 --- a/chrome/test/nacl/nacl_browsertest_util.cc +++ b/chrome/test/nacl/nacl_browsertest_util.cc @@ -242,9 +242,10 @@ bool NaClBrowserTestBase::StartTestServer() { base::FilePath document_root; if (!GetDocumentRoot(&document_root)) return false; - test_server_.reset(new net::TestServer(net::TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, - document_root)); + test_server_.reset(new net::SpawnedTestServer( + net::SpawnedTestServer::TYPE_HTTP, + net::SpawnedTestServer::kLocalhost, + document_root)); return test_server_->Start(); } diff --git a/chrome/test/nacl/nacl_browsertest_util.h b/chrome/test/nacl/nacl_browsertest_util.h index 84a6fd0..3b9853f 100644 --- a/chrome/test/nacl/nacl_browsertest_util.h +++ b/chrome/test/nacl/nacl_browsertest_util.h @@ -101,7 +101,7 @@ class NaClBrowserTestBase : public InProcessBrowserTest { private: bool StartTestServer(); - scoped_ptr<net::TestServer> test_server_; + scoped_ptr<net::SpawnedTestServer> test_server_; }; class NaClBrowserTestNewlib : public NaClBrowserTestBase { diff --git a/chrome/test/perf/mach_ports_test.cc b/chrome/test/perf/mach_ports_test.cc index d3a9666..583c067 100644 --- a/chrome/test/perf/mach_ports_test.cc +++ b/chrome/test/perf/mach_ports_test.cc @@ -13,7 +13,7 @@ #include "chrome/test/automation/tab_proxy.h" #include "chrome/test/perf/perf_test.h" #include "chrome/test/ui/ui_perf_test.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" namespace { @@ -24,8 +24,8 @@ namespace { class MachPortsTest : public UIPerfTest { public: MachPortsTest() - : server_(net::TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, + : server_(net::SpawnedTestServer::TYPE_HTTP, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("data/mach_ports/moz"))) { } @@ -61,7 +61,7 @@ class MachPortsTest : public UIPerfTest { } private: - net::TestServer server_; + net::SpawnedTestServer server_; std::vector<int> port_counts_; }; diff --git a/chrome/test/ppapi/ppapi_test.cc b/chrome/test/ppapi/ppapi_test.cc index d0ab8da..2708068 100644 --- a/chrome/test/ppapi/ppapi_test.cc +++ b/chrome/test/ppapi/ppapi_test.cc @@ -177,9 +177,9 @@ void PPAPITestBase::RunTestViaHTTP(const std::string& test_case) { ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&document_root)); base::FilePath http_document_root; ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&http_document_root)); - net::TestServer http_server(net::TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, - document_root); + net::SpawnedTestServer http_server(net::SpawnedTestServer::TYPE_HTTP, + net::SpawnedTestServer::kLocalhost, + document_root); ASSERT_TRUE(http_server.Start()); RunTestURL(GetTestURL(http_server, test_case, std::string())); } @@ -187,12 +187,12 @@ void PPAPITestBase::RunTestViaHTTP(const std::string& test_case) { void PPAPITestBase::RunTestWithSSLServer(const std::string& test_case) { base::FilePath http_document_root; ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&http_document_root)); - net::TestServer http_server(net::TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, - http_document_root); - net::TestServer ssl_server(net::TestServer::TYPE_HTTPS, - net::BaseTestServer::SSLOptions(), - http_document_root); + net::SpawnedTestServer http_server(net::SpawnedTestServer::TYPE_HTTP, + net::SpawnedTestServer::kLocalhost, + http_document_root); + net::SpawnedTestServer ssl_server(net::SpawnedTestServer::TYPE_HTTPS, + net::BaseTestServer::SSLOptions(), + http_document_root); // Start the servers in parallel. ASSERT_TRUE(http_server.StartInBackground()); ASSERT_TRUE(ssl_server.StartInBackground()); @@ -209,12 +209,12 @@ void PPAPITestBase::RunTestWithSSLServer(const std::string& test_case) { void PPAPITestBase::RunTestWithWebSocketServer(const std::string& test_case) { base::FilePath http_document_root; ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&http_document_root)); - net::TestServer http_server(net::TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, - http_document_root); - net::TestServer ws_server(net::TestServer::TYPE_WS, - net::TestServer::kLocalhost, - net::GetWebSocketTestDataDirectory()); + net::SpawnedTestServer http_server(net::SpawnedTestServer::TYPE_HTTP, + net::SpawnedTestServer::kLocalhost, + http_document_root); + net::SpawnedTestServer ws_server(net::SpawnedTestServer::TYPE_WS, + net::SpawnedTestServer::kLocalhost, + net::GetWebSocketTestDataDirectory()); // Start the servers in parallel. ASSERT_TRUE(http_server.StartInBackground()); ASSERT_TRUE(ws_server.StartInBackground()); @@ -269,7 +269,7 @@ void PPAPITestBase::RunTestURL(const GURL& test_url) { } GURL PPAPITestBase::GetTestURL( - const net::TestServer& http_server, + const net::SpawnedTestServer& http_server, const std::string& test_case, const std::string& extra_params) { std::string query = BuildQuery("files/test_case.html?", test_case); diff --git a/chrome/test/ppapi/ppapi_test.h b/chrome/test/ppapi/ppapi_test.h index 8441fbe..5540fcb 100644 --- a/chrome/test/ppapi/ppapi_test.h +++ b/chrome/test/ppapi/ppapi_test.h @@ -12,7 +12,7 @@ #include "base/compiler_specific.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/javascript_test_observer.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" namespace content { class RenderViewHost; @@ -82,7 +82,7 @@ class PPAPITestBase : public InProcessBrowserTest { void RunTestURL(const GURL& test_url); // Gets the URL of the the given |test_case| for the given HTTP test server. // If |extra_params| is non-empty, it will be appended as URL parameters. - GURL GetTestURL(const net::TestServer& http_server, + GURL GetTestURL(const net::SpawnedTestServer& http_server, const std::string& test_case, const std::string& extra_params); diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py index 984c7a6..c06517e 100755 --- a/chrome/test/pyautolib/pyauto.py +++ b/chrome/test/pyautolib/pyauto.py @@ -636,7 +636,7 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): """Get ftp:// url for the given path in the data dir. Args: - ftp_server: handle to ftp server, an instance of TestServer + ftp_server: handle to ftp server, an instance of SpawnedTestServer relative_path: any number of path elements The URL will be usable only after starting the ftp server. @@ -849,11 +849,12 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): data_dir: path where ftp files should be served Returns: - handle to FTP Server, an instance of TestServer + handle to FTP Server, an instance of SpawnedTestServer """ - ftp_server = pyautolib.TestServer(pyautolib.TestServer.TYPE_FTP, - '127.0.0.1', - pyautolib.FilePath(data_dir)) + ftp_server = pyautolib.SpawnedTestServer( + pyautolib.SpawnedTestServer.TYPE_FTP, + '127.0.0.1', + pyautolib.FilePath(data_dir)) assert ftp_server.Start(), 'Could not start ftp server' logging.debug('Started ftp server at "%s".', data_dir) return ftp_server @@ -865,18 +866,19 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): logging.debug('Stopped ftp server.') def StartHTTPServer(self, data_dir): - """Starts a local HTTP TestServer serving files from |data_dir|. + """Starts a local HTTP SpawnedTestServer serving files from |data_dir|. Args: - data_dir: path where the TestServer should serve files from. This will be - appended to the source dir to get the final document root. + data_dir: path where the SpawnedTestServer should serve files from. + This will be appended to the source dir to get the final document root. Returns: - handle to the HTTP TestServer + handle to the HTTP SpawnedTestServer """ - http_server = pyautolib.TestServer(pyautolib.TestServer.TYPE_HTTP, - '127.0.0.1', - pyautolib.FilePath(data_dir)) + http_server = pyautolib.SpawnedTestServer( + pyautolib.SpawnedTestServer.TYPE_HTTP, + '127.0.0.1', + pyautolib.FilePath(data_dir)) assert http_server.Start(), 'Could not start HTTP server' logging.debug('Started HTTP server at "%s".', data_dir) return http_server @@ -887,19 +889,20 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): logging.debug('Stopped HTTP server.') def StartHttpsServer(self, cert_type, data_dir): - """Starts a local HTTPS TestServer serving files from |data_dir|. + """Starts a local HTTPS SpawnedTestServer serving files from |data_dir|. Args: cert_type: An instance of SSLOptions.ServerCertificate for three certificate types: ok, expired, or mismatch. - data_dir: The path where TestServer should serve files from. This is - appended to the source dir to get the final document root. + data_dir: The path where SpawnedTestServer should serve files from. + This is appended to the source dir to get the final + document root. Returns: - Handle to the HTTPS TestServer + Handle to the HTTPS SpawnedTestServer """ - https_server = pyautolib.TestServer( - pyautolib.TestServer.TYPE_HTTPS, + https_server = pyautolib.SpawnedTestServer( + pyautolib.SpawnedTestServer.TYPE_HTTPS, pyautolib.SSLOptions(cert_type), pyautolib.FilePath(data_dir)) assert https_server.Start(), 'Could not start HTTPS server.' @@ -5798,9 +5801,10 @@ class PyUITestSuite(pyautolib.PyUITestSuiteBase, unittest.TestSuite): global _HTTP_SERVER assert not _HTTP_SERVER, 'HTTP Server already started' http_data_dir = _OPTIONS.http_data_dir - http_server = pyautolib.TestServer(pyautolib.TestServer.TYPE_HTTP, - '127.0.0.1', - pyautolib.FilePath(http_data_dir)) + http_server = pyautolib.SpawnedTestServer( + pyautolib.SpawnedTestServer.TYPE_HTTP, + '127.0.0.1', + pyautolib.FilePath(http_data_dir)) assert http_server.Start(), 'Could not start http server' _HTTP_SERVER = http_server logging.debug('Started http server at "%s".', http_data_dir) diff --git a/chrome/test/pyautolib/pyautolib.i b/chrome/test/pyautolib/pyautolib.i index 9e94f50..ce1a7e8 100644 --- a/chrome/test/pyautolib/pyautolib.i +++ b/chrome/test/pyautolib/pyautolib.i @@ -52,7 +52,7 @@ #include "chrome/test/automation/tab_proxy.h" #include "chrome/test/pyautolib/pyautolib.h" #include "content/public/common/security_style.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" %} // Handle type uint32 conversions as int @@ -186,11 +186,11 @@ class PyUITestBase { }; namespace net { -// TestServer +// SpawnedTestServer %feature("docstring", - "TestServer. Serves files in data dir over a local http server") - TestServer; -class TestServer { + "SpawnedTestServer. Serves files in data dir over a local http server") + SpawnedTestServer; +class SpawnedTestServer { public: enum Type { TYPE_FTP, @@ -198,18 +198,19 @@ class TestServer { TYPE_HTTPS, }; - // Initialize a TestServer listening on the specified host (IP or hostname). - TestServer(Type type, const std::string& host, - const base::FilePath& document_root); - // Initialize a TestServer with a specific set of SSLOptions. - TestServer(Type type, - const SSLOptions& ssl_options, - const base::FilePath& document_root); + // Initialize a SpawnedTestServer listening on the specified host + // (IP or hostname). + SpawnedTestServer(Type type, const std::string& host, + const base::FilePath& document_root); + // Initialize a SpawnedTestServer with a specific set of SSLOptions. + SpawnedTestServer(Type type, + const SSLOptions& ssl_options, + const base::FilePath& document_root); - %feature("docstring", "Start TestServer over an ephemeral port") Start; + %feature("docstring", "Start SpawnedTestServer over an ephemeral port") Start; bool Start(); - %feature("docstring", "Stop TestServer") Stop; + %feature("docstring", "Stop SpawnedTestServer") Stop; bool Stop(); %feature("docstring", "Get FilePath to the document root") document_root; @@ -221,7 +222,7 @@ class TestServer { GURL GetURL(const std::string& path) const; }; -%extend TestServer { +%extend SpawnedTestServer { %feature("docstring", "Get port number.") GetPort; int GetPort() const { int val = 0; @@ -247,7 +248,7 @@ struct SSLOptions { }; %{ -typedef net::TestServer::SSLOptions SSLOptions; +typedef net::SpawnedTestServer::SSLOptions SSLOptions; %} %pointer_class(int, int_ptr); diff --git a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc index 2471352..26b783c 100644 --- a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc +++ b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc @@ -28,7 +28,7 @@ #include "content/test/content_browser_test.h" #include "content/test/content_browser_test_utils.h" #include "net/base/net_util.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" #include "webkit/glue/webdropdata.h" @@ -477,9 +477,9 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, AdvanceFocus) { // a RenderViewHost swap in the web_contents. We verify that the embedder in the // web_contents gets cleared properly. IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, EmbedderChangedAfterSwap) { - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("content/test/data"))); ASSERT_TRUE(https_server.Start()); diff --git a/content/browser/download/download_browsertest.cc b/content/browser/download/download_browsertest.cc index 2645479..dd1ba30 100644 --- a/content/browser/download/download_browsertest.cc +++ b/content/browser/download/download_browsertest.cc @@ -29,7 +29,7 @@ #include "content/test/net/url_request_mock_http_job.h" #include "content/test/net/url_request_slow_download_job.h" #include "googleurl/src/gurl.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/content/browser/download/mhtml_generation_browsertest.cc b/content/browser/download/mhtml_generation_browsertest.cc index 6944a6c..0bd0e52 100644 --- a/content/browser/download/mhtml_generation_browsertest.cc +++ b/content/browser/download/mhtml_generation_browsertest.cc @@ -12,7 +12,7 @@ #include "content/shell/shell.h" #include "content/test/content_browser_test.h" #include "content/test/content_browser_test_utils.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "testing/gtest/include/gtest/gtest.h" namespace content { diff --git a/content/browser/fileapi/file_system_browsertest.cc b/content/browser/fileapi/file_system_browsertest.cc index 74633a0..6fe2f8c 100644 --- a/content/browser/fileapi/file_system_browsertest.cc +++ b/content/browser/fileapi/file_system_browsertest.cc @@ -17,7 +17,7 @@ #include "content/test/content_browser_test.h" #include "content/test/content_browser_test_utils.h" #include "content/test/layout_browsertest.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "webkit/quota/quota_manager.h" using quota::QuotaManager; diff --git a/content/browser/loader/resource_dispatcher_host_browsertest.cc b/content/browser/loader/resource_dispatcher_host_browsertest.cc index 282fecc..68aded9 100644 --- a/content/browser/loader/resource_dispatcher_host_browsertest.cc +++ b/content/browser/loader/resource_dispatcher_host_browsertest.cc @@ -20,7 +20,7 @@ #include "content/test/net/url_request_failed_job.h" #include "content/test/net/url_request_mock_http_job.h" #include "net/base/net_errors.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" namespace content { diff --git a/content/browser/media/webrtc_browsertest.cc b/content/browser/media/webrtc_browsertest.cc index de16b20..3ae93717 100644 --- a/content/browser/media/webrtc_browsertest.cc +++ b/content/browser/media/webrtc_browsertest.cc @@ -10,7 +10,7 @@ #include "content/shell/shell.h" #include "content/test/content_browser_test.h" #include "content/test/content_browser_test_utils.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #if defined(OS_WIN) #include "base/win/windows_version.h" diff --git a/content/browser/media/webrtc_internals_browsertest.cc b/content/browser/media/webrtc_internals_browsertest.cc index 00ca7a7..5dcb3a9 100644 --- a/content/browser/media/webrtc_internals_browsertest.cc +++ b/content/browser/media/webrtc_internals_browsertest.cc @@ -10,7 +10,7 @@ #include "content/shell/shell.h" #include "content/test/content_browser_test.h" #include "content/test/content_browser_test_utils.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" using std::string; namespace content { diff --git a/content/browser/renderer_host/render_view_host_browsertest.cc b/content/browser/renderer_host/render_view_host_browsertest.cc index 335c966..d75dd7a 100644 --- a/content/browser/renderer_host/render_view_host_browsertest.cc +++ b/content/browser/renderer_host/render_view_host_browsertest.cc @@ -16,7 +16,7 @@ #include "content/test/content_browser_test_utils.h" #include "net/base/host_port_pair.h" #include "net/base/net_util.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" namespace content { diff --git a/content/browser/renderer_host/render_view_host_manager_browsertest.cc b/content/browser/renderer_host/render_view_host_manager_browsertest.cc index b3f92ae..00a2f67 100644 --- a/content/browser/renderer_host/render_view_host_manager_browsertest.cc +++ b/content/browser/renderer_host/render_view_host_manager_browsertest.cc @@ -8,10 +8,10 @@ #include "base/path_service.h" #include "base/utf_string_conversions.h" #include "base/values.h" -#include "content/common/content_constants_internal.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/site_instance_impl.h" #include "content/browser/web_contents/web_contents_impl.h" +#include "content/common/content_constants_internal.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_details.h" @@ -28,7 +28,7 @@ #include "content/test/content_browser_test.h" #include "content/test/content_browser_test_utils.h" #include "net/base/net_util.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" namespace content { @@ -40,10 +40,10 @@ class RenderViewHostManagerTest : public ContentBrowserTest { const std::string& original_file_path, const net::HostPortPair& host_port_pair, std::string* replacement_path) { - std::vector<net::TestServer::StringPair> replacement_text; + std::vector<net::SpawnedTestServer::StringPair> replacement_text; replacement_text.push_back( make_pair("REPLACE_WITH_HOST_AND_PORT", host_port_pair.ToString())); - return net::TestServer::GetFilePathWithReplacements( + return net::SpawnedTestServer::GetFilePathWithReplacements( original_file_path, replacement_text, replacement_path); } }; @@ -52,9 +52,9 @@ class RenderViewHostManagerTest : public ContentBrowserTest { IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, NoScriptAccessAfterSwapOut) { // Start two servers with different sites. ASSERT_TRUE(test_server()->Start()); - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("content/test/data"))); ASSERT_TRUE(https_server.Start()); @@ -120,9 +120,9 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, SwapProcessWithRelNoreferrerAndTargetBlank) { // Start two servers with different sites. ASSERT_TRUE(test_server()->Start()); - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("content/test/data"))); ASSERT_TRUE(https_server.Start()); @@ -173,9 +173,9 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, SwapProcessWithSameSiteRelNoreferrer) { // Start two servers with different sites. ASSERT_TRUE(test_server()->Start()); - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("content/test/data"))); ASSERT_TRUE(https_server.Start()); @@ -226,9 +226,9 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, DontSwapProcessWithOnlyTargetBlank) { // Start two servers with different sites. ASSERT_TRUE(test_server()->Start()); - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("content/test/data"))); ASSERT_TRUE(https_server.Start()); @@ -274,9 +274,9 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, DontSwapProcessWithOnlyRelNoreferrer) { // Start two servers with different sites. ASSERT_TRUE(test_server()->Start()); - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("content/test/data"))); ASSERT_TRUE(https_server.Start()); @@ -320,9 +320,9 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, AllowTargetedNavigationsAfterSwap) { // Start two servers with different sites. ASSERT_TRUE(test_server()->Start()); - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("content/test/data"))); ASSERT_TRUE(https_server.Start()); @@ -403,9 +403,9 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, DisownOpener) { // Start two servers with different sites. ASSERT_TRUE(test_server()->Start()); - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("content/test/data"))); ASSERT_TRUE(https_server.Start()); @@ -505,9 +505,9 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, SupportCrossProcessPostMessage) { // Start two servers with different sites. ASSERT_TRUE(test_server()->Start()); - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("content/test/data"))); ASSERT_TRUE(https_server.Start()); @@ -643,9 +643,9 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, AllowTargetedNavigationsInOpenerAfterSwap) { // Start two servers with different sites. ASSERT_TRUE(test_server()->Start()); - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("content/test/data"))); ASSERT_TRUE(https_server.Start()); @@ -714,9 +714,9 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, ProcessExitWithSwappedOutViews) { // Start two servers with different sites. ASSERT_TRUE(test_server()->Start()); - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("content/test/data"))); ASSERT_TRUE(https_server.Start()); @@ -781,9 +781,9 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, ClickLinkAfter204Error) { // Start two servers with different sites. ASSERT_TRUE(test_server()->Start()); - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("content/test/data"))); ASSERT_TRUE(https_server.Start()); @@ -844,9 +844,9 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, BackForwardNotStale) { // Start two servers with different sites. ASSERT_TRUE(test_server()->Start()); - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("content/test/data"))); ASSERT_TRUE(https_server.Start()); @@ -959,9 +959,9 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, SwappedOutViewHasCorrectVisibilityState) { // Start two servers with different sites. ASSERT_TRUE(test_server()->Start()); - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("content/test/data"))); ASSERT_TRUE(https_server.Start()); @@ -1085,9 +1085,9 @@ class RenderViewHostObserverArray { IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, LeakingRenderViewHosts) { // Start two servers with different sites. ASSERT_TRUE(test_server()->Start()); - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("content/test/data"))); ASSERT_TRUE(https_server.Start()); @@ -1158,9 +1158,9 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, DontPreemptNavigationWithFrameTreeUpdate) { // Start two servers with different sites. ASSERT_TRUE(test_server()->Start()); - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("content/test/data"))); ASSERT_TRUE(https_server.Start()); diff --git a/content/browser/session_history_browsertest.cc b/content/browser/session_history_browsertest.cc index cd70207..cb5d100 100644 --- a/content/browser/session_history_browsertest.cc +++ b/content/browser/session_history_browsertest.cc @@ -14,7 +14,7 @@ #include "content/shell/shell.h" #include "content/test/content_browser_test.h" #include "content/test/content_browser_test_utils.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "testing/gtest/include/gtest/gtest.h" namespace content { diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc index d4af058..0989c7a 100644 --- a/content/browser/site_per_process_browsertest.cc +++ b/content/browser/site_per_process_browsertest.cc @@ -166,9 +166,9 @@ class SitePerProcessBrowserTest : public ContentBrowserTest { // security checks are back in place. IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DISABLED_CrossSiteIframe) { ASSERT_TRUE(test_server()->Start()); - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("content/test/data"))); ASSERT_TRUE(https_server.Start()); GURL main_url(test_server()->GetURL("files/site_per_process_main.html")); @@ -198,9 +198,9 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DISABLED_CrossSiteIframe) { IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DISABLED_CrossSiteIframeRedirectOnce) { ASSERT_TRUE(test_server()->Start()); - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("content/test/data"))); ASSERT_TRUE(https_server.Start()); @@ -322,9 +322,9 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DISABLED_CrossSiteIframeRedirectTwice) { ASSERT_TRUE(test_server()->Start()); - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("content/test/data"))); ASSERT_TRUE(https_server.Start()); diff --git a/content/browser/web_contents/web_contents_impl_browsertest.cc b/content/browser/web_contents/web_contents_impl_browsertest.cc index b3f5df8..f3830f1 100644 --- a/content/browser/web_contents/web_contents_impl_browsertest.cc +++ b/content/browser/web_contents/web_contents_impl_browsertest.cc @@ -14,7 +14,7 @@ #include "content/shell/shell.h" #include "content/test/content_browser_test.h" #include "content/test/content_browser_test_utils.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" namespace content { diff --git a/content/browser/web_contents/web_contents_view_aura_browsertest.cc b/content/browser/web_contents/web_contents_view_aura_browsertest.cc index a6cdfe3..a5cdf57 100644 --- a/content/browser/web_contents/web_contents_view_aura_browsertest.cc +++ b/content/browser/web_contents/web_contents_view_aura_browsertest.cc @@ -422,9 +422,9 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, ASSERT_NO_FATAL_FAILURE( StartTestWithPage("files/overscroll_navigation.html")); // Create a new server with a different site. - net::TestServer https_server( - net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, + net::SpawnedTestServer https_server( + net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("content/test/data"))); ASSERT_TRUE(https_server.Start()); diff --git a/content/browser/worker_host/test/worker_browsertest.cc b/content/browser/worker_host/test/worker_browsertest.cc index 3e67d7f..d44fde6 100644 --- a/content/browser/worker_host/test/worker_browsertest.cc +++ b/content/browser/worker_host/test/worker_browsertest.cc @@ -24,7 +24,7 @@ #include "content/test/layout_browsertest.h" #include "googleurl/src/gurl.h" #include "net/base/test_data_directory.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" namespace content { @@ -466,9 +466,9 @@ IN_PROC_BROWSER_TEST_F(WorkerTest, DISABLED_QueuedSharedWorkerStartedFromOtherTa IN_PROC_BROWSER_TEST_F(WorkerTest, WebSocketSharedWorker) { // Launch WebSocket server. - net::TestServer ws_server(net::TestServer::TYPE_WS, - net::TestServer::kLocalhost, - net::GetWebSocketTestDataDirectory()); + net::SpawnedTestServer ws_server(net::SpawnedTestServer::TYPE_WS, + net::SpawnedTestServer::kLocalhost, + net::GetWebSocketTestDataDirectory()); ASSERT_TRUE(ws_server.Start()); // Generate test URL. diff --git a/content/public/test/browser_test_base.cc b/content/public/test/browser_test_base.cc index 93f42d1..e89c28c 100644 --- a/content/public/test/browser_test_base.cc +++ b/content/public/test/browser_test_base.cc @@ -122,9 +122,9 @@ void BrowserTestBase::ProxyRunTestOnMainThreadLoop() { void BrowserTestBase::CreateTestServer(const base::FilePath& test_server_base) { CHECK(!test_server_.get()); - test_server_.reset(new net::TestServer( - net::TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, + test_server_.reset(new net::SpawnedTestServer( + net::SpawnedTestServer::TYPE_HTTP, + net::SpawnedTestServer::kLocalhost, test_server_base)); } diff --git a/content/public/test/browser_test_base.h b/content/public/test/browser_test_base.h index 31ca64b..8ddcba0 100644 --- a/content/public/test/browser_test_base.h +++ b/content/public/test/browser_test_base.h @@ -7,7 +7,7 @@ #include "base/callback.h" #include "base/compiler_specific.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "testing/gtest/include/gtest/gtest.h" class CommandLine; @@ -64,8 +64,10 @@ class BrowserTestBase : public testing::Test { virtual void RunTestOnMainThreadLoop() = 0; // Returns the testing server. Guaranteed to be non-NULL. - const net::TestServer* test_server() const { return test_server_.get(); } - net::TestServer* test_server() { return test_server_.get(); } + const net::SpawnedTestServer* test_server() const { + return test_server_.get(); + } + net::SpawnedTestServer* test_server() { return test_server_.get(); } #if defined(OS_POSIX) // This is only needed by a test that raises SIGTERM to ensure that a specific @@ -92,7 +94,7 @@ class BrowserTestBase : public testing::Test { void ProxyRunTestOnMainThreadLoop(); // Testing server, started on demand. - scoped_ptr<net::TestServer> test_server_; + scoped_ptr<net::SpawnedTestServer> test_server_; #if defined(OS_POSIX) bool handle_sigterm_; diff --git a/net/base/test_data_directory.h b/net/base/test_data_directory.h index 115f497..9f1a84d 100644 --- a/net/base/test_data_directory.h +++ b/net/base/test_data_directory.h @@ -21,7 +21,7 @@ base::FilePath GetTestClientCertsDirectory(); // Returns the base::FilePath object representing the relative path containing // resource files for testing WebSocket. Typically the FilePath will be used as -// document root argument for net::TestServer with TYPE_WS or TYPE_WSS. +// document root argument for net::SpawnedTestServer with TYPE_WS or TYPE_WSS. base::FilePath GetWebSocketTestDataDirectory(); } // namespace net diff --git a/net/net.gyp b/net/net.gyp index 05b9b01..8181589 100644 --- a/net/net.gyp +++ b/net/net.gyp @@ -2131,9 +2131,9 @@ 'test/python_utils.h', 'test/remote_test_server.cc', 'test/remote_test_server.h', + 'test/spawned_test_server.h', 'test/spawner_communicator.cc', 'test/spawner_communicator.h', - 'test/test_server.h', 'url_request/test_url_fetcher_factory.cc', 'url_request/test_url_fetcher_factory.h', 'url_request/url_request_test_util.cc', diff --git a/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc b/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc index 1cb389a..b192dbb 100644 --- a/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc +++ b/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc @@ -12,7 +12,7 @@ #include "net/base/test_completion_callback.h" #include "net/proxy/mock_proxy_script_fetcher.h" #include "net/proxy/proxy_script_fetcher_impl.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "net/url_request/url_request_test_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -269,9 +269,9 @@ class MockDhcpRealFetchProxyScriptAdapterFetcher }; TEST(DhcpProxyScriptAdapterFetcher, MockDhcpRealFetch) { - TestServer test_server( - TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, + SpawnedTestServer test_server( + SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, base::FilePath( FILE_PATH_LITERAL("net/data/proxy_script_fetcher_unittest"))); ASSERT_TRUE(test_server.Start()); diff --git a/net/proxy/proxy_resolver_perftest.cc b/net/proxy/proxy_resolver_perftest.cc index 4492120..0a0f2ec 100644 --- a/net/proxy/proxy_resolver_perftest.cc +++ b/net/proxy/proxy_resolver_perftest.cc @@ -12,7 +12,7 @@ #include "net/dns/mock_host_resolver.h" #include "net/proxy/proxy_info.h" #include "net/proxy/proxy_resolver_v8.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "testing/gtest/include/gtest/gtest.h" #if defined(OS_WIN) @@ -86,8 +86,8 @@ class PacPerfSuiteRunner { : resolver_(resolver), resolver_name_(resolver_name), test_server_( - net::TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, + net::SpawnedTestServer::TYPE_HTTP, + net::SpawnedTestServer::kLocalhost, base::FilePath( FILE_PATH_LITERAL("net/data/proxy_resolver_perftest"))) { } @@ -178,7 +178,7 @@ class PacPerfSuiteRunner { net::ProxyResolver* resolver_; std::string resolver_name_; - net::TestServer test_server_; + net::SpawnedTestServer test_server_; }; #if defined(OS_WIN) diff --git a/net/proxy/proxy_script_fetcher_impl_unittest.cc b/net/proxy/proxy_script_fetcher_impl_unittest.cc index cca4b85..3c23528 100644 --- a/net/proxy/proxy_script_fetcher_impl_unittest.cc +++ b/net/proxy/proxy_script_fetcher_impl_unittest.cc @@ -20,7 +20,7 @@ #include "net/http/http_network_session.h" #include "net/http/http_server_properties_impl.h" #include "net/ssl/ssl_config_service_defaults.h" -#include "net/test/test_server.h" +#include "net/test/spawned_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" @@ -182,14 +182,14 @@ class BasicNetworkDelegate : public NetworkDelegate { class ProxyScriptFetcherImplTest : public PlatformTest { public: ProxyScriptFetcherImplTest() - : test_server_(TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, + : test_server_(SpawnedTestServer::TYPE_HTTP, + net::SpawnedTestServer::kLocalhost, base::FilePath(kDocRoot)) { context_.set_network_delegate(&network_delegate_); } protected: - TestServer test_server_; + SpawnedTestServer test_server_; BasicNetworkDelegate network_delegate_; RequestContext context_; }; diff --git a/net/socket/ssl_client_socket_openssl_unittest.cc b/net/socket/ssl_client_socket_openssl_unittest.cc index 9c2895a..82c936f 100644 --- a/net/socket/ssl_client_socket_openssl_unittest.cc +++ b/net/socket/ssl_client_socket_openssl_unittest.cc @@ -37,7 +37,7 @@ #include "net/ssl/ssl_cert_request_info.h" #include "net/ssl/ssl_config_service.h" #include "net/test/cert_test_util.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" @@ -115,17 +115,17 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest { } // Connect to a HTTPS test server. - bool ConnectToTestServer(TestServer::SSLOptions& ssl_options) { - test_server_.reset(new TestServer(TestServer::TYPE_HTTPS, - ssl_options, - base::FilePath())); + bool ConnectToTestServer(SpawnedTestServer::SSLOptions& ssl_options) { + test_server_.reset(new SpawnedTestServer(SpawnedTestServer::TYPE_HTTPS, + ssl_options, + base::FilePath())); if (!test_server_->Start()) { - LOG(ERROR) << "Could not start TestServer"; + LOG(ERROR) << "Could not start SpawnedTestServer"; return false; } if (!test_server_->GetAddressList(&addr_)) { - LOG(ERROR) << "Could not get TestServer address list"; + LOG(ERROR) << "Could not get SpawnedTestServer address list"; return false; } @@ -134,7 +134,7 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest { int rv = callback_.GetResult( transport_->Connect(callback_.callback())); if (rv != OK) { - LOG(ERROR) << "Could not connect to TestServer"; + LOG(ERROR) << "Could not connect to SpawnedTestServer"; return false; } return true; @@ -187,7 +187,7 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest { scoped_ptr<MockCertVerifier> cert_verifier_; SSLClientSocketContext context_; OpenSSLClientKeyStore* key_store_; - scoped_ptr<TestServer> test_server_; + scoped_ptr<SpawnedTestServer> test_server_; AddressList addr_; TestCompletionCallback callback_; CapturingNetLog log_; @@ -198,7 +198,7 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest { // Connect to a server requesting client authentication, do not send // any client certificates. It should refuse the connection. TEST_F(SSLClientSocketOpenSSLClientAuthTest, NoCert) { - TestServer::SSLOptions ssl_options; + SpawnedTestServer::SSLOptions ssl_options; ssl_options.request_client_certificate = true; ASSERT_TRUE(ConnectToTestServer(ssl_options)); @@ -216,7 +216,7 @@ TEST_F(SSLClientSocketOpenSSLClientAuthTest, NoCert) { // Connect to a server requesting client authentication, and send it // an empty certificate. It should refuse the connection. TEST_F(SSLClientSocketOpenSSLClientAuthTest, SendEmptyCert) { - TestServer::SSLOptions ssl_options; + SpawnedTestServer::SSLOptions ssl_options; ssl_options.request_client_certificate = true; ssl_options.client_authorities.push_back( GetTestClientCertsDirectory().AppendASCII("client_1_ca.pem")); @@ -238,7 +238,7 @@ TEST_F(SSLClientSocketOpenSSLClientAuthTest, SendEmptyCert) { // Connect to a server requesting client authentication. Send it a // matching certificate. It should allow the connection. TEST_F(SSLClientSocketOpenSSLClientAuthTest, SendGoodCert) { - TestServer::SSLOptions ssl_options; + SpawnedTestServer::SSLOptions ssl_options; ssl_options.request_client_certificate = true; ssl_options.client_authorities.push_back( GetTestClientCertsDirectory().AppendASCII("client_1_ca.pem")); diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc index 7999455..cfb1f16 100644 --- a/net/socket/ssl_client_socket_unittest.cc +++ b/net/socket/ssl_client_socket_unittest.cc @@ -23,7 +23,7 @@ #include "net/ssl/ssl_cert_request_info.h" #include "net/ssl/ssl_config_service.h" #include "net/test/cert_test_util.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" @@ -266,9 +266,9 @@ static bool LogContainsSSLConnectEndEvent( }; TEST_F(SSLClientSocketTest, Connect) { - net::TestServer test_server(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - base::FilePath()); + net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, + base::FilePath()); ASSERT_TRUE(test_server.Start()); net::AddressList addr; @@ -307,11 +307,11 @@ TEST_F(SSLClientSocketTest, Connect) { } TEST_F(SSLClientSocketTest, ConnectExpired) { - net::TestServer::SSLOptions ssl_options( - net::TestServer::SSLOptions::CERT_EXPIRED); - net::TestServer test_server(net::TestServer::TYPE_HTTPS, - ssl_options, - base::FilePath()); + net::SpawnedTestServer::SSLOptions ssl_options( + net::SpawnedTestServer::SSLOptions::CERT_EXPIRED); + net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTPS, + ssl_options, + base::FilePath()); ASSERT_TRUE(test_server.Start()); cert_verifier_->set_default_result(net::ERR_CERT_DATE_INVALID); @@ -354,11 +354,11 @@ TEST_F(SSLClientSocketTest, ConnectExpired) { } TEST_F(SSLClientSocketTest, ConnectMismatched) { - net::TestServer::SSLOptions ssl_options( - net::TestServer::SSLOptions::CERT_MISMATCHED_NAME); - net::TestServer test_server(net::TestServer::TYPE_HTTPS, - ssl_options, - base::FilePath()); + net::SpawnedTestServer::SSLOptions ssl_options( + net::SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME); + net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTPS, + ssl_options, + base::FilePath()); ASSERT_TRUE(test_server.Start()); cert_verifier_->set_default_result(net::ERR_CERT_COMMON_NAME_INVALID); @@ -403,11 +403,11 @@ TEST_F(SSLClientSocketTest, ConnectMismatched) { // Attempt to connect to a page which requests a client certificate. It should // return an error code on connect. TEST_F(SSLClientSocketTest, ConnectClientAuthCertRequested) { - net::TestServer::SSLOptions ssl_options; + net::SpawnedTestServer::SSLOptions ssl_options; ssl_options.request_client_certificate = true; - net::TestServer test_server(net::TestServer::TYPE_HTTPS, - ssl_options, - base::FilePath()); + net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTPS, + ssl_options, + base::FilePath()); ASSERT_TRUE(test_server.Start()); net::AddressList addr; @@ -465,11 +465,11 @@ TEST_F(SSLClientSocketTest, ConnectClientAuthCertRequested) { // // TODO(davidben): Also test providing an actual certificate. TEST_F(SSLClientSocketTest, ConnectClientAuthSendNullCert) { - net::TestServer::SSLOptions ssl_options; + net::SpawnedTestServer::SSLOptions ssl_options; ssl_options.request_client_certificate = true; - net::TestServer test_server(net::TestServer::TYPE_HTTPS, - ssl_options, - base::FilePath()); + net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTPS, + ssl_options, + base::FilePath()); ASSERT_TRUE(test_server.Start()); net::AddressList addr; @@ -527,9 +527,9 @@ TEST_F(SSLClientSocketTest, ConnectClientAuthSendNullCert) { // - Server sends data unexpectedly. TEST_F(SSLClientSocketTest, Read) { - net::TestServer test_server(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - base::FilePath()); + net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, + base::FilePath()); ASSERT_TRUE(test_server.Start()); net::AddressList addr; @@ -583,9 +583,9 @@ TEST_F(SSLClientSocketTest, Read) { // Test the full duplex mode, with Read and Write pending at the same time. // This test also serves as a regression test for http://crbug.com/29815. TEST_F(SSLClientSocketTest, Read_FullDuplex) { - net::TestServer test_server(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - base::FilePath()); + net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, + base::FilePath()); ASSERT_TRUE(test_server.Start()); net::AddressList addr; @@ -641,9 +641,9 @@ TEST_F(SSLClientSocketTest, Read_FullDuplex) { } TEST_F(SSLClientSocketTest, Read_SmallChunks) { - net::TestServer test_server(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - base::FilePath()); + net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, + base::FilePath()); ASSERT_TRUE(test_server.Start()); net::AddressList addr; @@ -694,9 +694,9 @@ TEST_F(SSLClientSocketTest, Read_SmallChunks) { } TEST_F(SSLClientSocketTest, Read_ManySmallRecords) { - net::TestServer test_server(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - base::FilePath()); + net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, + base::FilePath()); ASSERT_TRUE(test_server.Start()); net::AddressList addr; @@ -746,9 +746,9 @@ TEST_F(SSLClientSocketTest, Read_ManySmallRecords) { } TEST_F(SSLClientSocketTest, Read_Interrupted) { - net::TestServer test_server(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - base::FilePath()); + net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, + base::FilePath()); ASSERT_TRUE(test_server.Start()); net::AddressList addr; @@ -796,9 +796,9 @@ TEST_F(SSLClientSocketTest, Read_Interrupted) { } TEST_F(SSLClientSocketTest, Read_FullLogging) { - net::TestServer test_server(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - base::FilePath()); + net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, + base::FilePath()); ASSERT_TRUE(test_server.Start()); net::AddressList addr; @@ -864,9 +864,9 @@ TEST_F(SSLClientSocketTest, Read_FullLogging) { // Regression test for http://crbug.com/42538 TEST_F(SSLClientSocketTest, PrematureApplicationData) { - net::TestServer test_server(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - base::FilePath()); + net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, + base::FilePath()); ASSERT_TRUE(test_server.Start()); net::AddressList addr; @@ -922,13 +922,13 @@ TEST_F(SSLClientSocketTest, CipherSuiteDisables) { 0x0005, // TLS_RSA_WITH_RC4_128_SHA }; - net::TestServer::SSLOptions ssl_options; + net::SpawnedTestServer::SSLOptions ssl_options; // Enable only RC4 on the test server. ssl_options.bulk_ciphers = - net::TestServer::SSLOptions::BULK_CIPHER_RC4; - net::TestServer test_server(net::TestServer::TYPE_HTTPS, - ssl_options, - base::FilePath()); + net::SpawnedTestServer::SSLOptions::BULK_CIPHER_RC4; + net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTPS, + ssl_options, + base::FilePath()); ASSERT_TRUE(test_server.Start()); net::AddressList addr; @@ -997,9 +997,9 @@ TEST_F(SSLClientSocketTest, CipherSuiteDisables) { // Here we verify that such a simple ClientSocketHandle, not associated with any // client socket pool, can be destroyed safely. TEST_F(SSLClientSocketTest, ClientSocketHandleNotFromPool) { - net::TestServer test_server(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - base::FilePath()); + net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, + base::FilePath()); ASSERT_TRUE(test_server.Start()); net::AddressList addr; @@ -1031,9 +1031,9 @@ TEST_F(SSLClientSocketTest, ClientSocketHandleNotFromPool) { // Verifies that SSLClientSocket::ExportKeyingMaterial return a success // code and different keying label results in different keying material. TEST_F(SSLClientSocketTest, ExportKeyingMaterial) { - net::TestServer test_server(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - base::FilePath()); + net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTPS, + net::SpawnedTestServer::kLocalhost, + base::FilePath()); ASSERT_TRUE(test_server.Start()); net::AddressList addr; @@ -1126,10 +1126,10 @@ TEST_F(SSLClientSocketTest, VerifyReturnChainProperlyOrdered) { net::ScopedTestRoot scoped_root(root_cert); // Set up a test server with CERT_CHAIN_WRONG_ROOT. - net::TestServer::SSLOptions ssl_options( - net::TestServer::SSLOptions::CERT_CHAIN_WRONG_ROOT); - net::TestServer test_server( - net::TestServer::TYPE_HTTPS, ssl_options, + net::SpawnedTestServer::SSLOptions ssl_options( + net::SpawnedTestServer::SSLOptions::CERT_CHAIN_WRONG_ROOT); + net::SpawnedTestServer test_server( + net::SpawnedTestServer::TYPE_HTTPS, ssl_options, base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); ASSERT_TRUE(test_server.Start()); @@ -1188,10 +1188,10 @@ class SSLClientSocketCertRequestInfoTest : public SSLClientSocketTest { // Creates a test server with the given SSLOptions, connects to it and returns // the SSLCertRequestInfo reported by the socket. scoped_refptr<net::SSLCertRequestInfo> GetCertRequest( - net::TestServer::SSLOptions ssl_options) { - net::TestServer test_server(net::TestServer::TYPE_HTTPS, - ssl_options, - base::FilePath()); + net::SpawnedTestServer::SSLOptions ssl_options) { + net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTPS, + ssl_options, + base::FilePath()); if (!test_server.Start()) return NULL; @@ -1227,7 +1227,7 @@ class SSLClientSocketCertRequestInfoTest : public SSLClientSocketTest { }; TEST_F(SSLClientSocketCertRequestInfoTest, NoAuthorities) { - net::TestServer::SSLOptions ssl_options; + net::SpawnedTestServer::SSLOptions ssl_options; ssl_options.request_client_certificate = true; scoped_refptr<net::SSLCertRequestInfo> request_info = GetCertRequest(ssl_options); @@ -1264,7 +1264,7 @@ TEST_F(SSLClientSocketCertRequestInfoTest, TwoAuthorities) { }; const size_t kDiginotarLen = sizeof(kDiginotarDN); - net::TestServer::SSLOptions ssl_options; + net::SpawnedTestServer::SSLOptions ssl_options; ssl_options.request_client_certificate = true; ssl_options.client_authorities.push_back( net::GetTestClientCertsDirectory().Append(kThawteFile)); diff --git a/net/test/test_server.h b/net/test/spawned_test_server.h index d005d8c..f673869 100644 --- a/net/test/test_server.h +++ b/net/test/spawned_test_server.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef NET_TEST_TEST_SERVER_H_ -#define NET_TEST_TEST_SERVER_H_ +#ifndef NET_TEST_SPAWNED_TEST_SERVER_H_ +#define NET_TEST_SPAWNED_TEST_SERVER_H_ #include "build/build_config.h" @@ -16,12 +16,12 @@ namespace net { #if defined(OS_ANDROID) -typedef RemoteTestServer TestServer; +typedef RemoteTestServer SpawnedTestServer; #else -typedef LocalTestServer TestServer; +typedef LocalTestServer SpawnedTestServer; #endif } // namespace net -#endif // NET_TEST_TEST_SERVER_H_ +#endif // NET_TEST_SPAWNED_TEST_SERVER_H_ diff --git a/net/test/spawner_communicator.h b/net/test/spawner_communicator.h index 4b4fbaf..6280a48 100644 --- a/net/test/spawner_communicator.h +++ b/net/test/spawner_communicator.h @@ -29,8 +29,8 @@ class ScopedPortException; // themselves continue running on the device. To control the test server on the // host machine, a second HTTP server is started, the spawner server, which // controls the life cycle of remote test servers. Calls to start/kill the -// net::TestServer are then redirected to the spawner server via this spawner -// communicator. +// net::SpawnedTestServer are then redirected to the spawner server via +// this spawner communicator. // // Currently only three commands are supported by spawner. // diff --git a/net/tools/testserver/run_testserver.cc b/net/tools/testserver/run_testserver.cc index 3362cfd..b765dd4 100644 --- a/net/tools/testserver/run_testserver.cc +++ b/net/tools/testserver/run_testserver.cc @@ -11,7 +11,7 @@ #include "base/message_loop.h" #include "base/test/test_timeouts.h" #include "base/utf_string_conversions.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" static void PrintUsage() { printf("run_testserver --doc-root=relpath\n" @@ -46,42 +46,43 @@ int main(int argc, const char* argv[]) { return -1; } - net::TestServer::Type server_type; + net::SpawnedTestServer::Type server_type; if (command_line->HasSwitch("http")) { - server_type = net::TestServer::TYPE_HTTP; + server_type = net::SpawnedTestServer::TYPE_HTTP; } else if (command_line->HasSwitch("https")) { - server_type = net::TestServer::TYPE_HTTPS; + server_type = net::SpawnedTestServer::TYPE_HTTPS; } else if (command_line->HasSwitch("ws")) { - server_type = net::TestServer::TYPE_WS; + server_type = net::SpawnedTestServer::TYPE_WS; } else if (command_line->HasSwitch("wss")) { - server_type = net::TestServer::TYPE_WSS; + server_type = net::SpawnedTestServer::TYPE_WSS; } else if (command_line->HasSwitch("ftp")) { - server_type = net::TestServer::TYPE_FTP; + server_type = net::SpawnedTestServer::TYPE_FTP; } else { // If no scheme switch is specified, select http or https scheme. // TODO(toyoshim): Remove this estimation. if (command_line->HasSwitch("ssl-cert")) - server_type = net::TestServer::TYPE_HTTPS; + server_type = net::SpawnedTestServer::TYPE_HTTPS; else - server_type = net::TestServer::TYPE_HTTP; + server_type = net::SpawnedTestServer::TYPE_HTTP; } - net::TestServer::SSLOptions ssl_options; + net::SpawnedTestServer::SSLOptions ssl_options; if (command_line->HasSwitch("ssl-cert")) { - if (!net::TestServer::UsingSSL(server_type)) { + if (!net::SpawnedTestServer::UsingSSL(server_type)) { printf("Error: --ssl-cert is specified on non-secure scheme\n"); PrintUsage(); return -1; } std::string cert_option = command_line->GetSwitchValueASCII("ssl-cert"); if (cert_option == "ok") { - ssl_options.server_certificate = net::TestServer::SSLOptions::CERT_OK; + ssl_options.server_certificate = + net::SpawnedTestServer::SSLOptions::CERT_OK; } else if (cert_option == "mismatched-name") { ssl_options.server_certificate = - net::TestServer::SSLOptions::CERT_MISMATCHED_NAME; + net::SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME; } else if (cert_option == "expired") { ssl_options.server_certificate = - net::TestServer::SSLOptions::CERT_EXPIRED; + net::SpawnedTestServer::SSLOptions::CERT_EXPIRED; } else { printf("Error: --ssl-cert has invalid value %s\n", cert_option.c_str()); PrintUsage(); @@ -96,13 +97,15 @@ int main(int argc, const char* argv[]) { return -1; } - scoped_ptr<net::TestServer> test_server; - if (net::TestServer::UsingSSL(server_type)) { - test_server.reset(new net::TestServer(server_type, ssl_options, doc_root)); + scoped_ptr<net::SpawnedTestServer> test_server; + if (net::SpawnedTestServer::UsingSSL(server_type)) { + test_server.reset( + new net::SpawnedTestServer(server_type, ssl_options, doc_root)); } else { - test_server.reset(new net::TestServer(server_type, - net::TestServer::kLocalhost, - doc_root)); + test_server.reset(new net::SpawnedTestServer( + server_type, + net::SpawnedTestServer::kLocalhost, + doc_root)); } if (!test_server->Start()) { diff --git a/net/url_request/url_fetcher_impl_unittest.cc b/net/url_request/url_fetcher_impl_unittest.cc index 768ad95..ecc9dbb 100644 --- a/net/url_request/url_fetcher_impl_unittest.cc +++ b/net/url_request/url_fetcher_impl_unittest.cc @@ -19,7 +19,7 @@ #include "net/base/network_change_notifier.h" #include "net/dns/mock_host_resolver.h" #include "net/http/http_response_headers.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "net/url_request/url_fetcher_delegate.h" #include "net/url_request/url_request_context_getter.h" #include "net/url_request/url_request_test_util.h" @@ -156,7 +156,7 @@ class URLFetcherMockDnsTest : public URLFetcherTest { protected: GURL test_url_; - scoped_ptr<TestServer> test_server_; + scoped_ptr<SpawnedTestServer> test_server_; MockHostResolver resolver_; scoped_ptr<URLFetcher> completed_fetcher_; }; @@ -199,9 +199,9 @@ void URLFetcherMockDnsTest::SetUp() { context_->set_host_resolver(&resolver_); context_->Init(); - test_server_.reset(new TestServer(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot))); + test_server_.reset(new SpawnedTestServer(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot))); ASSERT_TRUE(test_server_->Start()); // test_server_.GetURL() returns a URL with 127.0.0.1 (kLocalhost), that is @@ -889,9 +889,9 @@ void URLFetcherFileTest::OnURLFetchComplete(const URLFetcher* source) { } TEST_F(URLFetcherTest, SameThreadsTest) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); // Create the fetcher on the main thread. Since IO will happen on the main @@ -903,9 +903,9 @@ TEST_F(URLFetcherTest, SameThreadsTest) { } TEST_F(URLFetcherTest, DifferentThreadsTest) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); // Create a separate thread that will create the URLFetcher. The current @@ -932,9 +932,9 @@ void CancelAllOnIO() { // Tests to make sure CancelAll() will successfully cancel existing URLFetchers. TEST_F(URLFetcherTest, CancelAll) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); EXPECT_EQ(0, GetNumFetcherCores()); @@ -1057,9 +1057,9 @@ TEST_F(URLFetcherMockDnsTest, RetryOnNetworkChangedAndSucceed) { } TEST_F(URLFetcherPostTest, Basic) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); CreateFetcher(test_server.GetURL("echo")); @@ -1067,9 +1067,9 @@ TEST_F(URLFetcherPostTest, Basic) { } TEST_F(URLFetcherPostFileTest, Basic) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); CreateFetcher(test_server.GetURL("echo")); @@ -1077,9 +1077,9 @@ TEST_F(URLFetcherPostFileTest, Basic) { } TEST_F(URLFetcherPostFileTest, Range) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); SetUploadRange(30, 100); @@ -1089,9 +1089,9 @@ TEST_F(URLFetcherPostFileTest, Range) { } TEST_F(URLFetcherEmptyPostTest, Basic) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); CreateFetcher(test_server.GetURL("echo")); @@ -1099,9 +1099,9 @@ TEST_F(URLFetcherEmptyPostTest, Basic) { } TEST_F(URLFetcherUploadProgressTest, Basic) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); CreateFetcher(test_server.GetURL("echo")); @@ -1109,9 +1109,9 @@ TEST_F(URLFetcherUploadProgressTest, Basic) { } TEST_F(URLFetcherDownloadProgressTest, Basic) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); // Get a file large enough to require more than one read into @@ -1130,9 +1130,9 @@ TEST_F(URLFetcherDownloadProgressTest, Basic) { } TEST_F(URLFetcherDownloadProgressCancelTest, CancelWhileProgressReport) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); // Get a file large enough to require more than one read into @@ -1145,9 +1145,9 @@ TEST_F(URLFetcherDownloadProgressCancelTest, CancelWhileProgressReport) { } TEST_F(URLFetcherHeadersTest, Headers) { - TestServer test_server( - TestServer::TYPE_HTTP, - TestServer::kLocalhost, + SpawnedTestServer test_server( + SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))); ASSERT_TRUE(test_server.Start()); @@ -1157,9 +1157,9 @@ TEST_F(URLFetcherHeadersTest, Headers) { } TEST_F(URLFetcherSocketAddressTest, SocketAddress) { - TestServer test_server( - TestServer::TYPE_HTTP, - TestServer::kLocalhost, + SpawnedTestServer test_server( + SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))); ASSERT_TRUE(test_server.Start()); expected_port_ = test_server.host_port_pair().port(); @@ -1171,9 +1171,9 @@ TEST_F(URLFetcherSocketAddressTest, SocketAddress) { } TEST_F(URLFetcherStopOnRedirectTest, StopOnRedirect) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); CreateFetcher( @@ -1183,9 +1183,9 @@ TEST_F(URLFetcherStopOnRedirectTest, StopOnRedirect) { } TEST_F(URLFetcherProtectTest, Overload) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); GURL url(test_server.GetURL("defaultresponse")); @@ -1209,9 +1209,9 @@ TEST_F(URLFetcherProtectTest, Overload) { } TEST_F(URLFetcherProtectTest, ServerUnavailable) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); GURL url(test_server.GetURL("files/server-unavailable.html")); @@ -1237,9 +1237,9 @@ TEST_F(URLFetcherProtectTest, ServerUnavailable) { } TEST_F(URLFetcherProtectTestPassedThrough, ServerUnavailablePropagateResponse) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); GURL url(test_server.GetURL("files/server-unavailable.html")); @@ -1267,11 +1267,11 @@ TEST_F(URLFetcherProtectTestPassedThrough, ServerUnavailablePropagateResponse) { } TEST_F(URLFetcherBadHTTPSTest, BadHTTPSTest) { - TestServer::SSLOptions ssl_options( - TestServer::SSLOptions::CERT_EXPIRED); - TestServer test_server(TestServer::TYPE_HTTPS, - ssl_options, - base::FilePath(kDocRoot)); + SpawnedTestServer::SSLOptions ssl_options( + SpawnedTestServer::SSLOptions::CERT_EXPIRED); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTPS, + ssl_options, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); CreateFetcher(test_server.GetURL("defaultresponse")); @@ -1279,9 +1279,9 @@ TEST_F(URLFetcherBadHTTPSTest, BadHTTPSTest) { } TEST_F(URLFetcherCancelTest, ReleasesContext) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); GURL url(test_server.GetURL("files/server-unavailable.html")); @@ -1302,9 +1302,9 @@ TEST_F(URLFetcherCancelTest, ReleasesContext) { } TEST_F(URLFetcherCancelTest, CancelWhileDelayedStartTaskPending) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); GURL url(test_server.GetURL("files/server-unavailable.html")); @@ -1339,9 +1339,9 @@ TEST_F(URLFetcherCancelTest, CancelWhileDelayedStartTaskPending) { } TEST_F(URLFetcherMultipleAttemptTest, SameData) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); // Create the fetcher on the main thread. Since IO will happen on the main @@ -1353,9 +1353,9 @@ TEST_F(URLFetcherMultipleAttemptTest, SameData) { } TEST_F(URLFetcherFileTest, SmallGet) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); base::ScopedTempDir temp_dir; @@ -1375,9 +1375,9 @@ TEST_F(URLFetcherFileTest, SmallGet) { } TEST_F(URLFetcherFileTest, LargeGet) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); base::ScopedTempDir temp_dir; @@ -1395,9 +1395,9 @@ TEST_F(URLFetcherFileTest, LargeGet) { } TEST_F(URLFetcherFileTest, CanTakeOwnershipOfFile) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); base::ScopedTempDir temp_dir; @@ -1419,9 +1419,9 @@ TEST_F(URLFetcherFileTest, CanTakeOwnershipOfFile) { TEST_F(URLFetcherFileTest, OverwriteExistingFile) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); base::ScopedTempDir temp_dir; @@ -1446,9 +1446,9 @@ TEST_F(URLFetcherFileTest, OverwriteExistingFile) { } TEST_F(URLFetcherFileTest, TryToOverwriteDirectory) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); base::ScopedTempDir temp_dir; @@ -1473,9 +1473,9 @@ TEST_F(URLFetcherFileTest, TryToOverwriteDirectory) { } TEST_F(URLFetcherFileTest, SmallGetToTempFile) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); // Get a small file. @@ -1491,9 +1491,9 @@ TEST_F(URLFetcherFileTest, SmallGetToTempFile) { } TEST_F(URLFetcherFileTest, LargeGetToTempFile) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); // Get a file large enough to require more than one read into @@ -1507,9 +1507,9 @@ TEST_F(URLFetcherFileTest, LargeGetToTempFile) { } TEST_F(URLFetcherFileTest, CanTakeOwnershipOfTempFile) { - TestServer test_server(TestServer::TYPE_HTTP, - TestServer::kLocalhost, - base::FilePath(kDocRoot)); + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP, + SpawnedTestServer::kLocalhost, + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); // Get a small file. diff --git a/net/url_request/url_request_context_builder_unittest.cc b/net/url_request/url_request_context_builder_unittest.cc index af53c87..a3ffb95 100644 --- a/net/url_request/url_request_context_builder_unittest.cc +++ b/net/url_request/url_request_context_builder_unittest.cc @@ -5,7 +5,7 @@ #include "net/url_request/url_request_context_builder.h" #include "build/build_config.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_test_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -20,19 +20,19 @@ namespace net { namespace { -// A subclass of TestServer that uses a statically-configured hostname. This is -// to work around mysterious failures in chrome_frame_net_tests. See: +// A subclass of SpawnedTestServer that uses a statically-configured hostname. +// This is to work around mysterious failures in chrome_frame_net_tests. See: // http://crbug.com/114369 -class LocalHttpTestServer : public TestServer { +class LocalHttpTestServer : public SpawnedTestServer { public: explicit LocalHttpTestServer(const base::FilePath& document_root) - : TestServer(TestServer::TYPE_HTTP, - ScopedCustomUrlRequestTestHttpHost::value(), - document_root) {} + : SpawnedTestServer(SpawnedTestServer::TYPE_HTTP, + ScopedCustomUrlRequestTestHttpHost::value(), + document_root) {} LocalHttpTestServer() - : TestServer(TestServer::TYPE_HTTP, - ScopedCustomUrlRequestTestHttpHost::value(), - base::FilePath()) {} + : SpawnedTestServer(SpawnedTestServer::TYPE_HTTP, + ScopedCustomUrlRequestTestHttpHost::value(), + base::FilePath()) {} }; class URLRequestContextBuilderTest : public PlatformTest { diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index c9cabc1..ec7a349 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc @@ -57,7 +57,7 @@ #include "net/socket/ssl_client_socket.h" #include "net/ssl/ssl_connection_status_flags.h" #include "net/test/cert_test_util.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "net/url_request/ftp_protocol_handler.h" #include "net/url_request/static_http_user_agent_settings.h" #include "net/url_request/url_request.h" @@ -1763,21 +1763,21 @@ TEST_F(URLRequestTest, SetJobPriority) { EXPECT_EQ(MEDIUM, job->priority()); } -// TODO(droger): Support TestServer on iOS (see http://crbug.com/148666). +// TODO(droger): Support SpawnedTestServer on iOS (see http://crbug.com/148666). #if !defined(OS_IOS) -// A subclass of TestServer that uses a statically-configured hostname. This is -// to work around mysterious failures in chrome_frame_net_tests. See: +// A subclass of SpawnedTestServer that uses a statically-configured hostname. +// This is to work around mysterious failures in chrome_frame_net_tests. See: // http://crbug.com/114369 -class LocalHttpTestServer : public TestServer { +class LocalHttpTestServer : public SpawnedTestServer { public: explicit LocalHttpTestServer(const base::FilePath& document_root) - : TestServer(TestServer::TYPE_HTTP, - ScopedCustomUrlRequestTestHttpHost::value(), - document_root) {} + : SpawnedTestServer(SpawnedTestServer::TYPE_HTTP, + ScopedCustomUrlRequestTestHttpHost::value(), + document_root) {} LocalHttpTestServer() - : TestServer(TestServer::TYPE_HTTP, - ScopedCustomUrlRequestTestHttpHost::value(), - base::FilePath()) {} + : SpawnedTestServer(SpawnedTestServer::TYPE_HTTP, + ScopedCustomUrlRequestTestHttpHost::value(), + base::FilePath()) {} }; TEST_F(URLRequestTest, DelayedCookieCallback) { @@ -3308,8 +3308,8 @@ TEST_F(URLRequestTestHTTP, GetZippedTest) { TEST_F(URLRequestTestHTTP, HTTPSToHTTPRedirectNoRefererTest) { ASSERT_TRUE(test_server_.Start()); - TestServer https_test_server( - TestServer::TYPE_HTTPS, TestServer::kLocalhost, + SpawnedTestServer https_test_server( + SpawnedTestServer::TYPE_HTTPS, SpawnedTestServer::kLocalhost, base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); ASSERT_TRUE(https_test_server.Start()); @@ -3750,9 +3750,9 @@ TEST_F(URLRequestTestHTTP, ResponseHeadersTest) { } TEST_F(URLRequestTestHTTP, ProcessSTS) { - TestServer::SSLOptions ssl_options; - TestServer https_test_server( - TestServer::TYPE_HTTPS, + SpawnedTestServer::SSLOptions ssl_options; + SpawnedTestServer https_test_server( + SpawnedTestServer::TYPE_HTTPS, ssl_options, base::FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))); ASSERT_TRUE(https_test_server.Start()); @@ -3770,16 +3770,16 @@ TEST_F(URLRequestTestHTTP, ProcessSTS) { bool sni_available = true; TransportSecurityState::DomainState domain_state; EXPECT_TRUE(security_state->GetDomainState( - TestServer::kLocalhost, sni_available, &domain_state)); + SpawnedTestServer::kLocalhost, sni_available, &domain_state)); EXPECT_EQ(TransportSecurityState::DomainState::MODE_FORCE_HTTPS, domain_state.upgrade_mode); EXPECT_TRUE(domain_state.include_subdomains); } TEST_F(URLRequestTestHTTP, ProcessSTSOnce) { - TestServer::SSLOptions ssl_options; - TestServer https_test_server( - TestServer::TYPE_HTTPS, + SpawnedTestServer::SSLOptions ssl_options; + SpawnedTestServer https_test_server( + SpawnedTestServer::TYPE_HTTPS, ssl_options, base::FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))); ASSERT_TRUE(https_test_server.Start()); @@ -3798,16 +3798,16 @@ TEST_F(URLRequestTestHTTP, ProcessSTSOnce) { bool sni_available = true; TransportSecurityState::DomainState domain_state; EXPECT_TRUE(security_state->GetDomainState( - TestServer::kLocalhost, sni_available, &domain_state)); + SpawnedTestServer::kLocalhost, sni_available, &domain_state)); EXPECT_EQ(TransportSecurityState::DomainState::MODE_FORCE_HTTPS, domain_state.upgrade_mode); EXPECT_FALSE(domain_state.include_subdomains); } TEST_F(URLRequestTestHTTP, ProcessSTSAndPKP) { - TestServer::SSLOptions ssl_options; - TestServer https_test_server( - TestServer::TYPE_HTTPS, + SpawnedTestServer::SSLOptions ssl_options; + SpawnedTestServer https_test_server( + SpawnedTestServer::TYPE_HTTPS, ssl_options, base::FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))); ASSERT_TRUE(https_test_server.Start()); @@ -3826,7 +3826,7 @@ TEST_F(URLRequestTestHTTP, ProcessSTSAndPKP) { bool sni_available = true; TransportSecurityState::DomainState domain_state; EXPECT_TRUE(security_state->GetDomainState( - TestServer::kLocalhost, sni_available, &domain_state)); + SpawnedTestServer::kLocalhost, sni_available, &domain_state)); EXPECT_EQ(TransportSecurityState::DomainState::MODE_FORCE_HTTPS, domain_state.upgrade_mode); #if defined(OS_ANDROID) @@ -4552,9 +4552,10 @@ class HTTPSRequestTest : public testing::Test { }; TEST_F(HTTPSRequestTest, HTTPSGetTest) { - TestServer test_server(TestServer::TYPE_HTTPS, - TestServer::kLocalhost, - base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); + SpawnedTestServer test_server( + SpawnedTestServer::TYPE_HTTPS, + SpawnedTestServer::kLocalhost, + base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); ASSERT_TRUE(test_server.Start()); TestDelegate d; @@ -4577,11 +4578,12 @@ TEST_F(HTTPSRequestTest, HTTPSGetTest) { } TEST_F(HTTPSRequestTest, HTTPSMismatchedTest) { - TestServer::SSLOptions ssl_options( - TestServer::SSLOptions::CERT_MISMATCHED_NAME); - TestServer test_server(TestServer::TYPE_HTTPS, - ssl_options, - base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); + SpawnedTestServer::SSLOptions ssl_options( + SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME); + SpawnedTestServer test_server( + SpawnedTestServer::TYPE_HTTPS, + ssl_options, + base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); ASSERT_TRUE(test_server.Start()); bool err_allowed = true; @@ -4610,11 +4612,12 @@ TEST_F(HTTPSRequestTest, HTTPSMismatchedTest) { } TEST_F(HTTPSRequestTest, HTTPSExpiredTest) { - TestServer::SSLOptions ssl_options( - TestServer::SSLOptions::CERT_EXPIRED); - TestServer test_server(TestServer::TYPE_HTTPS, - ssl_options, - base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); + SpawnedTestServer::SSLOptions ssl_options( + SpawnedTestServer::SSLOptions::CERT_EXPIRED); + SpawnedTestServer test_server( + SpawnedTestServer::TYPE_HTTPS, + ssl_options, + base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); ASSERT_TRUE(test_server.Start()); // Iterate from false to true, just so that we do the opposite of the @@ -4655,13 +4658,14 @@ TEST_F(HTTPSRequestTest, TLSv1Fallback) { if (default_version_max <= SSL_PROTOCOL_VERSION_TLS1) return; - TestServer::SSLOptions ssl_options( - TestServer::SSLOptions::CERT_OK); + SpawnedTestServer::SSLOptions ssl_options( + SpawnedTestServer::SSLOptions::CERT_OK); ssl_options.tls_intolerant = - TestServer::SSLOptions::TLS_INTOLERANT_TLS1_1; - TestServer test_server(TestServer::TYPE_HTTPS, - ssl_options, - base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); + SpawnedTestServer::SSLOptions::TLS_INTOLERANT_TLS1_1; + SpawnedTestServer test_server( + SpawnedTestServer::TYPE_HTTPS, + ssl_options, + base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); ASSERT_TRUE(test_server.Start()); TestDelegate d; @@ -4684,11 +4688,12 @@ TEST_F(HTTPSRequestTest, TLSv1Fallback) { // the |certificate_errors_are_fatal| flag correctly. This flag will cause // the interstitial to be fatal. TEST_F(HTTPSRequestTest, HTTPSPreloadedHSTSTest) { - TestServer::SSLOptions ssl_options( - TestServer::SSLOptions::CERT_MISMATCHED_NAME); - TestServer test_server(TestServer::TYPE_HTTPS, - ssl_options, - base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); + SpawnedTestServer::SSLOptions ssl_options( + SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME); + SpawnedTestServer test_server( + SpawnedTestServer::TYPE_HTTPS, + ssl_options, + base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); ASSERT_TRUE(test_server.Start()); // We require that the URL be www.google.com in order to pick up the @@ -4727,11 +4732,12 @@ TEST_F(HTTPSRequestTest, HTTPSPreloadedHSTSTest) { TEST_F(HTTPSRequestTest, HTTPSErrorsNoClobberTSSTest) { // The actual problem -- CERT_MISMATCHED_NAME in this case -- doesn't // matter. It just has to be any error. - TestServer::SSLOptions ssl_options( - TestServer::SSLOptions::CERT_MISMATCHED_NAME); - TestServer test_server(TestServer::TYPE_HTTPS, - ssl_options, - base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); + SpawnedTestServer::SSLOptions ssl_options( + SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME); + SpawnedTestServer test_server( + SpawnedTestServer::TYPE_HTTPS, + ssl_options, + base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); ASSERT_TRUE(test_server.Start()); // We require that the URL be www.google.com in order to pick up the @@ -4787,16 +4793,19 @@ TEST_F(HTTPSRequestTest, HTTPSErrorsNoClobberTSSTest) { TEST_F(HTTPSRequestTest, HSTSPreservesPosts) { static const char kData[] = "hello world"; - TestServer::SSLOptions ssl_options(TestServer::SSLOptions::CERT_OK); - TestServer test_server(TestServer::TYPE_HTTPS, - ssl_options, - base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); + SpawnedTestServer::SSLOptions ssl_options( + SpawnedTestServer::SSLOptions::CERT_OK); + SpawnedTestServer test_server( + SpawnedTestServer::TYPE_HTTPS, + ssl_options, + base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); ASSERT_TRUE(test_server.Start()); // Per spec, TransportSecurityState expects a domain name, rather than an IP // address, so a MockHostResolver is needed to redirect www.somewhere.com to - // the TestServer. By default, MockHostResolver maps all hosts to 127.0.0.1. + // the SpawnedTestServer. By default, MockHostResolver maps all hosts + // to 127.0.0.1. MockHostResolver host_resolver; // Force https for www.somewhere.com. @@ -4835,12 +4844,14 @@ TEST_F(HTTPSRequestTest, HSTSPreservesPosts) { } TEST_F(HTTPSRequestTest, SSLv3Fallback) { - TestServer::SSLOptions ssl_options( - TestServer::SSLOptions::CERT_OK); - ssl_options.tls_intolerant = TestServer::SSLOptions::TLS_INTOLERANT_ALL; - TestServer test_server(TestServer::TYPE_HTTPS, - ssl_options, - base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); + SpawnedTestServer::SSLOptions ssl_options( + SpawnedTestServer::SSLOptions::CERT_OK); + ssl_options.tls_intolerant = + SpawnedTestServer::SSLOptions::TLS_INTOLERANT_ALL; + SpawnedTestServer test_server( + SpawnedTestServer::TYPE_HTTPS, + ssl_options, + base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); ASSERT_TRUE(test_server.Start()); TestDelegate d; @@ -4886,11 +4897,12 @@ class SSLClientAuthTestDelegate : public TestDelegate { // - Getting a certificate request in an SSL renegotiation sending the // HTTP request. TEST_F(HTTPSRequestTest, ClientAuthTest) { - TestServer::SSLOptions ssl_options; + SpawnedTestServer::SSLOptions ssl_options; ssl_options.request_client_certificate = true; - TestServer test_server(TestServer::TYPE_HTTPS, - ssl_options, - base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); + SpawnedTestServer test_server( + SpawnedTestServer::TYPE_HTTPS, + ssl_options, + base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); ASSERT_TRUE(test_server.Start()); SSLClientAuthTestDelegate d; @@ -4922,11 +4934,12 @@ TEST_F(HTTPSRequestTest, ClientAuthTest) { TEST_F(HTTPSRequestTest, ResumeTest) { // Test that we attempt a session resume when making two connections to the // same host. - TestServer::SSLOptions ssl_options; + SpawnedTestServer::SSLOptions ssl_options; ssl_options.record_resume = true; - TestServer test_server(TestServer::TYPE_HTTPS, - ssl_options, - base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); + SpawnedTestServer test_server( + SpawnedTestServer::TYPE_HTTPS, + ssl_options, + base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); ASSERT_TRUE(test_server.Start()); SSLClientSocket::ClearSessionCache(); @@ -4990,11 +5003,12 @@ TEST_F(HTTPSRequestTest, ResumeTest) { TEST_F(HTTPSRequestTest, SSLSessionCacheShardTest) { // Test that sessions aren't resumed when the value of ssl_session_cache_shard // differs. - TestServer::SSLOptions ssl_options; + SpawnedTestServer::SSLOptions ssl_options; ssl_options.record_resume = true; - TestServer test_server(TestServer::TYPE_HTTPS, - ssl_options, - base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); + SpawnedTestServer test_server( + SpawnedTestServer::TYPE_HTTPS, + ssl_options, + base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); ASSERT_TRUE(test_server.Start()); SSLClientSocket::ClearSessionCache(); @@ -5124,13 +5138,14 @@ class HTTPSOCSPTest : public HTTPSRequestTest { #endif } - void DoConnection(const TestServer::SSLOptions& ssl_options, + void DoConnection(const SpawnedTestServer::SSLOptions& ssl_options, CertStatus* out_cert_status) { // We always overwrite out_cert_status. *out_cert_status = 0; - TestServer test_server(TestServer::TYPE_HTTPS, - ssl_options, - base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); + SpawnedTestServer test_server( + SpawnedTestServer::TYPE_HTTPS, + ssl_options, + base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); ASSERT_TRUE(test_server.Start()); TestDelegate d; @@ -5212,8 +5227,9 @@ TEST_F(HTTPSOCSPTest, Valid) { return; } - TestServer::SSLOptions ssl_options(TestServer::SSLOptions::CERT_AUTO); - ssl_options.ocsp_status = TestServer::SSLOptions::OCSP_OK; + SpawnedTestServer::SSLOptions ssl_options( + SpawnedTestServer::SSLOptions::CERT_AUTO); + ssl_options.ocsp_status = SpawnedTestServer::SSLOptions::OCSP_OK; CertStatus cert_status; DoConnection(ssl_options, &cert_status); @@ -5232,9 +5248,9 @@ TEST_F(HTTPSOCSPTest, Revoked) { return; } - TestServer::SSLOptions ssl_options( - TestServer::SSLOptions::CERT_AUTO); - ssl_options.ocsp_status = TestServer::SSLOptions::OCSP_REVOKED; + SpawnedTestServer::SSLOptions ssl_options( + SpawnedTestServer::SSLOptions::CERT_AUTO); + ssl_options.ocsp_status = SpawnedTestServer::SSLOptions::OCSP_REVOKED; CertStatus cert_status; DoConnection(ssl_options, &cert_status); @@ -5253,9 +5269,9 @@ TEST_F(HTTPSOCSPTest, Invalid) { return; } - TestServer::SSLOptions ssl_options( - TestServer::SSLOptions::CERT_AUTO); - ssl_options.ocsp_status = TestServer::SSLOptions::OCSP_INVALID; + SpawnedTestServer::SSLOptions ssl_options( + SpawnedTestServer::SSLOptions::CERT_AUTO); + ssl_options.ocsp_status = SpawnedTestServer::SSLOptions::OCSP_INVALID; CertStatus cert_status; DoConnection(ssl_options, &cert_status); @@ -5283,9 +5299,9 @@ TEST_F(HTTPSEVCRLSetTest, MissingCRLSetAndInvalidOCSP) { return; } - TestServer::SSLOptions ssl_options( - TestServer::SSLOptions::CERT_AUTO); - ssl_options.ocsp_status = TestServer::SSLOptions::OCSP_INVALID; + SpawnedTestServer::SSLOptions ssl_options( + SpawnedTestServer::SSLOptions::CERT_AUTO); + ssl_options.ocsp_status = SpawnedTestServer::SSLOptions::OCSP_INVALID; SSLConfigService::SetCRLSet(scoped_refptr<CRLSet>()); CertStatus cert_status; @@ -5305,9 +5321,9 @@ TEST_F(HTTPSEVCRLSetTest, MissingCRLSetAndGoodOCSP) { return; } - TestServer::SSLOptions ssl_options( - TestServer::SSLOptions::CERT_AUTO); - ssl_options.ocsp_status = TestServer::SSLOptions::OCSP_OK; + SpawnedTestServer::SSLOptions ssl_options( + SpawnedTestServer::SSLOptions::CERT_AUTO); + ssl_options.ocsp_status = SpawnedTestServer::SSLOptions::OCSP_OK; SSLConfigService::SetCRLSet(scoped_refptr<CRLSet>()); CertStatus cert_status; @@ -5327,9 +5343,9 @@ TEST_F(HTTPSEVCRLSetTest, ExpiredCRLSet) { return; } - TestServer::SSLOptions ssl_options( - TestServer::SSLOptions::CERT_AUTO); - ssl_options.ocsp_status = TestServer::SSLOptions::OCSP_INVALID; + SpawnedTestServer::SSLOptions ssl_options( + SpawnedTestServer::SSLOptions::CERT_AUTO); + ssl_options.ocsp_status = SpawnedTestServer::SSLOptions::OCSP_INVALID; SSLConfigService::SetCRLSet( scoped_refptr<CRLSet>(CRLSet::ExpiredCRLSetForTesting())); @@ -5345,9 +5361,9 @@ TEST_F(HTTPSEVCRLSetTest, ExpiredCRLSet) { } TEST_F(HTTPSEVCRLSetTest, FreshCRLSet) { - TestServer::SSLOptions ssl_options( - TestServer::SSLOptions::CERT_AUTO); - ssl_options.ocsp_status = TestServer::SSLOptions::OCSP_INVALID; + SpawnedTestServer::SSLOptions ssl_options( + SpawnedTestServer::SSLOptions::CERT_AUTO); + ssl_options.ocsp_status = SpawnedTestServer::SSLOptions::OCSP_INVALID; SSLConfigService::SetCRLSet( scoped_refptr<CRLSet>(CRLSet::EmptyCRLSetForTesting())); @@ -5377,9 +5393,9 @@ TEST_F(HTTPSEVCRLSetTest, ExpiredCRLSetAndRevokedNonEVCert) { // checking (as per the user preference) ev_test_policy_.reset(); - TestServer::SSLOptions ssl_options( - TestServer::SSLOptions::CERT_AUTO); - ssl_options.ocsp_status = TestServer::SSLOptions::OCSP_REVOKED; + SpawnedTestServer::SSLOptions ssl_options( + SpawnedTestServer::SSLOptions::CERT_AUTO); + ssl_options.ocsp_status = SpawnedTestServer::SSLOptions::OCSP_REVOKED; SSLConfigService::SetCRLSet( scoped_refptr<CRLSet>(CRLSet::ExpiredCRLSetForTesting())); @@ -5402,9 +5418,9 @@ class HTTPSCRLSetTest : public HTTPSOCSPTest { }; TEST_F(HTTPSCRLSetTest, ExpiredCRLSet) { - TestServer::SSLOptions ssl_options( - TestServer::SSLOptions::CERT_AUTO); - ssl_options.ocsp_status = TestServer::SSLOptions::OCSP_INVALID; + SpawnedTestServer::SSLOptions ssl_options( + SpawnedTestServer::SSLOptions::CERT_AUTO); + ssl_options.ocsp_status = SpawnedTestServer::SSLOptions::OCSP_INVALID; SSLConfigService::SetCRLSet( scoped_refptr<CRLSet>(CRLSet::ExpiredCRLSetForTesting())); @@ -5423,12 +5439,12 @@ TEST_F(HTTPSCRLSetTest, ExpiredCRLSet) { class URLRequestTestFTP : public URLRequestTest { public: URLRequestTestFTP() - : test_server_(TestServer::TYPE_FTP, TestServer::kLocalhost, + : test_server_(SpawnedTestServer::TYPE_FTP, SpawnedTestServer::kLocalhost, base::FilePath()) { } protected: - TestServer test_server_; + SpawnedTestServer test_server_; }; // Make sure an FTP request using an unsafe ports fails. diff --git a/ppapi/tests/test_websocket.cc b/ppapi/tests/test_websocket.cc index 61a8e19..9a3839b 100644 --- a/ppapi/tests/test_websocket.cc +++ b/ppapi/tests/test_websocket.cc @@ -31,7 +31,7 @@ #include "ppapi/tests/testing_instance.h" #include "ppapi/utility/websocket/websocket_api.h" -// net::TestServer serves WebSocket service for testing. +// net::SpawnedTestServer serves WebSocket service for testing. // Following URLs are handled by pywebsocket handlers in // net/data/websocket/*_wsh.py. const char kEchoServerURL[] = "echo-with-no-extension"; diff --git a/sync/internal_api/http_bridge_unittest.cc b/sync/internal_api/http_bridge_unittest.cc index 93df2b7..ad50367 100644 --- a/sync/internal_api/http_bridge_unittest.cc +++ b/sync/internal_api/http_bridge_unittest.cc @@ -5,7 +5,7 @@ #include "base/message_loop_proxy.h" #include "base/synchronization/waitable_event.h" #include "base/threading/thread.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "net/url_request/test_url_fetcher_factory.h" #include "net/url_request/url_fetcher_delegate.h" #include "net/url_request/url_request_test_util.h" @@ -23,8 +23,8 @@ const base::FilePath::CharType kDocRoot[] = class SyncHttpBridgeTest : public testing::Test { public: SyncHttpBridgeTest() - : test_server_(net::TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, + : test_server_(net::SpawnedTestServer::TYPE_HTTP, + net::SpawnedTestServer::kLocalhost, base::FilePath(kDocRoot)), fake_default_request_context_getter_(NULL), bridge_for_race_test_(NULL), @@ -92,7 +92,7 @@ class SyncHttpBridgeTest : public testing::Test { return fake_default_request_context_getter_; } - net::TestServer test_server_; + net::SpawnedTestServer test_server_; base::Thread* io_thread() { return &io_thread_; } diff --git a/sync/test/local_sync_test_server.cc b/sync/test/local_sync_test_server.cc index a11234f..4f9242b 100644 --- a/sync/test/local_sync_test_server.cc +++ b/sync/test/local_sync_test_server.cc @@ -9,20 +9,22 @@ #include "base/string_number_conversions.h" #include "base/values.h" #include "net/test/python_utils.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" namespace syncer { LocalSyncTestServer::LocalSyncTestServer() - : LocalTestServer(net::TestServer::TYPE_HTTP, // Sync uses the HTTP scheme. - net::TestServer::kLocalhost, - base::FilePath()), + : LocalTestServer( + net::SpawnedTestServer::TYPE_HTTP, // Sync uses the HTTP scheme. + net::SpawnedTestServer::kLocalhost, + base::FilePath()), xmpp_port_(0) {} LocalSyncTestServer::LocalSyncTestServer(uint16 port, uint16 xmpp_port) - : LocalTestServer(net::TestServer::TYPE_HTTP, // Sync uses the HTTP scheme. - net::TestServer::kLocalhost, - base::FilePath()), + : LocalTestServer( + net::SpawnedTestServer::TYPE_HTTP, // Sync uses the HTTP scheme. + net::SpawnedTestServer::kLocalhost, + base::FilePath()), xmpp_port_(xmpp_port) { SetPort(port); } diff --git a/tools/valgrind/memcheck/suppressions.txt b/tools/valgrind/memcheck/suppressions.txt index 5b195b4..be01ba5 100644 --- a/tools/valgrind/memcheck/suppressions.txt +++ b/tools/valgrind/memcheck/suppressions.txt @@ -932,10 +932,10 @@ fun:_ZN7logging11InitLoggingEPKcNS_18LoggingDestinationENS_15LogLockingStateENS_20OldFileDeletionStateE } { - Linux tests don't bother to undo net::TestServer::LoadTestRootCert(). + Linux tests don't bother to undo net::SpawnedTestServer::LoadTestRootCert(). Memcheck:Leak ... - fun:_ZN3net10TestServer16LoadTestRootCertEv + fun:_ZN3net10SpawnedTestServer16LoadTestRootCertEv } { # uitest's ResourceDispatcherTest.CrossSiteAfterCrash crashes on purpose diff --git a/webkit/support/test_webkit_platform_support.cc b/webkit/support/test_webkit_platform_support.cc index c615405..b2e5f16 100644 --- a/webkit/support/test_webkit_platform_support.cc +++ b/webkit/support/test_webkit_platform_support.cc @@ -15,7 +15,7 @@ #include "media/base/media.h" #include "net/cookies/cookie_monster.h" #include "net/http/http_cache.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebAudioDevice.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebData.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebFileSystem.h" diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc index 9792716..38e70e0 100644 --- a/webkit/tools/test_shell/test_shell_main.cc +++ b/webkit/tools/test_shell/test_shell_main.cc @@ -25,7 +25,7 @@ #include "net/cookies/cookie_monster.h" #include "net/http/http_cache.h" #include "net/http/http_util.h" -#include "net/test/test_server.h" +#include "net/test/spawned_test_server.h" #include "net/url_request/url_request_context.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h" |