diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-26 20:59:05 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-26 20:59:05 +0000 |
commit | c1dffe83ba4c933b6e5a87edc92780eda101b2b4 (patch) | |
tree | 869a9fedc1763f15ec6ed974c6c815050601d898 | |
parent | 3a4ddfce956ad9e8f6a47ddee43e779c36443c88 (diff) | |
download | chromium_src-c1dffe83ba4c933b6e5a87edc92780eda101b2b4.zip chromium_src-c1dffe83ba4c933b6e5a87edc92780eda101b2b4.tar.gz chromium_src-c1dffe83ba4c933b6e5a87edc92780eda101b2b4.tar.bz2 |
GTTF: convert some tests in chrome to use EmbeddedTestServer patch nr 1
This eliminates a whole class of problems with SpawnedTestServer
failing to start.
BUG=96594, 98194
R=asargent@chromium.org, rsleevi@chromium.org, sky@chromium.org
Review URL: https://codereview.chromium.org/16268017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@208784 0039d316-1c4b-4281-b951-d872f2087c98
188 files changed, 1176 insertions, 818 deletions
diff --git a/chrome/browser/browser_keyevents_browsertest.cc b/chrome/browser/browser_keyevents_browsertest.cc index 781d009..f27f00f 100644 --- a/chrome/browser/browser_keyevents_browsertest.cc +++ b/chrome/browser/browser_keyevents_browsertest.cc @@ -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/spawned_test_server/spawned_test_server.h" +#include "net/test/embedded_test_server/embedded_test_server.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/views/controls/textfield/textfield.h" @@ -40,7 +40,7 @@ using content::RenderViewHost; namespace { -const char kTestingPage[] = "files/keyevents_test.html"; +const char kTestingPage[] = "/keyevents_test.html"; const char kSuppressEventJS[] = "window.domAutomationController.send(setDefaultAction('%ls', %ls));"; const char kGetResultJS[] = @@ -368,10 +368,10 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, MAYBE_NormalKeyEvents) { "U 65 0 false false false false" } }, }; - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); - GURL url = test_server()->GetURL(kTestingPage); + GURL url = embedded_test_server()->GetURL(kTestingPage); ui_test_utils::NavigateToURL(browser(), url); ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); @@ -461,10 +461,10 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, MAYBE_CtrlKeyEvents) { "U 17 0 true false false false" } }; - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); - GURL url = test_server()->GetURL(kTestingPage); + GURL url = embedded_test_server()->GetURL(kTestingPage); ui_test_utils::NavigateToURL(browser(), url); ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); @@ -507,10 +507,10 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, DISABLED_CommandKeyEvents) { "U 91 0 false false false true" } }; - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); - GURL url = test_server()->GetURL(kTestingPage); + GURL url = embedded_test_server()->GetURL(kTestingPage); ui_test_utils::NavigateToURL(browser(), url); ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); @@ -607,10 +607,10 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, DISABLED_AccessKeys) { #endif #endif - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); - GURL url = test_server()->GetURL(kTestingPage); + GURL url = embedded_test_server()->GetURL(kTestingPage); ui_test_utils::NavigateToURL(browser(), url); content::RunAllPendingInMessageLoop(); @@ -681,10 +681,10 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, DISABLED_AccessKeys) { #define MAYBE_ReservedAccelerators ReservedAccelerators #endif IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, MAYBE_ReservedAccelerators) { - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); - GURL url = test_server()->GetURL(kTestingPage); + GURL url = embedded_test_server()->GetURL(kTestingPage); ui_test_utils::NavigateToURL(browser(), url); ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); @@ -783,10 +783,10 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, EditorKeyBindings) { "U 17 0 true false false false" } }; - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); - GURL url = test_server()->GetURL(kTestingPage); + GURL url = embedded_test_server()->GetURL(kTestingPage); ui_test_utils::NavigateToURL(browser(), url); ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); @@ -821,10 +821,10 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, DISABLED_PageUpDownKeys) { "U 34 0 false false false false" } }; - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); - GURL url = test_server()->GetURL(kTestingPage); + GURL url = embedded_test_server()->GetURL(kTestingPage); ui_test_utils::NavigateToURL(browser(), url); ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); @@ -863,10 +863,10 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, FocusMenuBarByAltKey) { "U 17 0 true false false false" } }; - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); - GURL url = test_server()->GetURL(kTestingPage); + GURL url = embedded_test_server()->GetURL(kTestingPage); ui_test_utils::NavigateToURL(browser(), url); ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_apitest.cc b/chrome/browser/chromeos/extensions/wallpaper_private_apitest.cc index 20de42a..14f164f 100644 --- a/chrome/browser/chromeos/extensions/wallpaper_private_apitest.cc +++ b/chrome/browser/chromeos/extensions/wallpaper_private_apitest.cc @@ -7,6 +7,6 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WallpaperPicker) { host_resolver()->AddRule("a.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunComponentExtensionTest("wallpaper_manager")) << message_; } diff --git a/chrome/browser/chromeos/login/kiosk_browsertest.cc b/chrome/browser/chromeos/login/kiosk_browsertest.cc index 3998ea9..5f24137 100644 --- a/chrome/browser/chromeos/login/kiosk_browsertest.cc +++ b/chrome/browser/chromeos/login/kiosk_browsertest.cc @@ -443,7 +443,7 @@ class KioskTest : public chromeos::CrosInProcessBrowserTest, scoped_ptr<BasicHttpResponse> http_response(new BasicHttpResponse()); if (url.path() == "/ServiceLogin") { - http_response->set_code(net::test_server::SUCCESS); + http_response->set_code(net::HTTP_OK); http_response->set_content(service_login_response_); http_response->set_content_type("text/html"); } else if (url.path() == "/ServiceLoginAuth") { @@ -454,7 +454,7 @@ class KioskTest : public chromeos::CrosInProcessBrowserTest, int continue_arg_end = request.content.find("&", continue_arg_begin); const std::string continue_url = request.content.substr( continue_arg_begin, continue_arg_end - continue_arg_begin); - http_response->set_code(net::test_server::SUCCESS); + http_response->set_code(net::HTTP_OK); const std::string redirect_js = "document.location.href = unescape('" + continue_url + "');"; http_response->set_content( diff --git a/chrome/browser/chromeos/login/oobe_browsertest.cc b/chrome/browser/chromeos/login/oobe_browsertest.cc index 676fe87..ec6c1f8 100644 --- a/chrome/browser/chromeos/login/oobe_browsertest.cc +++ b/chrome/browser/chromeos/login/oobe_browsertest.cc @@ -176,7 +176,7 @@ class OobeTest : public chromeos::CrosInProcessBrowserTest { scoped_ptr<BasicHttpResponse> http_response(new BasicHttpResponse()); if (url.path() == "/ServiceLogin") { - http_response->set_code(net::test_server::SUCCESS); + http_response->set_code(net::HTTP_OK); http_response->set_content(service_login_response_); http_response->set_content_type("text/html"); } else if (url.path() == "/ServiceLoginAuth") { @@ -187,7 +187,7 @@ class OobeTest : public chromeos::CrosInProcessBrowserTest { int continue_arg_end = request.content.find("&", continue_arg_begin); const std::string continue_url = request.content.substr( continue_arg_begin, continue_arg_end - continue_arg_begin); - http_response->set_code(net::test_server::SUCCESS); + http_response->set_code(net::HTTP_OK); const std::string redirect_js = "document.location.href = unescape('" + continue_url + "');"; http_response->set_content( diff --git a/chrome/browser/collected_cookies_browsertest.cc b/chrome/browser/collected_cookies_browsertest.cc index 539fcac..b26c17e 100644 --- a/chrome/browser/collected_cookies_browsertest.cc +++ b/chrome/browser/collected_cookies_browsertest.cc @@ -13,20 +13,13 @@ #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/spawned_test_server/spawned_test_server.h" - -namespace { - -const base::FilePath::CharType kDocRoot[] = - FILE_PATH_LITERAL("chrome/test/data"); - -} // namespace +#include "net/test/embedded_test_server/embedded_test_server.h" typedef InProcessBrowserTest CollectedCookiesTest; // If this crashes on Windows, use http://crbug.com/79331 IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, DoubleDisplay) { - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); // Disable cookies. CookieSettings::Factory::GetForProfile(browser()->profile())-> @@ -34,7 +27,7 @@ IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, DoubleDisplay) { // Load a page with cookies. ui_test_utils::NavigateToURL( - browser(), test_server()->GetURL("files/cookie1.html")); + browser(), embedded_test_server()->GetURL("/cookie1.html")); // Click on the info link twice. content::WebContents* web_contents = @@ -52,7 +45,7 @@ IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, NavigateAway) { // Load a page with cookies. ui_test_utils::NavigateToURL( - browser(), test_server()->GetURL("files/cookie1.html")); + browser(), embedded_test_server()->GetURL("/cookie1.html")); // Click on the info link. content::WebContents* web_contents = @@ -61,5 +54,5 @@ IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, NavigateAway) { // Navigate to another page. ui_test_utils::NavigateToURL( - browser(), test_server()->GetURL("files/cookie2.html")); + browser(), embedded_test_server()->GetURL("/cookie2.html")); } diff --git a/chrome/browser/extensions/active_tab_apitest.cc b/chrome/browser/extensions/active_tab_apitest.cc index 836d94c..d6a6d1d 100644 --- a/chrome/browser/extensions/active_tab_apitest.cc +++ b/chrome/browser/extensions/active_tab_apitest.cc @@ -9,6 +9,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/common/extensions/extension.h" #include "chrome/test/base/ui_test_utils.h" +#include "net/test/embedded_test_server/embedded_test_server.h" namespace extensions { namespace { @@ -20,7 +21,7 @@ namespace { #define MAYBE_ActiveTab ActiveTab #endif IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_ActiveTab) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); const Extension* extension = LoadExtension(test_data_dir_.AppendASCII("active_tab")); @@ -32,7 +33,10 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_ActiveTab) { // Shouldn't be initially granted based on activeTab. { ResultCatcher catcher; - ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("page.html")); + ui_test_utils::NavigateToURL( + browser(), + embedded_test_server()->GetURL( + "/extensions/api_test/active_tab/page.html")); EXPECT_TRUE(catcher.GetNextResult()) << message_; } @@ -46,8 +50,10 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_ActiveTab) { // Changing page should go back to it not having access. { ResultCatcher catcher; - ui_test_utils::NavigateToURL(browser(), - test_server()->GetURL("final_page.html")); + ui_test_utils::NavigateToURL( + browser(), + embedded_test_server()->GetURL( + "/extensions/api_test/active_tab/final_page.html")); EXPECT_TRUE(catcher.GetNextResult()) << message_; } } diff --git a/chrome/browser/extensions/activity_log/activity_log_browsertest.cc b/chrome/browser/extensions/activity_log/activity_log_browsertest.cc index 2080b6e..3368730 100644 --- a/chrome/browser/extensions/activity_log/activity_log_browsertest.cc +++ b/chrome/browser/extensions/activity_log/activity_log_browsertest.cc @@ -15,6 +15,7 @@ #include "content/public/browser/notification_service.h" #include "content/public/test/browser_test_utils.h" #include "net/dns/mock_host_resolver.h" +#include "net/test/embedded_test_server/embedded_test_server.h" namespace extensions { @@ -37,9 +38,9 @@ class ActivityLogExtensionTest : public ExtensionApiTest { } // Start the test server, load the activity log extension, and navigate // the browser to the options page of the extension. - TabStripModel* StartTestServerAndInitialize() { + TabStripModel* StartEmbeddedTestServerAndInitialize() { host_resolver()->AddRule("*", "127.0.0.1"); - StartTestServer(); + StartEmbeddedTestServer(); // Get the extension (chrome/test/data/extensions/activity_log) const extensions::Extension* ext = @@ -81,12 +82,12 @@ class ActivityLogExtensionTest : public ExtensionApiTest { #endif IN_PROC_BROWSER_TEST_F(ActivityLogExtensionTest, MAYBE_ChromeEndToEnd) { - TabStripModel* tab_strip = StartTestServerAndInitialize(); + TabStripModel* tab_strip = StartEmbeddedTestServerAndInitialize(); ResultCatcher catcher; // Set the default URL so that is has the correct port number. - net::HostPortPair host_port = test_server()->host_port_pair(); std::string url_setting_script = base::StringPrintf( - "defaultUrl = \'http://www.google.com:%d\';", host_port.port()); + "defaultUrl = \'http://www.google.com:%d\';", + embedded_test_server()->port()); ASSERT_TRUE(content::ExecuteScript(tab_strip->GetActiveWebContents(), url_setting_script)); // Set the test buttons array @@ -108,12 +109,12 @@ IN_PROC_BROWSER_TEST_F(ActivityLogExtensionTest, MAYBE_ChromeEndToEnd) { #endif IN_PROC_BROWSER_TEST_F(ActivityLogExtensionTest, MAYBE_DOMEndToEnd) { - TabStripModel* tab_strip = StartTestServerAndInitialize(); + TabStripModel* tab_strip = StartEmbeddedTestServerAndInitialize(); ResultCatcher catcher; // Set the default URL so that is has the correct port number. - net::HostPortPair host_port = test_server()->host_port_pair(); std::string url_setting_script = base::StringPrintf( - "defaultUrl = \'http://www.google.com:%d\';", host_port.port()); + "defaultUrl = \'http://www.google.com:%d\';", + embedded_test_server()->port()); ASSERT_TRUE(content::ExecuteScript(tab_strip->GetActiveWebContents(), url_setting_script)); // Set the test buttons array @@ -129,8 +130,8 @@ IN_PROC_BROWSER_TEST_F(ActivityLogExtensionTest, MAYBE_DOMEndToEnd) { IN_PROC_BROWSER_TEST_F(ActivityLogExtensionTest, ExtensionPrerender) { host_resolver()->AddRule("*", "127.0.0.1"); - StartTestServer(); - int port = test_server()->host_port_pair().port(); + StartEmbeddedTestServer(); + int port = embedded_test_server()->port(); // Get the extension (chrome/test/data/extensions/activity_log) const Extension* ext = diff --git a/chrome/browser/extensions/ad_view_browsertest.cc b/chrome/browser/extensions/ad_view_browsertest.cc index 7f1ed50..efcc775 100644 --- a/chrome/browser/extensions/ad_view_browsertest.cc +++ b/chrome/browser/extensions/ad_view_browsertest.cc @@ -26,7 +26,7 @@ class AdViewTest : public extensions::PlatformAppBrowserTest { #define MAYBE_LoadCommitEventIsCalled LoadCommitEventIsCalled #endif IN_PROC_BROWSER_TEST_F(AdViewTest, MAYBE_LoadCommitEventIsCalled) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunPlatformAppTest( "platform_apps/ad_view/loadcommit_event")) << message_; @@ -35,7 +35,7 @@ IN_PROC_BROWSER_TEST_F(AdViewTest, MAYBE_LoadCommitEventIsCalled) { // This test checks the "loadabort" event is called when the "src" attribute // of an <adview> is an invalid URL. IN_PROC_BROWSER_TEST_F(AdViewTest, LoadAbortEventIsCalled) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunPlatformAppTest( "platform_apps/ad_view/loadabort_event")) << message_; @@ -51,7 +51,7 @@ IN_PROC_BROWSER_TEST_F(AdViewTest, LoadAbortEventIsCalled) { #define MAYBE_CommitMessageFromAdNetwork CommitMessageFromAdNetwork #endif IN_PROC_BROWSER_TEST_F(AdViewTest, MAYBE_CommitMessageFromAdNetwork) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunPlatformAppTest( "platform_apps/ad_view/onloadcommit_ack")) << message_; @@ -63,7 +63,7 @@ IN_PROC_BROWSER_TEST_F(AdViewTest, MAYBE_CommitMessageFromAdNetwork) { // file (image035.png) which the trybots don't process correctly when // first checked-in. IN_PROC_BROWSER_TEST_F(AdViewTest, DISABLED_DisplayFirstAd) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunPlatformAppTest( "platform_apps/ad_view/display_first_ad")) << message_; @@ -72,7 +72,7 @@ IN_PROC_BROWSER_TEST_F(AdViewTest, DISABLED_DisplayFirstAd) { // This test checks that <adview> attributes are also exposed as properties // (with the same name and value). IN_PROC_BROWSER_TEST_F(AdViewTest, PropertiesAreInSyncWithAttributes) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunPlatformAppTest( "platform_apps/ad_view/properties_exposed")) << message_; @@ -81,7 +81,7 @@ IN_PROC_BROWSER_TEST_F(AdViewTest, PropertiesAreInSyncWithAttributes) { // This test checks an <adview> element has no behavior when the "adview" // permission is missing from the application manifest. IN_PROC_BROWSER_TEST_F(AdViewTest, AdViewPermissionIsRequired) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunPlatformAppTest( "platform_apps/ad_view/permission_required")) << message_; @@ -97,7 +97,7 @@ IN_PROC_BROWSER_TEST_F(AdViewTest, AdViewPermissionIsRequired) { #define MAYBE_ChangeAdNetworkValue ChangeAdNetworkValue #endif IN_PROC_BROWSER_TEST_F(AdViewTest, ChangeAdNetworkValue) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunPlatformAppTest( "platform_apps/ad_view/change_ad_network")) << message_; @@ -115,7 +115,7 @@ class AdViewNoSrcTest : public extensions::PlatformAppBrowserTest { // This test checks an invalid "ad-network" value (i.e. not whitelisted) // is ignored. IN_PROC_BROWSER_TEST_F(AdViewNoSrcTest, InvalidAdNetworkIsIgnored) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunPlatformAppTest( "platform_apps/ad_view/invalid_ad_network")) << message_; @@ -124,7 +124,7 @@ IN_PROC_BROWSER_TEST_F(AdViewNoSrcTest, InvalidAdNetworkIsIgnored) { // This test checks the "src" attribute is ignored when the // "kEnableAdviewSrcAttribute" is missing. IN_PROC_BROWSER_TEST_F(AdViewNoSrcTest, EnableAdviewSrcAttributeFlagRequired) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunPlatformAppTest( "platform_apps/ad_view/src_flag_required")) << message_; @@ -164,7 +164,7 @@ class AdViewNotEnabledTest : public extensions::PlatformAppBrowserTest { // This test checks an <adview> element has no behavior when the "kEnableAdview" // flag is missing. IN_PROC_BROWSER_TEST_F(AdViewNotEnabledTest, EnableAdviewFlagRequired) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunPlatformAppTest( "platform_apps/ad_view/flag_required")) << message_; diff --git a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc index 8eacf45..b3f08d0 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc @@ -1541,7 +1541,8 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, DownloadExtensionTest_Download_Basic) { LoadExtension("downloads_split"); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL("slow?0").spec(); GoOnTheRecord(); @@ -1584,7 +1585,8 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, DownloadExtensionTest_Download_Incognito) { LoadExtension("downloads_split"); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); GoOffTheRecord(); std::string download_url = test_server()->GetURL("slow?0").spec(); @@ -1635,7 +1637,8 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, MAYBE_DownloadExtensionTest_Download_UnsafeHeaders) { LoadExtension("downloads_split"); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); GoOnTheRecord(); static const char* kUnsafeHeaders[] = { @@ -1687,7 +1690,8 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, DownloadExtensionTest_Download_Subdirectory) { LoadExtension("downloads_split"); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL("slow?0").spec(); GoOnTheRecord(); @@ -1703,7 +1707,8 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, DownloadExtensionTest_Download_InvalidFilename) { LoadExtension("downloads_split"); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL("slow?0").spec(); GoOnTheRecord(); @@ -1749,7 +1754,8 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, DownloadExtensionTest_Download_URLFragment) { LoadExtension("downloads_split"); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL("slow?0#fragment").spec(); GoOnTheRecord(); @@ -1886,7 +1892,8 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, DownloadExtensionTest_Download_AuthBasic_Fail) { LoadExtension("downloads_split"); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL("auth-basic").spec(); GoOnTheRecord(); @@ -1916,7 +1923,8 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, DownloadExtensionTest_Download_Headers) { LoadExtension("downloads_split"); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL("files/downloads/" "a_zip_file.zip?expected_headers=Foo:bar&expected_headers=Qx:yo").spec(); GoOnTheRecord(); @@ -1966,7 +1974,8 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, DownloadExtensionTest_Download_Headers_Fail) { LoadExtension("downloads_split"); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL("files/downloads/" "a_zip_file.zip?expected_headers=Foo:bar&expected_headers=Qx:yo").spec(); GoOnTheRecord(); @@ -1999,7 +2008,8 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, DownloadExtensionTest_Download_AuthBasic) { LoadExtension("downloads_split"); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL("auth-basic").spec(); // This is just base64 of 'username:secret'. static const char* kAuthorization = "dXNlcm5hbWU6c2VjcmV0"; @@ -2039,7 +2049,8 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, DownloadExtensionTest_Download_Post) { LoadExtension("downloads_split"); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL("files/post/downloads/" "a_zip_file.zip?expected_body=BODY").spec(); GoOnTheRecord(); @@ -2088,7 +2099,8 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, DownloadExtensionTest_Download_Post_Get) { LoadExtension("downloads_split"); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL("files/post/downloads/" "a_zip_file.zip?expected_body=BODY").spec(); GoOnTheRecord(); @@ -2126,7 +2138,8 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, DownloadExtensionTest_Download_Post_NoBody) { LoadExtension("downloads_split"); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL("files/post/downloads/" "a_zip_file.zip?expected_body=BODY").spec(); GoOnTheRecord(); @@ -2163,7 +2176,8 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, DownloadExtensionTest_Download_Cancel) { LoadExtension("downloads_split"); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL( "download-known-size").spec(); GoOnTheRecord(); @@ -2258,7 +2272,8 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, GoOnTheRecord(); LoadExtension("downloads_split"); AddFilenameDeterminer(); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL("slow?0").spec(); // Start downloading a file. @@ -2325,7 +2340,8 @@ IN_PROC_BROWSER_TEST_F( GoOnTheRecord(); LoadExtension("downloads_split"); AddFilenameDeterminer(); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL("slow?0").spec(); // Start downloading a file. @@ -2401,7 +2417,8 @@ IN_PROC_BROWSER_TEST_F( GoOnTheRecord(); LoadExtension("downloads_split"); AddFilenameDeterminer(); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL("slow?0").spec(); // Start downloading a file. @@ -2465,7 +2482,8 @@ IN_PROC_BROWSER_TEST_F( GoOnTheRecord(); LoadExtension("downloads_split"); AddFilenameDeterminer(); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL("slow?0").spec(); // Start downloading a file. @@ -2529,7 +2547,8 @@ IN_PROC_BROWSER_TEST_F( GoOnTheRecord(); LoadExtension("downloads_split"); AddFilenameDeterminer(); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL("slow?0").spec(); // Start downloading a file. @@ -2594,7 +2613,8 @@ IN_PROC_BROWSER_TEST_F( GoOnTheRecord(); LoadExtension("downloads_split"); AddFilenameDeterminer(); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL("slow?0").spec(); // Start downloading a file. @@ -2658,7 +2678,8 @@ IN_PROC_BROWSER_TEST_F( GoOnTheRecord(); LoadExtension("downloads_split"); AddFilenameDeterminer(); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL("slow?0").spec(); // Start downloading a file. @@ -2719,7 +2740,8 @@ IN_PROC_BROWSER_TEST_F( IN_PROC_BROWSER_TEST_F( DownloadExtensionTest, DownloadExtensionTest_OnDeterminingFilename_ParentDirInvalid) { - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); GoOnTheRecord(); LoadExtension("downloads_split"); AddFilenameDeterminer(); @@ -2786,7 +2808,8 @@ IN_PROC_BROWSER_TEST_F( GoOnTheRecord(); LoadExtension("downloads_split"); AddFilenameDeterminer(); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL("slow?0").spec(); // Start downloading a file. @@ -2851,7 +2874,8 @@ IN_PROC_BROWSER_TEST_F( GoOnTheRecord(); LoadExtension("downloads_split"); AddFilenameDeterminer(); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL("slow?0").spec(); // Start downloading a file. @@ -2916,7 +2940,8 @@ IN_PROC_BROWSER_TEST_F( GoOnTheRecord(); LoadExtension("downloads_split"); AddFilenameDeterminer(); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL("slow?0").spec(); // Start downloading a file. @@ -3037,7 +3062,8 @@ IN_PROC_BROWSER_TEST_F( IN_PROC_BROWSER_TEST_F( DownloadExtensionTest, DownloadExtensionTest_OnDeterminingFilename_RemoveFilenameDeterminer) { - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); GoOnTheRecord(); LoadExtension("downloads_split"); content::RenderProcessHost* host = AddFilenameDeterminer(); @@ -3087,7 +3113,8 @@ IN_PROC_BROWSER_TEST_F( DownloadExtensionTest, DownloadExtensionTest_OnDeterminingFilename_IncognitoSplit) { LoadExtension("downloads_split"); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL("slow?0").spec(); GoOnTheRecord(); @@ -3219,7 +3246,8 @@ IN_PROC_BROWSER_TEST_F( DownloadExtensionTest, DownloadExtensionTest_OnDeterminingFilename_IncognitoSpanning) { LoadExtension("downloads_spanning"); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); std::string download_url = test_server()->GetURL("slow?0").spec(); GoOnTheRecord(); @@ -3364,7 +3392,8 @@ IN_PROC_BROWSER_TEST_F( CommandLine::ForCurrentProcess()->AppendSwitch( switches::kEnableDownloadResumption); LoadExtension("downloads_split"); - CHECK(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(test_server()->Start()); GoOnTheRecord(); content::RenderProcessHost* host = AddFilenameDeterminer(); 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 f81f958..c30884d 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/spawned_test_server/spawned_test_server.h" +#include "net/test/embedded_test_server/embedded_test_server.h" #include "testing/gmock/include/gmock/gmock.h" namespace extensions { @@ -40,7 +40,7 @@ class ScriptBadgeApiTest : public ExtensionApiTest { }; IN_PROC_BROWSER_TEST_F(ScriptBadgeApiTest, Basics) { - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(RunExtensionTest("script_badge/basics")) << message_; const Extension* extension = GetSingleLoadedExtension(); ASSERT_TRUE(extension) << message_; @@ -88,8 +88,8 @@ IN_PROC_BROWSER_TEST_F(ScriptBadgeApiTest, Basics) { ResultCatcher catcher; // Visit a non-extension page so the extension can run a content script and // cause the script badge to be animated in. - ui_test_utils::NavigateToURL(browser(), - test_server()->GetURL(std::string())); + ui_test_utils::NavigateToURL( + browser(), embedded_test_server()->GetURL("/title1.html")); ASSERT_TRUE(catcher.GetNextResult()); } EXPECT_TRUE(script_badge->GetIsVisible(tab_id)); diff --git a/chrome/browser/extensions/api/history/history_apitest.cc b/chrome/browser/extensions/api/history/history_apitest.cc index b690e0c..f2394e0 100644 --- a/chrome/browser/extensions/api/history/history_apitest.cc +++ b/chrome/browser/extensions/api/history/history_apitest.cc @@ -26,8 +26,6 @@ class HistoryApiTest : public ExtensionApiTest { host_resolver()->AddRule("www.a.com", "127.0.0.1"); host_resolver()->AddRule("www.b.com", "127.0.0.1"); - - ASSERT_TRUE(StartTestServer()); } virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { @@ -38,11 +36,13 @@ class HistoryApiTest : public ExtensionApiTest { // Full text search indexing sometimes exceeds a timeout. (http://crbug/119505) IN_PROC_BROWSER_TEST_F(HistoryApiTest, DISABLED_MiscSearch) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionSubtest("history", "misc_search.html")) << message_; } // Same could happen here without the FTS (http://crbug/119505) IN_PROC_BROWSER_TEST_F(HistoryApiTest, DISABLED_TimedSearch) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionSubtest("history", "timed_search.html")) << message_; } @@ -53,18 +53,21 @@ IN_PROC_BROWSER_TEST_F(HistoryApiTest, DISABLED_TimedSearch) { #define MAYBE_Delete Delete #endif IN_PROC_BROWSER_TEST_F(HistoryApiTest, MAYBE_Delete) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionSubtest("history", "delete.html")) << message_; } IN_PROC_BROWSER_TEST_F(HistoryApiTest, DeleteProhibited) { browser()->profile()->GetPrefs()-> SetBoolean(prefs::kAllowDeletingBrowserHistory, false); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionSubtest("history", "delete_prohibited.html")) << message_; } // See crbug.com/79074 IN_PROC_BROWSER_TEST_F(HistoryApiTest, DISABLED_GetVisits) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionSubtest("history", "get_visits.html")) << message_; } @@ -77,11 +80,14 @@ IN_PROC_BROWSER_TEST_F(HistoryApiTest, DISABLED_GetVisits) { #endif IN_PROC_BROWSER_TEST_F(HistoryApiTest, MAYBE_SearchAfterAdd) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionSubtest("history", "search_after_add.html")) << message_; } IN_PROC_BROWSER_TEST_F(HistoryApiTest, MostVisited) { + ASSERT_TRUE(StartEmbeddedTestServer()); + // Add entries to the history database that we can query for (using the // extension history API for this doesn't work as it only adds URLs with // LINK transition type). diff --git a/chrome/browser/extensions/api/i18n/i18n_apitest.cc b/chrome/browser/extensions/api/i18n/i18n_apitest.cc index a255d1f..12c7142 100644 --- a/chrome/browser/extensions/api/i18n/i18n_apitest.cc +++ b/chrome/browser/extensions/api/i18n/i18n_apitest.cc @@ -10,15 +10,15 @@ #include "chrome/browser/ui/browser.h" #include "chrome/common/extensions/extension.h" #include "chrome/test/base/ui_test_utils.h" -#include "net/test/spawned_test_server/spawned_test_server.h" +#include "net/test/embedded_test_server/embedded_test_server.h" IN_PROC_BROWSER_TEST_F(ExtensionApiTest, I18N) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("i18n")) << message_; } IN_PROC_BROWSER_TEST_F(ExtensionApiTest, I18NUpdate) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); // Create an Extension whose messages.json file will be updated. base::ScopedTempDir extension_dir; ASSERT_TRUE(extension_dir.CreateUniqueTempDir()); @@ -42,7 +42,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, I18NUpdate) { // Test that the messages.json file is loaded and the i18n message is loaded. ui_test_utils::NavigateToURL( - browser(), test_server()->GetURL("file/extensions/test_file.html")); + browser(), + embedded_test_server()->GetURL("/extensions/test_file.html")); EXPECT_TRUE(catcher.GetNextResult()); string16 title; @@ -58,7 +59,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, I18NUpdate) { // Check that the i18n message is also changed. ui_test_utils::NavigateToURL( - browser(), test_server()->GetURL("file/extensions/test_file.html")); + browser(), + embedded_test_server()->GetURL("/extensions/test_file.html")); EXPECT_TRUE(catcher.GetNextResult()); ui_test_utils::GetCurrentTabTitle(browser(), &title); diff --git a/chrome/browser/extensions/api/page_capture/page_capture_apitest.cc b/chrome/browser/extensions/api/page_capture/page_capture_apitest.cc index 34e7654..a2bb28b 100644 --- a/chrome/browser/extensions/api/page_capture/page_capture_apitest.cc +++ b/chrome/browser/extensions/api/page_capture/page_capture_apitest.cc @@ -18,23 +18,8 @@ class ExtensionPageCaptureApiTest : public ExtensionApiTest { ExtensionApiTest::SetUpCommandLine(command_line); command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); } - - virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { - ExtensionApiTest::SetUpInProcessBrowserTestFixture(); - - host_resolver()->AddRule("www.a.com", "127.0.0.1"); - - ASSERT_TRUE(StartTestServer()); - } }; -// Disabled on Linux http://crbug.com/98194 -#if defined(OS_LINUX) -#define MAYBE_SaveAsMHTML DISABLED_SaveAsMHTML -#else -#define MAYBE_SaveAsMHTML SaveAsMHTML -#endif // defined(OS_LINUX) - class PageCaptureSaveAsMHTMLDelegate : public PageCaptureSaveAsMHTMLFunction::TestDelegate { public: @@ -54,7 +39,9 @@ class PageCaptureSaveAsMHTMLDelegate base::FilePath temp_file_; }; -IN_PROC_BROWSER_TEST_F(ExtensionPageCaptureApiTest, MAYBE_SaveAsMHTML) { +IN_PROC_BROWSER_TEST_F(ExtensionPageCaptureApiTest, SaveAsMHTML) { + host_resolver()->AddRule("www.a.com", "127.0.0.1"); + ASSERT_TRUE(StartEmbeddedTestServer()); PageCaptureSaveAsMHTMLDelegate delegate; ASSERT_TRUE(RunExtensionTest("page_capture")) << message_; ASSERT_FALSE(delegate.temp_file_.empty()); diff --git a/chrome/browser/extensions/api/permissions/permissions_apitest.cc b/chrome/browser/extensions/api/permissions/permissions_apitest.cc index ef20085..9928c8c 100644 --- a/chrome/browser/extensions/api/permissions/permissions_apitest.cc +++ b/chrome/browser/extensions/api/permissions/permissions_apitest.cc @@ -84,7 +84,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OptionalPermissionsGranted) { PermissionsRequestFunction::SetIgnoreUserGestureForTests(true); host_resolver()->AddRule("*.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); EXPECT_TRUE(RunExtensionTest("permissions/optional")) << message_; } @@ -95,7 +95,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OptionalPermissionsAutoConfirm) { PermissionsRequestFunction::SetAutoConfirmForTests(true); PermissionsRequestFunction::SetIgnoreUserGestureForTests(true); host_resolver()->AddRule("*.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); EXPECT_TRUE(RunExtensionTest("permissions/optional")) << message_; } @@ -114,7 +114,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OptionalPermissionsDeny) { PermissionsRequestFunction::SetAutoConfirmForTests(false); PermissionsRequestFunction::SetIgnoreUserGestureForTests(true); host_resolver()->AddRule("*.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); EXPECT_TRUE(RunExtensionTest("permissions/optional_deny")) << message_; } @@ -123,7 +123,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OptionalPermissionsDeny) { IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OptionalPermissionsGesture) { PermissionsRequestFunction::SetIgnoreUserGestureForTests(false); host_resolver()->AddRule("*.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); EXPECT_TRUE(RunExtensionTest("permissions/optional_gesture")) << message_; } diff --git a/chrome/browser/extensions/api/proxy/proxy_apitest.cc b/chrome/browser/extensions/api/proxy/proxy_apitest.cc index be76c40..a05e71a 100644 --- a/chrome/browser/extensions/api/proxy/proxy_apitest.cc +++ b/chrome/browser/extensions/api/proxy/proxy_apitest.cc @@ -283,7 +283,7 @@ IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, // Tests error events: invalid proxy IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, MAYBE_ProxyEventsInvalidProxy) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE( RunExtensionSubtest("proxy/events", "invalid_proxy.html")) << message_; } diff --git a/chrome/browser/extensions/api/runtime/runtime_apitest.cc b/chrome/browser/extensions/api/runtime/runtime_apitest.cc index 55f0d2a..c2c17be 100644 --- a/chrome/browser/extensions/api/runtime/runtime_apitest.cc +++ b/chrome/browser/extensions/api/runtime/runtime_apitest.cc @@ -6,6 +6,7 @@ #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/extension_function_test_utils.h" #include "chrome/test/base/ui_test_utils.h" +#include "net/test/embedded_test_server/embedded_test_server.h" // Tests the privileged components of chrome.runtime. IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeRuntimePrivileged) { @@ -14,14 +15,14 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeRuntimePrivileged) { // Tests the unprivileged components of chrome.runtime. IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeRuntimeUnprivileged) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE( LoadExtension(test_data_dir_.AppendASCII("runtime/content_script"))); // The content script runs on webpage.html. ResultCatcher catcher; ui_test_utils::NavigateToURL(browser(), - test_server()->GetURL("webpage.html")); + embedded_test_server()->GetURL("/webpage.html")); EXPECT_TRUE(catcher.GetNextResult()) << message_; } diff --git a/chrome/browser/extensions/api/streams_private/streams_private_apitest.cc b/chrome/browser/extensions/api/streams_private/streams_private_apitest.cc index 83e8c90..3139336 100644 --- a/chrome/browser/extensions/api/streams_private/streams_private_apitest.cc +++ b/chrome/browser/extensions/api/streams_private/streams_private_apitest.cc @@ -51,7 +51,7 @@ scoped_ptr<HttpResponse> HandleRequest(const HttpRequest& request) { // For relative path "/doc_path.doc", return success response with MIME type // "application/msword". if (request.relative_url == "/doc_path.doc") { - response->set_code(net::test_server::SUCCESS); + response->set_code(net::HTTP_OK); response->set_content_type("application/msword"); return response.PassAs<HttpResponse>(); } @@ -60,7 +60,7 @@ scoped_ptr<HttpResponse> HandleRequest(const HttpRequest& request) { // MIME type "plain/text" and content "txt content". Also, set content // disposition to be attachment. if (request.relative_url == "/text_path_attch.txt") { - response->set_code(net::test_server::SUCCESS); + response->set_code(net::HTTP_OK); response->set_content("txt content"); response->set_content_type("plain/text"); response->AddCustomHeader("Content-Disposition", @@ -70,7 +70,7 @@ scoped_ptr<HttpResponse> HandleRequest(const HttpRequest& request) { // For relative path "/test_path_attch.txt", return success response with // MIME type "plain/text" and content "txt content". if (request.relative_url == "/text_path.txt") { - response->set_code(net::test_server::SUCCESS); + response->set_code(net::HTTP_OK); response->set_content("txt content"); response->set_content_type("plain/text"); return response.PassAs<HttpResponse>(); @@ -78,7 +78,7 @@ scoped_ptr<HttpResponse> HandleRequest(const HttpRequest& request) { // No other requests should be handled in the tests. EXPECT_TRUE(false) << "NOTREACHED!"; - response->set_code(net::test_server::NOT_FOUND); + response->set_code(net::HTTP_NOT_FOUND); return response.PassAs<HttpResponse>(); } diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc index d0b3aeb..d57a78e 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc @@ -37,6 +37,7 @@ #include "content/public/common/url_constants.h" #include "content/public/test/browser_test_utils.h" #include "net/dns/mock_host_resolver.h" +#include "net/test/embedded_test_server/embedded_test_server.h" #include "third_party/WebKit/public/web/WebContextMenuData.h" #include "third_party/WebKit/public/web/WebInputEvent.h" #include "webkit/glue/resource_type.h" @@ -360,7 +361,6 @@ class WebNavigationApiTest : public ExtensionApiTest { switches::kAllowLegacyExtensionManifests); host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); } virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { @@ -387,6 +387,7 @@ class WebNavigationApiTest : public ExtensionApiTest { #define MAYBE_Api Api #endif // defined(OS_WIN) IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_Api) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE( RunExtensionSubtest("webnavigation", "test_api.html")) << message_; } @@ -398,17 +399,20 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_Api) { #define MAYBE_GetFrame GetFrame #endif // defined(OS_WIN) IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_GetFrame) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE( RunExtensionSubtest("webnavigation", "test_getFrame.html")) << message_; } IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, ClientRedirect) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE( RunExtensionSubtest("webnavigation", "test_clientRedirect.html")) << message_; } IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, ServerRedirect) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE( RunExtensionSubtest("webnavigation", "test_serverRedirect.html")) << message_; @@ -423,6 +427,8 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, ServerRedirect) { #endif IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_ServerRedirectSingleProcess) { + ASSERT_TRUE(StartEmbeddedTestServer()); + // Set max renderers to 1 to force running out of processes. content::RenderProcessHost::SetMaxRendererProcessCount(1); @@ -437,15 +443,15 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, ResultCatcher catcher; GURL url(base::StringPrintf( "http://www.a.com:%d/" - "files/extensions/api_test/webnavigation/serverRedirect/a.html", - test_server()->host_port_pair().port())); + "extensions/api_test/webnavigation/serverRedirect/a.html", + embedded_test_server()->port())); ui_test_utils::NavigateToURL(browser(), url); url = GURL(base::StringPrintf( "http://www.b.com:%d/server-redirect?http://www.b.com:%d/", - test_server()->host_port_pair().port(), - test_server()->host_port_pair().port())); + embedded_test_server()->port(), + embedded_test_server()->port())); ui_test_utils::NavigateToURL(browser(), url); @@ -453,33 +459,39 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, } IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, ForwardBack) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE( RunExtensionSubtest("webnavigation", "test_forwardBack.html")) << message_; } IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, IFrame) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE( RunExtensionSubtest("webnavigation", "test_iframe.html")) << message_; } IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, SrcDoc) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE( RunExtensionSubtest("webnavigation", "test_srcdoc.html")) << message_; } IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, OpenTab) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE( RunExtensionSubtest("webnavigation", "test_openTab.html")) << message_; } IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, ReferenceFragment) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE( RunExtensionSubtest("webnavigation", "test_referenceFragment.html")) << message_; } IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, SimpleLoad) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE( RunExtensionSubtest("webnavigation", "test_simpleLoad.html")) << message_; } @@ -491,11 +503,13 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, SimpleLoad) { #define MAYBE_Failures Failures #endif // defined(OS_WIN) IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_Failures) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE( RunExtensionSubtest("webnavigation", "test_failures.html")) << message_; } IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, FilteredTest) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE( RunExtensionSubtest("webnavigation", "test_filtered.html")) << message_; } @@ -507,6 +521,8 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, FilteredTest) { #define MAYBE_UserAction UserAction #endif // defined(OS_WIN) IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_UserAction) { + ASSERT_TRUE(StartEmbeddedTestServer()); + // Wait for the extension to set itself up and return control to us. ASSERT_TRUE( RunExtensionSubtest("webnavigation", "test_userAction.html")) << message_; @@ -547,6 +563,8 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_UserAction) { #define MAYBE_RequestOpenTab RequestOpenTab #endif IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_RequestOpenTab) { + ASSERT_TRUE(StartEmbeddedTestServer()); + // Wait for the extension to set itself up and return control to us. ASSERT_TRUE(RunExtensionSubtest("webnavigation", "test_requestOpenTab.html")) << message_; @@ -585,6 +603,8 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_RequestOpenTab) { #define MAYBE_TargetBlank TargetBlank #endif // defined(OS_WIN) IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_TargetBlank) { + ASSERT_TRUE(StartEmbeddedTestServer()); + // Wait for the extension to set itself up and return control to us. ASSERT_TRUE(RunExtensionSubtest("webnavigation", "test_targetBlank.html")) << message_; @@ -594,8 +614,8 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_TargetBlank) { ResultCatcher catcher; - GURL url = test_server()->GetURL( - "files/extensions/api_test/webnavigation/targetBlank/a.html"); + GURL url = embedded_test_server()->GetURL( + "/extensions/api_test/webnavigation/targetBlank/a.html"); chrome::NavigateParams params(browser(), url, content::PAGE_TRANSITION_LINK); ui_test_utils::NavigateToURL(¶ms); @@ -622,6 +642,8 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_TargetBlank) { #define MAYBE_TargetBlankIncognito TargetBlankIncognito #endif IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_TargetBlankIncognito) { + ASSERT_TRUE(StartEmbeddedTestServer()); + // Wait for the extension to set itself up and return control to us. ASSERT_TRUE(RunExtensionSubtest( "webnavigation", "test_targetBlank.html", @@ -629,8 +651,8 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_TargetBlankIncognito) { ResultCatcher catcher; - GURL url = test_server()->GetURL( - "files/extensions/api_test/webnavigation/targetBlank/a.html"); + GURL url = embedded_test_server()->GetURL( + "/extensions/api_test/webnavigation/targetBlank/a.html"); Browser* otr_browser = ui_test_utils::OpenURLOffTheRecord( browser()->profile(), url); @@ -652,12 +674,15 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_TargetBlankIncognito) { } IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, History) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE( RunExtensionSubtest("webnavigation", "test_history.html")) << message_; } IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, CrossProcess) { + ASSERT_TRUE(StartEmbeddedTestServer()); + LoadExtension(test_data_dir_.AppendASCII("webnavigation").AppendASCII("app")); LoadExtension(test_data_dir_.AppendASCII("webnavigation")); @@ -669,7 +694,7 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, CrossProcess) { // See crossProcess/d.html. DelayLoadStartAndExecuteJavascript call_script( test_navigation_listener(), - test_server()->GetURL("test1"), + embedded_test_server()->GetURL("/test1"), "navigate2()", extension->GetResourceURL("crossProcess/empty.html")); @@ -679,6 +704,8 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, CrossProcess) { } IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, CrossProcessFragment) { + ASSERT_TRUE(StartEmbeddedTestServer()); + LoadExtension(test_data_dir_.AppendASCII("webnavigation")); ExtensionService* service = extensions::ExtensionSystem::Get( @@ -689,20 +716,20 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, CrossProcessFragment) { // See crossProcess/f.html. DelayLoadStartAndExecuteJavascript call_script3( test_navigation_listener(), - test_server()->GetURL("test3"), + embedded_test_server()->GetURL("/test3"), "updateFragment()", extension->GetResourceURL(base::StringPrintf( "crossProcess/f.html?%d#foo", - test_server()->host_port_pair().port()))); + embedded_test_server()->port()))); // See crossProcess/g.html. DelayLoadStartAndExecuteJavascript call_script4( test_navigation_listener(), - test_server()->GetURL("test4"), + embedded_test_server()->GetURL("/test4"), "updateFragment()", extension->GetResourceURL(base::StringPrintf( "crossProcess/g.html?%d#foo", - test_server()->host_port_pair().port()))); + embedded_test_server()->port()))); ASSERT_TRUE(RunPageTest( extension->GetResourceURL("test_crossProcessFragment.html").spec())) @@ -710,6 +737,8 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, CrossProcessFragment) { } IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, CrossProcessHistory) { + ASSERT_TRUE(StartEmbeddedTestServer()); + LoadExtension(test_data_dir_.AppendASCII("webnavigation")); ExtensionService* service = extensions::ExtensionSystem::Get( @@ -720,21 +749,21 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, CrossProcessHistory) { // See crossProcess/e.html. DelayLoadStartAndExecuteJavascript call_script2( test_navigation_listener(), - test_server()->GetURL("test2"), + embedded_test_server()->GetURL("/test2"), "updateHistory()", extension->GetResourceURL("crossProcess/empty.html")); // See crossProcess/h.html. DelayLoadStartAndExecuteJavascript call_script5( test_navigation_listener(), - test_server()->GetURL("test5"), + embedded_test_server()->GetURL("/test5"), "updateHistory()", extension->GetResourceURL("crossProcess/empty.html")); // See crossProcess/i.html. DelayLoadStartAndExecuteJavascript call_script6( test_navigation_listener(), - test_server()->GetURL("test6"), + embedded_test_server()->GetURL("/test6"), "updateHistory()", extension->GetResourceURL("crossProcess/empty.html")); @@ -750,6 +779,8 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, CrossProcessHistory) { #define MAYBE_Crash Crash #endif IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_Crash) { + ASSERT_TRUE(StartEmbeddedTestServer()); + // Wait for the extension to set itself up and return control to us. ASSERT_TRUE(RunExtensionSubtest("webnavigation", "test_crash.html")) << message_; @@ -761,16 +792,16 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, MAYBE_Crash) { GURL url(base::StringPrintf( "http://www.a.com:%d/" - "files/extensions/api_test/webnavigation/crash/a.html", - test_server()->host_port_pair().port())); + "extensions/api_test/webnavigation/crash/a.html", + embedded_test_server()->port())); ui_test_utils::NavigateToURL(browser(), url); ui_test_utils::NavigateToURL(browser(), GURL(content::kChromeUICrashURL)); url = GURL(base::StringPrintf( "http://www.a.com:%d/" - "files/extensions/api_test/webnavigation/crash/b.html", - test_server()->host_port_pair().port())); + "extensions/api_test/webnavigation/crash/b.html", + embedded_test_server()->port())); ui_test_utils::NavigateToURL(browser(), url); ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); diff --git a/chrome/browser/extensions/api/web_request/web_request_apitest.cc b/chrome/browser/extensions/api/web_request/web_request_apitest.cc index 767eeec..0cca09d 100644 --- a/chrome/browser/extensions/api/web_request/web_request_apitest.cc +++ b/chrome/browser/extensions/api/web_request/web_request_apitest.cc @@ -22,6 +22,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" #include "net/dns/mock_host_resolver.h" +#include "net/test/embedded_test_server/embedded_test_server.h" #include "third_party/WebKit/public/web/WebInputEvent.h" using content::WebContents; @@ -64,7 +65,6 @@ class ExtensionWebRequestApiTest : public ExtensionApiTest { ExtensionApiTest::SetUpInProcessBrowserTestFixture(); host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); } void RunPermissionTest( @@ -76,6 +76,7 @@ class ExtensionWebRequestApiTest : public ExtensionApiTest { }; IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebRequestApi) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_api.html")) << message_; } @@ -86,11 +87,13 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebRequestApi) { #define MAYBE_WebRequestSimple WebRequestSimple #endif // defined(OS_WIN) IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, MAYBE_WebRequestSimple) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_simple.html")) << message_; } IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebRequestComplex) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_complex.html")) << message_; } @@ -100,6 +103,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, DISABLED_WebRequestAuthRequired) { CancelLoginDialog login_dialog_helper; + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_auth_required.html")) << message_; } @@ -111,6 +115,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, #define MAYBE_WebRequestBlocking WebRequestBlocking #endif IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, MAYBE_WebRequestBlocking) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_blocking.html")) << message_; } @@ -122,6 +127,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, MAYBE_WebRequestBlocking) { #define MAYBE_WebRequestNewTab WebRequestNewTab #endif // defined(OS_WIN) IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, MAYBE_WebRequestNewTab) { + ASSERT_TRUE(StartEmbeddedTestServer()); // Wait for the extension to set itself up and return control to us. ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_newTab.html")) << message_; @@ -155,6 +161,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, MAYBE_WebRequestNewTab) { } IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebRequestDeclarative1) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_declarative1.html")) << message_; } @@ -167,6 +174,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebRequestDeclarative1) { #endif IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, MAYBE_WebRequestDeclarative2) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_declarative2.html")) << message_; } @@ -200,7 +208,7 @@ void ExtensionWebRequestApiTest::RunPermissionTest( // This navigation should be redirected. ui_test_utils::NavigateToURL( browser(), - test_server()->GetURL("files/extensions/test_file.html")); + embedded_test_server()->GetURL("/extensions/test_file.html")); std::string body; WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); @@ -221,7 +229,7 @@ void ExtensionWebRequestApiTest::RunPermissionTest( // load_extension_with_incognito_permission is true. ui_test_utils::NavigateToURL( otr_browser, - test_server()->GetURL("files/extensions/test_file.html")); + embedded_test_server()->GetURL("/extensions/test_file.html")); body.clear(); WebContents* otr_tab = otr_browser->tab_strip_model()->GetActiveWebContents(); @@ -235,12 +243,14 @@ void ExtensionWebRequestApiTest::RunPermissionTest( IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebRequestDeclarativePermissionSpanning1) { // Test spanning with incognito permission. + ASSERT_TRUE(StartEmbeddedTestServer()); RunPermissionTest("spanning", true, false, "redirected1", "redirected1"); } IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebRequestDeclarativePermissionSpanning2) { // Test spanning without incognito permission. + ASSERT_TRUE(StartEmbeddedTestServer()); RunPermissionTest("spanning", false, false, "redirected1", ""); } @@ -248,12 +258,14 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebRequestDeclarativePermissionSplit1) { // Test split with incognito permission. + ASSERT_TRUE(StartEmbeddedTestServer()); RunPermissionTest("split", true, true, "redirected1", "redirected2"); } IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebRequestDeclarativePermissionSplit2) { // Test split without incognito permission. + ASSERT_TRUE(StartEmbeddedTestServer()); RunPermissionTest("split", false, false, "redirected1", ""); } @@ -267,18 +279,21 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, #endif IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, MAYBE_PostData1) { // Test HTML form POST data access with the default and "url" encoding. + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_post1.html")) << message_; } IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, MAYBE_PostData2) { // Test HTML form POST data access with the multipart and plaintext encoding. + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_post2.html")) << message_; } IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, DeclarativeSendMessage) { + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("webrequest_sendmessage")) << message_; } @@ -286,6 +301,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, // has two active background pages with registered events does not crash the // browser. Regression test for http://crbug.com/224094 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, IncognitoSplitModeReload) { + ASSERT_TRUE(StartEmbeddedTestServer()); // Wait for rules to be set up. ExtensionTestMessageListener listener("done", true); ExtensionTestMessageListener listener_incognito("done_incognito", true); diff --git a/chrome/browser/extensions/api/web_socket_proxy_private/web_socket_proxy_private_apitest.cc b/chrome/browser/extensions/api/web_socket_proxy_private/web_socket_proxy_private_apitest.cc index d75832c..c417921 100644 --- a/chrome/browser/extensions/api/web_socket_proxy_private/web_socket_proxy_private_apitest.cc +++ b/chrome/browser/extensions/api/web_socket_proxy_private/web_socket_proxy_private_apitest.cc @@ -18,7 +18,7 @@ class ExtensionWebSocketProxyPrivateApiTest : public ExtensionApiTest { IN_PROC_BROWSER_TEST_F(ExtensionWebSocketProxyPrivateApiTest, Pass) { // Currently WebSocket-to-TCP proxy is operational only on ChromeOS platform. #if defined(OS_CHROMEOS) - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("web_socket_proxy_private")) << message_; // Check if API still works on subsequent calls. ASSERT_TRUE(RunExtensionTest("web_socket_proxy_private")) << message_; diff --git a/chrome/browser/extensions/app_background_page_apitest.cc b/chrome/browser/extensions/app_background_page_apitest.cc index 773c528..75fe6cf 100644 --- a/chrome/browser/extensions/app_background_page_apitest.cc +++ b/chrome/browser/extensions/app_background_page_apitest.cc @@ -20,6 +20,7 @@ #include "content/public/test/test_notification_tracker.h" #include "content/public/test/test_utils.h" #include "net/dns/mock_host_resolver.h" +#include "net/test/embedded_test_server/embedded_test_server.h" #if defined(OS_MACOSX) #include "base/mac/scoped_nsautorelease_pool.h" @@ -114,7 +115,7 @@ class AppBackgroundPageApiTest : public ExtensionApiTest { IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, MAYBE_Basic) { host_resolver()->AddRule("a.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); std::string app_manifest = base::StringPrintf( "{" @@ -131,7 +132,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, MAYBE_Basic) { " }," " \"permissions\": [\"background\"]" "}", - test_server()->host_port_pair().port()); + embedded_test_server()->port()); base::FilePath app_dir; ASSERT_TRUE(CreateApp(app_manifest, &app_dir)); @@ -147,7 +148,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, MAYBE_Basic) { // Crashy, http://crbug.com/69215. IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, DISABLED_LacksPermission) { host_resolver()->AddRule("a.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); std::string app_manifest = base::StringPrintf( "{" @@ -163,7 +164,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, DISABLED_LacksPermission) { " }" " }" "}", - test_server()->host_port_pair().port()); + embedded_test_server()->port()); base::FilePath app_dir; ASSERT_TRUE(CreateApp(app_manifest, &app_dir)); @@ -175,7 +176,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, DISABLED_LacksPermission) { IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, ManifestBackgroundPage) { host_resolver()->AddRule("a.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); std::string app_manifest = base::StringPrintf( "{" @@ -195,8 +196,8 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, ManifestBackgroundPage) { " \"page\": \"http://a.com:%d/test.html\"" " }" "}", - test_server()->host_port_pair().port(), - test_server()->host_port_pair().port()); + embedded_test_server()->port(), + embedded_test_server()->port()); base::FilePath app_dir; ASSERT_TRUE(CreateApp(app_manifest, &app_dir)); @@ -223,7 +224,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, NoJsBackgroundPage) { content::Source<Profile>(browser()->profile())); host_resolver()->AddRule("a.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); std::string app_manifest = base::StringPrintf( "{" @@ -243,7 +244,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, NoJsBackgroundPage) { " \"allow_js_access\": false" " }" "}", - test_server()->host_port_pair().port()); + embedded_test_server()->port()); base::FilePath app_dir; ASSERT_TRUE(CreateApp(app_manifest, &app_dir)); @@ -267,7 +268,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, NoJsBackgroundPage) { IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, NoJsManifestBackgroundPage) { host_resolver()->AddRule("a.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); std::string app_manifest = base::StringPrintf( "{" @@ -288,8 +289,8 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, NoJsManifestBackgroundPage) { " \"allow_js_access\": false" " }" "}", - test_server()->host_port_pair().port(), - test_server()->host_port_pair().port()); + embedded_test_server()->port(), + embedded_test_server()->port()); base::FilePath app_dir; ASSERT_TRUE(CreateApp(app_manifest, &app_dir)); @@ -307,7 +308,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, NoJsManifestBackgroundPage) { IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, OpenTwoBackgroundPages) { host_resolver()->AddRule("a.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); std::string app_manifest = base::StringPrintf( "{" @@ -324,7 +325,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, OpenTwoBackgroundPages) { " }," " \"permissions\": [\"background\"]" "}", - test_server()->host_port_pair().port()); + embedded_test_server()->port()); base::FilePath app_dir; ASSERT_TRUE(CreateApp(app_manifest, &app_dir)); @@ -336,7 +337,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, OpenTwoBackgroundPages) { IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, OpenTwoPagesWithManifest) { host_resolver()->AddRule("a.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); std::string app_manifest = base::StringPrintf( "{" @@ -356,8 +357,8 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, OpenTwoPagesWithManifest) { " }," " \"permissions\": [\"background\"]" "}", - test_server()->host_port_pair().port(), - test_server()->host_port_pair().port()); + embedded_test_server()->port(), + embedded_test_server()->port()); base::FilePath app_dir; ASSERT_TRUE(CreateApp(app_manifest, &app_dir)); @@ -371,7 +372,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, OpenTwoPagesWithManifest) { // Times out occasionally -- see crbug.com/108493 IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, DISABLED_OpenPopupFromBGPage) { host_resolver()->AddRule("a.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); std::string app_manifest = base::StringPrintf( "{" @@ -386,12 +387,12 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, DISABLED_OpenPopupFromBGPage) { " \"web_url\": \"http://a.com:%d/\"" " }" " }," - " \"background\": { \"page\": \"http://a.com:%d/files/extensions/api_test/" + " \"background\": { \"page\": \"http://a.com:%d/extensions/api_test/" "app_background_page/bg_open/bg_open_bg.html\" }," " \"permissions\": [\"background\"]" "}", - test_server()->host_port_pair().port(), - test_server()->host_port_pair().port()); + embedded_test_server()->port(), + embedded_test_server()->port()); base::FilePath app_dir; ASSERT_TRUE(CreateApp(app_manifest, &app_dir)); @@ -401,7 +402,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, DISABLED_OpenPopupFromBGPage) { IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, DISABLED_OpenThenClose) { host_resolver()->AddRule("a.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); std::string app_manifest = base::StringPrintf( "{" @@ -418,7 +419,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, DISABLED_OpenThenClose) { " }," " \"permissions\": [\"background\"]" "}", - test_server()->host_port_pair().port()); + embedded_test_server()->port()); base::FilePath app_dir; ASSERT_TRUE(CreateApp(app_manifest, &app_dir)); @@ -447,7 +448,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, DISABLED_OpenThenClose) { IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, UnloadExtensionWhileHidden) { host_resolver()->AddRule("a.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); std::string app_manifest = base::StringPrintf( "{" @@ -467,8 +468,8 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, UnloadExtensionWhileHidden) { " \"page\": \"http://a.com:%d/test.html\"" " }" "}", - test_server()->host_port_pair().port(), - test_server()->host_port_pair().port()); + embedded_test_server()->port(), + embedded_test_server()->port()); base::FilePath app_dir; ASSERT_TRUE(CreateApp(app_manifest, &app_dir)); diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc index f47eb7b..e48b29d 100644 --- a/chrome/browser/extensions/app_process_apitest.cc +++ b/chrome/browser/extensions/app_process_apitest.cc @@ -28,6 +28,7 @@ #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_navigation_observer.h" #include "net/dns/mock_host_resolver.h" +#include "net/test/embedded_test_server/embedded_test_server.h" #include "sync/api/string_ordinal.h" using content::NavigationController; @@ -44,8 +45,8 @@ class AppApiTest : public ExtensionApiTest { GURL::Replacements replace_host; std::string host_str("localhost"); // must stay in scope with replace_host replace_host.SetHostStr(host_str); - GURL base_url = test_server()->GetURL( - "files/extensions/api_test/" + test_directory + "/"); + GURL base_url = embedded_test_server()->GetURL( + "/extensions/api_test/" + test_directory + "/"); return base_url.ReplaceComponents(replace_host); } @@ -67,7 +68,7 @@ class AppApiTest : public ExtensionApiTest { browser()->profile())->extension_service()->process_map(); host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(LoadExtension( test_data_dir_.AppendASCII(app_name))); @@ -144,7 +145,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_AppProcess) { browser()->profile())->extension_service()->process_map(); host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process"))); @@ -291,7 +292,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_BookmarkAppGetsNormalProcess) { extensions::ProcessMap* process_map = service->process_map(); host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); GURL base_url = GetTestBaseURL("app_process"); // Load an app as a bookmark app. @@ -371,7 +372,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_BookmarkAppGetsNormalProcess) { // See http://crbug.com/61757 IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcessRedirectBack) { host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process"))); @@ -397,7 +398,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcessRedirectBack) { // 3 tabs, including the initial about:blank. The last 2 should be the same // process. ASSERT_EQ(3, browser()->tab_strip_model()->count()); - EXPECT_EQ("/files/extensions/api_test/app_process/path1/empty.html", + EXPECT_EQ("/extensions/api_test/app_process/path1/empty.html", browser()->tab_strip_model()->GetWebContentsAt(2)-> GetController().GetLastCommittedEntry()->GetURL().path()); EXPECT_EQ(browser()->tab_strip_model()->GetWebContentsAt(1)-> @@ -416,7 +417,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, NavigateIntoAppProcess) { browser()->profile())->extension_service()->process_map(); host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); // The app under test acts on URLs whose host is "localhost", // so the URLs we navigate to must have host "localhost". @@ -463,7 +464,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, ReloadIntoAppProcess) { browser()->profile())->extension_service()->process_map(); host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); // The app under test acts on URLs whose host is "localhost", // so the URLs we navigate to must have host "localhost". @@ -528,7 +529,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, ReloadIntoAppProcessWithJavaScript) { browser()->profile())->extension_service()->process_map(); host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); // The app under test acts on URLs whose host is "localhost", // so the URLs we navigate to must have host "localhost". @@ -602,7 +603,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, OpenAppFromIframe) { browser()->profile())->extension_service()->process_map(); host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); GURL base_url = GetTestBaseURL("app_process"); @@ -638,7 +639,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, OpenAppFromIframe) { #endif IN_PROC_BROWSER_TEST_F(BlockedAppApiTest, MAYBE_OpenAppFromIframe) { host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); // Load app and start URL (not in the app). const Extension* app = @@ -666,7 +667,7 @@ IN_PROC_BROWSER_TEST_F(BlockedAppApiTest, MAYBE_OpenAppFromIframe) { // up with an app process. See http://crbug.com/99349 for more details. IN_PROC_BROWSER_TEST_F(AppApiTest, ServerRedirectToAppFromExtension) { host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); LoadExtension(test_data_dir_.AppendASCII("app_process")); const Extension* launcher = @@ -708,7 +709,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, ServerRedirectToAppFromExtension) { // up with an app process. IN_PROC_BROWSER_TEST_F(AppApiTest, ClientRedirectToAppFromExtension) { host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); LoadExtension(test_data_dir_.AppendASCII("app_process")); const Extension* launcher = @@ -757,7 +758,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, OpenWebPopupFromWebIframe) { browser()->profile())->extension_service()->process_map(); host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); GURL base_url = GetTestBaseURL("app_process"); @@ -794,7 +795,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_ReloadAppAfterCrash) { browser()->profile())->extension_service()->process_map(); host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process"))); diff --git a/chrome/browser/extensions/content_script_apitest.cc b/chrome/browser/extensions/content_script_apitest.cc index 1bd0dce..48f6cc6 100644 --- a/chrome/browser/extensions/content_script_apitest.cc +++ b/chrome/browser/extensions/content_script_apitest.cc @@ -16,31 +16,32 @@ #include "content/public/test/browser_test_utils.h" #include "googleurl/src/gurl.h" #include "net/dns/mock_host_resolver.h" +#include "net/test/embedded_test_server/embedded_test_server.h" IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptAllFrames) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("content_scripts/all_frames")) << message_; } IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptAboutBlankIframes) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE( RunExtensionTest("content_scripts/about_blank_iframes")) << message_; } IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptExtensionIframe) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("content_scripts/extension_iframe")) << message_; } IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptExtensionProcess) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE( RunExtensionTest("content_scripts/extension_process")) << message_; } IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptFragmentNavigation) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); const char* extension_name = "content_scripts/fragment"; ASSERT_TRUE(RunExtensionTest(extension_name)) << message_; } @@ -54,7 +55,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptFragmentNavigation) { IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_ContentScriptIsolatedWorlds) { // This extension runs various bits of script and tests that they all run in // the same isolated world. - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("content_scripts/isolated_world1")) << message_; // Now load a different extension, inject into same page, verify worlds aren't @@ -65,14 +66,14 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_ContentScriptIsolatedWorlds) { IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptIgnoreHostPermissions) { host_resolver()->AddRule("a.com", "127.0.0.1"); host_resolver()->AddRule("b.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest( "content_scripts/dont_match_host_permissions")) << message_; } // crbug.com/39249 -- content scripts js should not run on view source. IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptViewSource) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("content_scripts/view_source")) << message_; } @@ -80,7 +81,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptViewSource) { // extensions. IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptOtherExtensions) { host_resolver()->AddRule("a.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); // First, load extension that sets up content script. ASSERT_TRUE(RunExtensionTest("content_scripts/other_extensions/injector")) << message_; @@ -93,7 +94,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptOtherExtensions) { IN_PROC_BROWSER_TEST_F( ExtensionApiTest, DISABLED_ContentScriptStylesInjectedIntoExistingRenderers) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); content::WindowedNotificationObserver signal( chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, @@ -121,25 +122,29 @@ IN_PROC_BROWSER_TEST_F( IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptCSSLocalization) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("content_scripts/css_l10n")) << message_; } IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptExtensionAPIs) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); const extensions::Extension* extension = LoadExtension( test_data_dir_.AppendASCII("content_scripts/extension_api")); ResultCatcher catcher; ui_test_utils::NavigateToURL( - browser(), test_server()->GetURL("functions.html")); + browser(), + embedded_test_server()->GetURL( + "/extensions/api_test/content_scripts/extension_api/functions.html")); EXPECT_TRUE(catcher.GetNextResult()); // Navigate to a page that will cause a content script to run that starts // listening for an extension event. ui_test_utils::NavigateToURL( - browser(), test_server()->GetURL("events.html")); + browser(), + embedded_test_server()->GetURL( + "/extensions/api_test/content_scripts/extension_api/events.html")); // Navigate to an extension page that will fire the event events.js is // listening for. @@ -159,11 +164,11 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_ContentScriptPermissionsApi) { extensions::PermissionsRequestFunction::SetIgnoreUserGestureForTests(true); extensions::PermissionsRequestFunction::SetAutoConfirmForTests(true); host_resolver()->AddRule("*.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("content_scripts/permissions")) << message_; } IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptBypassPageCSP) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("content_scripts/bypass_page_csp")) << message_; } diff --git a/chrome/browser/extensions/content_security_policy_apitest.cc b/chrome/browser/extensions/content_security_policy_apitest.cc index d2a4969..cbf104d 100644 --- a/chrome/browser/extensions/content_security_policy_apitest.cc +++ b/chrome/browser/extensions/content_security_policy_apitest.cc @@ -7,12 +7,12 @@ #include "net/dns/mock_host_resolver.h" IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSecurityPolicy) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("content_security_policy")) << message_; } IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DefaultContentSecurityPolicy) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("default_content_security_policy")) << message_; } diff --git a/chrome/browser/extensions/cross_origin_xhr_apitest.cc b/chrome/browser/extensions/cross_origin_xhr_apitest.cc index 4198b7d..eae682f 100644 --- a/chrome/browser/extensions/cross_origin_xhr_apitest.cc +++ b/chrome/browser/extensions/cross_origin_xhr_apitest.cc @@ -7,19 +7,19 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, CrossOriginXHRBackgroundPage) { host_resolver()->AddRule("*.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("cross_origin_xhr/background_page")) << message_; } IN_PROC_BROWSER_TEST_F(ExtensionApiTest, CrossOriginXHRAllURLs) { host_resolver()->AddRule("*.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("cross_origin_xhr/all_urls")) << message_; } IN_PROC_BROWSER_TEST_F(ExtensionApiTest, CrossOriginXHRContentScript) { host_resolver()->AddRule("*.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("cross_origin_xhr/content_script")) << message_; } diff --git a/chrome/browser/extensions/execute_script_apitest.cc b/chrome/browser/extensions/execute_script_apitest.cc index c2d96d7..f28ba8c 100644 --- a/chrome/browser/extensions/execute_script_apitest.cc +++ b/chrome/browser/extensions/execute_script_apitest.cc @@ -18,14 +18,14 @@ class ExecuteScriptApiTest : public ExtensionApiTest { // If failing, mark disabled and update http://crbug.com/92105. IN_PROC_BROWSER_TEST_F(ExecuteScriptApiTest, ExecuteScriptBasic) { SetupDelayedHostResolver(); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("executescript/basic")) << message_; } // If failing, mark disabled and update http://crbug.com/92105. IN_PROC_BROWSER_TEST_F(ExecuteScriptApiTest, ExecuteScriptInFrame) { SetupDelayedHostResolver(); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("executescript/in_frame")) << message_; } @@ -39,20 +39,20 @@ IN_PROC_BROWSER_TEST_F(ExecuteScriptApiTest, ExecuteScriptInFrame) { IN_PROC_BROWSER_TEST_F(ExecuteScriptApiTest, MAYBE_ExecuteScriptPermissions) { SetupDelayedHostResolver(); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("executescript/permissions")) << message_; } // If failing, mark disabled and update http://crbug.com/84760. IN_PROC_BROWSER_TEST_F(ExecuteScriptApiTest, ExecuteScriptFileAfterClose) { host_resolver()->AddRule("b.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("executescript/file_after_close")) << message_; } // If crashing, mark disabled and update http://crbug.com/67774. IN_PROC_BROWSER_TEST_F(ExecuteScriptApiTest, ExecuteScriptFragmentNavigation) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); const char* extension_name = "executescript/fragment"; ASSERT_TRUE(RunExtensionTest(extension_name)) << message_; } @@ -67,7 +67,7 @@ IN_PROC_BROWSER_TEST_F(ExecuteScriptApiTest, MAYBE_NavigationRaceExecuteScript) { host_resolver()->AddRule("a.com", "127.0.0.1"); host_resolver()->AddRule("b.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionSubtest("executescript/navigation_race", "execute_script.html")) << message_; } @@ -75,7 +75,7 @@ IN_PROC_BROWSER_TEST_F(ExecuteScriptApiTest, IN_PROC_BROWSER_TEST_F(ExecuteScriptApiTest, NavigationRaceJavaScriptURL) { host_resolver()->AddRule("a.com", "127.0.0.1"); host_resolver()->AddRule("b.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionSubtest("executescript/navigation_race", "javascript_url.html")) << message_; } @@ -83,18 +83,18 @@ IN_PROC_BROWSER_TEST_F(ExecuteScriptApiTest, NavigationRaceJavaScriptURL) { // If failing, mark disabled and update http://crbug.com/92105. IN_PROC_BROWSER_TEST_F(ExecuteScriptApiTest, ExecuteScriptFrameAfterLoad) { SetupDelayedHostResolver(); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("executescript/frame_after_load")) << message_; } IN_PROC_BROWSER_TEST_F(ExecuteScriptApiTest, ExecuteScriptRunAt) { SetupDelayedHostResolver(); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("executescript/run_at")) << message_; } IN_PROC_BROWSER_TEST_F(ExecuteScriptApiTest, ExecuteScriptCallback) { SetupDelayedHostResolver(); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("executescript/callback")) << message_; } diff --git a/chrome/browser/extensions/extension_apitest.cc b/chrome/browser/extensions/extension_apitest.cc index c14182b..0b126afa 100644 --- a/chrome/browser/extensions/extension_apitest.cc +++ b/chrome/browser/extensions/extension_apitest.cc @@ -4,6 +4,7 @@ #include "chrome/browser/extensions/extension_apitest.h" +#include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "chrome/browser/extensions/api/test/test_api.h" @@ -18,7 +19,11 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_service.h" +#include "net/base/escape.h" #include "net/base/net_util.h" +#include "net/test/embedded_test_server/embedded_test_server.h" +#include "net/test/embedded_test_server/http_response.h" +#include "net/test/embedded_test_server/http_request.h" #include "net/test/spawned_test_server/spawned_test_server.h" namespace { @@ -28,9 +33,108 @@ const char kTestServerPort[] = "testServer.port"; const char kTestDataDirectory[] = "testDataDirectory"; const char kTestWebSocketPort[] = "testWebSocketPort"; +scoped_ptr<net::test_server::HttpResponse> HandleServerRedirectRequest( + const net::test_server::HttpRequest& request) { + if (!StartsWithASCII(request.relative_url, "/server-redirect?", true)) + return scoped_ptr<net::test_server::HttpResponse>(NULL); + + size_t query_string_pos = request.relative_url.find('?'); + std::string redirect_target = + request.relative_url.substr(query_string_pos + 1); + + scoped_ptr<net::test_server::BasicHttpResponse> http_response( + new net::test_server::BasicHttpResponse); + http_response->set_code(net::HTTP_MOVED_PERMANENTLY); + http_response->AddCustomHeader("Location", redirect_target); + return http_response.PassAs<net::test_server::HttpResponse>(); +} + +scoped_ptr<net::test_server::HttpResponse> HandleEchoHeaderRequest( + const net::test_server::HttpRequest& request) { + if (!StartsWithASCII(request.relative_url, "/echoheader?", true)) + return scoped_ptr<net::test_server::HttpResponse>(NULL); + + size_t query_string_pos = request.relative_url.find('?'); + std::string header_name = + request.relative_url.substr(query_string_pos + 1); + + std::string header_value; + std::map<std::string, std::string>::const_iterator it = request.headers.find( + header_name); + if (it != request.headers.end()) + header_value = it->second; + + scoped_ptr<net::test_server::BasicHttpResponse> http_response( + new net::test_server::BasicHttpResponse); + http_response->set_code(net::HTTP_OK); + http_response->set_content(header_value); + return http_response.PassAs<net::test_server::HttpResponse>(); +} + +scoped_ptr<net::test_server::HttpResponse> HandleSetCookieRequest( + const net::test_server::HttpRequest& request) { + if (!StartsWithASCII(request.relative_url, "/set-cookie?", true)) + return scoped_ptr<net::test_server::HttpResponse>(NULL); + + scoped_ptr<net::test_server::BasicHttpResponse> http_response( + new net::test_server::BasicHttpResponse); + http_response->set_code(net::HTTP_OK); + + size_t query_string_pos = request.relative_url.find('?'); + std::string cookie_value = + request.relative_url.substr(query_string_pos + 1); + + std::vector<std::string> cookies; + base::SplitString(cookie_value, '&', &cookies); + + for (size_t i = 0; i < cookies.size(); i++) + http_response->AddCustomHeader("Set-Cookie", cookies[i]); + + return http_response.PassAs<net::test_server::HttpResponse>(); +} + +scoped_ptr<net::test_server::HttpResponse> HandleSetHeaderRequest( + const net::test_server::HttpRequest& request) { + if (!StartsWithASCII(request.relative_url, "/set-header?", true)) + return scoped_ptr<net::test_server::HttpResponse>(NULL); + + size_t query_string_pos = request.relative_url.find('?'); + std::string escaped_header = + request.relative_url.substr(query_string_pos + 1); + + std::string header = + net::UnescapeURLComponent(escaped_header, + net::UnescapeRule::NORMAL | + net::UnescapeRule::SPACES | + net::UnescapeRule::URL_SPECIAL_CHARS); + + size_t colon_pos = header.find(':'); + if (colon_pos == std::string::npos) + return scoped_ptr<net::test_server::HttpResponse>(NULL); + + std::string header_name = header.substr(0, colon_pos); + // Skip space after colon. + std::string header_value = header.substr(colon_pos + 2); + + scoped_ptr<net::test_server::BasicHttpResponse> http_response( + new net::test_server::BasicHttpResponse); + http_response->set_code(net::HTTP_OK); + http_response->AddCustomHeader(header_name, header_value); + return http_response.PassAs<net::test_server::HttpResponse>(); +} + }; // namespace -ExtensionApiTest::ExtensionApiTest() {} +ExtensionApiTest::ExtensionApiTest() { + embedded_test_server()->RegisterRequestHandler( + base::Bind(&HandleServerRedirectRequest)); + embedded_test_server()->RegisterRequestHandler( + base::Bind(&HandleEchoHeaderRequest)); + embedded_test_server()->RegisterRequestHandler( + base::Bind(&HandleSetCookieRequest)); + embedded_test_server()->RegisterRequestHandler( + base::Bind(&HandleSetHeaderRequest)); +} ExtensionApiTest::~ExtensionApiTest() {} @@ -305,15 +409,15 @@ const extensions::Extension* ExtensionApiTest::GetSingleLoadedExtension() { return extension; } -bool ExtensionApiTest::StartTestServer() { - if (!test_server()->Start()) +bool ExtensionApiTest::StartEmbeddedTestServer() { + if (!embedded_test_server()->InitializeAndWaitUntilReady()) return false; // Build a dictionary of values that tests can use to build URLs that // access the test server and local file system. Tests can see these values // using the extension API function chrome.test.getConfig(). test_config_->SetInteger(kTestServerPort, - test_server()->host_port_pair().port()); + embedded_test_server()->port()); return true; } diff --git a/chrome/browser/extensions/extension_apitest.h b/chrome/browser/extensions/extension_apitest.h index 9d6cf0c..12827ad 100644 --- a/chrome/browser/extensions/extension_apitest.h +++ b/chrome/browser/extensions/extension_apitest.h @@ -158,7 +158,7 @@ class ExtensionApiTest : public ExtensionBrowserTest { // Start the test server, and store details of its state. Those details // will be available to javascript tests using chrome.test.getConfig(). - bool StartTestServer(); + bool StartEmbeddedTestServer(); // Start the test WebSocket server, and store details of its state. Those // details will be available to javascript tests using diff --git a/chrome/browser/extensions/extension_dom_clipboard_apitest.cc b/chrome/browser/extensions/extension_dom_clipboard_apitest.cc index 0d63acb..0d2e6a1 100644 --- a/chrome/browser/extensions/extension_dom_clipboard_apitest.cc +++ b/chrome/browser/extensions/extension_dom_clipboard_apitest.cc @@ -11,6 +11,7 @@ #include "content/public/test/browser_test_utils.h" #include "googleurl/src/gurl.h" #include "net/dns/mock_host_resolver.h" +#include "net/test/embedded_test_server/embedded_test_server.h" namespace { @@ -29,7 +30,7 @@ bool ClipboardApiTest::LoadHostedApp(const std::string& app_name, const std::string& launch_page) { host_resolver()->AddRule("*", "127.0.0.1"); - if (!StartTestServer()) { + if (!StartEmbeddedTestServer()) { message_ = "Failed to start test server."; return false; } @@ -40,7 +41,8 @@ bool ClipboardApiTest::LoadHostedApp(const std::string& app_name, return false; } - GURL base_url = test_server()->GetURL("files/extensions/api_test/clipboard/"); + GURL base_url = embedded_test_server()->GetURL( + "/extensions/api_test/clipboard/"); GURL::Replacements replace_host; std::string host_str("localhost"); // Must stay in scope with replace_host. replace_host.SetHostStr(host_str); @@ -80,12 +82,12 @@ bool ClipboardApiTest::ExecuteScriptInSelectedTab(const std::string& script, } // namespace IN_PROC_BROWSER_TEST_F(ClipboardApiTest, Extension) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("clipboard/extension")) << message_; } IN_PROC_BROWSER_TEST_F(ClipboardApiTest, ExtensionNoPermission) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("clipboard/extension_no_permission")) << message_; } diff --git a/chrome/browser/extensions/extension_incognito_apitest.cc b/chrome/browser/extensions/extension_incognito_apitest.cc index dbf7033..c122733 100644 --- a/chrome/browser/extensions/extension_incognito_apitest.cc +++ b/chrome/browser/extensions/extension_incognito_apitest.cc @@ -16,11 +16,12 @@ #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" #include "net/dns/mock_host_resolver.h" +#include "net/test/embedded_test_server/embedded_test_server.h" using content::WebContents; IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoNoScript) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); // Loads a simple extension which attempts to change the title of every page // that loads to "modified". @@ -30,7 +31,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoNoScript) { // Open incognito window and navigate to test page. Browser* otr_browser = ui_test_utils::OpenURLOffTheRecord( browser()->profile(), - test_server()->GetURL("files/extensions/test_file.html")); + embedded_test_server()->GetURL("/extensions/test_file.html")); WebContents* tab = otr_browser->tab_strip_model()->GetActiveWebContents(); @@ -52,7 +53,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoNoScript) { IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_IncognitoYesScript) { host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); // Load a dummy extension. This just tests that we don't regress a // crash fix when multiple incognito- and non-incognito-enabled extensions @@ -72,7 +73,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_IncognitoYesScript) { // Open incognito window and navigate to test page. Browser* otr_browser = ui_test_utils::OpenURLOffTheRecord( browser()->profile(), - test_server()->GetURL("files/extensions/test_file.html")); + embedded_test_server()->GetURL("/extensions/test_file.html")); WebContents* tab = otr_browser->tab_strip_model()->GetActiveWebContents(); @@ -102,14 +103,14 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_Incognito) { IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Incognito) { #endif host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ResultCatcher catcher; // Open incognito window and navigate to test page. ui_test_utils::OpenURLOffTheRecord( browser()->profile(), - test_server()->GetURL("files/extensions/test_file.html")); + embedded_test_server()->GetURL("/extensions/test_file.html")); ASSERT_TRUE(LoadExtensionIncognito(test_data_dir_ .AppendASCII("incognito").AppendASCII("apis"))); @@ -126,7 +127,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_IncognitoSplitMode) { IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoSplitMode) { #endif host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); // We need 2 ResultCatchers because we'll be running the same test in both // regular and incognito mode. @@ -142,7 +143,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoSplitMode) { // Open incognito window and navigate to test page. ui_test_utils::OpenURLOffTheRecord( browser()->profile(), - test_server()->GetURL("files/extensions/test_file.html")); + embedded_test_server()->GetURL("/extensions/test_file.html")); ASSERT_TRUE(LoadExtensionIncognito(test_data_dir_ .AppendASCII("incognito").AppendASCII("split"))); @@ -166,14 +167,14 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_IncognitoDisabled) { IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoDisabled) { #endif host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ResultCatcher catcher; // Open incognito window and navigate to test page. ui_test_utils::OpenURLOffTheRecord( browser()->profile(), - test_server()->GetURL("files/extensions/test_file.html")); + embedded_test_server()->GetURL("/extensions/test_file.html")); ASSERT_TRUE(LoadExtension(test_data_dir_ .AppendASCII("incognito").AppendASCII("apis_disabled"))); @@ -190,7 +191,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoDisabled) { // Test that opening a popup from an incognito browser window works properly. IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_IncognitoPopup) { host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ResultCatcher catcher; @@ -200,7 +201,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_IncognitoPopup) { // Open incognito window and navigate to test page. Browser* incognito_browser = ui_test_utils::OpenURLOffTheRecord( browser()->profile(), - test_server()->GetURL("files/extensions/test_file.html")); + embedded_test_server()->GetURL("/extensions/test_file.html")); // Simulate the incognito's browser action being clicked. BrowserActionTestUtil(incognito_browser).Press(0); diff --git a/chrome/browser/extensions/extension_javascript_url_apitest.cc b/chrome/browser/extensions/extension_javascript_url_apitest.cc index 4076c145..9e7fca1 100644 --- a/chrome/browser/extensions/extension_javascript_url_apitest.cc +++ b/chrome/browser/extensions/extension_javascript_url_apitest.cc @@ -9,7 +9,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, JavaScriptURLPermissions) { host_resolver()->AddRule("a.com", "127.0.0.1"); host_resolver()->AddRule("b.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("tabs/javascript_url_permissions")) << message_; } diff --git a/chrome/browser/extensions/extension_messages_apitest.cc b/chrome/browser/extensions/extension_messages_apitest.cc index 7e98128..2b9d995 100644 --- a/chrome/browser/extensions/extension_messages_apitest.cc +++ b/chrome/browser/extensions/extension_messages_apitest.cc @@ -92,7 +92,7 @@ class MessageSender : public content::NotificationObserver { // Tests that message passing between extensions and content scripts works. IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Messaging) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("messaging/connect")) << message_; } diff --git a/chrome/browser/extensions/extension_tabs_apitest.cc b/chrome/browser/extensions/extension_tabs_apitest.cc index 128e0b3..d42c4be 100644 --- a/chrome/browser/extensions/extension_tabs_apitest.cc +++ b/chrome/browser/extensions/extension_tabs_apitest.cc @@ -140,7 +140,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_TabGetCurrent) { // Flaky on the trybots. See http://crbug.com/96725. IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_TabConnect) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("tabs/connect")) << message_; } @@ -156,7 +156,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_TabReload) { IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_CaptureVisibleTabJpeg) { host_resolver()->AddRule("a.com", "127.0.0.1"); host_resolver()->AddRule("b.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionSubtest("tabs/capture_visible_tab", "test_jpeg.html")) << message_; } @@ -164,7 +164,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_CaptureVisibleTabJpeg) { IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_CaptureVisibleTabPng) { host_resolver()->AddRule("a.com", "127.0.0.1"); host_resolver()->AddRule("b.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionSubtest("tabs/capture_visible_tab", "test_png.html")) << message_; } diff --git a/chrome/browser/extensions/isolated_app_browsertest.cc b/chrome/browser/extensions/isolated_app_browsertest.cc index ca84974..2bec428 100644 --- a/chrome/browser/extensions/isolated_app_browsertest.cc +++ b/chrome/browser/extensions/isolated_app_browsertest.cc @@ -21,6 +21,9 @@ #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" #include "net/dns/mock_host_resolver.h" +#include "net/test/embedded_test_server/embedded_test_server.h" +#include "net/test/embedded_test_server/http_response.h" +#include "net/test/embedded_test_server/http_request.h" using content::ExecuteScript; using content::ExecuteScriptAndExtractString; @@ -35,6 +38,64 @@ std::string WrapForJavascriptAndExtract(const char* javascript_expression) { javascript_expression + ")"; } +scoped_ptr<net::test_server::HttpResponse> HandleExpectAndSetCookieRequest( + const net::test_server::EmbeddedTestServer* test_server, + const net::test_server::HttpRequest& request) { + if (!StartsWithASCII(request.relative_url, "/expect-and-set-cookie?", true)) + return scoped_ptr<net::test_server::HttpResponse>(NULL); + + scoped_ptr<net::test_server::BasicHttpResponse> http_response( + new net::test_server::BasicHttpResponse); + http_response->set_code(net::HTTP_OK); + + std::string request_cookies; + std::map<std::string, std::string>::const_iterator it = + request.headers.find("Cookie"); + if (it != request.headers.end()) + request_cookies = it->second; + + size_t query_string_pos = request.relative_url.find('?'); + std::string query_string = + request.relative_url.substr(query_string_pos + 1); + url_parse::Component query(0, query_string.length()), key_pos, value_pos; + bool expectations_satisfied = true; + std::vector<std::string> cookies_to_set; + while (url_parse::ExtractQueryKeyValue( + query_string.c_str(), &query, &key_pos, &value_pos)) { + std::string escaped_key(query_string.substr(key_pos.begin, key_pos.len)); + std::string escaped_value( + query_string.substr(value_pos.begin, value_pos.len)); + + std::string key = + net::UnescapeURLComponent(escaped_key, + net::UnescapeRule::NORMAL | + net::UnescapeRule::SPACES | + net::UnescapeRule::URL_SPECIAL_CHARS); + + std::string value = + net::UnescapeURLComponent(escaped_value, + net::UnescapeRule::NORMAL | + net::UnescapeRule::SPACES | + net::UnescapeRule::URL_SPECIAL_CHARS); + + if (key == "expect") { + if (request_cookies.find(value) == std::string::npos) + expectations_satisfied = false; + } else if (key == "set") { + cookies_to_set.push_back(value); + } else { + return scoped_ptr<net::test_server::HttpResponse>(NULL); + } + } + + if (expectations_satisfied) { + for (size_t i = 0; i < cookies_to_set.size(); i++) + http_response->AddCustomHeader("Set-Cookie", cookies_to_set[i]); + } + + return http_response.PassAs<net::test_server::HttpResponse>(); +} + class IsolatedAppTest : public ExtensionBrowserTest { public: // Returns whether the given tab's current URL has the given cookie. @@ -76,12 +137,12 @@ class IsolatedAppTest : public ExtensionBrowserTest { IN_PROC_BROWSER_TEST_F(IsolatedAppTest, CrossProcessClientRedirect) { host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app1"))); ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app2"))); - GURL base_url = test_server()->GetURL("files/extensions/isolated_apps/"); + GURL base_url = embedded_test_server()->GetURL("/extensions/isolated_apps/"); GURL::Replacements replace_host; std::string host_str("localhost"); // Must stay in scope with replace_host. replace_host.SetHostStr(host_str); @@ -91,8 +152,8 @@ IN_PROC_BROWSER_TEST_F(IsolatedAppTest, CrossProcessClientRedirect) { CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); // Redirect to app2. - GURL redirect_url(test_server()->GetURL( - "client-redirect?files/extensions/isolated_apps/app2/main.html")); + GURL redirect_url(embedded_test_server()->GetURL( + "/extensions/isolated_apps/app2/redirect.html")); ui_test_utils::NavigateToURLWithDisposition( browser(), redirect_url, CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); @@ -143,14 +204,14 @@ IN_PROC_BROWSER_TEST_F(IsolatedAppTest, CrossProcessClientRedirect) { // separation as you would expect. IN_PROC_BROWSER_TEST_F(IsolatedAppTest, CookieIsolation) { host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app1"))); ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app2"))); // The app under test acts on URLs whose host is "localhost", // so the URLs we navigate to must have host "localhost". - GURL base_url = test_server()->GetURL("files/extensions/isolated_apps/"); + GURL base_url = embedded_test_server()->GetURL("/extensions/isolated_apps/"); GURL::Replacements replace_host; std::string host_str("localhost"); // Must stay in scope with replace_host. replace_host.SetHostStr(host_str); @@ -242,11 +303,11 @@ IN_PROC_BROWSER_TEST_F(IsolatedAppTest, CookieIsolation) { // Ensure that cookies are not isolated if the isolated apps are not installed. IN_PROC_BROWSER_TEST_F(IsolatedAppTest, DISABLED_NoCookieIsolationWithoutApp) { host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); // The app under test acts on URLs whose host is "localhost", // so the URLs we navigate to must have host "localhost". - GURL base_url = test_server()->GetURL("files/extensions/isolated_apps/"); + GURL base_url = embedded_test_server()->GetURL("/extensions/isolated_apps/"); GURL::Replacements replace_host; std::string host_str("localhost"); // Must stay in scope with replace_host. replace_host.SetHostStr(host_str); @@ -321,15 +382,18 @@ IN_PROC_BROWSER_TEST_F(IsolatedAppTest, DISABLED_NoCookieIsolationWithoutApp) { // Tests that subresource and media requests use the app's cookie store. // See http://crbug.com/141172. IN_PROC_BROWSER_TEST_F(IsolatedAppTest, MAYBE_SubresourceCookieIsolation) { + embedded_test_server()->RegisterRequestHandler( + base::Bind(&HandleExpectAndSetCookieRequest, embedded_test_server())); + host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app1"))); // The app under test acts on URLs whose host is "localhost", // so the URLs we navigate to must have host "localhost". - GURL root_url = test_server()->GetURL(std::string()); - GURL base_url = test_server()->GetURL("files/extensions/isolated_apps/"); + GURL root_url = embedded_test_server()->GetURL("/"); + GURL base_url = embedded_test_server()->GetURL("/extensions/isolated_apps/"); GURL::Replacements replace_host; std::string host_str("localhost"); // Must stay in scope with replace_host. replace_host.SetHostStr(host_str); @@ -338,7 +402,7 @@ IN_PROC_BROWSER_TEST_F(IsolatedAppTest, MAYBE_SubresourceCookieIsolation) { // First set cookies inside and outside the app. ui_test_utils::NavigateToURLWithDisposition( - browser(), root_url.Resolve("set-cookie?nonApp=1"), + browser(), root_url.Resolve("expect-and-set-cookie?set=nonApp%3d1"), CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); WebContents* tab0 = browser()->tab_strip_model()->GetWebContentsAt(0); ASSERT_FALSE(GetInstalledApp(tab0)); @@ -397,13 +461,13 @@ IN_PROC_BROWSER_TEST_F(IsolatedAppTest, MAYBE_SubresourceCookieIsolation) { // where non-app popups may be kept in the hosted app process. IN_PROC_BROWSER_TEST_F(IsolatedAppTest, MAYBE_IsolatedAppProcessModel) { host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app1"))); // The app under test acts on URLs whose host is "localhost", // so the URLs we navigate to must have host "localhost". - GURL base_url = test_server()->GetURL("files/extensions/isolated_apps/"); + GURL base_url = embedded_test_server()->GetURL("/extensions/isolated_apps/"); GURL::Replacements replace_host; std::string host_str("localhost"); // Must stay in scope with replace_host. replace_host.SetHostStr(host_str); @@ -457,14 +521,14 @@ IN_PROC_BROWSER_TEST_F(IsolatedAppTest, MAYBE_IsolatedAppProcessModel) { // removed. http://crbug.com/159932 IN_PROC_BROWSER_TEST_F(IsolatedAppTest, DISABLED_SessionStorage) { host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app1"))); ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app2"))); // The app under test acts on URLs whose host is "localhost", // so the URLs we navigate to must have host "localhost". - GURL base_url = test_server()->GetURL("files/extensions/isolated_apps/"); + GURL base_url = embedded_test_server()->GetURL("/extensions/isolated_apps/"); GURL::Replacements replace_host; std::string host_str("localhost"); // Must stay in scope with replace_host. replace_host.SetHostStr(host_str); diff --git a/chrome/browser/extensions/lazy_background_page_apitest.cc b/chrome/browser/extensions/lazy_background_page_apitest.cc index 8bb4b11..ba6f7de 100644 --- a/chrome/browser/extensions/lazy_background_page_apitest.cc +++ b/chrome/browser/extensions/lazy_background_page_apitest.cc @@ -30,6 +30,7 @@ #include "content/public/test/browser_test_utils.h" #include "googleurl/src/gurl.h" #include "net/dns/mock_host_resolver.h" +#include "net/test/embedded_test_server/embedded_test_server.h" using extensions::Extension; @@ -141,7 +142,7 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, } IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, BroadcastEvent) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); const Extension* extension = LoadExtensionAndWait("broadcast_event"); ASSERT_TRUE(extension); @@ -159,7 +160,7 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, BroadcastEvent) { chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, content::NotificationService::AllSources()); ui_test_utils::NavigateToURL( - browser(), test_server()->GetURL("files/extensions/test_file.html")); + browser(), embedded_test_server()->GetURL("/extensions/test_file.html")); page_complete.Wait(); EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_)); @@ -183,7 +184,7 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, Filters) { // Open a tab to a URL that will fire a webNavigation event. LazyBackgroundObserver page_complete; ui_test_utils::NavigateToURL( - browser(), test_server()->GetURL("files/extensions/test_file.html")); + browser(), embedded_test_server()->GetURL("/extensions/test_file.html")); page_complete.Wait(); } @@ -235,7 +236,7 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, WaitForView) { // are complete. IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, WaitForRequest) { host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); LazyBackgroundObserver page_complete; ResultCatcher catcher; @@ -376,7 +377,7 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, MAYBE_IncognitoSplitMode) { // Tests that messages from the content script activate the lazy background // page, and keep it alive until all channels are closed. IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, Messaging) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(LoadExtensionAndWait("messaging")); // Lazy Background Page doesn't exist yet. @@ -389,7 +390,7 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, Messaging) { ResultCatcher catcher; LazyBackgroundObserver lazybg; ui_test_utils::NavigateToURL( - browser(), test_server()->GetURL("files/extensions/test_file.html")); + browser(), embedded_test_server()->GetURL("/extensions/test_file.html")); lazybg.WaitUntilLoaded(); // Background page got the content script's message and is still loaded diff --git a/chrome/browser/extensions/platform_app_browsertest.cc b/chrome/browser/extensions/platform_app_browsertest.cc index 9d3748e..03b046c 100644 --- a/chrome/browser/extensions/platform_app_browsertest.cc +++ b/chrome/browser/extensions/platform_app_browsertest.cc @@ -42,6 +42,7 @@ #include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/web_contents_view.h" #include "content/public/test/test_utils.h" +#include "net/test/embedded_test_server/embedded_test_server.h" #include "googleurl/src/gurl.h" using content::WebContents; @@ -303,7 +304,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenuClicked) { IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DisallowNavigation) { TabsAddedNotificationObserver observer(2); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunPlatformAppTest("platform_apps/navigation")) << message_; observer.Wait(); @@ -315,7 +316,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DisallowNavigation) { } IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, Iframes) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunPlatformAppTest("platform_apps/iframes")) << message_; } @@ -342,11 +343,11 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, PlatformAppsOnly) { // Tests that platform apps have isolated storage by default. IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, Isolation) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); // Load a (non-app) page under the "localhost" origin that sets a cookie. - GURL set_cookie_url = test_server()->GetURL( - "files/extensions/platform_apps/isolation/set_cookie.html"); + GURL set_cookie_url = embedded_test_server()->GetURL( + "/extensions/platform_apps/isolation/set_cookie.html"); GURL::Replacements replace_host; std::string host_str("localhost"); // Must stay in scope with replace_host. replace_host.SetHostStr(host_str); @@ -607,7 +608,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, GetDisplayPath) { #endif // defined(OS_CHROMEOS) IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OpenLink) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); content::WindowedNotificationObserver observer( chrome::NOTIFICATION_TAB_ADDED, content::Source<content::WebContentsDelegate>(browser())); diff --git a/chrome/browser/extensions/process_management_browsertest.cc b/chrome/browser/extensions/process_management_browsertest.cc index d6ea919..bb54aeb 100644 --- a/chrome/browser/extensions/process_management_browsertest.cc +++ b/chrome/browser/extensions/process_management_browsertest.cc @@ -20,6 +20,7 @@ #include "content/public/browser/site_instance.h" #include "content/public/browser/web_contents.h" #include "net/dns/mock_host_resolver.h" +#include "net/test/embedded_test_server/embedded_test_server.h" using content::NavigationController; using content::WebContents; @@ -53,7 +54,7 @@ IN_PROC_BROWSER_TEST_F(ProcessManagementTest, MAYBE_ProcessOverflow) { content::RenderProcessHost::SetMaxRendererProcessCount(1); host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app1"))); ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app2"))); @@ -63,8 +64,8 @@ IN_PROC_BROWSER_TEST_F(ProcessManagementTest, MAYBE_ProcessOverflow) { // The app under test acts on URLs whose host is "localhost", // so the URLs we navigate to must have host "localhost". - GURL base_url = test_server()->GetURL( - "files/extensions/"); + GURL base_url = embedded_test_server()->GetURL( + "/extensions/"); GURL::Replacements replace_host; std::string host_str("localhost"); // Must stay in scope with replace_host. replace_host.SetHostStr(host_str); @@ -194,12 +195,12 @@ IN_PROC_BROWSER_TEST_F(ProcessManagementTest, MAYBE_ExtensionProcessBalancing) { content::RenderProcessHost::SetMaxRendererProcessCount(6); host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); // The app under test acts on URLs whose host is "localhost", // so the URLs we navigate to must have host "localhost". - GURL base_url = test_server()->GetURL( - "files/extensions/"); + GURL base_url = embedded_test_server()->GetURL( + "/extensions/"); GURL::Replacements replace_host; std::string host_str("localhost"); // Must stay in scope with replace_host. replace_host.SetHostStr(host_str); diff --git a/chrome/browser/extensions/stubs_apitest.cc b/chrome/browser/extensions/stubs_apitest.cc index 7a5a407..982d317 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/spawned_test_server/spawned_test_server.h" +#include "net/test/embedded_test_server/embedded_test_server.h" // Tests that we throw errors when you try using extension APIs that aren't // supported in content scripts. @@ -17,13 +17,13 @@ #define MAYBE_Stubs Stubs #endif IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_Stubs) { - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(RunExtensionTest("stubs")) << message_; // Navigate to a simple http:// page, which should get the content script // injected and run the rest of the test. - GURL url(test_server()->GetURL("file/extensions/test_file.html")); + GURL url(embedded_test_server()->GetURL("/extensions/test_file.html")); ui_test_utils::NavigateToURL(browser(), url); ResultCatcher catcher; diff --git a/chrome/browser/extensions/web_view_browsertest.cc b/chrome/browser/extensions/web_view_browsertest.cc index ba7dba2..9103ea4 100644 --- a/chrome/browser/extensions/web_view_browsertest.cc +++ b/chrome/browser/extensions/web_view_browsertest.cc @@ -20,6 +20,7 @@ #include "content/public/browser/web_contents_delegate.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/fake_speech_recognition_manager.h" +#include "net/test/embedded_test_server/embedded_test_server.h" #include "ui/compositor/compositor_setup.h" #include "ui/gl/gl_switches.h" @@ -204,26 +205,26 @@ class WebViewTest : public extensions::PlatformAppBrowserTest { navigate_to_url = navigate_to_url.ReplaceComponents(replace_host); - GURL tag_url1 = test_server()->GetURL( - "files/extensions/platform_apps/web_view/isolation/cookie.html"); + GURL tag_url1 = embedded_test_server()->GetURL( + "/extensions/platform_apps/web_view/isolation/cookie.html"); tag_url1 = tag_url1.ReplaceComponents(replace_host); - GURL tag_url2 = test_server()->GetURL( - "files/extensions/platform_apps/web_view/isolation/cookie2.html"); + GURL tag_url2 = embedded_test_server()->GetURL( + "/extensions/platform_apps/web_view/isolation/cookie2.html"); tag_url2 = tag_url2.ReplaceComponents(replace_host); - GURL tag_url3 = test_server()->GetURL( - "files/extensions/platform_apps/web_view/isolation/storage1.html"); + GURL tag_url3 = embedded_test_server()->GetURL( + "/extensions/platform_apps/web_view/isolation/storage1.html"); tag_url3 = tag_url3.ReplaceComponents(replace_host); - GURL tag_url4 = test_server()->GetURL( - "files/extensions/platform_apps/web_view/isolation/storage2.html"); + GURL tag_url4 = embedded_test_server()->GetURL( + "/extensions/platform_apps/web_view/isolation/storage2.html"); tag_url4 = tag_url4.ReplaceComponents(replace_host); - GURL tag_url5 = test_server()->GetURL( - "files/extensions/platform_apps/web_view/isolation/storage1.html#p1"); + GURL tag_url5 = embedded_test_server()->GetURL( + "/extensions/platform_apps/web_view/isolation/storage1.html#p1"); tag_url5 = tag_url5.ReplaceComponents(replace_host); - GURL tag_url6 = test_server()->GetURL( - "files/extensions/platform_apps/web_view/isolation/storage1.html#p2"); + GURL tag_url6 = embedded_test_server()->GetURL( + "/extensions/platform_apps/web_view/isolation/storage1.html#p2"); tag_url6 = tag_url6.ReplaceComponents(replace_host); - GURL tag_url7 = test_server()->GetURL( - "files/extensions/platform_apps/web_view/isolation/storage1.html#p3"); + GURL tag_url7 = embedded_test_server()->GetURL( + "/extensions/platform_apps/web_view/isolation/storage1.html#p3"); tag_url7 = tag_url7.ReplaceComponents(replace_host); ui_test_utils::NavigateToURLWithDisposition( @@ -356,7 +357,7 @@ class WebViewTest : public extensions::PlatformAppBrowserTest { const std::string& test_passed_msg, const std::string& test_failed_msg, const std::string& app_location) { - ASSERT_TRUE(StartTestServer()); // For serving guest pages. + ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. ExtensionTestMessageListener launched_listener("Launched", false); LoadAndLaunchPlatformApp(app_location.c_str()); ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); @@ -379,7 +380,7 @@ class WebViewTest : public extensions::PlatformAppBrowserTest { std::string host_str("localhost"); // Must stay in scope with replace_host. replace_host.SetHostStr(host_str); - GURL guest_url = test_server()->GetURL(guest_path); + GURL guest_url = embedded_test_server()->GetURL(guest_path); guest_url = guest_url.ReplaceComponents(replace_host); ui_test_utils::UrlLoadObserver guest_observer( @@ -407,7 +408,7 @@ class WebViewTest : public extensions::PlatformAppBrowserTest { // Runs media_access/deny tests, each of them are run separately otherwise // they timeout (mostly on Windows). void MediaAccessAPIDenyTestHelper(const std::string& test_name) { - ASSERT_TRUE(StartTestServer()); // For serving guest pages. + ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. ExtensionTestMessageListener loaded_listener("loaded", false); LoadAndLaunchPlatformApp("web_view/media_access/deny"); ASSERT_TRUE(loaded_listener.WaitUntilSatisfied()); @@ -439,7 +440,7 @@ class WebViewTest : public extensions::PlatformAppBrowserTest { #define MAYBE_Shim Shim #endif IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_Shim) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/shim")) << message_; } @@ -452,10 +453,10 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, ShimSrcAttribute) { // This test is here rather than in PrerenderBrowserTest for testing convenience // only. If it breaks then this is a bug in the prerenderer. IN_PROC_BROWSER_TEST_F(WebViewTest, NoPrerenderer) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); content::WebContents* guest_web_contents = LoadGuest( - "files/extensions/platform_apps/web_view/noprerenderer/guest.html", + "/extensions/platform_apps/web_view/noprerenderer/guest.html", "web_view/noprerenderer"); ASSERT_TRUE(guest_web_contents != NULL); @@ -471,7 +472,7 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, NoPrerenderer) { // multiple webview tags. Each tag sets a cookie and the test checks the proper // storage isolation is enforced. IN_PROC_BROWSER_TEST_F(WebViewTest, CookieIsolation) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); const std::string kExpire = "var expire = new Date(Date.now() + 24 * 60 * 60 * 1000);"; std::string cookie_script1(kExpire); @@ -485,8 +486,8 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, CookieIsolation) { std::string host_str("localhost"); // Must stay in scope with replace_host. replace_host.SetHostStr(host_str); - GURL set_cookie_url = test_server()->GetURL( - "files/extensions/platform_apps/isolation/set_cookie.html"); + GURL set_cookie_url = embedded_test_server()->GetURL( + "/extensions/platform_apps/isolation/set_cookie.html"); set_cookie_url = set_cookie_url.ReplaceComponents(replace_host); // The first two partitions will be used to set cookies and ensure they are @@ -537,7 +538,7 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, CookieIsolation) { // This tests that in-memory storage partitions are reset on browser restart, // but persistent ones maintain state for cookies and HTML5 storage. IN_PROC_BROWSER_TEST_F(WebViewTest, PRE_StoragePersistence) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); const std::string kExpire = "var expire = new Date(Date.now() + 24 * 60 * 60 * 1000);"; std::string cookie_script1(kExpire); @@ -622,7 +623,7 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, PRE_StoragePersistence) { // This is the post-reset portion of the StoragePersistence test. See // PRE_StoragePersistence for main comment. IN_PROC_BROWSER_TEST_F(WebViewTest, DISABLED_StoragePersistence) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); // We don't care where the main browser is on this test. GURL blank_url("about:blank"); @@ -692,8 +693,8 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, DISABLED_StoragePersistence) { // entries, which the test checks to ensure proper storage isolation is // enforced. IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_DOMStorageIsolation) { - ASSERT_TRUE(StartTestServer()); - GURL regular_url = test_server()->GetURL("files/title1.html"); + ASSERT_TRUE(StartEmbeddedTestServer()); + GURL regular_url = embedded_test_server()->GetURL("/title1.html"); std::string output; std::string get_local_storage("window.domAutomationController.send(" @@ -786,8 +787,8 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_DOMStorageIsolation) { // an app with multiple webview tags and each tag creates an IndexedDB record, // which the test checks to ensure proper storage isolation is enforced. IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_IndexedDBIsolation) { - ASSERT_TRUE(StartTestServer()); - GURL regular_url = test_server()->GetURL("files/title1.html"); + ASSERT_TRUE(StartEmbeddedTestServer()); + GURL regular_url = embedded_test_server()->GetURL("/title1.html"); content::WebContents* default_tag_contents1; content::WebContents* default_tag_contents2; @@ -899,7 +900,7 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, } void WebViewTest::MediaAccessAPIAllowTestHelper(const std::string& test_name) { - ASSERT_TRUE(StartTestServer()); // For serving guest pages. + ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. ExtensionTestMessageListener launched_listener("Launched", false); LoadAndLaunchPlatformApp("web_view/media_access/allow"); ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); @@ -941,16 +942,16 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, MediaAccessAPIAllow_TestAllowAsync) { // Checks that window.screenX/screenY/screenLeft/screenTop works correctly for // guests. IN_PROC_BROWSER_TEST_F(WebViewTest, ScreenCoordinates) { - ASSERT_TRUE(StartTestServer()); // For serving guest pages. + ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. ASSERT_TRUE(RunPlatformAppTestWithArg( "platform_apps/web_view/common", "screen_coordinates")) << message_; } IN_PROC_BROWSER_TEST_F(WebViewTest, SpeechRecognition) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); content::WebContents* guest_web_contents = LoadGuest( - "files/extensions/platform_apps/web_view/speech/guest.html", + "/extensions/platform_apps/web_view/speech/guest.html", "web_view/speech"); ASSERT_TRUE(guest_web_contents); @@ -1039,7 +1040,7 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, // BrowserPluginGeolocationPermissionContext::CancelGeolocationPermissionRequest // is handled correctly (and does not crash). IN_PROC_BROWSER_TEST_F(WebViewTest, GeolocationAPICancelGeolocation) { - ASSERT_TRUE(StartTestServer()); // For serving guest pages. + ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. ASSERT_TRUE(RunPlatformAppTest( "platform_apps/web_view/geolocation/cancel_request")) << message_; } @@ -1052,16 +1053,16 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, Navigation) { } IN_PROC_BROWSER_TEST_F(WebViewTest, ConsoleMessage) { - ASSERT_TRUE(StartTestServer()); // For serving guest pages. + ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. ASSERT_TRUE(RunPlatformAppTestWithArg( "platform_apps/web_view/common", "console_messages")) << message_; } IN_PROC_BROWSER_TEST_F(WebViewTest, DownloadPermission) { - ASSERT_TRUE(StartTestServer()); // For serving guest pages. + ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. content::WebContents* guest_web_contents = - LoadGuest("files/extensions/platform_apps/web_view/download/guest.html", + LoadGuest("/extensions/platform_apps/web_view/download/guest.html", "web_view/download"); ASSERT_TRUE(guest_web_contents); diff --git a/chrome/browser/extensions/web_view_interactive_browsertest.cc b/chrome/browser/extensions/web_view_interactive_browsertest.cc index bcece75..eb696e6 100644 --- a/chrome/browser/extensions/web_view_interactive_browsertest.cc +++ b/chrome/browser/extensions/web_view_interactive_browsertest.cc @@ -18,6 +18,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/embedded_test_server/embedded_test_server.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/base/test/ui_controls.h" @@ -101,7 +102,7 @@ class WebViewInteractiveTest void NewWindowTestHelper(const std::string& test_name, const std::string& app_location) { - ASSERT_TRUE(StartTestServer()); // For serving guest pages. + ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. ExtensionTestMessageListener launched_listener("Launched", false); LoadAndLaunchPlatformApp(app_location.c_str()); ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); @@ -122,12 +123,12 @@ class WebViewInteractiveTest void SetupTest(const std::string& app_name, const std::string& guest_url_spec) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); GURL::Replacements replace_host; std::string host_str("localhost"); // Must stay in scope with replace_host. replace_host.SetHostStr(host_str); - GURL guest_url = test_server()->GetURL(guest_url_spec); + GURL guest_url = embedded_test_server()->GetURL(guest_url_spec); guest_url = guest_url.ReplaceComponents(replace_host); ui_test_utils::UrlLoadObserver guest_observer( @@ -290,7 +291,7 @@ class WebViewInteractiveTest IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, PointerLock) { SetupTest("web_view/pointer_lock", - "files/extensions/platform_apps/web_view/pointer_lock/guest.html"); + "/extensions/platform_apps/web_view/pointer_lock/guest.html"); // Move the mouse over the Lock Pointer button. ASSERT_TRUE(ui_test_utils::SendMouseMoveSync( @@ -364,7 +365,7 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, PointerLock) { // Tests that setting focus on the <webview> sets focus on the guest. IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, DISABLED_Focus) { - ASSERT_TRUE(StartTestServer()); // For serving guest pages. + ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/focus")) << message_; } @@ -372,7 +373,7 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, DISABLED_Focus) { // Tests that guests receive edit commands and respond appropriately. IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, EditCommands) { SetupTest("web_view/edit_commands", - "files/extensions/platform_apps/web_view/edit_commands/guest.html"); + "/extensions/platform_apps/web_view/edit_commands/guest.html"); ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow( GetPlatformAppWindow())); @@ -390,7 +391,7 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, EditCommands) { // Tests that guests receive edit commands and respond appropriately. IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, EditCommandsNoMenu) { SetupTest("web_view/edit_commands_no_menu", - "files/extensions/platform_apps/web_view/edit_commands_no_menu/" + "/extensions/platform_apps/web_view/edit_commands_no_menu/" "guest.html"); ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow( @@ -436,7 +437,7 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, NewWindow_WebRequest) { } IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, ExecuteCode) { - ASSERT_TRUE(StartTestServer()); // For serving guest pages. + ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. ASSERT_TRUE(RunPlatformAppTestWithArg( "platform_apps/web_view/common", "execute_code")) << message_; } @@ -444,7 +445,7 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, ExecuteCode) { IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, PopupPositioning) { SetupTest( "web_view/popup_positioning", - "files/extensions/platform_apps/web_view/popup_positioning/guest.html"); + "/extensions/platform_apps/web_view/popup_positioning/guest.html"); ASSERT_TRUE(guest_web_contents()); PopupTestHelper(gfx::Point()); @@ -461,7 +462,7 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, PopupPositioning) { IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, DISABLED_PopupPositioningMoved) { SetupTest( "web_view/popup_positioning_moved", - "files/extensions/platform_apps/web_view/popup_positioning_moved" + "/extensions/platform_apps/web_view/popup_positioning_moved" "/guest.html"); ASSERT_TRUE(guest_web_contents()); diff --git a/chrome/browser/extensions/window_open_apitest.cc b/chrome/browser/extensions/window_open_apitest.cc index fe79889..151ce58 100644 --- a/chrome/browser/extensions/window_open_apitest.cc +++ b/chrome/browser/extensions/window_open_apitest.cc @@ -107,7 +107,7 @@ bool WaitForTabsAndPopups(Browser* browser, IN_PROC_BROWSER_TEST_F(ExtensionApiTest, BrowserIsApp) { host_resolver()->AddRule("a.com", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(LoadExtension( test_data_dir_.AppendASCII("window_open").AppendASCII("browser_is_app"))); @@ -122,7 +122,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, BrowserIsApp) { } IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WindowOpenPopupDefault) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(LoadExtension( test_data_dir_.AppendASCII("window_open").AppendASCII("popup"))); @@ -132,7 +132,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WindowOpenPopupDefault) { } IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WindowOpenPopupLarge) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(LoadExtension( test_data_dir_.AppendASCII("window_open").AppendASCII("popup_large"))); @@ -143,7 +143,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WindowOpenPopupLarge) { } IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WindowOpenPopupSmall) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(LoadExtension( test_data_dir_.AppendASCII("window_open").AppendASCII("popup_small"))); @@ -162,7 +162,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WindowOpenPopupSmall) { #endif IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_PopupBlockingExtension) { host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(LoadExtension( test_data_dir_.AppendASCII("window_open").AppendASCII("popup_blocking") @@ -264,7 +264,7 @@ IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, int num_popups = 2; int num_panels = 2; #endif - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); // Setup listeners to wait on strings we expect the extension pages to send. std::vector<std::string> test_strings; @@ -331,7 +331,7 @@ IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, MAYBE_ClosePanelsOnExtensionCrash) { int num_popups = 2; int num_panels = 2; #endif - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); // Setup listeners to wait on strings we expect the extension pages to send. std::vector<std::string> test_strings; @@ -381,7 +381,7 @@ IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, MAYBE_ClosePanelsOnExtensionCrash) { #define MAYBE_WindowOpenFromPanel WindowOpenFromPanel #endif IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, MAYBE_WindowOpenFromPanel) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); // Load the extension that will open a panel which then calls window.open. ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("window_open"). diff --git a/chrome/browser/geolocation/geolocation_browsertest.cc b/chrome/browser/geolocation/geolocation_browsertest.cc index 9ffc81a..597ce45 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/spawned_test_server/spawned_test_server.h" +#include "net/test/embedded_test_server/embedded_test_server.h" using content::DomOperationNotificationDetails; using content::NavigationController; @@ -274,9 +274,6 @@ class GeolocationBrowserTest : public InProcessBrowserTest { double fake_latitude_; double fake_longitude_; - // TODO(phajdan.jr): Remove after we can ask TestServer whether it is started. - bool started_test_server_; - private: DISALLOW_COPY_AND_ASSIGN(GeolocationBrowserTest); }; @@ -284,10 +281,10 @@ class GeolocationBrowserTest : public InProcessBrowserTest { GeolocationBrowserTest::GeolocationBrowserTest() : infobar_(NULL), current_browser_(NULL), - html_for_tests_("files/geolocation/simple.html"), + html_for_tests_("/geolocation/simple.html"), fake_latitude_(1.23), - fake_longitude_(4.56), - started_test_server_(false) {} + fake_longitude_(4.56) { +} void GeolocationBrowserTest::SetUpOnMainThread() { ui_test_utils::OverrideGeolocation(fake_latitude_, fake_longitude_); @@ -298,13 +295,13 @@ void GeolocationBrowserTest::TearDownInProcessBrowserTestFixture() { } bool GeolocationBrowserTest::Initialize(InitializationOptions options) { - if (!started_test_server_) - started_test_server_ = test_server()->Start(); - EXPECT_TRUE(started_test_server_); - if (!started_test_server_) + if (!embedded_test_server()->Started() && + !embedded_test_server()->InitializeAndWaitUntilReady()) { + ADD_FAILURE() << "Test server failed to start."; return false; + } - current_url_ = test_server()->GetURL(html_for_tests_); + current_url_ = embedded_test_server()->GetURL(html_for_tests_); LOG(WARNING) << "before navigate"; if (options == INITIALIZATION_OFFTHERECORD) { current_browser_ = ui_test_utils::OpenURLOffTheRecord( @@ -540,7 +537,7 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, NoLeakFromOffTheRecord) { // crbug.com/176291 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, DISABLED_IFramesWithFreshPosition) { - html_for_tests_ = "files/geolocation/iframes_different_origin.html"; + html_for_tests_ = "/geolocation/iframes_different_origin.html"; ASSERT_TRUE(Initialize(INITIALIZATION_IFRAMES)); LoadIFrames(2); LOG(WARNING) << "frames loaded"; @@ -585,7 +582,7 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, IFramesWithCachedPosition) { - html_for_tests_ = "files/geolocation/iframes_different_origin.html"; + html_for_tests_ = "/geolocation/iframes_different_origin.html"; ASSERT_TRUE(Initialize(INITIALIZATION_IFRAMES)); LoadIFrames(2); @@ -624,7 +621,7 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, // crbug.com/176291 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, DISABLED_CancelPermissionForFrame) { - html_for_tests_ = "files/geolocation/iframes_different_origin.html"; + html_for_tests_ = "/geolocation/iframes_different_origin.html"; ASSERT_TRUE(Initialize(INITIALIZATION_IFRAMES)); LoadIFrames(2); LOG(WARNING) << "frames loaded"; @@ -653,7 +650,7 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, InvalidUrlRequest) { // Tests that an invalid URL (e.g. from a popup window) is rejected // correctly. Also acts as a regression test for http://crbug.com/40478 - html_for_tests_ = "files/geolocation/invalid_request_url.html"; + html_for_tests_ = "/geolocation/invalid_request_url.html"; ASSERT_TRUE(Initialize(INITIALIZATION_NONE)); WebContents* original_tab = current_browser_->tab_strip_model()->GetActiveWebContents(); @@ -663,7 +660,7 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, InvalidUrlRequest) { IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, NoInfoBarBeforeStart) { // See http://crbug.com/42789 - html_for_tests_ = "files/geolocation/iframes_different_origin.html"; + html_for_tests_ = "/geolocation/iframes_different_origin.html"; ASSERT_TRUE(Initialize(INITIALIZATION_IFRAMES)); LoadIFrames(2); LOG(WARNING) << "frames loaded"; @@ -686,7 +683,7 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, NoInfoBarBeforeStart) { } IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, TwoWatchesInOneFrame) { - html_for_tests_ = "files/geolocation/two_watches.html"; + html_for_tests_ = "/geolocation/two_watches.html"; ASSERT_TRUE(Initialize(INITIALIZATION_NONE)); // First, set the JavaScript to navigate when it receives |final_position|. double final_position_latitude = 3.17; @@ -720,7 +717,7 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, TwoWatchesInOneFrame) { // crbug.com/176291 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, DISABLED_TabDestroyed) { - html_for_tests_ = "files/geolocation/tab_destroyed.html"; + html_for_tests_ = "/geolocation/tab_destroyed.html"; ASSERT_TRUE(Initialize(INITIALIZATION_IFRAMES)); LoadIFrames(3); diff --git a/chrome/browser/google_apis/drive_api_requests_unittest.cc b/chrome/browser/google_apis/drive_api_requests_unittest.cc index 2e74e6e..ee9e963 100644 --- a/chrome/browser/google_apis/drive_api_requests_unittest.cc +++ b/chrome/browser/google_apis/drive_api_requests_unittest.cc @@ -150,7 +150,7 @@ class DriveApiRequestsTest : public testing::Test { // Return the response with just "204 No Content" status code. scoped_ptr<net::test_server::BasicHttpResponse> http_response( new net::test_server::BasicHttpResponse); - http_response->set_code(net::test_server::NO_CONTENT); + http_response->set_code(net::HTTP_NO_CONTENT); return http_response.PassAs<net::test_server::HttpResponse>(); } @@ -198,7 +198,7 @@ class DriveApiRequestsTest : public testing::Test { if (found != request.headers.end() && found->second != "*" && found->second != kTestETag) { - response->set_code(net::test_server::PRECONDITION); + response->set_code(net::HTTP_PRECONDITION_FAILED); return response.PassAs<net::test_server::HttpResponse>(); } @@ -211,7 +211,7 @@ class DriveApiRequestsTest : public testing::Test { } received_bytes_ = 0; - response->set_code(net::test_server::SUCCESS); + response->set_code(net::HTTP_OK); response->AddCustomHeader( "Location", test_server_.base_url().Resolve(expected_upload_path_).spec()); @@ -256,7 +256,7 @@ class DriveApiRequestsTest : public testing::Test { scoped_ptr<net::test_server::BasicHttpResponse> response( new net::test_server::BasicHttpResponse); // Set RESUME INCOMPLETE (308) status code. - response->set_code(net::test_server::RESUME_INCOMPLETE); + response->set_code(static_cast<net::HttpStatusCode>(308)); // Add Range header to the response, based on the values of // Content-Range header in the request. @@ -277,7 +277,7 @@ class DriveApiRequestsTest : public testing::Test { // The response code is CREATED if it is new file uploading. if (http_request_.relative_url == kTestUploadNewFilePath) { - response->set_code(net::test_server::CREATED); + response->set_code(net::HTTP_CREATED); } return response.PassAs<net::test_server::HttpResponse>(); @@ -298,7 +298,7 @@ class DriveApiRequestsTest : public testing::Test { scoped_ptr<net::test_server::BasicHttpResponse> response( new net::test_server::BasicHttpResponse); - response->set_code(net::test_server::SUCCESS); + response->set_code(net::HTTP_OK); response->set_content_type(expected_content_type_); response->set_content(expected_content_); return response.PassAs<net::test_server::HttpResponse>(); diff --git a/chrome/browser/google_apis/gdata_wapi_requests_unittest.cc b/chrome/browser/google_apis/gdata_wapi_requests_unittest.cc index 442de14..13410bf 100644 --- a/chrome/browser/google_apis/gdata_wapi_requests_unittest.cc +++ b/chrome/browser/google_apis/gdata_wapi_requests_unittest.cc @@ -222,7 +222,7 @@ class GDataWapiRequestsTest : public testing::Test { if (found != request.headers.end() && found->second != "*" && found->second != kTestETag) { - http_response->set_code(net::test_server::PRECONDITION); + http_response->set_code(net::HTTP_PRECONDITION_FAILED); return http_response.PassAs<net::test_server::HttpResponse>(); } @@ -235,7 +235,7 @@ class GDataWapiRequestsTest : public testing::Test { } received_bytes_ = 0; - http_response->set_code(net::test_server::SUCCESS); + http_response->set_code(net::HTTP_OK); GURL upload_url; // POST is used for a new file, and PUT is used for an existing file. if (request.method == net::test_server::METHOD_POST) { @@ -271,7 +271,7 @@ class GDataWapiRequestsTest : public testing::Test { // response.code() is set to SUCCESS. Change it to CREATED if it's a new // file. if (absolute_url.path() == "/upload_new_file") - response->set_code(net::test_server::CREATED); + response->set_code(net::HTTP_CREATED); // Check if the Content-Range header is present. This must be present if // the request body is not empty. @@ -306,7 +306,7 @@ class GDataWapiRequestsTest : public testing::Test { // Change the code to RESUME_INCOMPLETE if upload is not complete. if (received_bytes_ < content_length_) - response->set_code(net::test_server::RESUME_INCOMPLETE); + response->set_code(static_cast<net::HttpStatusCode>(308)); return response.PassAs<net::test_server::HttpResponse>(); } diff --git a/chrome/browser/google_apis/test_util.cc b/chrome/browser/google_apis/test_util.cc index 2e09ea9..f23f518 100644 --- a/chrome/browser/google_apis/test_util.cc +++ b/chrome/browser/google_apis/test_util.cc @@ -139,7 +139,7 @@ scoped_ptr<net::test_server::BasicHttpResponse> CreateHttpResponseFromFile( scoped_ptr<net::test_server::BasicHttpResponse> http_response( new net::test_server::BasicHttpResponse); - http_response->set_code(net::test_server::SUCCESS); + http_response->set_code(net::HTTP_OK); http_response->set_content(content); http_response->set_content_type(content_type); return http_response.Pass(); diff --git a/chrome/browser/infobars/infobars_browsertest.cc b/chrome/browser/infobars/infobars_browsertest.cc index a9baaba..6b2c481 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/spawned_test_server/spawned_test_server.h" +#include "net/test/embedded_test_server/embedded_test_server.h" class InfoBarsTest : public InProcessBrowserTest { public: @@ -51,10 +51,10 @@ class InfoBarsTest : public InProcessBrowserTest { }; IN_PROC_BROWSER_TEST_F(InfoBarsTest, TestInfoBarsCloseOnNewTheme) { - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ui_test_utils::NavigateToURL( - browser(), test_server()->GetURL("files/simple.html")); + browser(), embedded_test_server()->GetURL("/simple.html")); content::WindowedNotificationObserver infobar_added_1( chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, @@ -63,7 +63,7 @@ IN_PROC_BROWSER_TEST_F(InfoBarsTest, TestInfoBarsCloseOnNewTheme) { infobar_added_1.Wait(); ui_test_utils::NavigateToURLWithDisposition( - browser(), test_server()->GetURL("files/simple.html"), + browser(), embedded_test_server()->GetURL("/simple.html"), NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); content::WindowedNotificationObserver infobar_added_2( chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, diff --git a/chrome/browser/loadtimes_extension_bindings_browsertest.cc b/chrome/browser/loadtimes_extension_bindings_browsertest.cc index efca60a..24ab846 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/spawned_test_server/spawned_test_server.h" +#include "net/test/embedded_test_server/embedded_test_server.h" class LoadtimesExtensionBindingsTest : public InProcessBrowserTest { public: @@ -45,8 +45,8 @@ class LoadtimesExtensionBindingsTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(LoadtimesExtensionBindingsTest, LoadTimesSameAfterClientInDocNavigation) { - ASSERT_TRUE(test_server()->Start()); - GURL plain_url = test_server()->GetURL("blank"); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + GURL plain_url = embedded_test_server()->GetURL("/simple.html"); ui_test_utils::NavigateToURL(browser(), plain_url); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -61,8 +61,8 @@ IN_PROC_BROWSER_TEST_F(LoadtimesExtensionBindingsTest, IN_PROC_BROWSER_TEST_F(LoadtimesExtensionBindingsTest, LoadTimesSameAfterUserInDocNavigation) { - ASSERT_TRUE(test_server()->Start()); - GURL plain_url = test_server()->GetURL("blank"); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + GURL plain_url = embedded_test_server()->GetURL("/simple.html"); GURL hash_url(plain_url.spec() + "#"); ui_test_utils::NavigateToURL(browser(), plain_url); content::WebContents* contents = diff --git a/chrome/browser/media/chrome_webrtc_browsertest.cc b/chrome/browser/media/chrome_webrtc_browsertest.cc index d6373fb..3f97182 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/spawned_test_server/spawned_test_server.h" +#include "net/test/embedded_test_server/embedded_test_server.h" static const base::FilePath::CharType kPeerConnectionServer[] = #if defined(OS_WIN) @@ -31,7 +31,7 @@ static const base::FilePath::CharType kPeerConnectionServer[] = #endif static const char kMainWebrtcTestHtmlPage[] = - "files/webrtc/webrtc_jsep01_test.html"; + "/webrtc/webrtc_jsep01_test.html"; // Top-level integration test for WebRTC. Requires a real webcam and microphone // on the running system. This test is not meant to run in the main browser @@ -218,10 +218,10 @@ class WebrtcBrowserTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, MANUAL_RunsAudioVideoWebRTCCallInTwoTabs) { - EXPECT_TRUE(test_server()->Start()); + EXPECT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ui_test_utils::NavigateToURL( - browser(), test_server()->GetURL(kMainWebrtcTestHtmlPage)); + browser(), embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); content::WebContents* left_tab = browser()->tab_strip_model()->GetActiveWebContents(); GetUserMedia(left_tab); @@ -230,7 +230,7 @@ IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, content::WebContents* right_tab = browser()->tab_strip_model()->GetActiveWebContents(); ui_test_utils::NavigateToURL( - browser(), test_server()->GetURL(kMainWebrtcTestHtmlPage)); + browser(), embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); GetUserMedia(right_tab); ConnectToPeerConnectionServer("peer 1", left_tab); diff --git a/chrome/browser/notifications/notification_browsertest.cc b/chrome/browser/notifications/notification_browsertest.cc index 06fe062..026ea9b 100644 --- a/chrome/browser/notifications/notification_browsertest.cc +++ b/chrome/browser/notifications/notification_browsertest.cc @@ -42,7 +42,7 @@ #include "content/public/test/test_utils.h" #include "googleurl/src/gurl.h" #include "net/base/net_util.h" -#include "net/test/spawned_test_server/spawned_test_server.h" +#include "net/test/embedded_test_server/embedded_test_server.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/window_open_disposition.h" #include "ui/message_center/message_center.h" @@ -57,7 +57,7 @@ namespace { -const char kExpectedIconUrl[] = "files/notifications/no_such_file.png"; +const char kExpectedIconUrl[] = "/notifications/no_such_file.png"; enum InfobarAction { DISMISS = 0, @@ -206,9 +206,6 @@ class NotificationsTest : public InProcessBrowserTest { NotificationsTest() {} protected: - // Overriden from InProcessBrowserTest: - virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; - int GetNotificationCount(); NotificationChangeObserver* CreateObserver(); @@ -244,23 +241,16 @@ class NotificationsTest : public InProcessBrowserTest { bool CheckOriginInSetting(const ContentSettingsForOneType& settings, const GURL& origin); - GURL empty_page_url_; - GURL test_page_url_; + GURL GetTestPageURL() const { + return embedded_test_server()->GetURL( + "/notifications/notification_tester.html"); + } private: void DropOriginPreference(const GURL& origin); DesktopNotificationService* GetDesktopNotificationService(); }; -void NotificationsTest::SetUpInProcessBrowserTestFixture() { - InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); - - ASSERT_TRUE(test_server()->Start()); - empty_page_url_ = test_server()->GetURL("files/empty.html"); - test_page_url_ = test_server()->GetURL( - "files/notifications/notification_tester.html"); -} - int NotificationsTest::GetNotificationCount() { if (message_center::IsRichNotificationEnabled()) { return message_center::MessageCenter::Get()->NotificationCount(); @@ -483,10 +473,12 @@ DesktopNotificationService* NotificationsTest::GetDesktopNotificationService() { // If this flakes, use http://crbug.com/62311 and http://crbug.com/74428. IN_PROC_BROWSER_TEST_F(NotificationsTest, TestUserGestureInfobar) { + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + ui_test_utils::NavigateToURL( browser(), - test_server()->GetURL( - "files/notifications/notifications_request_function.html")); + embedded_test_server()->GetURL( + "/notifications/notifications_request_function.html")); // Request permission by calling request() while eval'ing an inline script; // That's considered a user gesture to webkit, and should produce an infobar. @@ -503,12 +495,14 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestUserGestureInfobar) { // If this flakes, use http://crbug.com/62311. IN_PROC_BROWSER_TEST_F(NotificationsTest, TestNoUserGestureInfobar) { + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + // Load a page which just does a request; no user gesture should result // in no infobar. ui_test_utils::NavigateToURL( browser(), - test_server()->GetURL( - "files/notifications/notifications_request_inline.html")); + embedded_test_server()->GetURL( + "/notifications/notifications_request_inline.html")); EXPECT_EQ(0U, InfoBarService::FromWebContents( browser()->tab_strip_model()->GetWebContentsAt(0))->infobar_count()); @@ -521,14 +515,16 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCreateSimpleNotification) { return; #endif + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + // Creates a simple notification. AllowAllOrigins(); - ui_test_utils::NavigateToURL(browser(), test_page_url_); + ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); std::string result = CreateSimpleNotification(browser(), true); EXPECT_NE("-1", result); - GURL EXPECTED_ICON_URL = test_server()->GetURL(kExpectedIconUrl); + GURL EXPECTED_ICON_URL = embedded_test_server()->GetURL(kExpectedIconUrl); ASSERT_EQ(1, GetNotificationCount()); if (message_center::IsRichNotificationEnabled()) { message_center::NotificationList::Notifications notifications = @@ -553,9 +549,11 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCloseNotification) { return; #endif + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + // Creates a notification and closes it. AllowAllOrigins(); - ui_test_utils::NavigateToURL(browser(), test_page_url_); + ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); std::string result = CreateSimpleNotification(browser(), true); EXPECT_NE("-1", result); @@ -582,9 +580,11 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCancelNotification) { return; #endif + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + // Creates a notification and cancels it in the origin page. AllowAllOrigins(); - ui_test_utils::NavigateToURL(browser(), test_page_url_); + ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); std::string note_id = CreateSimpleNotification(browser(), true); EXPECT_NE(note_id, "-1"); @@ -595,8 +595,10 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCancelNotification) { } IN_PROC_BROWSER_TEST_F(NotificationsTest, TestPermissionInfobarAppears) { + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + // Requests notification privileges and verifies the infobar appears. - ui_test_utils::NavigateToURL(browser(), test_page_url_); + ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); ASSERT_TRUE(RequestPermissionAndWait(browser())); ASSERT_EQ(0, GetNotificationCount()); @@ -610,8 +612,10 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestAllowOnPermissionInfobar) { return; #endif + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + // Tries to create a notification and clicks allow on the infobar. - ui_test_utils::NavigateToURL(browser(), test_page_url_); + ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); // This notification should not be shown because we do not have permission. CreateSimpleNotification(browser(), false); ASSERT_EQ(0, GetNotificationCount()); @@ -624,21 +628,25 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestAllowOnPermissionInfobar) { } IN_PROC_BROWSER_TEST_F(NotificationsTest, TestDenyOnPermissionInfobar) { + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + // Test that no notification is created // when Deny is chosen from permission infobar. - ui_test_utils::NavigateToURL(browser(), test_page_url_); + ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); ASSERT_TRUE(RequestPermissionAndWait(browser())); PerformActionOnInfobar(browser(), DENY, 0, 0); CreateSimpleNotification(browser(), false); ASSERT_EQ(0, GetNotificationCount()); ContentSettingsForOneType settings; GetPrefsByContentSetting(CONTENT_SETTING_BLOCK, &settings); - EXPECT_TRUE(CheckOriginInSetting(settings, test_page_url_)); + EXPECT_TRUE(CheckOriginInSetting(settings, GetTestPageURL())); } IN_PROC_BROWSER_TEST_F(NotificationsTest, TestClosePermissionInfobar) { + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + // Test that no notification is created when permission infobar is dismissed. - ui_test_utils::NavigateToURL(browser(), test_page_url_); + ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); ASSERT_TRUE(RequestPermissionAndWait(browser())); PerformActionOnInfobar(browser(), DISMISS, 0, 0); CreateSimpleNotification(browser(), false); @@ -654,9 +662,12 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestAllowNotificationsFromAllSites) { if (base::mac::IsOSMountainLionOrLater()) return; #endif + + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + // Verify that all domains can be allowed to show notifications. SetDefaultPermissionSetting(CONTENT_SETTING_ALLOW); - ui_test_utils::NavigateToURL(browser(), test_page_url_); + ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); std::string result = CreateSimpleNotification(browser(), true); EXPECT_NE("-1", result); @@ -667,9 +678,11 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestAllowNotificationsFromAllSites) { } IN_PROC_BROWSER_TEST_F(NotificationsTest, TestDenyNotificationsFromAllSites) { + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + // Verify that no domain can show notifications. SetDefaultPermissionSetting(CONTENT_SETTING_BLOCK); - ui_test_utils::NavigateToURL(browser(), test_page_url_); + ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); std::string result = CreateSimpleNotification(browser(), false); EXPECT_EQ("-1", result); @@ -678,12 +691,14 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestDenyNotificationsFromAllSites) { } IN_PROC_BROWSER_TEST_F(NotificationsTest, TestDenyDomainAndAllowAll) { + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + // Verify that denying a domain and allowing all shouldn't show // notifications from the denied domain. - DenyOrigin(test_page_url_.GetOrigin()); + DenyOrigin(GetTestPageURL().GetOrigin()); SetDefaultPermissionSetting(CONTENT_SETTING_ALLOW); - ui_test_utils::NavigateToURL(browser(), test_page_url_); + ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); std::string result = CreateSimpleNotification(browser(), false); EXPECT_EQ("-1", result); @@ -697,12 +712,15 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestAllowDomainAndDenyAll) { if (base::mac::IsOSMountainLionOrLater()) return; #endif + + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + // Verify that allowing a domain and denying all others should show // notifications from the allowed domain. - AllowOrigin(test_page_url_.GetOrigin()); + AllowOrigin(GetTestPageURL().GetOrigin()); SetDefaultPermissionSetting(CONTENT_SETTING_BLOCK); - ui_test_utils::NavigateToURL(browser(), test_page_url_); + ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); std::string result = CreateSimpleNotification(browser(), true); EXPECT_NE("-1", result); @@ -716,17 +734,20 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestDenyAndThenAllowDomain) { if (base::mac::IsOSMountainLionOrLater()) return; #endif + + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + // Verify that denying and again allowing should show notifications. - DenyOrigin(test_page_url_.GetOrigin()); + DenyOrigin(GetTestPageURL().GetOrigin()); - ui_test_utils::NavigateToURL(browser(), test_page_url_); + ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); std::string result = CreateSimpleNotification(browser(), false); EXPECT_EQ("-1", result); ASSERT_EQ(0, GetNotificationCount()); - AllowOrigin(test_page_url_.GetOrigin()); + AllowOrigin(GetTestPageURL().GetOrigin()); result = CreateSimpleNotification(browser(), true); EXPECT_NE("-1", result); @@ -741,16 +762,19 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCreateDenyCloseNotifications) { if (base::mac::IsOSMountainLionOrLater()) return; #endif + + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + // Verify able to create, deny, and close the notification. AllowAllOrigins(); - ui_test_utils::NavigateToURL(browser(), test_page_url_); + ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); CreateSimpleNotification(browser(), true); ASSERT_EQ(1, GetNotificationCount()); - DenyOrigin(test_page_url_.GetOrigin()); + DenyOrigin(GetTestPageURL().GetOrigin()); ContentSettingsForOneType settings; GetPrefsByContentSetting(CONTENT_SETTING_BLOCK, &settings); - ASSERT_TRUE(CheckOriginInSetting(settings, test_page_url_.GetOrigin())); + ASSERT_TRUE(CheckOriginInSetting(settings, GetTestPageURL().GetOrigin())); EXPECT_EQ(1, GetNotificationCount()); if (message_center::IsRichNotificationEnabled()) { @@ -770,15 +794,17 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCreateDenyCloseNotifications) { IN_PROC_BROWSER_TEST_F( NotificationsTest, DISABLED_TestOriginPrefsNotSavedInIncognito) { + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + // Verify that allow/deny origin preferences are not saved in incognito. Browser* incognito = CreateIncognitoBrowser(); - ui_test_utils::NavigateToURL(incognito, test_page_url_); + ui_test_utils::NavigateToURL(incognito, GetTestPageURL()); ASSERT_TRUE(RequestPermissionAndWait(incognito)); PerformActionOnInfobar(incognito, DENY, 0, 0); CloseBrowserWindow(incognito); incognito = CreateIncognitoBrowser(); - ui_test_utils::NavigateToURL(incognito, test_page_url_); + ui_test_utils::NavigateToURL(incognito, GetTestPageURL()); ASSERT_TRUE(RequestPermissionAndWait(incognito)); PerformActionOnInfobar(incognito, ALLOW, 0, 0); CreateSimpleNotification(incognito, true); @@ -786,7 +812,7 @@ IN_PROC_BROWSER_TEST_F( CloseBrowserWindow(incognito); incognito = CreateIncognitoBrowser(); - ui_test_utils::NavigateToURL(incognito, test_page_url_); + ui_test_utils::NavigateToURL(incognito, GetTestPageURL()); ASSERT_TRUE(RequestPermissionAndWait(incognito)); ContentSettingsForOneType settings; @@ -797,8 +823,10 @@ IN_PROC_BROWSER_TEST_F( } IN_PROC_BROWSER_TEST_F(NotificationsTest, TestExitBrowserWithInfobar) { + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + // Exit the browser window, when the infobar appears. - ui_test_utils::NavigateToURL(browser(), test_page_url_); + ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); ASSERT_TRUE(RequestPermissionAndWait(browser())); } @@ -812,14 +840,16 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestExitBrowserWithInfobar) { #endif IN_PROC_BROWSER_TEST_F(NotificationsTest, MAYBE_TestCrashTabWithPermissionInfobar) { + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + // Test crashing the tab with permission infobar doesn't crash Chrome. ui_test_utils::NavigateToURLWithDisposition( browser(), - empty_page_url_, + embedded_test_server()->GetURL("/empty.html"), NEW_BACKGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); browser()->tab_strip_model()->ActivateTabAt(0, true); - ui_test_utils::NavigateToURL(browser(), test_page_url_); + ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); ASSERT_TRUE(RequestPermissionAndWait(browser())); CrashTab(browser(), 0); } @@ -834,9 +864,12 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestKillNotificationProcess) { if (base::mac::IsOSMountainLionOrLater()) return; #endif + + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + // Test killing a notification doesn't crash Chrome. AllowAllOrigins(); - ui_test_utils::NavigateToURL(browser(), test_page_url_); + ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); CreateSimpleNotification(browser(), true); ASSERT_EQ(1, GetNotificationCount()); @@ -852,9 +885,12 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestIncognitoNotification) { if (base::mac::IsOSMountainLionOrLater()) return; #endif + + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + // Test notifications in incognito window. Browser* browser = CreateIncognitoBrowser(); - ui_test_utils::NavigateToURL(browser, test_page_url_); + ui_test_utils::NavigateToURL(browser, GetTestPageURL()); browser->tab_strip_model()->ActivateTabAt(0, true); ASSERT_TRUE(RequestPermissionAndWait(browser)); PerformActionOnInfobar(browser, ALLOW, 0, 0); @@ -863,6 +899,8 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestIncognitoNotification) { } IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCloseTabWithPermissionInfobar) { + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + // Test that user can close tab when infobar present. ui_test_utils::NavigateToURLWithDisposition( browser(), @@ -870,7 +908,7 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCloseTabWithPermissionInfobar) { NEW_BACKGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); browser()->tab_strip_model()->ActivateTabAt(0, true); - ui_test_utils::NavigateToURL(browser(), test_page_url_); + ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); ASSERT_TRUE(RequestPermissionAndWait(browser())); content::WindowedNotificationObserver observer( content::NOTIFICATION_WEB_CONTENTS_DESTROYED, @@ -888,6 +926,9 @@ IN_PROC_BROWSER_TEST_F( if (base::mac::IsOSMountainLionOrLater()) return; #endif + + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + // Test navigating away when an infobar is present, // then trying to create a notification from the same page. ui_test_utils::NavigateToURLWithDisposition( @@ -896,9 +937,9 @@ IN_PROC_BROWSER_TEST_F( NEW_BACKGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); browser()->tab_strip_model()->ActivateTabAt(0, true); - ui_test_utils::NavigateToURL(browser(), test_page_url_); + ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); ASSERT_TRUE(RequestPermissionAndWait(browser())); - ui_test_utils::NavigateToURL(browser(), test_page_url_); + ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); ASSERT_TRUE(RequestPermissionAndWait(browser())); PerformActionOnInfobar(browser(), ALLOW, 0, 0); CreateSimpleNotification(browser(), true); @@ -921,6 +962,9 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, if (base::mac::IsOSMountainLionOrLater()) return; #endif + + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + // Test crashing renderer does not close or crash notification. AllowAllOrigins(); ui_test_utils::NavigateToURLWithDisposition( @@ -929,7 +973,7 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, NEW_BACKGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); browser()->tab_strip_model()->ActivateTabAt(0, true); - ui_test_utils::NavigateToURL(browser(), test_page_url_); + ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); CreateSimpleNotification(browser(), true); ASSERT_EQ(1, GetNotificationCount()); CrashTab(browser(), 0); @@ -942,10 +986,13 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestNotificationReplacement) { if (base::mac::IsOSMountainLionOrLater()) return; #endif + + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + // Test that we can replace a notification using the replaceId. AllowAllOrigins(); - ui_test_utils::NavigateToURL(browser(), test_page_url_); + ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); std::string result = CreateNotification( browser(), true, "abc.png", "Title1", "Body1", "chat"); @@ -968,7 +1015,7 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestNotificationReplacement) { ASSERT_EQ(1U, balloons.size()); Balloon* balloon = balloons[0]; const Notification& notification = balloon->notification(); - GURL EXPECTED_ICON_URL = test_server()->GetURL(kExpectedIconUrl); + GURL EXPECTED_ICON_URL = embedded_test_server()->GetURL(kExpectedIconUrl); EXPECT_EQ(EXPECTED_ICON_URL, notification.icon_url()); EXPECT_EQ(ASCIIToUTF16("Title2"), notification.title()); EXPECT_EQ(ASCIIToUTF16("Body2"), notification.message()); diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc index 8521d35..4a2f70e 100644 --- a/chrome/browser/prerender/prerender_browsertest.cc +++ b/chrome/browser/prerender/prerender_browsertest.cc @@ -2737,11 +2737,6 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, class PrerenderBrowserTestWithExtensions : public PrerenderBrowserTest, public ExtensionApiTest { public: - PrerenderBrowserTestWithExtensions() { - autostart_test_server_ = false; - } - virtual ~PrerenderBrowserTestWithExtensions() {} - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { PrerenderBrowserTest::SetUpCommandLine(command_line); ExtensionApiTest::SetUpCommandLine(command_line); @@ -2765,7 +2760,7 @@ class PrerenderBrowserTestWithExtensions : public PrerenderBrowserTest, // http://crbug.com/177163 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTestWithExtensions, DISABLED_WebNavigation) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); extensions::FrameNavigationState::set_allow_extension_scheme(true); CommandLine::ForCurrentProcess()->AppendSwitch( @@ -2796,7 +2791,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTestWithExtensions, #define MAYBE_TabsApi TabsApi #endif // defined(OS_WIN) IN_PROC_BROWSER_TEST_F(PrerenderBrowserTestWithExtensions, MAYBE_TabsApi) { - ASSERT_TRUE(StartTestServer()); + ASSERT_TRUE(StartEmbeddedTestServer()); extensions::FrameNavigationState::set_allow_extension_scheme(true); // Wait for the extension to set itself up and return control to us. diff --git a/chrome/browser/search_engines/template_url_fetcher_unittest.cc b/chrome/browser/search_engines/template_url_fetcher_unittest.cc index c174a51..f6ae15e 100644 --- a/chrome/browser/search_engines/template_url_fetcher_unittest.cc +++ b/chrome/browser/search_engines/template_url_fetcher_unittest.cc @@ -16,7 +16,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/test/base/testing_profile.h" #include "googleurl/src/gurl.h" -#include "net/test/spawned_test_server/spawned_test_server.h" +#include "net/test/embedded_test_server/embedded_test_server.h" #include "testing/gtest/include/gtest/gtest.h" class TemplateURLFetcherTest; @@ -53,10 +53,11 @@ class TemplateURLFetcherTest : public testing::Test { profile->CreateRequestContext(); ASSERT_TRUE(profile->GetRequestContext()); - ASSERT_TRUE(test_server_.Start()); + ASSERT_TRUE(test_server_.InitializeAndWaitUntilReady()); } virtual void TearDown() OVERRIDE { + ASSERT_TRUE(test_server_.ShutdownAndWaitUntilComplete()); test_util_.TearDown(); } @@ -78,7 +79,7 @@ class TemplateURLFetcherTest : public testing::Test { void WaitForDownloadToFinish(); TemplateURLServiceTestUtil test_util_; - net::SpawnedTestServer test_server_; + net::test_server::EmbeddedTestServer test_server_; // The last TemplateURL to come from a callback. scoped_ptr<TemplateURL> last_callback_template_url_; @@ -108,12 +109,16 @@ void TemplateURLFetcherTestCallbacks::ConfirmAddSearchProvider( } TemplateURLFetcherTest::TemplateURLFetcherTest() - : test_server_(net::SpawnedTestServer::TYPE_HTTP, - net::SpawnedTestServer::kLocalhost, - base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))), + : test_server_( + content::BrowserThread::GetMessageLoopProxyForThread( + content::BrowserThread::IO)), callbacks_destroyed_(0), add_provider_called_(0), waiting_for_download_(false) { + base::FilePath src_dir; + CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &src_dir)); + test_server_.ServeFilesFromDirectory( + src_dir.AppendASCII("chrome/test/data")); } void TemplateURLFetcherTest::DestroyedCallback( @@ -145,7 +150,7 @@ void TemplateURLFetcherTest::StartDownload( } // Start the fetch. - GURL osdd_url = test_server_.GetURL("files/" + osdd_file_name); + GURL osdd_url = test_server_.GetURL("/" + osdd_file_name); GURL favicon_url; TemplateURLFetcherFactory::GetForProfile( test_util_.profile())->ScheduleDownload( diff --git a/chrome/browser/sessions/tab_restore_browsertest.cc b/chrome/browser/sessions/tab_restore_browsertest.cc index 346f04f..7f9689b 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/spawned_test_server/spawned_test_server.h" +#include "net/test/embedded_test_server/embedded_test_server.h" #include "third_party/WebKit/public/web/WebFindOptions.h" class TabRestoreTest : public InProcessBrowserTest { @@ -363,10 +363,10 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreIntoSameWindow) { // Tests that a duplicate history entry is not created when we restore a page // to an existing SiteInstance. (Bug 1230446) IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWithExistingSiteInstance) { - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); - GURL http_url1(test_server()->GetURL("files/title1.html")); - GURL http_url2(test_server()->GetURL("files/title2.html")); + GURL http_url1(embedded_test_server()->GetURL("/title1.html")); + GURL http_url2(embedded_test_server()->GetURL("/title2.html")); int tab_count = browser()->tab_strip_model()->count(); // Add a tab @@ -420,10 +420,10 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWithExistingSiteInstance) { // already exists. (Bug 1204135) IN_PROC_BROWSER_TEST_F(TabRestoreTest, MAYBE_RestoreCrossSiteWithExistingSiteInstance) { - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); - GURL http_url1(test_server()->GetURL("files/title1.html")); - GURL http_url2(test_server()->GetURL("files/title2.html")); + GURL http_url1(embedded_test_server()->GetURL("/title1.html")); + GURL http_url2(embedded_test_server()->GetURL("/title2.html")); int tab_count = browser()->tab_strip_model()->count(); @@ -551,9 +551,9 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreTabWithSpecialURL) { // Restore tab with special URL in its navigation history, go back to that // entry and see that it loads properly. See http://crbug.com/31905 IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreTabWithSpecialURLOnBack) { - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); - const GURL http_url(test_server()->GetURL("files/title1.html")); + const GURL http_url(embedded_test_server()->GetURL("/title1.html")); // Navigate new tab to a special URL. ui_test_utils::NavigateToURLWithDisposition( diff --git a/chrome/browser/tab_contents/view_source_browsertest.cc b/chrome/browser/tab_contents/view_source_browsertest.cc index 9066db3..e7ffe44 100644 --- a/chrome/browser/tab_contents/view_source_browsertest.cc +++ b/chrome/browser/tab_contents/view_source_browsertest.cc @@ -17,10 +17,10 @@ #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" #include "googleurl/src/gurl.h" -#include "net/test/spawned_test_server/spawned_test_server.h" +#include "net/test/embedded_test_server/embedded_test_server.h" namespace { -const char kTestHtml[] = "files/viewsource/test.html"; +const char kTestHtml[] = "/viewsource/test.html"; const char kTestMedia[] = "files/media/pink_noise_140ms.wav"; } @@ -31,11 +31,11 @@ typedef InProcessBrowserTest ViewSourceTest; // page in view source). // Flaky; see http://crbug.com/72201. IN_PROC_BROWSER_TEST_F(ViewSourceTest, DoesBrowserRenderInViewSource) { - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); // First we navigate to our view-source test page. GURL url(content::kViewSourceScheme + std::string(":") + - test_server()->GetURL(kTestHtml).spec()); + embedded_test_server()->GetURL(kTestHtml).spec()); ui_test_utils::NavigateToURL(browser(), url); // Check that the title didn't get set. It should not be there (because we @@ -49,10 +49,10 @@ IN_PROC_BROWSER_TEST_F(ViewSourceTest, DoesBrowserRenderInViewSource) { // implementation of the view-source: prefix being consumed (removed from the // URL) if the URL was not changed (apart from adding the view-source prefix) IN_PROC_BROWSER_TEST_F(ViewSourceTest, DoesBrowserConsumeViewSourcePrefix) { - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); // First we navigate to google.html. - GURL url(test_server()->GetURL(kTestHtml)); + GURL url(embedded_test_server()->GetURL(kTestHtml)); ui_test_utils::NavigateToURL(browser(), url); // Then we navigate to the same url but with the "view-source:" prefix. @@ -69,9 +69,9 @@ IN_PROC_BROWSER_TEST_F(ViewSourceTest, DoesBrowserConsumeViewSourcePrefix) { // Make sure that when looking at the actual page, we can select "View Source" // from the menu. IN_PROC_BROWSER_TEST_F(ViewSourceTest, ViewSourceInMenuEnabledOnANormalPage) { - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); - GURL url(test_server()->GetURL(kTestHtml)); + GURL url(embedded_test_server()->GetURL(kTestHtml)); ui_test_utils::NavigateToURL(browser(), url); EXPECT_TRUE(chrome::CanViewSource(browser())); @@ -96,10 +96,10 @@ IN_PROC_BROWSER_TEST_F(ViewSourceTest, ViewSourceInMenuDisabledOnAMediaPage) { // from the menu. IN_PROC_BROWSER_TEST_F(ViewSourceTest, ViewSourceInMenuDisabledWhileViewingSource) { - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); GURL url_viewsource(content::kViewSourceScheme + std::string(":") + - test_server()->GetURL(kTestHtml).spec()); + embedded_test_server()->GetURL(kTestHtml).spec()); ui_test_utils::NavigateToURL(browser(), url_viewsource); EXPECT_FALSE(chrome::CanViewSource(browser())); @@ -109,10 +109,10 @@ IN_PROC_BROWSER_TEST_F(ViewSourceTest, // the page in view-source mode. // Times out on Mac, Windows, ChromeOS Linux: crbug.com/162080 IN_PROC_BROWSER_TEST_F(ViewSourceTest, DISABLED_TestViewSourceReload) { - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); GURL url_viewsource(content::kViewSourceScheme + std::string(":") + - test_server()->GetURL(kTestHtml).spec()); + embedded_test_server()->GetURL(kTestHtml).spec()); content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, diff --git a/chrome/browser/task_manager/task_manager_browsertest.cc b/chrome/browser/task_manager/task_manager_browsertest.cc index 81a2a1a..a4f2a93 100644 --- a/chrome/browser/task_manager/task_manager_browsertest.cc +++ b/chrome/browser/task_manager/task_manager_browsertest.cc @@ -39,6 +39,7 @@ #include "content/public/test/browser_test_utils.h" #include "grit/generated_resources.h" #include "net/dns/mock_host_resolver.h" +#include "net/test/embedded_test_server/embedded_test_server.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/l10n/l10n_util.h" @@ -302,12 +303,12 @@ IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeHostedAppTabs) { // The app under test acts on URLs whose host is "localhost", // so the URLs we navigate to must have host "localhost". host_resolver()->AddRule("*", "127.0.0.1"); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); GURL::Replacements replace_host; std::string host_str("localhost"); // must stay in scope with replace_host replace_host.SetHostStr(host_str); - GURL base_url = test_server()->GetURL( - "files/extensions/api_test/app_process/"); + GURL base_url = embedded_test_server()->GetURL( + "/extensions/api_test/app_process/"); base_url = base_url.ReplaceComponents(replace_host); // Open a new tab to an app URL before the app is loaded. diff --git a/chrome/browser/translate/translate_browsertest.cc b/chrome/browser/translate/translate_browsertest.cc index bb6ec05..f65093f 100644 --- a/chrome/browser/translate/translate_browsertest.cc +++ b/chrome/browser/translate/translate_browsertest.cc @@ -19,6 +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/embedded_test_server/embedded_test_server.h" #include "net/test/spawned_test_server/spawned_test_server.h" #include "net/url_request/test_url_fetcher_factory.h" #include "net/url_request/url_fetcher_delegate.h" @@ -27,7 +28,7 @@ namespace { const base::FilePath::CharType kTranslateRoot[] = FILE_PATH_LITERAL("chrome/test/data/translate"); -const char kNonSecurePrefix[] = "files/translate/"; +const char kNonSecurePrefix[] = "/translate/"; const char kSecurePrefix[] = "files/"; const char kFrenchTestPath[] = "fr_test.html"; const char kRefreshMetaTagTestPath[] = "refresh_meta_tag.html"; @@ -56,7 +57,7 @@ class TranslateBrowserTest : public InProcessBrowserTest { protected: GURL GetNonSecureURL(const std::string& path) const { std::string prefix(kNonSecurePrefix); - return test_server()->GetURL(prefix + path); + return embedded_test_server()->GetURL(prefix + path); } GURL GetSecureURL(const std::string& path) const { @@ -73,7 +74,7 @@ class TranslateBrowserTest : public InProcessBrowserTest { }; IN_PROC_BROWSER_TEST_F(TranslateBrowserTest, Translate) { - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -141,7 +142,7 @@ IN_PROC_BROWSER_TEST_F(TranslateBrowserTest, Translate) { } IN_PROC_BROWSER_TEST_F(TranslateBrowserTest, IgnoreRefreshMetaTag) { - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -172,7 +173,7 @@ IN_PROC_BROWSER_TEST_F(TranslateBrowserTest, IgnoreRefreshMetaTag) { IN_PROC_BROWSER_TEST_F(TranslateBrowserTest, IgnoreRefreshMetaTagInCaseInsensitive) { - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -202,7 +203,7 @@ IN_PROC_BROWSER_TEST_F(TranslateBrowserTest, } IN_PROC_BROWSER_TEST_F(TranslateBrowserTest, IgnoreRefreshMetaTagAtOnload) { - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -232,7 +233,7 @@ IN_PROC_BROWSER_TEST_F(TranslateBrowserTest, IgnoreRefreshMetaTagAtOnload) { } IN_PROC_BROWSER_TEST_F(TranslateBrowserTest, UpdateLocation) { - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -262,7 +263,7 @@ IN_PROC_BROWSER_TEST_F(TranslateBrowserTest, UpdateLocation) { } IN_PROC_BROWSER_TEST_F(TranslateBrowserTest, UpdateLocationAtOnload) { - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); diff --git a/chrome/browser/ui/app_list/search/webstore_provider_browsertest.cc b/chrome/browser/ui/app_list/search/webstore_provider_browsertest.cc index 9caf949..d7b2a47 100644 --- a/chrome/browser/ui/app_list/search/webstore_provider_browsertest.cc +++ b/chrome/browser/ui/app_list/search/webstore_provider_browsertest.cc @@ -98,11 +98,11 @@ class WebstoreProviderTest : public InProcessBrowserTest { if (request.relative_url.find("/jsonsearch?") != std::string::npos) { if (mock_server_response_ == "404") { - response->set_code(net::test_server::NOT_FOUND); + response->set_code(net::HTTP_NOT_FOUND); } else if (mock_server_response_ == "500") { - response->set_code(net::test_server::ACCESS_DENIED); + response->set_code(net::HTTP_INTERNAL_SERVER_ERROR); } else { - response->set_code(net::test_server::SUCCESS); + response->set_code(net::HTTP_OK); response->set_content(mock_server_response_); } } diff --git a/chrome/browser/ui/browser_focus_uitest.cc b/chrome/browser/ui/browser_focus_uitest.cc index e83c347..303d4c2 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/spawned_test_server/spawned_test_server.h" +#include "net/test/embedded_test_server/embedded_test_server.h" #if defined(TOOLKIT_VIEWS) #include "chrome/browser/ui/views/frame/browser_view.h" @@ -87,9 +87,9 @@ const int kActionDelayMs = 500; // Maxiumum time to wait until the focus is moved to expected view. const int kFocusChangeTimeoutMs = 500; -const char kSimplePage[] = "files/focus/page_with_focus.html"; -const char kStealFocusPage[] = "files/focus/page_steals_focus.html"; -const char kTypicalPage[] = "files/focus/typical_page.html"; +const char kSimplePage[] = "/focus/page_with_focus.html"; +const char kStealFocusPage[] = "/focus/page_steals_focus.html"; +const char kTypicalPage[] = "/focus/typical_page.html"; const char kTypicalPageName[] = "typical_page.html"; // Test to make sure Chrome is in the foreground as we start testing. This is @@ -238,10 +238,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_ClickingMovesFocus) { // Flaky, http://crbug.com/69034. IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_BrowsersRememberFocus) { ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); // First we navigate to our test page. - GURL url = test_server()->GetURL(kSimplePage); + GURL url = embedded_test_server()->GetURL(kSimplePage); ui_test_utils::NavigateToURL(browser(), url); gfx::NativeWindow window = browser()->window()->GetNativeWindow(); @@ -307,10 +307,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_BrowsersRememberFocus) { // Disabled, http://crbug.com/62542. IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_TabsRememberFocus) { ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); // First we navigate to our test page. - GURL url = test_server()->GetURL(kSimplePage); + GURL url = embedded_test_server()->GetURL(kSimplePage); ui_test_utils::NavigateToURL(browser(), url); // Create several tabs. @@ -376,10 +376,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_TabsRememberFocus) { // Tabs remember focus with find-in-page box. IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_TabsRememberFocusFindInPage) { ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); // First we navigate to our test page. - GURL url = test_server()->GetURL(kSimplePage); + GURL url = embedded_test_server()->GetURL(kSimplePage); ui_test_utils::NavigateToURL(browser(), url); chrome::Find(browser()); @@ -417,7 +417,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_TabsRememberFocusFindInPage) { IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_BackgroundBrowserDontStealFocus) { ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); // Open a new browser window. Browser* browser2 = @@ -450,7 +450,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, unfocused_browser = browser(); #endif - GURL steal_focus_url = test_server()->GetURL(kStealFocusPage); + GURL steal_focus_url = embedded_test_server()->GetURL(kStealFocusPage); ui_test_utils::NavigateToURL(unfocused_browser, steal_focus_url); // Activate the first browser. @@ -467,10 +467,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, // Page cannot steal focus when focus is on location bar. IN_PROC_BROWSER_TEST_F(BrowserFocusTest, LocationBarLockFocus) { ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); // Open the page that steals focus. - GURL url = test_server()->GetURL(kStealFocusPage); + GURL url = embedded_test_server()->GetURL(kStealFocusPage); ui_test_utils::NavigateToURL(browser(), url); chrome::FocusLocationBar(browser()); @@ -490,10 +490,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, LocationBarLockFocus) { // RenderWidget::didFocus()). IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversal) { ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); // First we navigate to our test page. - GURL url = test_server()->GetURL(kTypicalPage); + GURL url = embedded_test_server()->GetURL(kTypicalPage); ui_test_utils::NavigateToURL(browser(), url); chrome::FocusLocationBar(browser()); @@ -612,10 +612,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversal) { // Focus traversal while an interstitial is showing. IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversalOnInterstitial) { ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); // First we navigate to our test page. - GURL url = test_server()->GetURL(kSimplePage); + GURL url = embedded_test_server()->GetURL(kSimplePage); ui_test_utils::NavigateToURL(browser(), url); // Focus should be on the page. @@ -732,10 +732,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversalOnInterstitial) { // http://crbug.com/81451 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_InterstitialFocus) { ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); // First we navigate to our test page. - GURL url = test_server()->GetURL(kSimplePage); + GURL url = embedded_test_server()->GetURL(kSimplePage); ui_test_utils::NavigateToURL(browser(), url); // Page should have focus. @@ -769,10 +769,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_InterstitialFocus) { // Disabled due to flakiness. http://crbug.com/67301. IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_FindFocusTest) { ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); // Open some page (any page that doesn't steal focus). - GURL url = test_server()->GetURL(kTypicalPage); + GURL url = embedded_test_server()->GetURL(kTypicalPage); ui_test_utils::NavigateToURL(browser(), url); EXPECT_TRUE(ChromeInForeground()); @@ -853,7 +853,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_TabInitialFocus) { // Tests that focus goes where expected when using reload. IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) { ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); // Open the new tab, reload. { @@ -878,7 +878,8 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) { ASSERT_TRUE(IsViewFocused(VIEW_ID_OMNIBOX)); // Open a regular page, focus the location bar, reload. - ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(kSimplePage)); + ui_test_utils::NavigateToURL(browser(), + embedded_test_server()->GetURL(kSimplePage)); chrome::FocusLocationBar(browser()); ASSERT_TRUE(IsViewFocused(VIEW_ID_OMNIBOX)); { @@ -899,10 +900,11 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) { // Tests that focus goes where expected when using reload on a crashed tab. IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_FocusOnReloadCrashedTab) { ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); // Open a regular page, crash, reload. - ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(kSimplePage)); + ui_test_utils::NavigateToURL(browser(), + embedded_test_server()->GetURL(kSimplePage)); content::CrashTab(browser()->tab_strip_model()->GetActiveWebContents()); { content::WindowedNotificationObserver observer( 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 fe0922d..cca8aa3 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 @@ -13,11 +13,11 @@ #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/spawned_test_server/spawned_test_server.h" +#include "net/test/embedded_test_server/embedded_test_server.h" namespace { -const char kSimplePage[] = "404_is_enough_for_us.html"; +const char kSimplePage[] = "/404_is_enough_for_us.html"; void OnClicked(GtkWidget* widget, bool* clicked_bit) { *clicked_bit = true; @@ -31,14 +31,14 @@ class BookmarkBarGtkInteractiveUITest : public InProcessBrowserTest { // Makes sure that when you switch back to an NTP with an active findbar, // the findbar is above the floating bookmark bar. IN_PROC_BROWSER_TEST_F(BookmarkBarGtkInteractiveUITest, FindBarTest) { - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); // Create new tab; open findbar. chrome::NewTab(browser()); chrome::Find(browser()); // Create new tab with an arbitrary URL. - GURL url = test_server()->GetURL(kSimplePage); + GURL url = embedded_test_server()->GetURL(kSimplePage); chrome::AddSelectedTabWithURL(browser(), url, content::PAGE_TRANSITION_TYPED); // Switch back to the NTP with the active findbar. @@ -58,7 +58,7 @@ IN_PROC_BROWSER_TEST_F(BookmarkBarGtkInteractiveUITest, FindBarTest) { // Disabled due to http://crbug.com/88933. IN_PROC_BROWSER_TEST_F( BookmarkBarGtkInteractiveUITest, DISABLED_ClickOnFloatingTest) { - ASSERT_TRUE(test_server()->Start()); + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); GtkWidget* other_bookmarks = ViewIDUtil::GetWidget(GTK_WIDGET(browser()->window()->GetNativeWindow()), diff --git a/chrome/browser/ui/pdf/pdf_browsertest.cc b/chrome/browser/ui/pdf/pdf_browsertest.cc index 1917021..e7b0c14 100644 --- a/chrome/browser/ui/pdf/pdf_browsertest.cc +++ b/chrome/browser/ui/pdf/pdf_browsertest.cc @@ -21,7 +21,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/spawned_test_server/spawned_test_server.h" +#include "net/test/embedded_test_server/embedded_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,16 +44,19 @@ class PDFBrowserTest : public InProcessBrowserTest, PDFBrowserTest() : snapshot_different_(true), next_dummy_search_value_(0), - load_stop_notification_count_(0) { - pdf_test_server_.reset(new net::SpawnedTestServer( - net::SpawnedTestServer::TYPE_HTTP, - net::SpawnedTestServer::kLocalhost, - base::FilePath(FILE_PATH_LITERAL("pdf/test")))); + load_stop_notification_count_(0), + pdf_test_server_( + content::BrowserThread::GetMessageLoopProxyForThread( + content::BrowserThread::IO)) { + pdf_test_server_.ServeFilesFromDirectory( + base::FilePath(FILE_PATH_LITERAL("pdf/test"))); } protected: // Use our own TestServer so that we can serve files from the pdf directory. - net::SpawnedTestServer* pdf_test_server() { return pdf_test_server_.get(); } + net::test_server::EmbeddedTestServer* pdf_test_server() { + return &pdf_test_server_; + } int load_stop_notification_count() const { return load_stop_notification_count_; @@ -207,7 +210,7 @@ class PDFBrowserTest : public InProcessBrowserTest, // How many times we've seen chrome::LOAD_STOP. int load_stop_notification_count_; - scoped_ptr<net::SpawnedTestServer> pdf_test_server_; + net::test_server::EmbeddedTestServer pdf_test_server_; }; #if defined(OS_CHROMEOS) @@ -303,7 +306,7 @@ const int kLoadingNumberOfParts = 10; // regressions. // If it flakes, reopen http://crbug.com/74548. IN_PROC_BROWSER_TEST_P(PDFBrowserTest, Loading) { - ASSERT_TRUE(pdf_test_server()->Start()); + ASSERT_TRUE(pdf_test_server()->InitializeAndWaitUntilReady()); NavigationController* controller = &(browser()->tab_strip_model()->GetActiveWebContents()->GetController()); @@ -311,7 +314,7 @@ IN_PROC_BROWSER_TEST_P(PDFBrowserTest, Loading) { registrar.Add(this, content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>(controller)); - std::string base_url = std::string("files/"); + std::string base_url = std::string("/"); base::FileEnumerator file_enumerator( ui_test_utils::GetTestFilePath(GetPDFTestDir(), base::FilePath()), @@ -396,9 +399,9 @@ IN_PROC_BROWSER_TEST_F(PDFBrowserTest, Action) { // Flaky as per http://crbug.com/74549. IN_PROC_BROWSER_TEST_F(PDFBrowserTest, DISABLED_OnLoadAndReload) { - ASSERT_TRUE(pdf_test_server()->Start()); + ASSERT_TRUE(pdf_test_server()->InitializeAndWaitUntilReady()); - GURL url = pdf_test_server()->GetURL("files/onload_reload.html"); + GURL url = pdf_test_server()->GetURL("/onload_reload.html"); ui_test_utils::NavigateToURL(browser(), url); content::WindowedNotificationObserver observer( diff --git a/chrome/test/base/in_process_browser_test.cc b/chrome/test/base/in_process_browser_test.cc index eef8f84..07987ff 100644 --- a/chrome/test/base/in_process_browser_test.cc +++ b/chrome/test/base/in_process_browser_test.cc @@ -49,6 +49,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/embedded_test_server/embedded_test_server.h" #include "net/test/spawned_test_server/spawned_test_server.h" #include "ui/compositor/compositor_switches.h" @@ -135,6 +136,10 @@ InProcessBrowserTest::InProcessBrowserTest() CHECK(PathService::Override(base::FILE_EXE, chrome_path)); #endif // defined(OS_MACOSX) CreateTestServer(base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); + base::FilePath src_dir; + CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &src_dir)); + embedded_test_server()->ServeFilesFromDirectory( + src_dir.AppendASCII("chrome/test/data")); } InProcessBrowserTest::~InProcessBrowserTest() { diff --git a/chrome/test/data/extensions/api_test/app_background_page/basic/test.js b/chrome/test/data/extensions/api_test/app_background_page/basic/test.js index 5e3e502dc..9bba55e 100644 --- a/chrome/test/data/extensions/api_test/app_background_page/basic/test.js +++ b/chrome/test/data/extensions/api_test/app_background_page/basic/test.js @@ -16,7 +16,7 @@ var pageB; var backgroundPageResponded = false; var pagePrefix = - 'http://a.com:PORT/files/extensions/api_test/app_background_page/common'; + 'http://a.com:PORT/extensions/api_test/app_background_page/common'; // Dispatch "tunneled" functions from the live web pages to this testing page. chrome.extension.onRequest.addListener(function(request) { diff --git a/chrome/test/data/extensions/api_test/app_background_page/basic_close/test.js b/chrome/test/data/extensions/api_test/app_background_page/basic_close/test.js index 2690d42..dd1845c 100644 --- a/chrome/test/data/extensions/api_test/app_background_page/basic_close/test.js +++ b/chrome/test/data/extensions/api_test/app_background_page/basic_close/test.js @@ -5,7 +5,7 @@ // This test closes the existing background page opened by a.html. var pagePrefix = - 'http://a.com:PORT/files/extensions/api_test/app_background_page/common'; + 'http://a.com:PORT/extensions/api_test/app_background_page/common'; // Dispatch "tunneled" functions from the live web pages to this testing page. chrome.extension.onRequest.addListener(function(request) { diff --git a/chrome/test/data/extensions/api_test/app_background_page/basic_open/test.js b/chrome/test/data/extensions/api_test/app_background_page/basic_open/test.js index 25363fd..44b5ce5 100644 --- a/chrome/test/data/extensions/api_test/app_background_page/basic_open/test.js +++ b/chrome/test/data/extensions/api_test/app_background_page/basic_open/test.js @@ -5,7 +5,7 @@ // This test opens a single background page opened by a.html. var pagePrefix = - 'http://a.com:PORT/files/extensions/api_test/app_background_page/common'; + 'http://a.com:PORT/extensions/api_test/app_background_page/common'; // Dispatch "tunneled" functions from the live web pages to this testing page. chrome.extension.onRequest.addListener(function(request) { diff --git a/chrome/test/data/extensions/api_test/app_background_page/lacks_permission/test.js b/chrome/test/data/extensions/api_test/app_background_page/lacks_permission/test.js index ed1a4b6..99dd8a5 100644 --- a/chrome/test/data/extensions/api_test/app_background_page/lacks_permission/test.js +++ b/chrome/test/data/extensions/api_test/app_background_page/lacks_permission/test.js @@ -6,7 +6,7 @@ // that a visible window was created that contains the bg.html page. var pagePrefix = - 'http://a.com:PORT/files/extensions/api_test/app_background_page/common'; + 'http://a.com:PORT/extensions/api_test/app_background_page/common'; // Dispatch "tunneled" functions from the live web pages to this testing page. chrome.extension.onRequest.addListener(function(request) { diff --git a/chrome/test/data/extensions/api_test/app_background_page/no_js/test.js b/chrome/test/data/extensions/api_test/app_background_page/no_js/test.js index ffb91be..4a2a59d 100644 --- a/chrome/test/data/extensions/api_test/app_background_page/no_js/test.js +++ b/chrome/test/data/extensions/api_test/app_background_page/no_js/test.js @@ -11,7 +11,7 @@ // existing background page being closed and a new one being re-opened. var pagePrefix = - 'http://a.com:PORT/files/extensions/api_test/app_background_page/no_js'; + 'http://a.com:PORT/extensions/api_test/app_background_page/no_js'; var launchUrl; var launchTabId; var backgroundPageLoaded = false; diff --git a/chrome/test/data/extensions/api_test/app_background_page/no_js_manifest/test.js b/chrome/test/data/extensions/api_test/app_background_page/no_js_manifest/test.js index ef9332b..36a3420 100644 --- a/chrome/test/data/extensions/api_test/app_background_page/no_js_manifest/test.js +++ b/chrome/test/data/extensions/api_test/app_background_page/no_js_manifest/test.js @@ -9,7 +9,7 @@ // background page. This fails because allow_js_access is false. var pagePrefix = - 'http://a.com:PORT/files/extensions/api_test/app_background_page/common'; + 'http://a.com:PORT/extensions/api_test/app_background_page/common'; // Dispatch "tunneled" functions from the live web pages to this testing page. chrome.extension.onRequest.addListener(function(request) { diff --git a/chrome/test/data/extensions/api_test/app_background_page/two_pages/test.js b/chrome/test/data/extensions/api_test/app_background_page/two_pages/test.js index d6a468d..7c4d8017 100644 --- a/chrome/test/data/extensions/api_test/app_background_page/two_pages/test.js +++ b/chrome/test/data/extensions/api_test/app_background_page/two_pages/test.js @@ -17,7 +17,7 @@ var pageC; var step = 0; var pagePrefix = - 'http://a.com:PORT/files/extensions/api_test/app_background_page/common'; + 'http://a.com:PORT/extensions/api_test/app_background_page/common'; // Dispatch "tunneled" functions from the live web pages to this testing page. chrome.extension.onRequest.addListener(function(request) { diff --git a/chrome/test/data/extensions/api_test/app_background_page/two_with_manifest/test.js b/chrome/test/data/extensions/api_test/app_background_page/two_with_manifest/test.js index 5759681..2b8e87b 100644 --- a/chrome/test/data/extensions/api_test/app_background_page/two_with_manifest/test.js +++ b/chrome/test/data/extensions/api_test/app_background_page/two_with_manifest/test.js @@ -11,7 +11,7 @@ // loaded. var pagePrefix = - 'http://a.com:PORT/files/extensions/api_test/app_background_page/common'; + 'http://a.com:PORT/extensions/api_test/app_background_page/common'; // Dispatch "tunneled" functions from the live web pages to this testing page. chrome.extension.onRequest.addListener(function(request) { diff --git a/chrome/test/data/extensions/api_test/app_launcher/client_redirect.js b/chrome/test/data/extensions/api_test/app_launcher/client_redirect.js index f5fa3c6..a04f484 100644 --- a/chrome/test/data/extensions/api_test/app_launcher/client_redirect.js +++ b/chrome/test/data/extensions/api_test/app_launcher/client_redirect.js @@ -3,10 +3,8 @@ // found in the LICENSE file. chrome.test.getConfig(function(config) { - var appUrl = 'http://localhost:' + config.testServer.port + - '/files/extensions/api_test/app_process/path1/empty.html'; var redirectUrl = 'http://localhost:' + config.testServer.port + - '/client-redirect?' + appUrl; + '/extensions/api_test/app_process/path1/client_redirect.html'; chrome.tabs.create({ url: redirectUrl }); diff --git a/chrome/test/data/extensions/api_test/app_launcher/server_redirect.js b/chrome/test/data/extensions/api_test/app_launcher/server_redirect.js index 99e3a44..ba0e877 100644 --- a/chrome/test/data/extensions/api_test/app_launcher/server_redirect.js +++ b/chrome/test/data/extensions/api_test/app_launcher/server_redirect.js @@ -4,7 +4,7 @@ chrome.test.getConfig(function(config) { var appUrl = 'http://localhost:' + config.testServer.port + - '/files/extensions/api_test/app_process/path1/empty.html'; + '/extensions/api_test/app_process/path1/empty.html'; var redirectUrl = 'http://localhost:' + config.testServer.port + '/server-redirect?' + appUrl; chrome.tabs.create({ diff --git a/chrome/test/data/extensions/api_test/app_process/manifest.json b/chrome/test/data/extensions/api_test/app_process/manifest.json index b97c29b..a67e8c0 100644 --- a/chrome/test/data/extensions/api_test/app_process/manifest.json +++ b/chrome/test/data/extensions/api_test/app_process/manifest.json @@ -5,14 +5,14 @@ "description": "Tests that app URLs with the background permission are grouped into the same process.", "app": { "urls": [ - "http://localhost/files/extensions/api_test/app_process/path1", - "http://localhost/files/extensions/api_test/app_process/path2" + "http://localhost/extensions/api_test/app_process/path1", + "http://localhost/extensions/api_test/app_process/path2" ], "browse_urls": [ - "http://localhost/files/extensions/api_test/app_process/path4" + "http://localhost/extensions/api_test/app_process/path4" ], "launch": { - "web_url": "http://localhost/files/extensions/api_test/app_process/path1/foo.html" + "web_url": "http://localhost/extensions/api_test/app_process/path1/foo.html" } }, "permissions": [ diff --git a/chrome/test/data/extensions/api_test/app_process/path1/client_redirect.html b/chrome/test/data/extensions/api_test/app_process/path1/client_redirect.html new file mode 100644 index 0000000..c30c49a --- /dev/null +++ b/chrome/test/data/extensions/api_test/app_process/path1/client_redirect.html @@ -0,0 +1,8 @@ +<html> +<head> +<meta http-equiv="refresh" +content="0;/extensions/api_test/app_process/path1/empty.html"> +</head> +<body> +</body> +</html> diff --git a/chrome/test/data/extensions/api_test/app_process/path1/container.html b/chrome/test/data/extensions/api_test/app_process/path1/container.html index 05c32c1..4d6640b 100644 --- a/chrome/test/data/extensions/api_test/app_process/path1/container.html +++ b/chrome/test/data/extensions/api_test/app_process/path1/container.html @@ -1,2 +1,2 @@ <!-- Iframe to a normal web page, outside app manifest. --> -<iframe src="/files/extensions/api_test/app_process/path3/iframe.html"></iframe> +<iframe src="/extensions/api_test/app_process/path3/iframe.html"></iframe> diff --git a/chrome/test/data/extensions/api_test/app_process/path1/iframe.html b/chrome/test/data/extensions/api_test/app_process/path1/iframe.html index cfbc232..636f29c 100644 --- a/chrome/test/data/extensions/api_test/app_process/path1/iframe.html +++ b/chrome/test/data/extensions/api_test/app_process/path1/iframe.html @@ -1,6 +1,6 @@ <script> window.open( - '/files/extensions/api_test/app_process/path1/empty.html', + '/extensions/api_test/app_process/path1/empty.html', '', // Small enough that a popup will be created even on Chrome OS 'width=200,height=200'); diff --git a/chrome/test/data/extensions/api_test/app_process/path1/redirect.html b/chrome/test/data/extensions/api_test/app_process/path1/redirect.html index 462dfc2..16ef6f5 100644 --- a/chrome/test/data/extensions/api_test/app_process/path1/redirect.html +++ b/chrome/test/data/extensions/api_test/app_process/path1/redirect.html @@ -1,2 +1,8 @@ +<html> +<head> <meta http-equiv="refresh" -content="1;/server-redirect?/files/extensions/api_test/app_process/path1/empty.html"> +content="1;/server-redirect?/extensions/api_test/app_process/path1/empty.html"> +</head> +<body> +</body> +</html> diff --git a/chrome/test/data/extensions/api_test/app_process/path3/container.html b/chrome/test/data/extensions/api_test/app_process/path3/container.html index 4eb0967..e30be72 100644 --- a/chrome/test/data/extensions/api_test/app_process/path3/container.html +++ b/chrome/test/data/extensions/api_test/app_process/path3/container.html @@ -1 +1 @@ -<iframe src="/files/extensions/api_test/app_process/path1/iframe.html"></iframe> +<iframe src="/extensions/api_test/app_process/path1/iframe.html"></iframe> diff --git a/chrome/test/data/extensions/api_test/app_process/path3/iframe.html b/chrome/test/data/extensions/api_test/app_process/path3/iframe.html index e152dab..6a29b41 100644 --- a/chrome/test/data/extensions/api_test/app_process/path3/iframe.html +++ b/chrome/test/data/extensions/api_test/app_process/path3/iframe.html @@ -1,7 +1,7 @@ <script> // Open popup to another normal web page, same-origin and non-app. window.open( - '/files/extensions/api_test/app_process/path3/empty.html', + '/extensions/api_test/app_process/path3/empty.html', '', // Small enough that a popup will be created even on Chrome OS 'width=200,height=200'); diff --git a/chrome/test/data/extensions/api_test/app_process/test.html b/chrome/test/data/extensions/api_test/app_process/test.html index 8aa5812..154e6d1 100644 --- a/chrome/test/data/extensions/api_test/app_process/test.html +++ b/chrome/test/data/extensions/api_test/app_process/test.html @@ -3,7 +3,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -var origin = "http://localhost:1337/files/extensions/api_test/app_process/"; +var origin = "http://localhost:1337/extensions/api_test/app_process/"; var url1 = origin + "path1/empty.html"; var url2 = origin + "path2/empty.html"; var url3 = origin + "path3/empty.html"; diff --git a/chrome/test/data/extensions/api_test/app_process_background_instances/manifest.json b/chrome/test/data/extensions/api_test/app_process_background_instances/manifest.json index 9ee5d40..81f05b8 100644 --- a/chrome/test/data/extensions/api_test/app_process_background_instances/manifest.json +++ b/chrome/test/data/extensions/api_test/app_process_background_instances/manifest.json @@ -5,18 +5,18 @@ "description": "Tests that apps with no background JS are not consolidated.", "app": { "urls": [ - "http://localhost/files/extensions/api_test/app_process_background_instances/path1", - "http://localhost/files/extensions/api_test/app_process_background_instances/path2" + "http://localhost/extensions/api_test/app_process_background_instances/path1", + "http://localhost/extensions/api_test/app_process_background_instances/path2" ], "launch": { - "web_url": "http://localhost/files/extensions/api_test/app_process_background_instances/path1/empty.html" + "web_url": "http://localhost/extensions/api_test/app_process_background_instances/path1/empty.html" } }, "permissions": [ "background" ], "background": { - "page": "http://localhost/files/extensions/api_test/app_process_background_instances/path1/empty.html", + "page": "http://localhost/extensions/api_test/app_process_background_instances/path1/empty.html", "allow_js_access": false } } diff --git a/chrome/test/data/extensions/api_test/app_process_instances/manifest.json b/chrome/test/data/extensions/api_test/app_process_instances/manifest.json index 7dfe9ef..d14ea83 100644 --- a/chrome/test/data/extensions/api_test/app_process_instances/manifest.json +++ b/chrome/test/data/extensions/api_test/app_process_instances/manifest.json @@ -5,11 +5,11 @@ "description": "Tests that app URLs without the background permission are not consolidated.", "app": { "urls": [ - "http://localhost/files/extensions/api_test/app_process_instances/path1", - "http://localhost/files/extensions/api_test/app_process_instances/path2" + "http://localhost/extensions/api_test/app_process_instances/path1", + "http://localhost/extensions/api_test/app_process_instances/path2" ], "launch": { - "web_url": "http://localhost/files/extensions/api_test/app_process_instances/path1/empty.html" + "web_url": "http://localhost/extensions/api_test/app_process_instances/path1/empty.html" } } } diff --git a/chrome/test/data/extensions/api_test/clipboard/hosted_app/manifest.json b/chrome/test/data/extensions/api_test/clipboard/hosted_app/manifest.json index d9f060d..02eaa1c 100644 --- a/chrome/test/data/extensions/api_test/clipboard/hosted_app/manifest.json +++ b/chrome/test/data/extensions/api_test/clipboard/hosted_app/manifest.json @@ -5,10 +5,10 @@ "description": "end-to-end browser test for clipboard permissions in hosted apps", "app": { "urls": [ - "http://localhost/files/extensions/api_test/clipboard/hosted_app" + "http://localhost/extensions/api_test/clipboard/hosted_app" ], "launch": { - "web_url": "http://localhost/files/extensions/api_test/clipboard/hosted_app/main.html" + "web_url": "http://localhost/extensions/api_test/clipboard/hosted_app/main.html" } }, "permissions": ["clipboardRead", "clipboardWrite"] diff --git a/chrome/test/data/extensions/api_test/clipboard/hosted_app_no_permission/manifest.json b/chrome/test/data/extensions/api_test/clipboard/hosted_app_no_permission/manifest.json index f0e669c..57205ed 100644 --- a/chrome/test/data/extensions/api_test/clipboard/hosted_app_no_permission/manifest.json +++ b/chrome/test/data/extensions/api_test/clipboard/hosted_app_no_permission/manifest.json @@ -5,10 +5,10 @@ "description": "end-to-end browser test for clipboard permissions in hosted apps", "app": { "urls": [ - "http://localhost/files/extensions/api_test/clipboard/hosted_app_no_permission" + "http://localhost/extensions/api_test/clipboard/hosted_app_no_permission" ], "launch": { - "web_url": "http://localhost/files/extensions/api_test/clipboard/hosted_app_no_permission/main.html" + "web_url": "http://localhost/extensions/api_test/clipboard/hosted_app_no_permission/main.html" } } } diff --git a/chrome/test/data/extensions/api_test/content_scripts/about_blank_iframes/test.js b/chrome/test/data/extensions/api_test/content_scripts/about_blank_iframes/test.js index af5d329..b2760dd 100644 --- a/chrome/test/data/extensions/api_test/content_scripts/about_blank_iframes/test.js +++ b/chrome/test/data/extensions/api_test/content_scripts/about_blank_iframes/test.js @@ -15,7 +15,7 @@ chrome.test.getConfig(function(config) { ); chrome.test.log("Creating tab..."); var test_url = - ("http://localhost:PORT/files/extensions/" + + ("http://localhost:PORT/extensions/" + "test_file_with_about_blank_iframe.html") .replace(/PORT/, config.testServer.port); chrome.tabs.create({ url: test_url }); diff --git a/chrome/test/data/extensions/api_test/content_scripts/all_frames/test.js b/chrome/test/data/extensions/api_test/content_scripts/all_frames/test.js index 98c4ede..9197d7c 100644 --- a/chrome/test/data/extensions/api_test/content_scripts/all_frames/test.js +++ b/chrome/test/data/extensions/api_test/content_scripts/all_frames/test.js @@ -34,7 +34,7 @@ chrome.test.getConfig(function(config) { chrome.test.log("Creating tab..."); var test_url = - "http://localhost:PORT/files/extensions/test_file_with_iframe.html" + "http://localhost:PORT/extensions/test_file_with_iframe.html" .replace(/PORT/, config.testServer.port); chrome.tabs.create({ url: test_url }); diff --git a/chrome/test/data/extensions/api_test/content_scripts/bypass_page_csp/background.js b/chrome/test/data/extensions/api_test/content_scripts/bypass_page_csp/background.js index c7837e6..50a5162 100644 --- a/chrome/test/data/extensions/api_test/content_scripts/bypass_page_csp/background.js +++ b/chrome/test/data/extensions/api_test/content_scripts/bypass_page_csp/background.js @@ -17,7 +17,7 @@ chrome.test.getConfig(function(config) { chrome.test.log("Creating tab..."); var test_url = - "http://localhost:PORT/files/extensions/test_file_with_csp.html" + "http://localhost:PORT/extensions/test_file_with_csp.html" .replace(/PORT/, config.testServer.port); chrome.tabs.create({ url: test_url }); diff --git a/chrome/test/data/extensions/api_test/content_scripts/css_l10n/background.js b/chrome/test/data/extensions/api_test/content_scripts/css_l10n/background.js index c123237..cf4a4f4 100644 --- a/chrome/test/data/extensions/api_test/content_scripts/css_l10n/background.js +++ b/chrome/test/data/extensions/api_test/content_scripts/css_l10n/background.js @@ -7,7 +7,7 @@ var firstEnter = true; chrome.test.getConfig(function(config) { chrome.test.log('Creating tab...'); - var URL = 'http://localhost:PORT/files/extensions/test_file_with_body.html'; + var URL = 'http://localhost:PORT/extensions/test_file_with_body.html'; var TEST_FILE_URL = URL.replace(/PORT/, config.testServer.port); chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { diff --git a/chrome/test/data/extensions/api_test/content_scripts/dont_match_host_permissions/background.js b/chrome/test/data/extensions/api_test/content_scripts/dont_match_host_permissions/background.js index ba4a69d1..9817587 100644 --- a/chrome/test/data/extensions/api_test/content_scripts/dont_match_host_permissions/background.js +++ b/chrome/test/data/extensions/api_test/content_scripts/dont_match_host_permissions/background.js @@ -24,8 +24,8 @@ chrome.extension.onRequest.addListener(function(request, sender, sendResponse) { chrome.test.getConfig(function(config) { chrome.tabs.create({ url: 'http://a.com:' + config.testServer.port + - '/files/extensions/test_file.html'}); + '/extensions/test_file.html'}); chrome.tabs.create({ url: 'http://b.com:' + config.testServer.port + - '/files/extensions/test_file.html'}); + '/extensions/test_file.html'}); }); diff --git a/chrome/test/data/extensions/api_test/content_scripts/extension_api/events.html b/chrome/test/data/extensions/api_test/content_scripts/extension_api/events.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/chrome/test/data/extensions/api_test/content_scripts/extension_api/events.html diff --git a/chrome/test/data/extensions/api_test/content_scripts/extension_api/functions.html b/chrome/test/data/extensions/api_test/content_scripts/extension_api/functions.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/chrome/test/data/extensions/api_test/content_scripts/extension_api/functions.html diff --git a/chrome/test/data/extensions/api_test/content_scripts/extension_api/manifest.json b/chrome/test/data/extensions/api_test/content_scripts/extension_api/manifest.json index ffa1c4a..99d1e5d 100644 --- a/chrome/test/data/extensions/api_test/content_scripts/extension_api/manifest.json +++ b/chrome/test/data/extensions/api_test/content_scripts/extension_api/manifest.json @@ -5,11 +5,11 @@ "permissions": ["storage"], "content_scripts": [ { - "matches": ["*://*/functions.html"], + "matches": ["*://*/*/functions.html"], "js": ["functions.js"] }, { - "matches": ["*://*/events.html"], + "matches": ["*://*/*/events.html"], "js": ["events.js"] } ] diff --git a/chrome/test/data/extensions/api_test/content_scripts/extension_iframe/test.js b/chrome/test/data/extensions/api_test/content_scripts/extension_iframe/test.js index 70787a9..72f7cb0 100644 --- a/chrome/test/data/extensions/api_test/content_scripts/extension_iframe/test.js +++ b/chrome/test/data/extensions/api_test/content_scripts/extension_iframe/test.js @@ -17,7 +17,7 @@ chrome.test.runTests([ chrome.test.getConfig(function(config) { chrome.test.log("Creating tab..."); - var test_url = "http://localhost:PORT/files/extensions/test_file.html" + var test_url = "http://localhost:PORT/extensions/test_file.html" .replace(/PORT/, config.testServer.port); chrome.tabs.create({ url: test_url }); diff --git a/chrome/test/data/extensions/api_test/content_scripts/extension_process/background.js b/chrome/test/data/extensions/api_test/content_scripts/extension_process/background.js index ee7d3c0..d9c65c2 100644 --- a/chrome/test/data/extensions/api_test/content_scripts/extension_process/background.js +++ b/chrome/test/data/extensions/api_test/content_scripts/extension_process/background.js @@ -12,7 +12,7 @@ chrome.extension.onRequest.addListener(function(data) { }); chrome.test.getConfig(function(config) { - var test_file_url = "http://localhost:PORT/files/extensions/test_file.html" + var test_file_url = "http://localhost:PORT/extensions/test_file.html" .replace(/PORT/, config.testServer.port); // Add a window. diff --git a/chrome/test/data/extensions/api_test/content_scripts/fragment/background.js b/chrome/test/data/extensions/api_test/content_scripts/fragment/background.js index cf09eac..dfa2584 100644 --- a/chrome/test/data/extensions/api_test/content_scripts/fragment/background.js +++ b/chrome/test/data/extensions/api_test/content_scripts/fragment/background.js @@ -19,7 +19,7 @@ function fail() { } } -var test_url = "http://localhost:PORT/files/extensions/test_file.html"; +var test_url = "http://localhost:PORT/extensions/test_file.html"; // For running in normal chrome (ie outside of the browser_tests environment), // set debug to 1 here. diff --git a/chrome/test/data/extensions/api_test/content_scripts/isolated_world1/background.js b/chrome/test/data/extensions/api_test/content_scripts/isolated_world1/background.js index c8293c8..71fe96c 100644 --- a/chrome/test/data/extensions/api_test/content_scripts/isolated_world1/background.js +++ b/chrome/test/data/extensions/api_test/content_scripts/isolated_world1/background.js @@ -22,7 +22,7 @@ chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { chrome.test.getConfig(function(config) { chrome.test.log("Creating tab..."); chrome.tabs.create({ - url: "http://localhost:PORT/files/extensions/test_file.html" + url: "http://localhost:PORT/extensions/test_file.html" .replace(/PORT/, config.testServer.port) }); }); diff --git a/chrome/test/data/extensions/api_test/content_scripts/other_extensions/injector/test.js b/chrome/test/data/extensions/api_test/content_scripts/other_extensions/injector/test.js index e9e3bd4..89e3c7c 100644 --- a/chrome/test/data/extensions/api_test/content_scripts/other_extensions/injector/test.js +++ b/chrome/test/data/extensions/api_test/content_scripts/other_extensions/injector/test.js @@ -18,7 +18,7 @@ chrome.test.runTests([ chrome.test.getConfig(function(config) { chrome.test.log("Creating tab..."); - var test_url = ("http://a.com:PORT/files/extensions/api_test" + + var test_url = ("http://a.com:PORT/extensions/api_test" + "/content_scripts/other_extensions/iframe_content.html#" + escape(chrome.extension.getURL("test.html"))) .replace(/PORT/, config.testServer.port); diff --git a/chrome/test/data/extensions/api_test/content_scripts/other_extensions/victim/test.js b/chrome/test/data/extensions/api_test/content_scripts/other_extensions/victim/test.js index c3b8e30..35afcd4 100644 --- a/chrome/test/data/extensions/api_test/content_scripts/other_extensions/victim/test.js +++ b/chrome/test/data/extensions/api_test/content_scripts/other_extensions/victim/test.js @@ -18,7 +18,7 @@ chrome.test.runTests([ chrome.test.getConfig(function(config) { chrome.test.log("Creating tab..."); - var test_url = ("http://a.com:PORT/files/extensions/api_test" + + var test_url = ("http://a.com:PORT/extensions/api_test" + "/content_scripts/other_extensions/iframe_content.html#" + escape(chrome.extension.getURL("test.html"))) .replace(/PORT/, config.testServer.port); diff --git a/chrome/test/data/extensions/api_test/content_scripts/permissions/background.js b/chrome/test/data/extensions/api_test/content_scripts/permissions/background.js index 20172ab..fdd1278 100644 --- a/chrome/test/data/extensions/api_test/content_scripts/permissions/background.js +++ b/chrome/test/data/extensions/api_test/content_scripts/permissions/background.js @@ -13,7 +13,7 @@ var port; function testUrl(domain) { return 'http://' + domain + ':' + port + - '/files/extensions/test_file.html'; + '/extensions/test_file.html'; } function error(domain) { diff --git a/chrome/test/data/extensions/api_test/content_scripts/view_source/background.js b/chrome/test/data/extensions/api_test/content_scripts/view_source/background.js index 767f4c2..b1c2f94 100644 --- a/chrome/test/data/extensions/api_test/content_scripts/view_source/background.js +++ b/chrome/test/data/extensions/api_test/content_scripts/view_source/background.js @@ -23,7 +23,7 @@ chrome.test.runTests([ chrome.test.getConfig(function(config) { chrome.tabs.create({ url: 'view-source:http://localhost:' + config.testServer.port + - '/files/extensions/test_file.html'}); + '/extensions/test_file.html'}); }); } ]); diff --git a/chrome/test/data/extensions/api_test/cross_origin_xhr/all_urls/test.js b/chrome/test/data/extensions/api_test/cross_origin_xhr/all_urls/test.js index e3c1b39..5301de7 100644 --- a/chrome/test/data/extensions/api_test/cross_origin_xhr/all_urls/test.js +++ b/chrome/test/data/extensions/api_test/cross_origin_xhr/all_urls/test.js @@ -14,7 +14,7 @@ chrome.test.getConfig(function(config) { } function doReq(domain, expectSuccess) { - var url = rewriteURL(domain + ':PORT/files/extensions/test_file.txt'); + var url = rewriteURL(domain + ':PORT/extensions/test_file.txt'); chrome.tabs.sendRequest(testTabId, url, pass(function(response) { if (expectSuccess) { @@ -28,7 +28,7 @@ chrome.test.getConfig(function(config) { } chrome.tabs.create({ - url: rewriteURL('http://localhost:PORT/files/extensions/test_file.html')}, + url: rewriteURL('http://localhost:PORT/extensions/test_file.html')}, function(tab) { testTabId = tab.id; }); diff --git a/chrome/test/data/extensions/api_test/cross_origin_xhr/background_page/test.js b/chrome/test/data/extensions/api_test/cross_origin_xhr/background_page/test.js index 77288c2..a3e92119 100644 --- a/chrome/test/data/extensions/api_test/cross_origin_xhr/background_page/test.js +++ b/chrome/test/data/extensions/api_test/cross_origin_xhr/background_page/test.js @@ -6,7 +6,7 @@ chrome.test.getConfig(function(config) { function doReq(domain, expectSuccess) { var req = new XMLHttpRequest(); - var url = domain + ":PORT/files/extensions/test_file.txt"; + var url = domain + ":PORT/extensions/test_file.txt"; url = url.replace(/PORT/, config.testServer.port); chrome.test.log("Requesting url: " + url); @@ -53,8 +53,9 @@ chrome.test.getConfig(function(config) { function disallowedSubdomain() { doReq("http://foob.com", false); }, - function disallowedSSL() { - doReq("https://a.com", false); - } + // TODO(asargent): Explicitly create SSL test server and enable the test. + // function disallowedSSL() { + // doReq("https://a.com", false); + // } ]); }); diff --git a/chrome/test/data/extensions/api_test/cross_origin_xhr/content_script/test.js b/chrome/test/data/extensions/api_test/cross_origin_xhr/content_script/test.js index b3f12ed..fa58936 100644 --- a/chrome/test/data/extensions/api_test/cross_origin_xhr/content_script/test.js +++ b/chrome/test/data/extensions/api_test/cross_origin_xhr/content_script/test.js @@ -12,7 +12,7 @@ chrome.test.getConfig(function(config) { } function doReq(domain, expectSuccess) { - var url = rewriteURL(domain + ':PORT/files/extensions/test_file.txt'); + var url = rewriteURL(domain + ':PORT/extensions/test_file.txt'); chrome.tabs.sendRequest(testTabId, url, function(response) { if (expectSuccess) { @@ -28,7 +28,7 @@ chrome.test.getConfig(function(config) { } chrome.tabs.create({ - url: rewriteURL('http://localhost:PORT/files/extensions/test_file.html')}, + url: rewriteURL('http://localhost:PORT/extensions/test_file.html')}, function(tab) { testTabId = tab.id; }); @@ -52,9 +52,10 @@ chrome.test.getConfig(function(config) { function disallowedSubdomain() { doReq('http://foob.com', false); }, - function disallowedSSL() { - doReq('https://a.com', false); - }, + // TODO(asargent): Explicitly create SSL test server and enable the test. + // function disallowedSSL() { + // doReq('https://a.com', false); + // }, function targetPageAlwaysAllowed() { // Even though localhost does not show up in the host permissions, we // can still make requests to it since it's the page that the content diff --git a/chrome/test/data/extensions/api_test/executescript/basic/test.js b/chrome/test/data/extensions/api_test/executescript/basic/test.js index 02a4700..39102ce 100644 --- a/chrome/test/data/extensions/api_test/executescript/basic/test.js +++ b/chrome/test/data/extensions/api_test/executescript/basic/test.js @@ -7,7 +7,7 @@ var fail = chrome.test.callbackFail; var assertEq = chrome.test.assertEq; var assertTrue = chrome.test.assertTrue; var relativePath = - '/files/extensions/api_test/executescript/basic/test_executescript.html'; + '/extensions/api_test/executescript/basic/test_executescript.html'; var testUrl = 'http://a.com:PORT' + relativePath; var testFailureUrl = 'http://b.com:PORT' + relativePath; var firstEnter = true; diff --git a/chrome/test/data/extensions/api_test/executescript/callback/test.js b/chrome/test/data/extensions/api_test/executescript/callback/test.js index bbe3e07..42a64ef 100644 --- a/chrome/test/data/extensions/api_test/executescript/callback/test.js +++ b/chrome/test/data/extensions/api_test/executescript/callback/test.js @@ -3,7 +3,7 @@ // found in the LICENSE file. var relativePath = - '/files/extensions/api_test/executescript/callback/test.html'; + '/extensions/api_test/executescript/callback/test.html'; var testUrl = 'http://b.com:PORT' + relativePath; chrome.test.getConfig(function(config) { diff --git a/chrome/test/data/extensions/api_test/executescript/file_after_close/test.js b/chrome/test/data/extensions/api_test/executescript/file_after_close/test.js index eccc419..9e9b861 100644 --- a/chrome/test/data/extensions/api_test/executescript/file_after_close/test.js +++ b/chrome/test/data/extensions/api_test/executescript/file_after_close/test.js @@ -3,7 +3,7 @@ // found in the LICENSE file. var server = 'http://b.com:PORT'; -var relativePath = '/files/extensions/api_test/executescript/file_after_close/'; +var relativePath = '/extensions/api_test/executescript/file_after_close/'; var extensionPage = chrome.extension.getURL('extension_page.html'); var webPage1 = server + relativePath + 'web_page1.html'; var webPage2 = server + relativePath + 'web_page2.html'; diff --git a/chrome/test/data/extensions/api_test/executescript/fragment/background.js b/chrome/test/data/extensions/api_test/executescript/fragment/background.js index 6a3de2c..de101fb0 100644 --- a/chrome/test/data/extensions/api_test/executescript/fragment/background.js +++ b/chrome/test/data/extensions/api_test/executescript/fragment/background.js @@ -4,7 +4,7 @@ var got_request = false; -var test_url = "http://localhost:PORT/files/extensions/test_file.html"; +var test_url = "http://localhost:PORT/extensions/test_file.html"; // For running in normal chrome (ie outside of the browser_tests environment), // set debug to 1 here. diff --git a/chrome/test/data/extensions/api_test/executescript/frame_after_load/test.js b/chrome/test/data/extensions/api_test/executescript/frame_after_load/test.js index b120b41..c2aa092 100644 --- a/chrome/test/data/extensions/api_test/executescript/frame_after_load/test.js +++ b/chrome/test/data/extensions/api_test/executescript/frame_after_load/test.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -var baseUrl = 'http://a.com:PORT/files/extensions/api_test/executescript/' + +var baseUrl = 'http://a.com:PORT/extensions/api_test/executescript/' + 'frame_after_load/'; chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { diff --git a/chrome/test/data/extensions/api_test/executescript/in_frame/test.js b/chrome/test/data/extensions/api_test/executescript/in_frame/test.js index d8111c2..1c3ca0b 100644 --- a/chrome/test/data/extensions/api_test/executescript/in_frame/test.js +++ b/chrome/test/data/extensions/api_test/executescript/in_frame/test.js @@ -7,7 +7,7 @@ var fail = chrome.test.callbackFail; var assertEq = chrome.test.assertEq; var assertTrue = chrome.test.assertTrue; var relativePath = - '/files/extensions/api_test/executescript/in_frame/test_executescript.html'; + '/extensions/api_test/executescript/in_frame/test_executescript.html'; var testUrl = 'http://a.com:PORT' + relativePath; chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { diff --git a/chrome/test/data/extensions/api_test/executescript/navigation_race/test.js b/chrome/test/data/extensions/api_test/executescript/navigation_race/test.js index 40c28af..4db0c2d 100644 --- a/chrome/test/data/extensions/api_test/executescript/navigation_race/test.js +++ b/chrome/test/data/extensions/api_test/executescript/navigation_race/test.js @@ -3,7 +3,7 @@ // found in the LICENSE file. chrome.test.getConfig(function(config) { - var path = "/files/extensions/test_file.txt"; + var path = "/extensions/test_file.txt"; var urlA = "http://a.com:" + config.testServer.port + path; var urlB = "http://b.com:" + config.testServer.port + path; var testTabId; diff --git a/chrome/test/data/extensions/api_test/executescript/permissions/frames.js b/chrome/test/data/extensions/api_test/executescript/permissions/frames.js index baf71dc..dbed48f 100644 --- a/chrome/test/data/extensions/api_test/executescript/permissions/frames.js +++ b/chrome/test/data/extensions/api_test/executescript/permissions/frames.js @@ -6,7 +6,7 @@ // DOM to load before adding iframes. This means one less callback to wait on. function addIFrame(host) { document.write(['<iframe src="http://', host, ':', location.port, - '/files/extensions/api_test/executescript', + '/extensions/api_test/executescript', '/permissions/empty.html"> </iframe>'].join('')); } addIFrame("a.com"); diff --git a/chrome/test/data/extensions/api_test/executescript/permissions/test.js b/chrome/test/data/extensions/api_test/executescript/permissions/test.js index 451bbcc..71ff649 100644 --- a/chrome/test/data/extensions/api_test/executescript/permissions/test.js +++ b/chrome/test/data/extensions/api_test/executescript/permissions/test.js @@ -5,7 +5,7 @@ var assertEq = chrome.test.assertEq; var assertTrue = chrome.test.assertTrue; var numReceivedRequests = 0; -var relativePath = 'files/extensions/api_test/executescript/permissions/'; +var relativePath = 'extensions/api_test/executescript/permissions/'; var testFile = relativePath + 'empty.html'; var testFileFrames = relativePath + 'frames.html'; var onTabLoaded; diff --git a/chrome/test/data/extensions/api_test/executescript/run_at/test.js b/chrome/test/data/extensions/api_test/executescript/run_at/test.js index eed5b29..79eedea 100644 --- a/chrome/test/data/extensions/api_test/executescript/run_at/test.js +++ b/chrome/test/data/extensions/api_test/executescript/run_at/test.js @@ -3,7 +3,7 @@ // found in the LICENSE file. var relativePath = - '/files/extensions/api_test/executescript/run_at/test.html'; + '/extensions/api_test/executescript/run_at/test.html'; var testUrl = 'http://b.com:PORT' + relativePath; chrome.test.getConfig(function(config) { diff --git a/chrome/test/data/extensions/api_test/history/common.js b/chrome/test/data/extensions/api_test/history/common.js index 1f89f46..cc1961c 100644 --- a/chrome/test/data/extensions/api_test/history/common.js +++ b/chrome/test/data/extensions/api_test/history/common.js @@ -12,9 +12,9 @@ var PICASA_URL = 'http://www.picasa.com/'; // PORT will be changed to the port of the test server. var A_RELATIVE_URL = - 'http://www.a.com:PORT/files/extensions/api_test/history/a.html'; + 'http://www.a.com:PORT/extensions/api_test/history/a.html'; var B_RELATIVE_URL = - 'http://www.b.com:PORT/files/extensions/api_test/history/b.html'; + 'http://www.b.com:PORT/extensions/api_test/history/b.html'; /** * A helper function to flip the setTimeout arguments and make the code diff --git a/chrome/test/data/extensions/api_test/i18n/test.js b/chrome/test/data/extensions/api_test/i18n/test.js index 35060ad..9ef2ad1 100644 --- a/chrome/test/data/extensions/api_test/i18n/test.js +++ b/chrome/test/data/extensions/api_test/i18n/test.js @@ -10,7 +10,7 @@ var callbackPass = chrome.test.callbackPass; chrome.test.getConfig(function(config) { - var TEST_FILE_URL = "http://localhost:PORT/files/extensions/test_file.html" + var TEST_FILE_URL = "http://localhost:PORT/extensions/test_file.html" .replace(/PORT/, config.testServer.port); chrome.test.runTests([ diff --git a/chrome/test/data/extensions/api_test/incognito/apis/background.js b/chrome/test/data/extensions/api_test/incognito/apis/background.js index 7300b41..640c2ef 100644 --- a/chrome/test/data/extensions/api_test/incognito/apis/background.js +++ b/chrome/test/data/extensions/api_test/incognito/apis/background.js @@ -83,7 +83,7 @@ chrome.test.getConfig(function(config) { function contentScriptTestIncognito() { assertTrue(!chrome.extension.inIncognitoContext); - var testUrl = "http://localhost:PORT/files/extensions/test_file.html" + var testUrl = "http://localhost:PORT/extensions/test_file.html" .replace(/PORT/, config.testServer.port); // Test that chrome.extension.inIncognitoTab is true for incognito tabs. diff --git a/chrome/test/data/extensions/api_test/incognito/split/background.js b/chrome/test/data/extensions/api_test/incognito/split/background.js index 40fabbd..8492c1e 100644 --- a/chrome/test/data/extensions/api_test/incognito/split/background.js +++ b/chrome/test/data/extensions/api_test/incognito/split/background.js @@ -88,7 +88,7 @@ chrome.test.getConfig(function(config) { // Tests content script injection to verify that the script can tell its // in incongnito. function contentScriptTestIncognito() { - var testUrl = "http://localhost:PORT/files/extensions/test_file.html" + var testUrl = "http://localhost:PORT/extensions/test_file.html" .replace(/PORT/, config.testServer.port); // Test that chrome.extension.inIncognitoContext is true for incognito diff --git a/chrome/test/data/extensions/api_test/messaging/connect/test.js b/chrome/test/data/extensions/api_test/messaging/connect/test.js index c79f489..54b1009 100644 --- a/chrome/test/data/extensions/api_test/messaging/connect/test.js +++ b/chrome/test/data/extensions/api_test/messaging/connect/test.js @@ -26,7 +26,7 @@ chrome.test.getConfig(function(config) { function setupTestTab() { chrome.test.log("Creating tab..."); chrome.tabs.create({ - url: "http://localhost:PORT/files/extensions/test_file.html" + url: "http://localhost:PORT/extensions/test_file.html" .replace(/PORT/, config.testServer.port) }, function(newTab) { chrome.tabs.onUpdated.addListener(function listener(_, info, tab) { diff --git a/chrome/test/data/extensions/api_test/page_capture/test.js b/chrome/test/data/extensions/api_test/page_capture/test.js index 205530a..e51a99a 100644 --- a/chrome/test/data/extensions/api_test/page_capture/test.js +++ b/chrome/test/data/extensions/api_test/page_capture/test.js @@ -9,7 +9,7 @@ const assertEq = chrome.test.assertEq; const assertTrue = chrome.test.assertTrue; var testUrl = 'http://www.a.com:PORT' + - '/files/extensions/api_test/page_capture/google.html'; + '/extensions/api_test/page_capture/google.html'; function waitForCurrentTabLoaded(callback) { chrome.tabs.getSelected(null, function(tab) { diff --git a/chrome/test/data/extensions/api_test/permissions/optional/background.js b/chrome/test/data/extensions/api_test/permissions/optional/background.js index 9be32d6..d9d5c42 100644 --- a/chrome/test/data/extensions/api_test/permissions/optional/background.js +++ b/chrome/test/data/extensions/api_test/permissions/optional/background.js @@ -59,7 +59,7 @@ chrome.test.getConfig(function(config) { function doReq(domain, callback) { var req = new XMLHttpRequest(); - var url = domain + ":PORT/files/extensions/test_file.txt"; + var url = domain + ":PORT/extensions/test_file.txt"; url = url.replace(/PORT/, config.testServer.port); chrome.test.log("Requesting url: " + url); diff --git a/chrome/test/data/extensions/api_test/permissions/optional_deny/background.js b/chrome/test/data/extensions/api_test/permissions/optional_deny/background.js index 50579d5..2483607 100644 --- a/chrome/test/data/extensions/api_test/permissions/optional_deny/background.js +++ b/chrome/test/data/extensions/api_test/permissions/optional_deny/background.js @@ -14,7 +14,7 @@ chrome.test.getConfig(function(config) { function doReq(domain, callback) { var req = new XMLHttpRequest(); - var url = domain + ":PORT/files/extensions/test_file.txt"; + var url = domain + ":PORT/extensions/test_file.txt"; url = url.replace(/PORT/, config.testServer.port); chrome.test.log("Requesting url: " + url); diff --git a/chrome/test/data/extensions/api_test/proxy/events/invalid_proxy.js b/chrome/test/data/extensions/api_test/proxy/events/invalid_proxy.js index 45edc58..3cb2e3a 100644 --- a/chrome/test/data/extensions/api_test/proxy/events/invalid_proxy.js +++ b/chrome/test/data/extensions/api_test/proxy/events/invalid_proxy.js @@ -25,7 +25,7 @@ function readConfigAndSetProxy(test_config) { // Construct the URL used for XHRs and set the proxy settings. empty_json_url = "http://127.0.0.1:" + test_config.testServer.port + - "/files/extensions/api_test/proxy/events/empty.json"; + "/extensions/api_test/proxy/events/empty.json"; // Set an invalid proxy and fire of a XHR. This should trigger proxy errors. // There may be any number of proxy errors, as systems like safe browsing diff --git a/chrome/test/data/extensions/api_test/tabs/capture_visible_tab/test_jpeg.js b/chrome/test/data/extensions/api_test/tabs/capture_visible_tab/test_jpeg.js index 21a2bf8..a5c627c 100644 --- a/chrome/test/data/extensions/api_test/tabs/capture_visible_tab/test_jpeg.js +++ b/chrome/test/data/extensions/api_test/tabs/capture_visible_tab/test_jpeg.js @@ -15,7 +15,7 @@ var kWindowRect = { 'height': 400 }; -var kTestDir = '/files/extensions/api_test/tabs/capture_visible_tab/common/'; +var kTestDir = '/extensions/api_test/tabs/capture_visible_tab/common/'; var kURLBaseA = 'http://a.com:PORT' + kTestDir; var kURLBaseB = 'http://b.com:PORT' + kTestDir; diff --git a/chrome/test/data/extensions/api_test/tabs/capture_visible_tab/test_png.js b/chrome/test/data/extensions/api_test/tabs/capture_visible_tab/test_png.js index 73d7dc4..193b3f6 100644 --- a/chrome/test/data/extensions/api_test/tabs/capture_visible_tab/test_png.js +++ b/chrome/test/data/extensions/api_test/tabs/capture_visible_tab/test_png.js @@ -15,7 +15,7 @@ var kWindowRect = { 'height': 400 }; -var kTestDir = '/files/extensions/api_test/tabs/capture_visible_tab/common/'; +var kTestDir = '/extensions/api_test/tabs/capture_visible_tab/common/'; var kURLBaseA = 'http://a.com:PORT' + kTestDir; var kURLBaseB = 'http://b.com:PORT' + kTestDir; diff --git a/chrome/test/data/extensions/api_test/tabs/connect/test.js b/chrome/test/data/extensions/api_test/tabs/connect/test.js index 34e4505..7c8ee4b 100644 --- a/chrome/test/data/extensions/api_test/tabs/connect/test.js +++ b/chrome/test/data/extensions/api_test/tabs/connect/test.js @@ -16,7 +16,7 @@ chrome.test.getConfig(function(config) { chrome.test.runTests([ function setupConnect() { // The web page that our content script will be injected into. - var relativePath = '/files/extensions/api_test/tabs/basics/relative.html'; + var relativePath = '/extensions/api_test/tabs/basics/relative.html'; var testUrl = ['http://localhost:PORT'.replace(/PORT/, config.testServer.port), relativePath].join(''); diff --git a/chrome/test/data/extensions/api_test/tabs/javascript_url_permissions/test.js b/chrome/test/data/extensions/api_test/tabs/javascript_url_permissions/test.js index 104dc2b..c752526 100644 --- a/chrome/test/data/extensions/api_test/tabs/javascript_url_permissions/test.js +++ b/chrome/test/data/extensions/api_test/tabs/javascript_url_permissions/test.js @@ -11,8 +11,8 @@ chrome.test.getConfig(function(config) { var fixPort = function(url) { return url.replace(/PORT/, config.testServer.port); }; - var urlA = fixPort("http://a.com:PORT/files/extensions/test_file.html"); - var urlB = fixPort("http://b.com:PORT/files/extensions/test_file.html"); + var urlA = fixPort("http://a.com:PORT/extensions/test_file.html"); + var urlB = fixPort("http://b.com:PORT/extensions/test_file.html"); chrome.tabs.create({ url: urlA }, function(tab) { var firstTabId = tab.id; diff --git a/chrome/test/data/extensions/api_test/tabs/on_replaced/test_onreplaced.js b/chrome/test/data/extensions/api_test/tabs/on_replaced/test_onreplaced.js index 5575b5b..520a14e 100644 --- a/chrome/test/data/extensions/api_test/tabs/on_replaced/test_onreplaced.js +++ b/chrome/test/data/extensions/api_test/tabs/on_replaced/test_onreplaced.js @@ -18,7 +18,7 @@ onload = function() { chrome.tabs.onReplaced.addListener(onReplaceListener); var URL_TARGET = - "http://127.0.0.1:PORT/files/prerender/prerender_page.html" + "http://127.0.0.1:PORT/prerender/prerender_page.html" .replace(/PORT/g, config.testServer.port); chrome.tabs.update({ url: URL_TARGET diff --git a/chrome/test/data/extensions/api_test/wallpaper_manager/test.js b/chrome/test/data/extensions/api_test/wallpaper_manager/test.js index c274617..fc237ee 100644 --- a/chrome/test/data/extensions/api_test/wallpaper_manager/test.js +++ b/chrome/test/data/extensions/api_test/wallpaper_manager/test.js @@ -33,7 +33,7 @@ chrome.test.getConfig(function(config) { })); }, function setOnlineJpegWallpaper() { - var url = "http://a.com:PORT/files/extensions/api_test" + + var url = "http://a.com:PORT/extensions/api_test" + "/wallpaper_manager/test.jpg"; url = url.replace(/PORT/, config.testServer.port); requestImage(url, function(requestStatus, response) { @@ -64,7 +64,7 @@ chrome.test.getConfig(function(config) { })); }, function setCustomPngWallpaper() { - var url = "http://a.com:PORT/files/extensions/api_test" + + var url = "http://a.com:PORT/extensions/api_test" + "/wallpaper_manager/test.png"; url = url.replace(/PORT/, config.testServer.port); requestImage(url, function(requestStatus, response) { @@ -87,7 +87,7 @@ chrome.test.getConfig(function(config) { }); }, function setCustomJepgBadWallpaper() { - var url = "http://a.com:PORT/files/extensions/api_test" + + var url = "http://a.com:PORT/extensions/api_test" + "/wallpaper_manager/test_bad.jpg"; url = url.replace(/PORT/, config.testServer.port); requestImage(url, function(requestStatus, response) { @@ -102,7 +102,7 @@ chrome.test.getConfig(function(config) { }); }, function setWallpaperFromFileSystem() { - var url = "http://a.com:PORT/files/extensions/api_test" + + var url = "http://a.com:PORT/extensions/api_test" + "/wallpaper_manager/test.jpg"; url = url.replace(/PORT/, config.testServer.port); chrome.wallpaperPrivate.setWallpaperIfExists(url, 'CENTER_CROPPED', @@ -115,7 +115,7 @@ chrome.test.getConfig(function(config) { })); }, function getAndSetThumbnail() { - var url = "http://a.com:PORT/files/extensions/api_test" + + var url = "http://a.com:PORT/extensions/api_test" + "/wallpaper_manager/test.jpg"; url = url.replace(/PORT/, config.testServer.port); chrome.wallpaperPrivate.getThumbnail(url, 'ONLINE', pass(function(data) { diff --git a/chrome/test/data/extensions/api_test/webnavigation/crossProcess/a.js b/chrome/test/data/extensions/api_test/webnavigation/crossProcess/a.js index 5df72cb..2350716 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/crossProcess/a.js +++ b/chrome/test/data/extensions/api_test/webnavigation/crossProcess/a.js @@ -7,6 +7,6 @@ onload = function() { location.href = "http://127.0.0.1:" + location.search.substr(1) + - "/files/extensions/api_test/webnavigation/crossProcess/empty.html"; + "/extensions/api_test/webnavigation/crossProcess/empty.html"; }, 0); }; diff --git a/chrome/test/data/extensions/api_test/webnavigation/crossProcess/c.js b/chrome/test/data/extensions/api_test/webnavigation/crossProcess/c.js index 58de17a..f0c1e5d 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/crossProcess/c.js +++ b/chrome/test/data/extensions/api_test/webnavigation/crossProcess/c.js @@ -7,7 +7,7 @@ onload = function() { var target = "http://127.0.0.1:" + location.search.substr(1) + - "/files/extensions/api_test/webnavigation/crossProcess/empty.html"; + "/extensions/api_test/webnavigation/crossProcess/empty.html"; location.href = "http://www.a.com:" + location.search.substr(1) + diff --git a/chrome/test/data/extensions/api_test/webnavigation/test_crash.js b/chrome/test/data/extensions/api_test/webnavigation/test_crash.js index be0e349..be954d0 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/test_crash.js +++ b/chrome/test/data/extensions/api_test/webnavigation/test_crash.js @@ -4,9 +4,9 @@ onload = function() { var URL_A = - "http://www.a.com:PORT/files/extensions/api_test/webnavigation/crash/a.html"; + "http://www.a.com:PORT/extensions/api_test/webnavigation/crash/a.html"; var URL_B = - "http://www.a.com:PORT/files/extensions/api_test/webnavigation/crash/b.html"; + "http://www.a.com:PORT/extensions/api_test/webnavigation/crash/b.html"; chrome.tabs.create({"url": "about:blank"}, function(tab) { var tabId = tab.id; chrome.test.getConfig(function(config) { diff --git a/chrome/test/data/extensions/api_test/webnavigation/test_crossProcess.js b/chrome/test/data/extensions/api_test/webnavigation/test_crossProcess.js index 79b39ab..46e8287 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/test_crossProcess.js +++ b/chrome/test/data/extensions/api_test/webnavigation/test_crossProcess.js @@ -5,7 +5,7 @@ onload = function() { var getURL = chrome.extension.getURL; var URL_REGULAR = - "http://127.0.0.1:PORT/files/extensions/api_test/webnavigation/crossProcess/empty.html"; + "http://127.0.0.1:PORT/extensions/api_test/webnavigation/crossProcess/empty.html"; var URL_REDIRECT = "http://www.a.com:PORT/server-redirect"; var URL_TEST = "http://127.0.0.1:PORT/test"; chrome.tabs.create({"url": "about:blank"}, function(tab) { diff --git a/chrome/test/data/extensions/api_test/webnavigation/test_prerender.js b/chrome/test/data/extensions/api_test/webnavigation/test_prerender.js index ea822e3..eabb68c 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/test_prerender.js +++ b/chrome/test/data/extensions/api_test/webnavigation/test_prerender.js @@ -5,9 +5,9 @@ onload = function() { var getURL = chrome.extension.getURL; var URL_LOAD = - "http://127.0.0.1:PORT/files/prerender/prerender_loader.html"; + "http://127.0.0.1:PORT/prerender/prerender_loader.html"; var URL_TARGET = - "http://127.0.0.1:PORT/files/prerender/prerender_page.html"; + "http://127.0.0.1:PORT/prerender/prerender_page.html"; chrome.tabs.create({"url": "about:blank"}, function(tab) { var tabId = tab.id; chrome.test.getConfig(function(config) { diff --git a/chrome/test/data/extensions/api_test/webnavigation/test_serverRedirect.js b/chrome/test/data/extensions/api_test/webnavigation/test_serverRedirect.js index ee223fe..6e89772 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/test_serverRedirect.js +++ b/chrome/test/data/extensions/api_test/webnavigation/test_serverRedirect.js @@ -4,7 +4,7 @@ onload = function() { var URL_LOAD = - "http://www.a.com:PORT/files/extensions/api_test/webnavigation/serverRedirect/a.html"; + "http://www.a.com:PORT/extensions/api_test/webnavigation/serverRedirect/a.html"; var URL_LOAD_REDIRECT = "http://www.a.com:PORT/server-redirect"; chrome.tabs.create({"url": "about:blank"}, function(tab) { var tabId = tab.id; diff --git a/chrome/test/data/extensions/api_test/webnavigation/test_serverRedirectSingleProcess.js b/chrome/test/data/extensions/api_test/webnavigation/test_serverRedirectSingleProcess.js index 809e93e..7402f0d 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/test_serverRedirectSingleProcess.js +++ b/chrome/test/data/extensions/api_test/webnavigation/test_serverRedirectSingleProcess.js @@ -7,7 +7,7 @@ onload = function() { debug = true; var URL_LOAD = - "http://www.a.com:PORT/files/extensions/api_test/webnavigation/serverRedirect/a.html"; + "http://www.a.com:PORT/extensions/api_test/webnavigation/serverRedirect/a.html"; var URL_REDIRECT = "http://www.b.com:PORT/server-redirect"; var URL_TARGET = "http://www.b.com:PORT/"; chrome.tabs.create({"url": "about:blank"}, function(tab) { diff --git a/chrome/test/data/extensions/api_test/webnavigation/test_targetBlank.js b/chrome/test/data/extensions/api_test/webnavigation/test_targetBlank.js index c1c535b..7ac3f7f 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/test_targetBlank.js +++ b/chrome/test/data/extensions/api_test/webnavigation/test_targetBlank.js @@ -4,9 +4,9 @@ onload = function() { var URL_LOAD = - "http://127.0.0.1:PORT/files/extensions/api_test/webnavigation/targetBlank/a.html"; + "http://127.0.0.1:PORT/extensions/api_test/webnavigation/targetBlank/a.html"; var URL_TARGET = - "http://127.0.0.1:PORT/files/extensions/api_test/webnavigation/targetBlank/b.html"; + "http://127.0.0.1:PORT/extensions/api_test/webnavigation/targetBlank/b.html"; chrome.tabs.create({"url": "about:blank"}, function(tab) { var tabId = tab.id; chrome.test.getConfig(function(config) { diff --git a/chrome/test/data/extensions/api_test/webrequest/declarative/a.html b/chrome/test/data/extensions/api_test/webrequest/declarative/a.html index 7fe8ca4..01d927f 100644 --- a/chrome/test/data/extensions/api_test/webrequest/declarative/a.html +++ b/chrome/test/data/extensions/api_test/webrequest/declarative/a.html @@ -1,2 +1,7 @@ +<html> +<head></head> +<body> <img src="image.png"> <iframe src="frame.html"></iframe> +</body> +</html> diff --git a/chrome/test/data/extensions/api_test/webrequest/declarative/third-party.html b/chrome/test/data/extensions/api_test/webrequest/declarative/third-party.html index 2ac5f9a..b20b2f7 100644 --- a/chrome/test/data/extensions/api_test/webrequest/declarative/third-party.html +++ b/chrome/test/data/extensions/api_test/webrequest/declarative/third-party.html @@ -1 +1,6 @@ +<html> +<head></head> +<body> <img src="http://non_existing_third_party.com/image.png"></img> +</body> +</html> diff --git a/chrome/test/data/extensions/api_test/webrequest/test_auth_required.js b/chrome/test/data/extensions/api_test/webrequest/test_auth_required.js index 5157995..500eaab 100644 --- a/chrome/test/data/extensions/api_test/webrequest/test_auth_required.js +++ b/chrome/test/data/extensions/api_test/webrequest/test_auth_required.js @@ -41,7 +41,7 @@ runTests([ details: { url: url, responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized" + statusLine: "HTTP/1.1 401 Unauthorized" } }, { label: "onAuthRequired", @@ -53,7 +53,7 @@ runTests([ realm: realm, challenger: {host: testServer, port: testServerPort}, responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized", + statusLine: "HTTP/1.1 401 Unauthorized", } }, { label: "onResponseStarted", @@ -64,7 +64,7 @@ runTests([ statusCode: 401, ip: "127.0.0.1", responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized", + statusLine: "HTTP/1.1 401 Unauthorized", } }, { label: "onCompleted", @@ -75,7 +75,7 @@ runTests([ statusCode: 401, ip: "127.0.0.1", responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized", + statusLine: "HTTP/1.1 401 Unauthorized", } }, ], @@ -119,7 +119,7 @@ runTests([ details: { url: url, responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized" + statusLine: "HTTP/1.1 401 Unauthorized" } }, { label: "onAuthRequired", @@ -131,7 +131,7 @@ runTests([ realm: realm, challenger: {host: testServer, port: testServerPort}, responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized", + statusLine: "HTTP/1.1 401 Unauthorized", } }, { label: "onResponseStarted", @@ -142,7 +142,7 @@ runTests([ statusCode: 401, ip: "127.0.0.1", responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized", + statusLine: "HTTP/1.1 401 Unauthorized", } }, { label: "onCompleted", @@ -153,7 +153,7 @@ runTests([ statusCode: 401, ip: "127.0.0.1", responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized", + statusLine: "HTTP/1.1 401 Unauthorized", } }, ], @@ -199,7 +199,7 @@ runTests([ details: { url: url, responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized" + statusLine: "HTTP/1.1 401 Unauthorized" } }, { label: "onAuthRequired", @@ -211,7 +211,7 @@ runTests([ realm: realm, challenger: {host: testServer, port: testServerPort}, responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized", + statusLine: "HTTP/1.1 401 Unauthorized", }, retval: {cancel: true} }, @@ -223,7 +223,7 @@ runTests([ statusCode: 401, ip: "127.0.0.1", responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized", + statusLine: "HTTP/1.1 401 Unauthorized", } }, { label: "onCompleted", @@ -234,7 +234,7 @@ runTests([ statusCode: 401, ip: "127.0.0.1", responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized", + statusLine: "HTTP/1.1 401 Unauthorized", } }, ], @@ -281,7 +281,7 @@ runTests([ details: { url: url, responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized" + statusLine: "HTTP/1.1 401 Unauthorized" } }, { label: "onAuthRequired", @@ -293,7 +293,7 @@ runTests([ realm: realm, challenger: {host: testServer, port: testServerPort}, responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized", + statusLine: "HTTP/1.1 401 Unauthorized", }, retval: {authCredentials: {username: "foo", password: "secret"}} }, @@ -361,7 +361,7 @@ runTests([ details: { url: url, responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized" + statusLine: "HTTP/1.1 401 Unauthorized" } }, { label: "onAuthRequired", @@ -373,7 +373,7 @@ runTests([ realm: realm, challenger: {host: testServer, port: testServerPort}, responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized", + statusLine: "HTTP/1.1 401 Unauthorized", } }, { label: "onResponseStarted", @@ -384,7 +384,7 @@ runTests([ statusCode: 401, ip: "127.0.0.1", responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized", + statusLine: "HTTP/1.1 401 Unauthorized", } }, { label: "onCompleted", @@ -395,7 +395,7 @@ runTests([ statusCode: 401, ip: "127.0.0.1", responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized", + statusLine: "HTTP/1.1 401 Unauthorized", } }, ], @@ -441,7 +441,7 @@ runTests([ details: { url: url, responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized" + statusLine: "HTTP/1.1 401 Unauthorized" } }, { label: "onAuthRequired", @@ -453,7 +453,7 @@ runTests([ realm: realm, challenger: {host: testServer, port: testServerPort}, responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized", + statusLine: "HTTP/1.1 401 Unauthorized", }, retval: {cancel: true} }, @@ -465,7 +465,7 @@ runTests([ statusCode: 401, ip: "127.0.0.1", responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized", + statusLine: "HTTP/1.1 401 Unauthorized", } }, { label: "onCompleted", @@ -476,7 +476,7 @@ runTests([ statusCode: 401, ip: "127.0.0.1", responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized", + statusLine: "HTTP/1.1 401 Unauthorized", } }, ], @@ -523,7 +523,7 @@ runTests([ details: { url: url, responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized" + statusLine: "HTTP/1.1 401 Unauthorized" } }, { label: "onAuthRequired", @@ -535,7 +535,7 @@ runTests([ realm: realm, challenger: {host: testServer, port: testServerPort}, responseHeadersExist: true, - statusLine: "HTTP/1.0 401 Unauthorized", + statusLine: "HTTP/1.1 401 Unauthorized", }, retval: {authCredentials: {username: "foo", password: "secret"}} }, diff --git a/chrome/test/data/extensions/api_test/webrequest/test_blocking.js b/chrome/test/data/extensions/api_test/webrequest/test_blocking.js index cbed9a2..0bbe347 100644 --- a/chrome/test/data/extensions/api_test/webrequest/test_blocking.js +++ b/chrome/test/data/extensions/api_test/webrequest/test_blocking.js @@ -18,10 +18,10 @@ function getURLNonUTF8SetCookie() { } function getURLHttpSimpleLoad() { - return getServerURL('files/extensions/api_test/webrequest/simpleLoad/a.html'); + return getServerURL('extensions/api_test/webrequest/simpleLoad/a.html'); } function getURLHttpXHRData() { - return getServerURL('files/extensions/api_test/webrequest/xhr/data.json'); + return getServerURL('extensions/api_test/webrequest/xhr/data.json'); } function toCharCodes(str) { @@ -100,7 +100,7 @@ runTests([ event: "onHeadersReceived", details: { url: getURLHttpSimpleLoad(), - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", }, retval: {cancel: true} }, @@ -215,7 +215,7 @@ runTests([ event: "onHeadersReceived", details: { url: getURLEchoUserAgent(), - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", } }, { label: "onResponseStarted", @@ -225,7 +225,7 @@ runTests([ fromCache: false, statusCode: 200, ip: "127.0.0.1", - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", } }, { label: "onCompleted", @@ -235,7 +235,7 @@ runTests([ fromCache: false, statusCode: 200, ip: "127.0.0.1", - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", } }, ], @@ -290,7 +290,7 @@ runTests([ event: "onHeadersReceived", details: { url: getURLEchoUserAgent(), - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", } }, { label: "onResponseStarted", @@ -300,7 +300,7 @@ runTests([ fromCache: false, statusCode: 200, ip: "127.0.0.1", - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", } }, { label: "onCompleted", @@ -310,7 +310,7 @@ runTests([ fromCache: false, statusCode: 200, ip: "127.0.0.1", - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", } }, ], @@ -363,7 +363,7 @@ runTests([ event: "onHeadersReceived", details: { url: getURLSetCookie(), - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", responseHeadersExist: true, }, retval_function: function(name, details) { @@ -387,7 +387,7 @@ runTests([ url: getURLSetCookie(), fromCache: false, statusCode: 200, - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", ip: "127.0.0.1", responseHeadersExist: true, } @@ -398,7 +398,7 @@ runTests([ url: getURLSetCookie(), fromCache: false, statusCode: 200, - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", ip: "127.0.0.1", responseHeadersExist: true, } @@ -453,7 +453,7 @@ runTests([ event: "onHeadersReceived", details: { url: getURLNonUTF8SetCookie(), - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", responseHeadersExist: true, }, retval_function: function(name, details) { @@ -484,7 +484,7 @@ runTests([ url: getURLNonUTF8SetCookie(), fromCache: false, statusCode: 200, - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", ip: "127.0.0.1", responseHeadersExist: true, } @@ -495,7 +495,7 @@ runTests([ url: getURLNonUTF8SetCookie(), fromCache: false, statusCode: 200, - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", ip: "127.0.0.1", responseHeadersExist: true, } @@ -566,7 +566,7 @@ runTests([ url: getURLHttpXHRData(), statusCode: 200, fromCache: false, - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", tabId: 1, type: "xmlhttprequest", ip: "127.0.0.1", @@ -579,7 +579,7 @@ runTests([ url: getURLHttpXHRData(), statusCode: 200, fromCache: false, - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", tabId: 1, type: "xmlhttprequest", ip: "127.0.0.1", @@ -695,7 +695,7 @@ runTests([ url: getURLHttpXHRData(), statusCode: 200, fromCache: false, - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", tabId: 1, type: "xmlhttprequest", ip: "127.0.0.1", @@ -709,7 +709,7 @@ runTests([ url: getURLHttpXHRData(), tabId: 1, type: "xmlhttprequest", - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", } }, { label: "x-onCompleted", @@ -718,7 +718,7 @@ runTests([ url: getURLHttpXHRData(), statusCode: 200, fromCache: false, - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", tabId: 1, type: "xmlhttprequest", ip: "127.0.0.1", diff --git a/chrome/test/data/extensions/api_test/webrequest/test_complex.js b/chrome/test/data/extensions/api_test/webrequest/test_complex.js index a162826..9d4e24c 100644 --- a/chrome/test/data/extensions/api_test/webrequest/test_complex.js +++ b/chrome/test/data/extensions/api_test/webrequest/test_complex.js @@ -3,13 +3,13 @@ // found in the LICENSE file. function getURLHttpXHR() { - return getServerURL('files/extensions/api_test/webrequest/xhr/a.html'); + return getServerURL('extensions/api_test/webrequest/xhr/a.html'); } function getURLHttpXHRJavaScript() { - return getServerURL('files/extensions/api_test/webrequest/xhr/a.js'); + return getServerURL('extensions/api_test/webrequest/xhr/a.js'); } function getURLHttpXHRData() { - return getServerURL('files/extensions/api_test/webrequest/xhr/data.json'); + return getServerURL('extensions/api_test/webrequest/xhr/data.json'); } runTests([ @@ -252,7 +252,7 @@ runTests([ details: { type: "main_frame", url: getURLHttpXHR(), - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", } }, { label: "onResponseStarted-1", @@ -263,7 +263,7 @@ runTests([ statusCode: 200, ip: "127.0.0.1", fromCache: false, - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", } }, { label: "onCompleted-1", @@ -274,7 +274,7 @@ runTests([ statusCode: 200, ip: "127.0.0.1", fromCache: false, - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", } }, { label: "a.js-onBeforeRequest", @@ -304,7 +304,7 @@ runTests([ details: { type: "script", url: getURLHttpXHRJavaScript(), - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", } }, { label: "a.js-onResponseStarted", @@ -315,7 +315,7 @@ runTests([ statusCode: 200, ip: "127.0.0.1", fromCache: false, - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", } }, { label: "a.js-onCompleted", @@ -326,7 +326,7 @@ runTests([ statusCode: 200, ip: "127.0.0.1", fromCache: false, - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", } }, { label: "onBeforeRequest-2", @@ -356,7 +356,7 @@ runTests([ details: { type: "xmlhttprequest", url: getURLHttpXHRData(), - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", } }, { label: "onResponseStarted-2", @@ -367,7 +367,7 @@ runTests([ statusCode: 200, ip: "127.0.0.1", fromCache: false, - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", } }, { label: "onCompleted-2", @@ -378,7 +378,7 @@ runTests([ statusCode: 200, ip: "127.0.0.1", fromCache: false, - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", } } ], diff --git a/chrome/test/data/extensions/api_test/webrequest/test_declarative1.js b/chrome/test/data/extensions/api_test/webrequest/test_declarative1.js index 88c60ef..8705ff9 100644 --- a/chrome/test/data/extensions/api_test/webrequest/test_declarative1.js +++ b/chrome/test/data/extensions/api_test/webrequest/test_declarative1.js @@ -30,32 +30,32 @@ var RemoveResponseCookie = chrome.declarativeWebRequest.RemoveResponseCookie; // Constants as functions, not to be called until after runTests. function getURLHttpSimple() { - return getServerURL("files/extensions/api_test/webrequest/simpleLoad/a.html"); + return getServerURL("extensions/api_test/webrequest/simpleLoad/a.html"); } function getURLHttpSimpleB() { - return getServerURL("files/extensions/api_test/webrequest/simpleLoad/b.html"); + return getServerURL("extensions/api_test/webrequest/simpleLoad/b.html"); } function getURLHttpComplex() { return getServerURL( - "files/extensions/api_test/webrequest/complexLoad/a.html"); + "extensions/api_test/webrequest/complexLoad/a.html"); } function getURLHttpRedirectTest() { return getServerURL( - "files/extensions/api_test/webrequest/declarative/a.html"); + "extensions/api_test/webrequest/declarative/a.html"); } function getURLHttpWithHeaders() { return getServerURL( - "files/extensions/api_test/webrequest/declarative/headers.html"); + "extensions/api_test/webrequest/declarative/headers.html"); } function getURLOfHTMLWithThirdParty() { // Returns the URL of a HTML document with a third-party resource. return getServerURL( - "files/extensions/api_test/webrequest/declarative/third-party.html"); + "extensions/api_test/webrequest/declarative/third-party.html"); } // Shared test sections. @@ -80,7 +80,7 @@ function cancelThirdPartyExpected() { event: "onHeadersReceived", details: { url: getURLOfHTMLWithThirdParty(), - statusLine: "HTTP/1.0 200 OK" + statusLine: "HTTP/1.1 200 OK" } }, { label: "onResponseStarted", @@ -90,7 +90,7 @@ function cancelThirdPartyExpected() { fromCache: false, ip: "127.0.0.1", statusCode: 200, - statusLine: "HTTP/1.0 200 OK" + statusLine: "HTTP/1.1 200 OK" } }, { label: "onCompleted", @@ -100,7 +100,7 @@ function cancelThirdPartyExpected() { ip: "127.0.0.1", url: getURLOfHTMLWithThirdParty(), statusCode: 200, - statusLine: "HTTP/1.0 200 OK" + statusLine: "HTTP/1.1 200 OK" } }, { label: "img-onBeforeRequest", @@ -330,7 +330,7 @@ runTests([ url: getURLHttpSimple(), fromCache: false, statusCode: 200, - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", } }, ], @@ -357,7 +357,7 @@ runTests([ url: getURLHttpRedirectTest(), fromCache: false, statusCode: 200, - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", } }, // We cannot wait for onCompleted signals because these are not sent @@ -366,7 +366,7 @@ runTests([ event: "onBeforeRedirect", details: { url: getServerURL( - "files/extensions/api_test/webrequest/declarative/image.png"), + "extensions/api_test/webrequest/declarative/image.png"), redirectUrl: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEA" + "AAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJ" + "ggg==", @@ -382,7 +382,7 @@ runTests([ frameId: 1, parentFrameId: 0, url: getServerURL( - "files/extensions/api_test/webrequest/declarative/frame.html"), + "extensions/api_test/webrequest/declarative/frame.html"), redirectUrl: "data:text/html,", fromCache: false, statusCode: -1, @@ -416,7 +416,7 @@ runTests([ url: getURLHttpSimpleB(), fromCache: false, statusCode: 200, - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", } }, ], diff --git a/chrome/test/data/extensions/api_test/webrequest/test_declarative2.js b/chrome/test/data/extensions/api_test/webrequest/test_declarative2.js index b2c9609..fd23a65 100644 --- a/chrome/test/data/extensions/api_test/webrequest/test_declarative2.js +++ b/chrome/test/data/extensions/api_test/webrequest/test_declarative2.js @@ -34,13 +34,13 @@ function getURLEchoUserAgent() { } function getURLHttpSimple() { - return getServerURL("files/extensions/api_test/webrequest/simpleLoad/a.html"); + return getServerURL("extensions/api_test/webrequest/simpleLoad/a.html"); } function getURLOfHTMLWithThirdParty() { // Returns the URL of a HTML document with a third-party resource. return getServerURL( - "files/extensions/api_test/webrequest/declarative/third-party.html"); + "extensions/api_test/webrequest/declarative/third-party.html"); } function getURLSetCookie() { @@ -57,7 +57,7 @@ function getURLEchoCookie() { } function getURLHttpXHRData() { - return getServerURL("files/extensions/api_test/webrequest/xhr/data.json", + return getServerURL("extensions/api_test/webrequest/xhr/data.json", "b.com"); } @@ -160,7 +160,7 @@ runTests([ url: getURLHttpSimple(), statusCode: 200, fromCache: false, - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", ip: "127.0.0.1", } } diff --git a/chrome/test/data/extensions/api_test/webrequest/test_simple.js b/chrome/test/data/extensions/api_test/webrequest/test_simple.js index 0db4373..2ef4a05 100644 --- a/chrome/test/data/extensions/api_test/webrequest/test_simple.js +++ b/chrome/test/data/extensions/api_test/webrequest/test_simple.js @@ -4,7 +4,7 @@ // Constants as functions, not to be called until after runTests. function getURLHttpSimpleLoad() { - return getServerURL('files/extensions/api_test/webrequest/simpleLoad/a.html'); + return getServerURL('extensions/api_test/webrequest/simpleLoad/a.html'); } function getURLHttpSimpleLoadRedirect() { @@ -80,7 +80,7 @@ runTests([ details: { url: getURLHttpSimpleLoadRedirect(), responseHeadersExist: true, - statusLine: "HTTP/1.0 301 Moved Permanently" + statusLine: "HTTP/1.1 301 Moved Permanently" } }, { label: "onBeforeRedirect", @@ -92,7 +92,7 @@ runTests([ responseHeadersExist: true, ip: "127.0.0.1", fromCache: false, - statusLine: "HTTP/1.0 301 Moved Permanently" + statusLine: "HTTP/1.1 301 Moved Permanently" } }, { label: "onBeforeRequest-2", @@ -121,7 +121,7 @@ runTests([ details: { url: getURLHttpSimpleLoad(), responseHeadersExist: true, - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", } }, { label: "onResponseStarted", @@ -132,7 +132,7 @@ runTests([ responseHeadersExist: true, ip: "127.0.0.1", fromCache: false, - statusLine: "HTTP/1.0 200 OK", + statusLine: "HTTP/1.1 200 OK", } }, { label: "onCompleted", @@ -143,7 +143,7 @@ runTests([ ip: "127.0.0.1", fromCache: false, responseHeadersExist: true, - statusLine: "HTTP/1.0 200 OK" + statusLine: "HTTP/1.1 200 OK" } } ], diff --git a/chrome/test/data/extensions/api_test/webrequest/xhr/data.json.mock-http-headers b/chrome/test/data/extensions/api_test/webrequest/xhr/data.json.mock-http-headers index 4221a62..345ffffb2 100644 --- a/chrome/test/data/extensions/api_test/webrequest/xhr/data.json.mock-http-headers +++ b/chrome/test/data/extensions/api_test/webrequest/xhr/data.json.mock-http-headers @@ -1,3 +1,3 @@ -HTTP/1.0 200 OK +HTTP/1.1 200 OK Content-type: application/json Access-Control-Allow-Origin: * diff --git a/chrome/test/data/extensions/api_test/webrequest_sendmessage/background.js b/chrome/test/data/extensions/api_test/webrequest_sendmessage/background.js index e13f9a7..43bf7c5 100644 --- a/chrome/test/data/extensions/api_test/webrequest_sendmessage/background.js +++ b/chrome/test/data/extensions/api_test/webrequest_sendmessage/background.js @@ -6,7 +6,7 @@ var EVENT_MESSAGE_EXTENSION_STRING = "Extension"; // Constants as functions, not to be called until after runTests. function getURLHttpSimpleLoad() { - return getServerURL('files/extensions/api_test/webrequest/simpleLoad/a.html'); + return getServerURL('extensions/api_test/webrequest/simpleLoad/a.html'); } function getServerURL(path) { diff --git a/chrome/test/data/extensions/api_test/window_open/popup_blocking/extension/background.js b/chrome/test/data/extensions/api_test/window_open/popup_blocking/extension/background.js index 3af7a0a..031279f 100644 --- a/chrome/test/data/extensions/api_test/window_open/popup_blocking/extension/background.js +++ b/chrome/test/data/extensions/api_test/window_open/popup_blocking/extension/background.js @@ -3,7 +3,7 @@ // found in the LICENSE file. function buildUrl(host, port) { - return ("http://HOST:PORT/files/extensions/api_test/window_open/" + + return ("http://HOST:PORT/extensions/api_test/window_open/" + "popup_blocking/extension/foo.html") .replace(/HOST/, host).replace(/PORT/, port); } diff --git a/chrome/test/data/extensions/hosted_app/manifest.json b/chrome/test/data/extensions/hosted_app/manifest.json index 804417d..a249e03 100644 --- a/chrome/test/data/extensions/hosted_app/manifest.json +++ b/chrome/test/data/extensions/hosted_app/manifest.json @@ -5,10 +5,10 @@ "description": "Trivial hosted app.", "app": { "urls": [ - "http://localhost/files/extensions/hosted_app/main.html" + "http://localhost/extensions/hosted_app/main.html" ], "launch": { - "web_url": "http://localhost/files/extensions/hosted_app/main.html" + "web_url": "http://localhost/extensions/hosted_app/main.html" } } } diff --git a/chrome/test/data/extensions/isolated_apps/app1/manifest.json b/chrome/test/data/extensions/isolated_apps/app1/manifest.json index 7a0480f..f8418b3 100644 --- a/chrome/test/data/extensions/isolated_apps/app1/manifest.json +++ b/chrome/test/data/extensions/isolated_apps/app1/manifest.json @@ -5,10 +5,10 @@ "description": "Tests isolation of stored data for apps.", "app": { "urls": [ - "http://localhost/files/extensions/isolated_apps/app1" + "http://localhost/extensions/isolated_apps/app1" ], "launch": { - "web_url": "http://localhost/files/extensions/isolated_apps/app1/main.html" + "web_url": "http://localhost/extensions/isolated_apps/app1/main.html" }, "isolation": [ "storage" diff --git a/chrome/test/data/extensions/isolated_apps/app2/manifest.json b/chrome/test/data/extensions/isolated_apps/app2/manifest.json index 4771423..edfb421 100644 --- a/chrome/test/data/extensions/isolated_apps/app2/manifest.json +++ b/chrome/test/data/extensions/isolated_apps/app2/manifest.json @@ -5,10 +5,10 @@ "description": "Tests isolation of stored data for apps.", "app": { "urls": [ - "http://localhost/files/extensions/isolated_apps/app2" + "http://localhost/extensions/isolated_apps/app2" ], "launch": { - "web_url": "http://localhost/files/extensions/isolated_apps/app2/main.html" + "web_url": "http://localhost/extensions/isolated_apps/app2/main.html" }, "isolation": [ "storage" diff --git a/chrome/test/data/extensions/isolated_apps/app2/redirect.html b/chrome/test/data/extensions/isolated_apps/app2/redirect.html new file mode 100644 index 0000000..63ba1fa --- /dev/null +++ b/chrome/test/data/extensions/isolated_apps/app2/redirect.html @@ -0,0 +1,8 @@ +<html> +<head> +<meta http-equiv="refresh" +content="0;/extensions/isolated_apps/app2/main.html"> +</head> +<body> +</body> +</html> diff --git a/chrome/test/data/extensions/platform_apps/ad_view/change_ad_network/chrometest.js b/chrome/test/data/extensions/platform_apps/ad_view/change_ad_network/chrometest.js index 6f9ed3d..f290915 100644 --- a/chrome/test/data/extensions/platform_apps/ad_view/change_ad_network/chrometest.js +++ b/chrome/test/data/extensions/platform_apps/ad_view/change_ad_network/chrometest.js @@ -59,7 +59,7 @@ function runTests(guestURL) { window.onload = function() { chrome.test.getConfig(function(config) { var guestURL = 'http://localhost:' + config.testServer.port + - '/files/extensions/platform_apps/ad_view/ad_network_site/testsdk.html'; + '/extensions/platform_apps/ad_view/ad_network_site/testsdk.html'; runTests(guestURL); }); } diff --git a/chrome/test/data/extensions/platform_apps/ad_view/display_first_ad/chrometest.js b/chrome/test/data/extensions/platform_apps/ad_view/display_first_ad/chrometest.js index d5dab08..5b03c5b 100644 --- a/chrome/test/data/extensions/platform_apps/ad_view/display_first_ad/chrometest.js +++ b/chrome/test/data/extensions/platform_apps/ad_view/display_first_ad/chrometest.js @@ -32,7 +32,7 @@ function runTests(guestURL) { window.onload = function() { chrome.test.getConfig(function(config) { var guestURL = 'http://localhost:' + config.testServer.port + - '/files/extensions/platform_apps/ad_view/ad_network_site/testsdk.html'; + '/extensions/platform_apps/ad_view/ad_network_site/testsdk.html'; runTests(guestURL); }); } diff --git a/chrome/test/data/extensions/platform_apps/ad_view/loadcommit_event/chrometest.js b/chrome/test/data/extensions/platform_apps/ad_view/loadcommit_event/chrometest.js index b7d65c1..c508a3b 100644 --- a/chrome/test/data/extensions/platform_apps/ad_view/loadcommit_event/chrometest.js +++ b/chrome/test/data/extensions/platform_apps/ad_view/loadcommit_event/chrometest.js @@ -27,7 +27,7 @@ function runTests(guestURL) { window.onload = function() { chrome.test.getConfig(function(config) { var guestURL = 'http://localhost:' + config.testServer.port + - '/files/extensions/platform_apps/ad_view/ad_network_site/testsdk.html'; + '/extensions/platform_apps/ad_view/ad_network_site/testsdk.html'; runTests(guestURL); }); } diff --git a/chrome/test/data/extensions/platform_apps/ad_view/onloadcommit_ack/chrometest.js b/chrome/test/data/extensions/platform_apps/ad_view/onloadcommit_ack/chrometest.js index 2be96d4..fd7697c 100644 --- a/chrome/test/data/extensions/platform_apps/ad_view/onloadcommit_ack/chrometest.js +++ b/chrome/test/data/extensions/platform_apps/ad_view/onloadcommit_ack/chrometest.js @@ -33,7 +33,7 @@ function runTests(guestURL) { window.onload = function() { chrome.test.getConfig(function(config) { var guestURL = 'http://localhost:' + config.testServer.port + - '/files/extensions/platform_apps/ad_view/ad_network_site/testsdk.html'; + '/extensions/platform_apps/ad_view/ad_network_site/testsdk.html'; runTests(guestURL); }); } diff --git a/chrome/test/data/extensions/platform_apps/ad_view/permission_required/chrometest.js b/chrome/test/data/extensions/platform_apps/ad_view/permission_required/chrometest.js index 2feee67c..ca87e67 100644 --- a/chrome/test/data/extensions/platform_apps/ad_view/permission_required/chrometest.js +++ b/chrome/test/data/extensions/platform_apps/ad_view/permission_required/chrometest.js @@ -33,7 +33,7 @@ function runTests(guestURL) { window.onload = function() { chrome.test.getConfig(function(config) { var guestURL = 'http://localhost:' + config.testServer.port + - '/files/extensions/platform_apps/ad_view/ad_network_site/testsdk.html'; + '/extensions/platform_apps/ad_view/ad_network_site/testsdk.html'; runTests(guestURL); }); } diff --git a/chrome/test/data/extensions/platform_apps/ad_view/properties_exposed/chrometest.js b/chrome/test/data/extensions/platform_apps/ad_view/properties_exposed/chrometest.js index 4631275..352df34 100644 --- a/chrome/test/data/extensions/platform_apps/ad_view/properties_exposed/chrometest.js +++ b/chrome/test/data/extensions/platform_apps/ad_view/properties_exposed/chrometest.js @@ -32,7 +32,7 @@ function runTests(guestURL) { window.onload = function() { chrome.test.getConfig(function(config) { var guestURL = 'http://localhost:' + config.testServer.port + - '/files/extensions/platform_apps/ad_view/ad_network_site/testsdk.html'; + '/extensions/platform_apps/ad_view/ad_network_site/testsdk.html'; runTests(guestURL); }); } diff --git a/chrome/test/data/extensions/platform_apps/ad_view/src_flag_required/chrometest.js b/chrome/test/data/extensions/platform_apps/ad_view/src_flag_required/chrometest.js index 5085bc3..34c0310 100644 --- a/chrome/test/data/extensions/platform_apps/ad_view/src_flag_required/chrometest.js +++ b/chrome/test/data/extensions/platform_apps/ad_view/src_flag_required/chrometest.js @@ -28,7 +28,7 @@ function runTests(guestURL) { window.onload = function() { chrome.test.getConfig(function(config) { var guestURL = 'http://localhost:' + config.testServer.port + - '/files/extensions/platform_apps/ad_view/ad_network_site/testsdk.html'; + '/extensions/platform_apps/ad_view/ad_network_site/testsdk.html'; runTests(guestURL); }); } diff --git a/chrome/test/data/extensions/platform_apps/iframes/main.js b/chrome/test/data/extensions/platform_apps/iframes/main.js index 666cff1..0fe80ba 100644 --- a/chrome/test/data/extensions/platform_apps/iframes/main.js +++ b/chrome/test/data/extensions/platform_apps/iframes/main.js @@ -6,7 +6,7 @@ chrome.test.getConfig(function(config) { var LOCAL_URL = 'local-iframe.html'; var DATA_URL = 'data:text/plain,This frame should be displayed.'; var REMOTE_URL = 'http://localhost:' + config.testServer.port - '/files/extensions/platform_apps/iframes/remote-iframe.html'; + '/extensions/platform_apps/iframes/remote-iframe.html'; chrome.test.runTests([ function localIframe() { diff --git a/chrome/test/data/extensions/platform_apps/isolation/test.js b/chrome/test/data/extensions/platform_apps/isolation/test.js index 6788d0b..37079dd 100644 --- a/chrome/test/data/extensions/platform_apps/isolation/test.js +++ b/chrome/test/data/extensions/platform_apps/isolation/test.js @@ -11,9 +11,8 @@ chrome.test.getConfig(function(config) { 'http://localhost:' + config.testServer.port + '/echoheader?Cookie', true); xhr.onload = function() { - // Cookies should not have been passed in the request, so the echo of - // their header should be the Pythonic "None". - chrome.test.assertEq('None', xhr.responseText); + // Cookies should not have been passed in the request. + chrome.test.assertEq('', xhr.responseText); chrome.test.succeed(); }; xhr.onerror = function() { diff --git a/chrome/test/data/extensions/platform_apps/navigation/main.js b/chrome/test/data/extensions/platform_apps/navigation/main.js index 63a2e5c..e69d5d3 100644 --- a/chrome/test/data/extensions/platform_apps/navigation/main.js +++ b/chrome/test/data/extensions/platform_apps/navigation/main.js @@ -5,7 +5,7 @@ chrome.test.getConfig(function(config) { var IN_APP_URL = 'nav-target.html'; var REMOTE_URL = 'http://localhost:' + config.testServer.port - '/files/extensions/platform_apps/navigation/nav-target.html'; + '/extensions/platform_apps/navigation/nav-target.html'; var testForm = document.getElementById('test-form'); var testLink = document.getElementById('test-link'); diff --git a/chrome/test/data/extensions/platform_apps/open_link/main.js b/chrome/test/data/extensions/platform_apps/open_link/main.js index ddd0c8a..56575db 100644 --- a/chrome/test/data/extensions/platform_apps/open_link/main.js +++ b/chrome/test/data/extensions/platform_apps/open_link/main.js @@ -5,7 +5,7 @@ chrome.test.getConfig(function(config) { var linkNode = document.getElementById('test-link'); linkNode.href = 'http://localhost:' + config.testServer.port + - '/files/extensions/platform_apps/open_link/link.html'; + '/extensions/platform_apps/open_link/link.html'; var clickEvent = document.createEvent('MouseEvents'); clickEvent.initMouseEvent('click', true, true, window, diff --git a/chrome/test/data/extensions/platform_apps/web_view/common/screen_coordinates/main.js b/chrome/test/data/extensions/platform_apps/web_view/common/screen_coordinates/main.js index 43483c1..c6fceec 100644 --- a/chrome/test/data/extensions/platform_apps/web_view/common/screen_coordinates/main.js +++ b/chrome/test/data/extensions/platform_apps/web_view/common/screen_coordinates/main.js @@ -10,7 +10,7 @@ embedder.guestURL = ''; embedder.setUp = function(config) { embedder.baseGuestURL = 'http://localhost:' + config.testServer.port; embedder.guestURL = embedder.baseGuestURL + - '/files/extensions/platform_apps/web_view/screen_coordinates' + + '/extensions/platform_apps/web_view/screen_coordinates' + '/guest.html'; chrome.test.log('Guest url is: ' + embedder.guestURL); }; diff --git a/chrome/test/data/extensions/platform_apps/web_view/common/utils.js b/chrome/test/data/extensions/platform_apps/web_view/common/utils.js index e4fac87..0a74ebb 100644 --- a/chrome/test/data/extensions/platform_apps/web_view/common/utils.js +++ b/chrome/test/data/extensions/platform_apps/web_view/common/utils.js @@ -37,7 +37,7 @@ utils.test.assertEq = function(expected, actual) { utils.setUp = function(chromeConfig, config) { embedder.baseGuestURL = 'http://localhost:' + chromeConfig.testServer.port; embedder.guestURL = embedder.baseGuestURL + - '/files/extensions/platform_apps/web_view/common/' + + '/extensions/platform_apps/web_view/common/' + config.TEST_DIR + '/guest.html'; chrome.test.log('Guest url is: ' + embedder.guestURL); }; diff --git a/chrome/test/data/extensions/platform_apps/web_view/download/embedder.js b/chrome/test/data/extensions/platform_apps/web_view/download/embedder.js index db7f9f6..288a62a 100644 --- a/chrome/test/data/extensions/platform_apps/web_view/download/embedder.js +++ b/chrome/test/data/extensions/platform_apps/web_view/download/embedder.js @@ -44,7 +44,7 @@ onload = function() { chrome.test.getConfig(function(config) { embedder.baseGuestURL = 'http://localhost:' + config.testServer.port; embedder.guestURL = embedder.baseGuestURL + - '/files/extensions/platform_apps/web_view/download/guest.html'; + '/extensions/platform_apps/web_view/download/guest.html'; embedder.setUpGuest_(); }); }; diff --git a/chrome/test/data/extensions/platform_apps/web_view/edit_commands/embedder.js b/chrome/test/data/extensions/platform_apps/web_view/edit_commands/embedder.js index 506dd64..b7e49bc 100644 --- a/chrome/test/data/extensions/platform_apps/web_view/edit_commands/embedder.js +++ b/chrome/test/data/extensions/platform_apps/web_view/edit_commands/embedder.js @@ -10,7 +10,7 @@ embedder.guestURL = ''; embedder.setUp = function(config) { embedder.baseGuestURL = 'http://localhost:' + config.testServer.port; embedder.guestURL = embedder.baseGuestURL + - '/files/extensions/platform_apps/web_view/edit_commands' + + '/extensions/platform_apps/web_view/edit_commands' + '/guest.html'; chrome.test.log('Guest url is: ' + embedder.guestURL); }; diff --git a/chrome/test/data/extensions/platform_apps/web_view/edit_commands_no_menu/embedder.js b/chrome/test/data/extensions/platform_apps/web_view/edit_commands_no_menu/embedder.js index 123cb40..000dc19 100644 --- a/chrome/test/data/extensions/platform_apps/web_view/edit_commands_no_menu/embedder.js +++ b/chrome/test/data/extensions/platform_apps/web_view/edit_commands_no_menu/embedder.js @@ -10,7 +10,7 @@ embedder.guestURL = ''; embedder.setUp = function(config) { embedder.baseGuestURL = 'http://localhost:' + config.testServer.port; embedder.guestURL = embedder.baseGuestURL + - '/files/extensions/platform_apps/web_view/edit_commands_no_menu' + + '/extensions/platform_apps/web_view/edit_commands_no_menu' + '/guest.html'; chrome.test.log('Guest url is: ' + embedder.guestURL); }; diff --git a/chrome/test/data/extensions/platform_apps/web_view/focus/embedder.js b/chrome/test/data/extensions/platform_apps/web_view/focus/embedder.js index b3f055a..2f253bb 100644 --- a/chrome/test/data/extensions/platform_apps/web_view/focus/embedder.js +++ b/chrome/test/data/extensions/platform_apps/web_view/focus/embedder.js @@ -10,7 +10,7 @@ embedder.guestURL = ''; embedder.setUp = function(config) { embedder.baseGuestURL = 'http://localhost:' + config.testServer.port; embedder.guestURL = embedder.baseGuestURL + - '/files/extensions/platform_apps/web_view/focus' + + '/extensions/platform_apps/web_view/focus' + '/guest.html'; chrome.test.log('Guest url is: ' + embedder.guestURL); }; diff --git a/chrome/test/data/extensions/platform_apps/web_view/geolocation/cancel_request/embedder.js b/chrome/test/data/extensions/platform_apps/web_view/geolocation/cancel_request/embedder.js index 4ef8717..53b4afd 100644 --- a/chrome/test/data/extensions/platform_apps/web_view/geolocation/cancel_request/embedder.js +++ b/chrome/test/data/extensions/platform_apps/web_view/geolocation/cancel_request/embedder.js @@ -11,10 +11,10 @@ embedder.iframeURL = ''; embedder.setUp_ = function(config) { embedder.baseGuestURL = 'http://localhost:' + config.testServer.port; embedder.guestURL = embedder.baseGuestURL + - '/files/extensions/platform_apps/web_view/geolocation' + + '/extensions/platform_apps/web_view/geolocation' + '/cancel_request/pages/guest.html'; embedder.iframeURL = embedder.baseGuestURL + - '/files/extensions/platform_apps/web_view/geolocation' + + '/extensions/platform_apps/web_view/geolocation' + '/cancel_request/pages/iframe.html'; chrome.test.log('Guest url is: ' + embedder.guestURL); }; diff --git a/chrome/test/data/extensions/platform_apps/web_view/geolocation/embedder_has_no_permission/embedder.js b/chrome/test/data/extensions/platform_apps/web_view/geolocation/embedder_has_no_permission/embedder.js index 4ae2432..06ce383 100644 --- a/chrome/test/data/extensions/platform_apps/web_view/geolocation/embedder_has_no_permission/embedder.js +++ b/chrome/test/data/extensions/platform_apps/web_view/geolocation/embedder_has_no_permission/embedder.js @@ -52,7 +52,7 @@ embedder.test.assertFalse = function(condition) { embedder.setUp = function(config) { embedder.baseGuestURL = 'http://localhost:' + config.testServer.port; embedder.guestURL = embedder.baseGuestURL + - '/files/extensions/platform_apps/web_view/geolocation' + + '/extensions/platform_apps/web_view/geolocation' + '/geolocation_access_guest.html'; chrome.test.log('Guest url is: ' + embedder.guestURL); }; diff --git a/chrome/test/data/extensions/platform_apps/web_view/geolocation/embedder_has_permission/embedder.js b/chrome/test/data/extensions/platform_apps/web_view/geolocation/embedder_has_permission/embedder.js index dffb8e7..846029f 100644 --- a/chrome/test/data/extensions/platform_apps/web_view/geolocation/embedder_has_permission/embedder.js +++ b/chrome/test/data/extensions/platform_apps/web_view/geolocation/embedder_has_permission/embedder.js @@ -24,10 +24,10 @@ window.runTest = function(testName) { embedder.setUp_ = function(config) { embedder.baseGuestURL = 'http://localhost:' + config.testServer.port; embedder.guestURL = embedder.baseGuestURL + - '/files/extensions/platform_apps/web_view/geolocation' + + '/extensions/platform_apps/web_view/geolocation' + '/geolocation_access_guest.html'; embedder.iframeURL = embedder.baseGuestURL + - '/files/extensions/platform_apps/web_view/geolocation' + + '/extensions/platform_apps/web_view/geolocation' + '/geolocation_access_iframe.html'; chrome.test.log('Guest url is: ' + embedder.guestURL); }; diff --git a/chrome/test/data/extensions/platform_apps/web_view/isolation/main.js b/chrome/test/data/extensions/platform_apps/web_view/isolation/main.js index b265d0b..702e803 100644 --- a/chrome/test/data/extensions/platform_apps/web_view/isolation/main.js +++ b/chrome/test/data/extensions/platform_apps/web_view/isolation/main.js @@ -4,19 +4,19 @@ chrome.test.getConfig(function(config) { var url = 'http://localhost:' + config.testServer.port + - '/files/extensions/platform_apps/web_view/isolation/cookie.html'; + '/extensions/platform_apps/web_view/isolation/cookie.html'; var url2 = 'http://localhost:' + config.testServer.port + - '/files/extensions/platform_apps/web_view/isolation/cookie2.html'; + '/extensions/platform_apps/web_view/isolation/cookie2.html'; var url3 = 'http://localhost:' + config.testServer.port + - '/files/extensions/platform_apps/web_view/isolation/storage1.html'; + '/extensions/platform_apps/web_view/isolation/storage1.html'; var url4 = 'http://localhost:' + config.testServer.port + - '/files/extensions/platform_apps/web_view/isolation/storage2.html'; + '/extensions/platform_apps/web_view/isolation/storage2.html'; var url5 = 'http://localhost:' + config.testServer.port + - '/files/extensions/platform_apps/web_view/isolation/storage1.html#p1'; + '/extensions/platform_apps/web_view/isolation/storage1.html#p1'; var url6 = 'http://localhost:' + config.testServer.port + - '/files/extensions/platform_apps/web_view/isolation/storage1.html#p2'; + '/extensions/platform_apps/web_view/isolation/storage1.html#p2'; var url7 = 'http://localhost:' + config.testServer.port + - '/files/extensions/platform_apps/web_view/isolation/storage1.html#p3'; + '/extensions/platform_apps/web_view/isolation/storage1.html#p3'; var node = document.getElementById('web_view_container'); node.innerHTML = "<webview id='webview' src='" + url + "'></webview>" + diff --git a/chrome/test/data/extensions/platform_apps/web_view/media_access/allow/embedder.js b/chrome/test/data/extensions/platform_apps/web_view/media_access/allow/embedder.js index 1c4f24c..b22282f 100644 --- a/chrome/test/data/extensions/platform_apps/web_view/media_access/allow/embedder.js +++ b/chrome/test/data/extensions/platform_apps/web_view/media_access/allow/embedder.js @@ -215,7 +215,7 @@ function startAllowTest(testName) { chrome.test.getConfig(function(config) { embedder.baseGuestURL = 'http://localhost:' + config.testServer.port; embedder.guestURL = embedder.baseGuestURL + - '/files/extensions/platform_apps/web_view/media_access' + + '/extensions/platform_apps/web_view/media_access' + '/media_access_guest.html'; chrome.test.log('Guest url is: ' + embedder.guestURL); diff --git a/chrome/test/data/extensions/platform_apps/web_view/media_access/deny/embedder.js b/chrome/test/data/extensions/platform_apps/web_view/media_access/deny/embedder.js index a7e8a0f..988de62 100644 --- a/chrome/test/data/extensions/platform_apps/web_view/media_access/deny/embedder.js +++ b/chrome/test/data/extensions/platform_apps/web_view/media_access/deny/embedder.js @@ -207,7 +207,7 @@ onload = function() { chrome.test.getConfig(function(config) { embedder.baseGuestURL = 'http://localhost:' + config.testServer.port; embedder.guestURL = embedder.baseGuestURL + - '/files/extensions/platform_apps/web_view/media_access' + + '/extensions/platform_apps/web_view/media_access' + '/media_access_guest.html'; chrome.test.log('Guest url is: ' + embedder.guestURL); chrome.test.sendMessage('loaded'); diff --git a/chrome/test/data/extensions/platform_apps/web_view/newwindow/embedder.js b/chrome/test/data/extensions/platform_apps/web_view/newwindow/embedder.js index b227537..cd86c9f 100644 --- a/chrome/test/data/extensions/platform_apps/web_view/newwindow/embedder.js +++ b/chrome/test/data/extensions/platform_apps/web_view/newwindow/embedder.js @@ -23,7 +23,7 @@ window.runNewWindowTest = function(testName) { embedder.setUp_ = function(config) { embedder.baseGuestURL = 'http://localhost:' + config.testServer.port; embedder.guestURL = embedder.baseGuestURL + - '/files/extensions/platform_apps/web_view/newwindow' + + '/extensions/platform_apps/web_view/newwindow' + '/guest_opener.html'; chrome.test.log('Guest url is: ' + embedder.guestURL); }; diff --git a/chrome/test/data/extensions/platform_apps/web_view/noprerenderer/main.js b/chrome/test/data/extensions/platform_apps/web_view/noprerenderer/main.js index 63bd2d8..13bc94f 100644 --- a/chrome/test/data/extensions/platform_apps/web_view/noprerenderer/main.js +++ b/chrome/test/data/extensions/platform_apps/web_view/noprerenderer/main.js @@ -8,7 +8,7 @@ var startTest = function() { chrome.test.getConfig(function(config) { var guestURL = 'http://localhost:' + config.testServer.port + - '/files/extensions/platform_apps/web_view/noprerenderer/guest.html'; + '/extensions/platform_apps/web_view/noprerenderer/guest.html'; document.querySelector('#webview-tag-container').innerHTML = '<webview style="width: 10px; height: 10px; margin: 0; padding: 0;"' + ' src="' + guestURL + '"' + diff --git a/chrome/test/data/extensions/platform_apps/web_view/pointer_lock/main.js b/chrome/test/data/extensions/platform_apps/web_view/pointer_lock/main.js index a0a6edc..ae30db4 100644 --- a/chrome/test/data/extensions/platform_apps/web_view/pointer_lock/main.js +++ b/chrome/test/data/extensions/platform_apps/web_view/pointer_lock/main.js @@ -89,7 +89,7 @@ var receiveMessage = function(event) { chrome.test.getConfig(function(config) { guestURL = 'http://localhost:' + config.testServer.port + - '/files/extensions/platform_apps/web_view/pointer_lock/guest.html'; + '/extensions/platform_apps/web_view/pointer_lock/guest.html'; document.querySelector('#webview-tag-container').innerHTML = '<webview id=\'webview\' style="width: 400px; height: 400px; ' + 'margin: 0; padding: 0;"' + diff --git a/chrome/test/data/extensions/platform_apps/web_view/popup_positioning/main.js b/chrome/test/data/extensions/platform_apps/web_view/popup_positioning/main.js index eb11e9f..61b37d74 100644 --- a/chrome/test/data/extensions/platform_apps/web_view/popup_positioning/main.js +++ b/chrome/test/data/extensions/platform_apps/web_view/popup_positioning/main.js @@ -8,7 +8,7 @@ var startTest = function() { chrome.test.getConfig(function(config) { var guestURL = 'http://localhost:' + config.testServer.port + - '/files/extensions/platform_apps/web_view/popup_positioning/guest.html'; + '/extensions/platform_apps/web_view/popup_positioning/guest.html'; var webview = document.createElement('webview'); var loaded = false; webview.addEventListener('loadstop', function(e) { diff --git a/chrome/test/data/extensions/platform_apps/web_view/popup_positioning_moved/main.js b/chrome/test/data/extensions/platform_apps/web_view/popup_positioning_moved/main.js index 870bbc7..4797bbb 100644 --- a/chrome/test/data/extensions/platform_apps/web_view/popup_positioning_moved/main.js +++ b/chrome/test/data/extensions/platform_apps/web_view/popup_positioning_moved/main.js @@ -8,7 +8,7 @@ var startTest = function() { chrome.test.getConfig(function(config) { var guestURL = 'http://localhost:' + config.testServer.port + - '/files/extensions/platform_apps/web_view/popup_positioning_moved' + + '/extensions/platform_apps/web_view/popup_positioning_moved' + '/guest.html'; var webview = document.createElement('webview'); var loaded = false; diff --git a/chrome/test/data/extensions/platform_apps/web_view/shim/main.js b/chrome/test/data/extensions/platform_apps/web_view/shim/main.js index 9978a9b..d8b4e5b 100644 --- a/chrome/test/data/extensions/platform_apps/web_view/shim/main.js +++ b/chrome/test/data/extensions/platform_apps/web_view/shim/main.js @@ -22,9 +22,9 @@ util.createWebViewTagInDOM = function(partitionName) { chrome.test.getConfig(function(config) { var windowOpenGuestURL = 'http://localhost:' + config.testServer.port + - '/files/extensions/platform_apps/web_view/shim/guest.html'; + '/extensions/platform_apps/web_view/shim/guest.html'; var noReferrerGuestURL = 'http://localhost:' + config.testServer.port + - '/files/extensions/platform_apps/web_view/shim/guest_noreferrer.html'; + '/extensions/platform_apps/web_view/shim/guest_noreferrer.html'; chrome.test.runTests([ function webView() { var webview = document.querySelector('webview'); diff --git a/chrome/test/data/extensions/platform_apps/web_view/speech/main.js b/chrome/test/data/extensions/platform_apps/web_view/speech/main.js index c56ea0b..8a89997 100644 --- a/chrome/test/data/extensions/platform_apps/web_view/speech/main.js +++ b/chrome/test/data/extensions/platform_apps/web_view/speech/main.js @@ -8,7 +8,7 @@ var startTest = function() { chrome.test.getConfig(function(config) { var guestURL = 'http://localhost:' + config.testServer.port + - '/files/extensions/platform_apps/web_view/speech/guest.html'; + '/extensions/platform_apps/web_view/speech/guest.html'; document.querySelector('#webview-tag-container').innerHTML = '<webview style="width: 10px; height: 10px; margin: 0; padding: 0;"' + ' src="' + guestURL + '"' + diff --git a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc index 7b78d9b..342f16f 100644 --- a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc +++ b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc @@ -733,7 +733,7 @@ scoped_ptr<net::test_server::HttpResponse> RedirectResponseHandler( scoped_ptr<net::test_server::BasicHttpResponse> http_response( new net::test_server::BasicHttpResponse); - http_response->set_code(net::test_server::MOVED); + http_response->set_code(net::HTTP_MOVED_PERMANENTLY); http_response->AddCustomHeader("Location", redirect_target.spec()); return http_response.PassAs<net::test_server::HttpResponse>(); } diff --git a/content/browser/loader/resource_dispatcher_host_browsertest.cc b/content/browser/loader/resource_dispatcher_host_browsertest.cc index f2f4433..b4370be 100644 --- a/content/browser/loader/resource_dispatcher_host_browsertest.cc +++ b/content/browser/loader/resource_dispatcher_host_browsertest.cc @@ -256,7 +256,7 @@ scoped_ptr<net::test_server::HttpResponse> NoContentResponseHandler( scoped_ptr<net::test_server::BasicHttpResponse> http_response( new net::test_server::BasicHttpResponse); - http_response->set_code(net::test_server::NO_CONTENT); + http_response->set_code(net::HTTP_NO_CONTENT); return http_response.PassAs<net::test_server::HttpResponse>(); } diff --git a/content/browser/session_history_browsertest.cc b/content/browser/session_history_browsertest.cc index e393645..6e2f3bf 100644 --- a/content/browser/session_history_browsertest.cc +++ b/content/browser/session_history_browsertest.cc @@ -33,7 +33,7 @@ scoped_ptr<net::test_server::HttpResponse> HandleEchoTitleRequest( scoped_ptr<net::test_server::BasicHttpResponse> http_response( new net::test_server::BasicHttpResponse); - http_response->set_code(net::test_server::SUCCESS); + http_response->set_code(net::HTTP_OK); http_response->set_content( base::StringPrintf( "<html><head><title>%s</title></head></html>", diff --git a/net/http/http_status_code.cc b/net/http/http_status_code.cc index 80d0265e..fb7261b 100644 --- a/net/http/http_status_code.cc +++ b/net/http/http_status_code.cc @@ -16,7 +16,7 @@ const char* GetHttpReasonPhrase(HttpStatusCode code) { #undef HTTP_STATUS default: - NOTREACHED(); + NOTREACHED() << "unknown HTTP status code " << code; } return ""; diff --git a/net/test/embedded_test_server/embedded_test_server.cc b/net/test/embedded_test_server/embedded_test_server.cc index bf55539..3b73545 100644 --- a/net/test/embedded_test_server/embedded_test_server.cc +++ b/net/test/embedded_test_server/embedded_test_server.cc @@ -25,6 +25,23 @@ namespace test_server { namespace { +class CustomHttpResponse : public HttpResponse { + public: + CustomHttpResponse(const std::string& headers, const std::string& contents) + : headers_(headers), contents_(contents) { + } + + virtual std::string ToResponseString() const OVERRIDE { + return headers_ + "\r\n" + contents_; + } + + private: + std::string headers_; + std::string contents_; + + DISALLOW_COPY_AND_ASSIGN(CustomHttpResponse); +}; + // Handles |request| by serving a file from under |server_root|. scoped_ptr<HttpResponse> HandleFileRequest( const base::FilePath& server_root, @@ -40,14 +57,26 @@ scoped_ptr<HttpResponse> HandleFileRequest( if (query_pos != std::string::npos) request_path = request_path.substr(0, query_pos); + base::FilePath file_path(server_root.AppendASCII(request_path)); std::string file_contents; - if (!file_util::ReadFileToString( - server_root.AppendASCII(request_path), &file_contents)) { + if (!file_util::ReadFileToString(file_path, &file_contents)) return scoped_ptr<HttpResponse>(); + + base::FilePath headers_path( + file_path.AddExtension(FILE_PATH_LITERAL("mock-http-headers"))); + + if (file_util::PathExists(headers_path)) { + std::string headers_contents; + if (!file_util::ReadFileToString(headers_path, &headers_contents)) + return scoped_ptr<HttpResponse>(NULL); + + scoped_ptr<CustomHttpResponse> http_response( + new CustomHttpResponse(headers_contents, file_contents)); + return http_response.PassAs<HttpResponse>(); } scoped_ptr<BasicHttpResponse> http_response(new BasicHttpResponse); - http_response->set_code(net::test_server::SUCCESS); + http_response->set_code(HTTP_OK); http_response->set_content(file_contents); return http_response.PassAs<HttpResponse>(); } @@ -168,7 +197,7 @@ void EmbeddedTestServer::HandleRequest(HttpConnection* connection, LOG(WARNING) << "Request not handled. Returning 404: " << request->relative_url; scoped_ptr<BasicHttpResponse> not_found_response(new BasicHttpResponse); - not_found_response->set_code(NOT_FOUND); + not_found_response->set_code(HTTP_NOT_FOUND); connection->SendResponse( not_found_response.PassAs<HttpResponse>()); } diff --git a/net/test/embedded_test_server/embedded_test_server_unittest.cc b/net/test/embedded_test_server/embedded_test_server_unittest.cc index cfdcab1..35d0fd4 100644 --- a/net/test/embedded_test_server/embedded_test_server_unittest.cc +++ b/net/test/embedded_test_server/embedded_test_server_unittest.cc @@ -85,7 +85,7 @@ class EmbeddedTestServerTest : public testing::Test, scoped_ptr<HttpResponse> HandleRequest(const std::string& path, const std::string& content, const std::string& content_type, - ResponseCode code, + HttpStatusCode code, const HttpRequest& request) { request_relative_url_ = request.relative_url; @@ -128,7 +128,7 @@ TEST_F(EmbeddedTestServerTest, RegisterRequestHandler) { "/test", "<b>Worked!</b>", "text/html", - SUCCESS)); + HTTP_OK)); scoped_ptr<URLFetcher> fetcher( URLFetcher::Create(server_->GetURL("/test?q=foo"), @@ -139,7 +139,7 @@ TEST_F(EmbeddedTestServerTest, RegisterRequestHandler) { WaitForResponses(1); EXPECT_EQ(URLRequestStatus::SUCCESS, fetcher->GetStatus().status()); - EXPECT_EQ(SUCCESS, fetcher->GetResponseCode()); + EXPECT_EQ(HTTP_OK, fetcher->GetResponseCode()); EXPECT_EQ("<b>Worked!</b>", GetContentFromFetcher(*fetcher)); EXPECT_EQ("text/html", GetContentTypeFromFetcher(*fetcher)); @@ -161,7 +161,7 @@ TEST_F(EmbeddedTestServerTest, ServeFilesFromDirectory) { WaitForResponses(1); EXPECT_EQ(URLRequestStatus::SUCCESS, fetcher->GetStatus().status()); - EXPECT_EQ(SUCCESS, fetcher->GetResponseCode()); + EXPECT_EQ(HTTP_OK, fetcher->GetResponseCode()); EXPECT_EQ("<p>Hello World!</p>", GetContentFromFetcher(*fetcher)); EXPECT_EQ("", GetContentTypeFromFetcher(*fetcher)); } @@ -176,7 +176,7 @@ TEST_F(EmbeddedTestServerTest, DefaultNotFoundResponse) { fetcher->Start(); WaitForResponses(1); EXPECT_EQ(URLRequestStatus::SUCCESS, fetcher->GetStatus().status()); - EXPECT_EQ(NOT_FOUND, fetcher->GetResponseCode()); + EXPECT_EQ(HTTP_NOT_FOUND, fetcher->GetResponseCode()); } TEST_F(EmbeddedTestServerTest, ConcurrentFetches) { @@ -186,21 +186,21 @@ TEST_F(EmbeddedTestServerTest, ConcurrentFetches) { "/test1", "Raspberry chocolate", "text/html", - SUCCESS)); + HTTP_OK)); server_->RegisterRequestHandler( base::Bind(&EmbeddedTestServerTest::HandleRequest, base::Unretained(this), "/test2", "Vanilla chocolate", "text/html", - SUCCESS)); + HTTP_OK)); server_->RegisterRequestHandler( base::Bind(&EmbeddedTestServerTest::HandleRequest, base::Unretained(this), "/test3", "No chocolates", "text/plain", - NOT_FOUND)); + HTTP_NOT_FOUND)); scoped_ptr<URLFetcher> fetcher1 = scoped_ptr<URLFetcher>( URLFetcher::Create(server_->GetURL("/test1"), @@ -225,17 +225,17 @@ TEST_F(EmbeddedTestServerTest, ConcurrentFetches) { WaitForResponses(3); EXPECT_EQ(URLRequestStatus::SUCCESS, fetcher1->GetStatus().status()); - EXPECT_EQ(SUCCESS, fetcher1->GetResponseCode()); + EXPECT_EQ(HTTP_OK, fetcher1->GetResponseCode()); EXPECT_EQ("Raspberry chocolate", GetContentFromFetcher(*fetcher1)); EXPECT_EQ("text/html", GetContentTypeFromFetcher(*fetcher1)); EXPECT_EQ(URLRequestStatus::SUCCESS, fetcher2->GetStatus().status()); - EXPECT_EQ(SUCCESS, fetcher2->GetResponseCode()); + EXPECT_EQ(HTTP_OK, fetcher2->GetResponseCode()); EXPECT_EQ("Vanilla chocolate", GetContentFromFetcher(*fetcher2)); EXPECT_EQ("text/html", GetContentTypeFromFetcher(*fetcher2)); EXPECT_EQ(URLRequestStatus::SUCCESS, fetcher3->GetStatus().status()); - EXPECT_EQ(NOT_FOUND, fetcher3->GetResponseCode()); + EXPECT_EQ(HTTP_NOT_FOUND, fetcher3->GetResponseCode()); EXPECT_EQ("No chocolates", GetContentFromFetcher(*fetcher3)); EXPECT_EQ("text/plain", GetContentTypeFromFetcher(*fetcher3)); } diff --git a/net/test/embedded_test_server/http_response.cc b/net/test/embedded_test_server/http_response.cc index 759c056..64bf3ec 100644 --- a/net/test/embedded_test_server/http_response.cc +++ b/net/test/embedded_test_server/http_response.cc @@ -7,6 +7,7 @@ #include "base/format_macros.h" #include "base/logging.h" #include "base/strings/stringprintf.h" +#include "net/http/http_status_code.h" namespace net { namespace test_server { @@ -14,7 +15,7 @@ namespace test_server { HttpResponse::~HttpResponse() { } -BasicHttpResponse::BasicHttpResponse() : code_(SUCCESS) { +BasicHttpResponse::BasicHttpResponse() : code_(HTTP_OK) { } BasicHttpResponse::~BasicHttpResponse() { @@ -24,23 +25,23 @@ std::string BasicHttpResponse::ToResponseString() const { // Response line with headers. std::string response_builder; + std::string http_reason_phrase(GetHttpReasonPhrase(code_)); + // TODO(mtomasz): For http/1.0 requests, send http/1.0. - // TODO(mtomasz): For different codes, send a corrent string instead of OK. - base::StringAppendF(&response_builder, "HTTP/1.1 %d OK\r\n", code_); - base::StringAppendF(&response_builder, "Connection: closed\r\n"); + base::StringAppendF(&response_builder, + "HTTP/1.1 %d %s\r\n", + code_, + http_reason_phrase.c_str()); + base::StringAppendF(&response_builder, "Connection: close\r\n"); base::StringAppendF(&response_builder, "Content-Length: %"PRIuS"\r\n", content_.size()); base::StringAppendF(&response_builder, "Content-Type: %s\r\n", content_type_.c_str()); - for (std::map<std::string, std::string>::const_iterator it = - custom_headers_.begin(); - it != custom_headers_.end(); - ++it) { - // Multi-line header value support. - const std::string& header_name = it->first; - const std::string& header_value = it->second; + for (size_t i = 0; i < custom_headers_.size(); ++i) { + const std::string& header_name = custom_headers_[i].first; + const std::string& header_value = custom_headers_[i].second; DCHECK(header_value.find_first_of("\n\r") == std::string::npos) << "Malformed header value."; base::StringAppendF(&response_builder, diff --git a/net/test/embedded_test_server/http_response.h b/net/test/embedded_test_server/http_response.h index 141c8cb..422a5255 100644 --- a/net/test/embedded_test_server/http_response.h +++ b/net/test/embedded_test_server/http_response.h @@ -7,24 +7,15 @@ #include <map> #include <string> +#include <vector> #include "base/basictypes.h" #include "base/compiler_specific.h" +#include "net/http/http_status_code.h" namespace net { namespace test_server { -enum ResponseCode { - SUCCESS = 200, - CREATED = 201, - NO_CONTENT = 204, - MOVED = 301, - RESUME_INCOMPLETE = 308, - NOT_FOUND = 404, - PRECONDITION = 412, - ACCESS_DENIED = 500, -}; - // Interface for HTTP response implementations. class HttpResponse{ public: @@ -44,8 +35,8 @@ class BasicHttpResponse : public HttpResponse { virtual ~BasicHttpResponse(); // The response code. - ResponseCode code() const { return code_; } - void set_code(ResponseCode code) { code_ = code; } + HttpStatusCode code() const { return code_; } + void set_code(HttpStatusCode code) { code_ = code; } // The content of the response. const std::string& content() const { return content_; } @@ -57,24 +48,19 @@ class BasicHttpResponse : public HttpResponse { content_type_ = content_type; } - // The custom headers to be sent to the client. - const std::map<std::string, std::string>& custom_headers() const { - return custom_headers_; - } - // Adds a custom header. void AddCustomHeader(const std::string& key, const std::string& value) { - custom_headers_[key] = value; + custom_headers_.push_back(std::make_pair(key, value)); } // Generates and returns a http response string. virtual std::string ToResponseString() const OVERRIDE; private: - ResponseCode code_; + HttpStatusCode code_; std::string content_; std::string content_type_; - std::map<std::string, std::string> custom_headers_; + std::vector<std::pair<std::string, std::string> > custom_headers_; DISALLOW_COPY_AND_ASSIGN(BasicHttpResponse); }; diff --git a/net/test/embedded_test_server/http_response_unittest.cc b/net/test/embedded_test_server/http_response_unittest.cc index 82f5112..83b767f 100644 --- a/net/test/embedded_test_server/http_response_unittest.cc +++ b/net/test/embedded_test_server/http_response_unittest.cc @@ -11,14 +11,14 @@ namespace test_server { TEST(HttpResponseTest, GenerateResponse) { BasicHttpResponse response; - response.set_code(SUCCESS); + response.set_code(HTTP_OK); response.set_content("Sample content - Hello world!"); response.set_content_type("text/plain"); response.AddCustomHeader("Simple-Header", "Simple value."); std::string kExpectedResponseString = "HTTP/1.1 200 OK\r\n" - "Connection: closed\r\n" + "Connection: close\r\n" "Content-Length: 29\r\n" "Content-Type: text/plain\r\n" "Simple-Header: Simple value.\r\n\r\n" |