diff options
Diffstat (limited to 'chrome/test')
-rw-r--r-- | chrome/test/automation/automation_proxy_uitest.cc | 8 | ||||
-rw-r--r-- | chrome/test/automation/dom_automation_browsertest.cc | 18 | ||||
-rw-r--r-- | chrome/test/data/file_client_redirect.html | 4 | ||||
-rw-r--r-- | chrome/test/in_process_browser_test.cc | 12 | ||||
-rw-r--r-- | chrome/test/in_process_browser_test.h | 10 | ||||
-rw-r--r-- | chrome/test/interactive_ui/infobars_uitest.cc | 12 | ||||
-rw-r--r-- | chrome/test/live_sync/live_sync_test.cc | 17 | ||||
-rw-r--r-- | chrome/test/live_sync/live_sync_test.h | 3 | ||||
-rw-r--r-- | chrome/test/ui/ppapi_uitest.cc | 10 |
9 files changed, 42 insertions, 52 deletions
diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc index 7f530bc..080f96a 100644 --- a/chrome/test/automation/automation_proxy_uitest.cc +++ b/chrome/test/automation/automation_proxy_uitest.cc @@ -968,10 +968,10 @@ TEST_F(ExternalTabUITest, FLAKY_TabPostMessage) { } TEST_F(ExternalTabUITest, FLAKY_PostMessageTarget) { - const wchar_t kDocRoot[] = L"chrome/test/data/external_tab"; - scoped_refptr<net::HTTPTestServer> server( - net::HTTPTestServer::CreateServer(kDocRoot)); - ASSERT_THAT(server.get(), testing::NotNull()); + net::TestServer test_server( + net::TestServer::TYPE_HTTP, + FilePath(FILE_PATH_LITERAL("chrome/test/data/external_tab"))); + ASSERT_TRUE(test_server.Start()); scoped_refptr<TabProxy> tab; TimedMessageLoopRunner loop(MessageLoop::current()); diff --git a/chrome/test/automation/dom_automation_browsertest.cc b/chrome/test/automation/dom_automation_browsertest.cc index dbaa1ef..48192c4 100644 --- a/chrome/test/automation/dom_automation_browsertest.cc +++ b/chrome/test/automation/dom_automation_browsertest.cc @@ -32,7 +32,7 @@ class DOMAutomationTest : public InProcessBrowserTest { typedef DOMElementProxy::By By; IN_PROC_BROWSER_TEST_F(DOMAutomationTest, FindByXPath) { - ASSERT_TRUE(StartHTTPServer()); + ASSERT_TRUE(test_server()->Start()); ui_test_utils::NavigateToURL(browser(), GetTestURL("find_elements/test.html")); DOMElementProxyRef main_doc = ui_test_utils::GetActiveDOMDocument(browser()); @@ -78,7 +78,7 @@ IN_PROC_BROWSER_TEST_F(DOMAutomationTest, FindByXPath) { } IN_PROC_BROWSER_TEST_F(DOMAutomationTest, FindBySelectors) { - ASSERT_TRUE(StartHTTPServer()); + ASSERT_TRUE(test_server()->Start()); ui_test_utils::NavigateToURL(browser(), GetTestURL("find_elements/test.html")); DOMElementProxyRef main_doc = ui_test_utils::GetActiveDOMDocument(browser()); @@ -122,7 +122,7 @@ IN_PROC_BROWSER_TEST_F(DOMAutomationTest, FindBySelectors) { } IN_PROC_BROWSER_TEST_F(DOMAutomationTest, FindByText) { - ASSERT_TRUE(StartHTTPServer()); + ASSERT_TRUE(test_server()->Start()); ui_test_utils::NavigateToURL(browser(), GetTestURL("find_elements/test.html")); DOMElementProxyRef main_doc = ui_test_utils::GetActiveDOMDocument(browser()); @@ -170,7 +170,7 @@ IN_PROC_BROWSER_TEST_F(DOMAutomationTest, FindByText) { } IN_PROC_BROWSER_TEST_F(DOMAutomationTest, WaitFor1VisibleElement) { - ASSERT_TRUE(StartHTTPServer()); + ASSERT_TRUE(test_server()->Start()); ui_test_utils::NavigateToURL(browser(), GetTestURL("wait/test.html")); DOMElementProxyRef main_doc = ui_test_utils::GetActiveDOMDocument(browser()); @@ -181,7 +181,7 @@ IN_PROC_BROWSER_TEST_F(DOMAutomationTest, WaitFor1VisibleElement) { } IN_PROC_BROWSER_TEST_F(DOMAutomationTest, WaitForElementsToDisappear) { - ASSERT_TRUE(StartHTTPServer()); + ASSERT_TRUE(test_server()->Start()); ui_test_utils::NavigateToURL(browser(), GetTestURL("wait/test.html")); DOMElementProxyRef main_doc = ui_test_utils::GetActiveDOMDocument(browser()); @@ -192,7 +192,7 @@ IN_PROC_BROWSER_TEST_F(DOMAutomationTest, WaitForElementsToDisappear) { } IN_PROC_BROWSER_TEST_F(DOMAutomationTest, EnsureAttributeEventuallyMatches) { - ASSERT_TRUE(StartHTTPServer()); + ASSERT_TRUE(test_server()->Start()); ui_test_utils::NavigateToURL(browser(), GetTestURL("wait/test.html")); DOMElementProxyRef main_doc = ui_test_utils::GetActiveDOMDocument(browser()); @@ -203,7 +203,7 @@ IN_PROC_BROWSER_TEST_F(DOMAutomationTest, EnsureAttributeEventuallyMatches) { } IN_PROC_BROWSER_TEST_F(DOMAutomationTest, Frames) { - ASSERT_TRUE(StartHTTPServer()); + ASSERT_TRUE(test_server()->Start()); ui_test_utils::NavigateToURL(browser(), GetTestURL("frames/test.html")); DOMElementProxyRef main_doc = ui_test_utils::GetActiveDOMDocument(browser()); @@ -243,7 +243,7 @@ IN_PROC_BROWSER_TEST_F(DOMAutomationTest, Frames) { } IN_PROC_BROWSER_TEST_F(DOMAutomationTest, Events) { - ASSERT_TRUE(StartHTTPServer()); + ASSERT_TRUE(test_server()->Start()); ui_test_utils::NavigateToURL(browser(), GetTestURL("events/test.html")); DOMElementProxyRef main_doc = ui_test_utils::GetActiveDOMDocument(browser()); @@ -271,7 +271,7 @@ IN_PROC_BROWSER_TEST_F(DOMAutomationTest, Events) { } IN_PROC_BROWSER_TEST_F(DOMAutomationTest, StringEscape) { - ASSERT_TRUE(StartHTTPServer()); + ASSERT_TRUE(test_server()->Start()); ui_test_utils::NavigateToURL(browser(), GetTestURL("string_escape/test.html")); DOMElementProxyRef main_doc = ui_test_utils::GetActiveDOMDocument(browser()); diff --git a/chrome/test/data/file_client_redirect.html b/chrome/test/data/file_client_redirect.html index 61dc261..90ec0e8 100644 --- a/chrome/test/data/file_client_redirect.html +++ b/chrome/test/data/file_client_redirect.html @@ -1,8 +1,8 @@ <!-- -Test file for empty referrer client redirects, e.g https>http, file>http. +Test file for empty referrer client redirects, e.g https>http, file>http. See ClientEmptyReferrerRedirectTest in redirect_uitest.cc --> <html> <head></head> -<body onload="document.location='http://localhost:1337'"></body> +<body onload="document.location='http://127.0.0.1:1337'"></body> </html> diff --git a/chrome/test/in_process_browser_test.cc b/chrome/test/in_process_browser_test.cc index 4761c0a..9fc2544 100644 --- a/chrome/test/in_process_browser_test.cc +++ b/chrome/test/in_process_browser_test.cc @@ -78,6 +78,8 @@ const int kSubsequentTimeoutInMS = 5000; InProcessBrowserTest::InProcessBrowserTest() : browser_(NULL), + test_server_(net::TestServer::TYPE_HTTP, + FilePath(FILE_PATH_LITERAL("chrome/test/data"))), show_window_(false), dom_automation_enabled_(false), tab_closeable_state_watcher_enabled_(false), @@ -237,13 +239,6 @@ void InProcessBrowserTest::TearDown() { RenderProcessHost::set_run_renderer_in_process(original_single_process_); } -net::HTTPTestServer* InProcessBrowserTest::StartHTTPServer() { - DCHECK(!http_server_.get()); - http_server_ = net::HTTPTestServer::CreateServer( - L"chrome/test/data"); - return http_server_.get(); -} - // Creates a browser with a single tab (about:blank), waits for the tab to // finish loading and shows the browser. Browser* InProcessBrowserTest::CreateBrowser(Profile* profile) { @@ -312,9 +307,6 @@ void InProcessBrowserTest::RunTestOnMainThreadLoop() { QuitBrowsers(); pool.Recycle(); - - // Stop the HTTP server. - http_server_ = NULL; } void InProcessBrowserTest::QuitBrowsers() { diff --git a/chrome/test/in_process_browser_test.h b/chrome/test/in_process_browser_test.h index eef6c94..0af1877 100644 --- a/chrome/test/in_process_browser_test.h +++ b/chrome/test/in_process_browser_test.h @@ -9,6 +9,7 @@ #include "base/compiler_specific.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" +#include "net/test/test_server.h" #include "testing/gtest/include/gtest/gtest.h" class Browser; @@ -16,7 +17,6 @@ class CommandLine; class Profile; namespace net { -class HTTPTestServer; class RuleBasedHostResolverProc; } @@ -101,8 +101,8 @@ class InProcessBrowserTest : public testing::Test { // Sets Initial Timeout value. void SetInitialTimeoutInMS(int initial_timeout); - // Starts an HTTP server. - net::HTTPTestServer* StartHTTPServer() WARN_UNUSED_RESULT; + // Returns the testing server. Guaranteed to be non-NULL. + net::TestServer* test_server() { return &test_server_; } // Creates a browser with a single tab (about:blank), waits for the tab to // finish loading and shows the browser. @@ -136,8 +136,8 @@ class InProcessBrowserTest : public testing::Test { // Browser created from CreateBrowser. Browser* browser_; - // HTTPServer, created when StartHTTPServer is invoked. - scoped_refptr<net::HTTPTestServer> http_server_; + // Testing server, started on demand. + net::TestServer test_server_; // Whether this test requires the browser windows to be shown (interactive // tests for example need the windows shown). diff --git a/chrome/test/interactive_ui/infobars_uitest.cc b/chrome/test/interactive_ui/infobars_uitest.cc index a57ef58..34d1bda 100644 --- a/chrome/test/interactive_ui/infobars_uitest.cc +++ b/chrome/test/interactive_ui/infobars_uitest.cc @@ -16,17 +16,17 @@ class InfoBarsUITest : public UITest { }; TEST_F(InfoBarsUITest, TestInfoBarsCloseOnNewTheme) { - const wchar_t kDocRoot[] = L"chrome/test/data"; - scoped_refptr<net::HTTPTestServer> server( - net::HTTPTestServer::CreateServer(kDocRoot)); - ASSERT_TRUE(server.get() != NULL); + net::TestServer test_server(net::TestServer::TYPE_HTTP, + FilePath(FILE_PATH_LITERAL("chrome/test/data"))); + ASSERT_TRUE(test_server.Start()); + scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); ASSERT_TRUE(browser.get()); scoped_refptr<TabProxy> tab_1(browser->GetActiveTab()); ASSERT_TRUE(tab_1.get()); EXPECT_TRUE(tab_1->NavigateToURL( - server->TestServerPage("files/simple.html"))); + test_server.GetURL("files/simple.html"))); scoped_refptr<ExtensionProxy> theme = automation()->InstallExtension( test_data_directory_.AppendASCII("extensions").AppendASCII("theme.crx"), true); @@ -34,7 +34,7 @@ TEST_F(InfoBarsUITest, TestInfoBarsCloseOnNewTheme) { EXPECT_TRUE(tab_1->WaitForInfoBarCount(1, action_max_timeout_ms())); EXPECT_TRUE(browser->AppendTab( - server->TestServerPage("files/simple.html"))); + test_server.GetURL("files/simple.html"))); WaitUntilTabCount(2); scoped_refptr<TabProxy> tab_2(browser->GetActiveTab()); ASSERT_TRUE(tab_2.get()); diff --git a/chrome/test/live_sync/live_sync_test.cc b/chrome/test/live_sync/live_sync_test.cc index e09573b..8297006 100644 --- a/chrome/test/live_sync/live_sync_test.cc +++ b/chrome/test/live_sync/live_sync_test.cc @@ -240,22 +240,19 @@ void LiveSyncTest::TearDownInProcessBrowserTestFixture() { } void LiveSyncTest::SetUpLocalTestServer() { - bool success = server_.Start(net::TestServerLauncher::ProtoHTTP, - server_.kHostName, server_.kOKHTTPSPort, - FilePath(), FilePath(), std::wstring()); - ASSERT_TRUE(success); + ASSERT_TRUE(test_server_.Start()); started_local_test_server_ = true; CommandLine* cl = CommandLine::ForCurrentProcess(); cl->AppendSwitchASCII(switches::kSyncServiceURL, - StringPrintf("http://%s:%d/chromiumsync", server_.kHostName, - server_.kOKHTTPSPort)); + StringPrintf("http://%s:%d/chromiumsync", + test_server_.host_port_pair().host().c_str(), + test_server_.host_port_pair().port())); } void LiveSyncTest::TearDownLocalTestServer() { - bool success = server_.Stop(); - ASSERT_TRUE(success); + ASSERT_TRUE(test_server_.Stop()); } @@ -295,8 +292,8 @@ void LiveSyncTest::SetProxyConfig(URLRequestContextGetter* context_getter, bool LiveSyncTest::ConfigureSyncServer(const std::string& name, const std::string& value) { std::string url = StringPrintf("http://%s:%d/chromiumsync/configure", - server_.kHostName, - server_.kOKHTTPSPort); + test_server_.host_port_pair().host().c_str(), + test_server_.host_port_pair().port()); std::string data = EscapePath(name) + "=" + EscapePath(value); ConfigureURLFectcherDelegate delegate; scoped_ptr<URLFetcher> fetcher( diff --git a/chrome/test/live_sync/live_sync_test.h b/chrome/test/live_sync/live_sync_test.h index 0026251..134b200 100644 --- a/chrome/test/live_sync/live_sync_test.h +++ b/chrome/test/live_sync/live_sync_test.h @@ -60,6 +60,7 @@ class LiveSyncTest : public InProcessBrowserTest { explicit LiveSyncTest(TestType test_type) : test_type_(test_type), num_clients_(-1), + test_server_(net::TestServer::TYPE_HTTP, FilePath()), started_local_test_server_(false) { InProcessBrowserTest::set_show_window(true); InProcessBrowserTest::SetInitialTimeoutInMS(kTestTimeoutInMS); @@ -195,7 +196,7 @@ class LiveSyncTest : public InProcessBrowserTest { scoped_ptr<Profile> verifier_; // Local instance of python sync server. - net::TestServerLauncher server_; + net::TestServer test_server_; // Keeps track of whether a local python sync server was used for a test. bool started_local_test_server_; diff --git a/chrome/test/ui/ppapi_uitest.cc b/chrome/test/ui/ppapi_uitest.cc index b190a26..cdad677 100644 --- a/chrome/test/ui/ppapi_uitest.cc +++ b/chrome/test/ui/ppapi_uitest.cc @@ -68,11 +68,11 @@ class PPAPITest : public UITest { } void RunTestViaHTTP(const std::string& test_case) { - const wchar_t kDocRoot[] = L"third_party/ppapi/tests"; - scoped_refptr<net::HTTPTestServer> server( - net::HTTPTestServer::CreateServer(kDocRoot)); - ASSERT_TRUE(server); - RunTestURL(server->TestServerPage("files/test_case.html?" + test_case)); + net::TestServer test_server( + net::TestServer::TYPE_HTTP, + FilePath(FILE_PATH_LITERAL("third_party/ppapi/tests"))); + ASSERT_TRUE(test_server.Start()); + RunTestURL(test_server.GetURL("files/test_case.html?" + test_case)); } private: |