diff options
author | paulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-16 02:57:22 +0000 |
---|---|---|
committer | paulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-16 02:57:22 +0000 |
commit | 7fb087e0800d0faaa31e4a029ad6813f251b4848 (patch) | |
tree | 2076a41c5df464dda2709950cde1c4b4786280ed /chrome/browser | |
parent | f643bc141744031f1e3b304f753dd3837e6600eb (diff) | |
download | chromium_src-7fb087e0800d0faaa31e4a029ad6813f251b4848.zip chromium_src-7fb087e0800d0faaa31e4a029ad6813f251b4848.tar.gz chromium_src-7fb087e0800d0faaa31e4a029ad6813f251b4848.tar.bz2 |
Remove timeout constants from ui_tests. All tests will now
use accessors for various timeouts which can be set (via
command line parameters) to values appropriate to the test
environment, such as longer timeouts when running under purify.
Review URL: http://codereview.chromium.org/18109
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8164 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/browser_uitest.cc | 4 | ||||
-rw-r--r-- | chrome/browser/download/save_page_uitest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/errorpage_uitest.cc | 4 | ||||
-rw-r--r-- | chrome/browser/history/redirect_uitest.cc | 8 | ||||
-rw-r--r-- | chrome/browser/iframe_uitest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/images_uitest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc | 12 | ||||
-rw-r--r-- | chrome/browser/tab_contents/view_source_uitest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/tab_restore_uitest.cc | 36 |
9 files changed, 36 insertions, 36 deletions
diff --git a/chrome/browser/browser_uitest.cc b/chrome/browser/browser_uitest.cc index 4574c17..188725a 100644 --- a/chrome/browser/browser_uitest.cc +++ b/chrome/browser/browser_uitest.cc @@ -65,7 +65,7 @@ TEST_F(BrowserTest, NoTitle) { file_util::AppendToPath(&test_file, L"title1.html"); NavigateToURL(net::FilePathToFileURL(test_file)); - Sleep(kWaitForActionMsec); // The browser lazily updates the title. + Sleep(sleep_timeout_ms()); // The browser lazily updates the title. EXPECT_EQ(WindowCaptionFromPageTitle(L"title1.html"), GetWindowTitle()); EXPECT_EQ(L"title1.html", GetActiveTabTitle()); @@ -78,7 +78,7 @@ TEST_F(BrowserTest, Title) { file_util::AppendToPath(&test_file, L"title2.html"); NavigateToURL(net::FilePathToFileURL(test_file)); - Sleep(kWaitForActionMsec); // The browser lazily updates the title. + Sleep(sleep_timeout_ms()); // The browser lazily updates the title. const std::wstring test_title(L"Title Of Awesomeness"); EXPECT_EQ(WindowCaptionFromPageTitle(test_title), GetWindowTitle()); diff --git a/chrome/browser/download/save_page_uitest.cc b/chrome/browser/download/save_page_uitest.cc index be422f8..6531267 100644 --- a/chrome/browser/download/save_page_uitest.cc +++ b/chrome/browser/download/save_page_uitest.cc @@ -29,7 +29,7 @@ class SavePageTest : public UITest { exist = true; break; } - Sleep(kWaitForActionMaxMsec / 20); + Sleep(sleep_timeout_ms()); } EXPECT_TRUE(exist); diff --git a/chrome/browser/errorpage_uitest.cc b/chrome/browser/errorpage_uitest.cc index a071fb2..78939498 100644 --- a/chrome/browser/errorpage_uitest.cc +++ b/chrome/browser/errorpage_uitest.cc @@ -20,7 +20,7 @@ TEST_F(ErrorPageTest, DNSError) { int i; std::wstring title; for (i = 0; i < 10; ++i) { - Sleep(kWaitForActionMaxMsec / 10); + Sleep(sleep_timeout_ms()); title = GetActiveTabTitle(); if (title.find(test_host) != std::wstring::npos) { // Success, bail out. @@ -49,7 +49,7 @@ TEST_F(ErrorPageTest, IFrame404) { int i; std::wstring title; for (i = 0; i < 10; ++i) { - Sleep(kWaitForActionMaxMsec / 10); + Sleep(sleep_timeout_ms()); title = GetActiveTabTitle(); if (title == L"SUCCESS") { // Success, bail out. diff --git a/chrome/browser/history/redirect_uitest.cc b/chrome/browser/history/redirect_uitest.cc index 4002500..e9f7c0b 100644 --- a/chrome/browser/history/redirect_uitest.cc +++ b/chrome/browser/history/redirect_uitest.cc @@ -92,7 +92,7 @@ TEST_F(RedirectTest, ClientEmptyReferer) { // loads the html file on disk, rather than just getting a response from // the TestServer. for (int i = 0; i < 10; ++i) { - Sleep(kWaitForActionMaxMsec / 10); + Sleep(sleep_timeout_ms()); scoped_ptr<TabProxy> tab_proxy(GetActiveTab()); ASSERT_TRUE(tab_proxy.get()); ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects)); @@ -160,7 +160,7 @@ TEST_F(RedirectTest, DISABLED_ClientServerServer) { NavigateToURL(first_url); for (int i = 0; i < 10; ++i) { - Sleep(kWaitForActionMaxMsec / 10); + Sleep(sleep_timeout_ms()); scoped_ptr<TabProxy> tab_proxy(GetActiveTab()); ASSERT_TRUE(tab_proxy.get()); ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects)); @@ -231,7 +231,7 @@ TEST_F(RedirectTest, ClientFragments) { NavigateToURL(first_url); for (int i = 0; i < 10; ++i) { - Sleep(kWaitForActionMaxMsec / 10); + Sleep(sleep_timeout_ms()); scoped_ptr<TabProxy> tab_proxy(GetActiveTab()); ASSERT_TRUE(tab_proxy.get()); ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects)); @@ -279,7 +279,7 @@ TEST_F(RedirectTest, std::wstring final_url_title = L"Title Of Awesomeness"; // Wait till the final page has been loaded. for (int i = 0; i < 10; ++i) { - Sleep(kWaitForActionMaxMsec / 10); + Sleep(sleep_timeout_ms()); scoped_ptr<TabProxy> tab_proxy(GetActiveTab()); ASSERT_TRUE(tab_proxy.get()); ASSERT_TRUE(tab_proxy->GetTabTitle(&tab_title)); diff --git a/chrome/browser/iframe_uitest.cc b/chrome/browser/iframe_uitest.cc index fb36a86..05c8d7de 100644 --- a/chrome/browser/iframe_uitest.cc +++ b/chrome/browser/iframe_uitest.cc @@ -14,7 +14,7 @@ class IFrameTest : public UITest { file_util::AppendToPath(&test_file, url); NavigateToURL(net::FilePathToFileURL(test_file)); - Sleep(kWaitForActionMsec); // The browser lazily updates the title. + Sleep(sleep_timeout_ms()); // The browser lazily updates the title. // Make sure the navigation succeeded. EXPECT_EQ(std::wstring(page_title), GetActiveTabTitle()); diff --git a/chrome/browser/images_uitest.cc b/chrome/browser/images_uitest.cc index 6cb03db..cfe0938 100644 --- a/chrome/browser/images_uitest.cc +++ b/chrome/browser/images_uitest.cc @@ -19,7 +19,7 @@ TEST_F(ImagesTest, AnimatedGIFs) { // Let the GIFs fully animate. for (int i = 0; i < 10; ++i) { - Sleep(kWaitForActionMaxMsec / 10); + Sleep(sleep_timeout_ms()); if (page_title == GetActiveTabTitle()) break; } diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc index 350e544..0ff6044 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc @@ -65,7 +65,7 @@ TEST_F(ResourceDispatcherTest, DoNotSniffHTMLFromImageGIF) { TEST_F(ResourceDispatcherTest, SniffNoContentTypeNoData) { CheckTitleTest(L"content-sniffer-test3.html", L"Content Sniffer Test 3"); - Sleep(kWaitForActionMaxMsec / 2); + Sleep(sleep_timeout_ms() * 2); EXPECT_EQ(1, GetTabCount()); // Make sure the download shelf is not showing. @@ -132,7 +132,7 @@ TEST_F(ResourceDispatcherTest, SyncXMLHttpRequestDuringUnload) { // (the bug would make this step hang the renderer). bool timed_out = false; tab->NavigateToURLWithTimeout(server->TestServerPageW(L"files/title2.html"), - kWaitForActionMaxMsec, + action_max_timeout_ms(), &timed_out); EXPECT_FALSE(timed_out); @@ -190,7 +190,7 @@ TEST_F(ResourceDispatcherTest, CrossSiteAfterCrash) { // Cause the renderer to crash. expected_crashes_ = 1; tab->NavigateToURLAsync(GURL("about:crash")); - Sleep(kWaitForActionMsec); // Wait for browser to notice the renderer crash. + Sleep(sleep_timeout_ms()); // Wait for browser to notice the renderer crash. // Navigate to a new cross-site page. The browser should not wait around for // the old renderer's on{before}unload handlers to run. @@ -215,7 +215,7 @@ TEST_F(ResourceDispatcherTest, CrossSiteNavigationNonBuffered) { file_util::AppendToPath(&test_file, L"title2.html"); bool timed_out = false; tab->NavigateToURLWithTimeout(net::FilePathToFileURL(test_file), - kWaitForActionMaxMsec, + action_max_timeout_ms(), &timed_out); EXPECT_FALSE(timed_out); EXPECT_EQ(L"Title Of Awesomeness", GetActiveTabTitle()); @@ -248,7 +248,7 @@ TEST_F(ResourceDispatcherTest, CrossSiteNavigationErrorPage) { // reason as ErrorPageTest::DNSError. See bug 1199491. tab->NavigateToURL(GURL(URLRequestFailedDnsJob::kTestUrl)); for (int i = 0; i < 10; ++i) { - Sleep(kWaitForActionMaxMsec / 10); + Sleep(sleep_timeout_ms()); if (GetActiveTabTitle() != L"set cookie on unload") { // Success, bail out. break; @@ -272,7 +272,7 @@ TEST_F(ResourceDispatcherTest, CrossSiteNavigationErrorPage) { std::wstring redirect_url = L"javascript:window.location='" + ASCIIToWide(test_url.possibly_invalid_spec()) + L"'"; tab->NavigateToURLAsync(GURL(redirect_url)); - Sleep(kWaitForActionMsec); // Wait for JavaScript redirect to happen. + Sleep(sleep_timeout_ms()); // Wait for JavaScript redirect to happen. EXPECT_TRUE(tab->GetTabTitle(&tab_title)); EXPECT_EQ(L"Title Of Awesomeness", tab_title); } diff --git a/chrome/browser/tab_contents/view_source_uitest.cc b/chrome/browser/tab_contents/view_source_uitest.cc index 73cc875..1cc19c6 100644 --- a/chrome/browser/tab_contents/view_source_uitest.cc +++ b/chrome/browser/tab_contents/view_source_uitest.cc @@ -49,7 +49,7 @@ TEST_F(ViewSourceTest, DoesBrowserRenderInViewSource) { url = GURL("view-source:" + url.spec()); scoped_ptr<TabProxy> tab(GetActiveTab()); tab->NavigateToURL(url); - Sleep(kWaitForActionMsec); + Sleep(sleep_timeout_ms()); // Try to retrieve the cookie that the page sets // It should not be there (because we are in view-source mode diff --git a/chrome/browser/tab_restore_uitest.cc b/chrome/browser/tab_restore_uitest.cc index ad32b9d..48aea5a 100644 --- a/chrome/browser/tab_restore_uitest.cc +++ b/chrome/browser/tab_restore_uitest.cc @@ -69,7 +69,7 @@ TEST_F(TabRestoreUITest, Basic) { int new_tab_count; ASSERT_TRUE(browser_proxy->WaitForTabCountToChange(initial_tab_count, &new_tab_count, - 5000)); + action_max_timeout_ms())); scoped_ptr<TabProxy> new_tab(browser_proxy->GetTab(new_tab_count - 1)); // Make sure we're at url. new_tab->NavigateToURL(url1_); @@ -106,13 +106,13 @@ TEST_F(TabRestoreUITest, RestoreToDifferentWindow) { // Create a new browser. ASSERT_TRUE(automation()->OpenNewBrowserWindow(SW_HIDE)); - ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, - kWaitForActionMaxMsec)); + ASSERT_TRUE(automation()->WaitForWindowCountToBecome( + 2, action_max_timeout_ms())); // Close the first browser. EXPECT_TRUE(tab_proxy->Close(true)); - ASSERT_TRUE(automation()->WaitForWindowCountToBecome(1, - kWaitForActionMaxMsec)); + ASSERT_TRUE(automation()->WaitForWindowCountToBecome( + 1, action_max_timeout_ms())); // Tab and browser are no longer valid. tab_proxy.reset(); @@ -147,7 +147,7 @@ TEST_F(TabRestoreUITest, RestoreWithExistingSiteInstance) { int new_tab_count; ASSERT_TRUE(browser_proxy->WaitForTabCountToChange(initial_tab_count, &new_tab_count, - 5000)); + action_max_timeout_ms())); scoped_ptr<TabProxy> tab(browser_proxy->GetTab(new_tab_count - 1)); // Navigate to another same-site URL. @@ -192,7 +192,7 @@ TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) { int new_tab_count; ASSERT_TRUE(browser_proxy->WaitForTabCountToChange(initial_tab_count, &new_tab_count, - 5000)); + action_max_timeout_ms())); scoped_ptr<TabProxy> tab(browser_proxy->GetTab(new_tab_count - 1)); // Navigate to more URLs, then a cross-site URL. @@ -230,8 +230,8 @@ TEST_F(TabRestoreUITest, RestoreWindow) { int window_count; ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); ASSERT_TRUE(automation()->OpenNewBrowserWindow(SW_HIDE)); - ASSERT_TRUE(automation()->WaitForWindowCountToBecome(++window_count, - kWaitForActionMaxMsec)); + ASSERT_TRUE(automation()->WaitForWindowCountToBecome( + ++window_count, action_max_timeout_ms())); // Create two more tabs, one with url1, the other url2. scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); @@ -239,12 +239,12 @@ TEST_F(TabRestoreUITest, RestoreWindow) { ASSERT_TRUE(browser_proxy->GetTabCount(&initial_tab_count)); browser_proxy->AppendTab(url1_); ASSERT_TRUE(browser_proxy->WaitForTabCountToBecome(initial_tab_count + 1, - kWaitForActionMaxMsec)); + action_max_timeout_ms())); scoped_ptr<TabProxy> new_tab(browser_proxy->GetTab(initial_tab_count)); new_tab->NavigateToURL(url1_); browser_proxy->AppendTab(url2_); ASSERT_TRUE(browser_proxy->WaitForTabCountToBecome(initial_tab_count + 2, - kWaitForActionMaxMsec)); + action_max_timeout_ms())); new_tab.reset(browser_proxy->GetTab(initial_tab_count + 1)); new_tab->NavigateToURL(url2_); @@ -252,29 +252,29 @@ TEST_F(TabRestoreUITest, RestoreWindow) { ASSERT_TRUE(browser_proxy->ApplyAccelerator(IDC_CLOSE_WINDOW)); browser_proxy.reset(); new_tab.reset(); - ASSERT_TRUE(automation()->WaitForWindowCountToBecome(window_count - 1, - kWaitForActionMaxMsec)); + ASSERT_TRUE(automation()->WaitForWindowCountToBecome( + window_count - 1, action_max_timeout_ms())); // Restore the window. browser_proxy.reset(automation()->GetBrowserWindow(0)); ASSERT_TRUE(browser_proxy->ApplyAccelerator(IDC_RESTORE_TAB)); - ASSERT_TRUE(automation()->WaitForWindowCountToBecome(window_count, - kWaitForActionMaxMsec)); + ASSERT_TRUE(automation()->WaitForWindowCountToBecome( + window_count, action_max_timeout_ms())); browser_proxy.reset(automation()->GetBrowserWindow(1)); ASSERT_TRUE(browser_proxy->WaitForTabCountToBecome(initial_tab_count + 2, - kWaitForActionMaxMsec)); + action_max_timeout_ms())); scoped_ptr<TabProxy> restored_tab_proxy( browser_proxy->GetTab(initial_tab_count)); - ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(kWaitForActionMsec)); + ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(action_timeout_ms())); GURL url; ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); ASSERT_TRUE(url == url1_); restored_tab_proxy.reset( browser_proxy->GetTab(initial_tab_count + 1)); - ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(kWaitForActionMsec)); + ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(action_timeout_ms())); ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); ASSERT_TRUE(url == url2_); } |