summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser_uitest.cc4
-rw-r--r--chrome/browser/download/save_page_uitest.cc2
-rw-r--r--chrome/browser/errorpage_uitest.cc4
-rw-r--r--chrome/browser/history/redirect_uitest.cc8
-rw-r--r--chrome/browser/iframe_uitest.cc2
-rw-r--r--chrome/browser/images_uitest.cc2
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc12
-rw-r--r--chrome/browser/tab_contents/view_source_uitest.cc2
-rw-r--r--chrome/browser/tab_restore_uitest.cc36
-rw-r--r--chrome/test/accessibility/accessibility_tests.cc32
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_tests.cc42
-rw-r--r--chrome/test/automation/automation_proxy_uitest.cc4
-rw-r--r--chrome/test/reliability/page_load_test.cc8
-rw-r--r--chrome/test/ui/ui_test.cc14
-rw-r--r--chrome/test/ui/ui_test.h16
15 files changed, 94 insertions, 94 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_);
}
diff --git a/chrome/test/accessibility/accessibility_tests.cc b/chrome/test/accessibility/accessibility_tests.cc
index bff3296..6b83812 100644
--- a/chrome/test/accessibility/accessibility_tests.cc
+++ b/chrome/test/accessibility/accessibility_tests.cc
@@ -151,7 +151,7 @@ TEST_F(AccessibilityTest, TestBackBtnStatusOnNewTab) {
std::wstring test_file1 = test_data_directory_;
file_util::AppendToPath(&test_file1, L"title1.html");
tab1->NavigateToURL(net::FilePathToFileURL(test_file1));
- Sleep(kWaitForActionMsec);
+ Sleep(sleep_timeout_ms());
if (win_util::GetWinVersion() > win_util::WINVERSION_2000) {
EXPECT_EQ(STATE_SYSTEM_HASPOPUP | STATE_SYSTEM_FOCUSABLE,
GetState(acc_obj));
@@ -160,7 +160,7 @@ TEST_F(AccessibilityTest, TestBackBtnStatusOnNewTab) {
}
// Go Back and check status.
window->ApplyAccelerator(IDC_BACK);
- Sleep(kWaitForActionMsec);
+ Sleep(sleep_timeout_ms());
if (win_util::GetWinVersion() > win_util::WINVERSION_2000) {
EXPECT_EQ(STATE_SYSTEM_HASPOPUP |
STATE_SYSTEM_FOCUSABLE |
@@ -175,7 +175,7 @@ TEST_F(AccessibilityTest, TestBackBtnStatusOnNewTab) {
ASSERT_TRUE(window->GetTabCount(&old_tab_count));
ASSERT_TRUE(window->ApplyAccelerator(IDC_NEW_TAB));
ASSERT_TRUE(window->WaitForTabCountToChange(old_tab_count, &new_tab_count,
- kWaitForActionMsec * 5));
+ action_max_timeout_ms()));
// Check tab count. Also, check accessibility object's children.
ASSERT_GE(new_tab_count, old_tab_count);
if (win_util::GetWinVersion() > win_util::WINVERSION_2000) {
@@ -194,10 +194,10 @@ TEST_F(AccessibilityTest, TestBackBtnStatusOnNewTab) {
file_util::AppendToPath(&test_file2, L"title1.html");
ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(test_file2)));
ASSERT_TRUE(window->WaitForTabCountToChange(old_tab_count, &new_tab_count,
- kWaitForActionMsec * 5));
+ action_max_timeout_ms()));
// Check tab count. Also, check accessibility object's children.
ASSERT_GE(new_tab_count, old_tab_count);
- Sleep(kWaitForActionMsec);
+ Sleep(sleep_timeout_ms());
if (win_util::GetWinVersion() > win_util::WINVERSION_2000) {
EXPECT_EQ(STATE_SYSTEM_HASPOPUP |
STATE_SYSTEM_FOCUSABLE |
@@ -276,7 +276,7 @@ TEST_F(AccessibilityTest, TestForwardBtnStatusOnNewTab) {
std::wstring test_file1 = test_data_directory_;
file_util::AppendToPath(&test_file1, L"title1.html");
tab1->NavigateToURL(net::FilePathToFileURL(test_file1));
- Sleep(kWaitForActionMsec);
+ Sleep(sleep_timeout_ms());
if (win_util::GetWinVersion() > win_util::WINVERSION_2000) {
EXPECT_EQ(STATE_SYSTEM_HASPOPUP |
STATE_SYSTEM_FOCUSABLE |
@@ -288,7 +288,7 @@ TEST_F(AccessibilityTest, TestForwardBtnStatusOnNewTab) {
}
// Go Back and check status.
window->ApplyAccelerator(IDC_BACK);
- Sleep(kWaitForActionMsec);
+ Sleep(sleep_timeout_ms());
if (win_util::GetWinVersion() > win_util::WINVERSION_2000) {
EXPECT_EQ(STATE_SYSTEM_HASPOPUP | STATE_SYSTEM_FOCUSABLE,
GetState(acc_obj));
@@ -297,7 +297,7 @@ TEST_F(AccessibilityTest, TestForwardBtnStatusOnNewTab) {
}
// Go Forward and check status.
window->ApplyAccelerator(IDC_FORWARD);
- Sleep(kWaitForActionMsec);
+ Sleep(sleep_timeout_ms());
if (win_util::GetWinVersion() > win_util::WINVERSION_2000) {
EXPECT_EQ(STATE_SYSTEM_HASPOPUP |
STATE_SYSTEM_FOCUSABLE |
@@ -312,7 +312,7 @@ TEST_F(AccessibilityTest, TestForwardBtnStatusOnNewTab) {
ASSERT_TRUE(window->GetTabCount(&old_tab_count));
ASSERT_TRUE(window->ApplyAccelerator(IDC_NEW_TAB));
ASSERT_TRUE(window->WaitForTabCountToChange(old_tab_count, &new_tab_count,
- kWaitForActionMsec * 5));
+ action_max_timeout_ms()));
// Check tab count.
ASSERT_GE(new_tab_count, old_tab_count);
if (win_util::GetWinVersion() > win_util::WINVERSION_2000) {
@@ -331,10 +331,10 @@ TEST_F(AccessibilityTest, TestForwardBtnStatusOnNewTab) {
file_util::AppendToPath(&test_file2, L"title1.html");
ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(test_file2)));
ASSERT_TRUE(window->WaitForTabCountToChange(old_tab_count, &new_tab_count,
- kWaitForActionMsec * 5));
+ action_max_timeout_ms()));
// Check tab count.
ASSERT_GE(new_tab_count, old_tab_count);
- Sleep(kWaitForActionMsec);
+ Sleep(sleep_timeout_ms());
if (win_util::GetWinVersion() > win_util::WINVERSION_2000) {
EXPECT_EQ(STATE_SYSTEM_HASPOPUP |
STATE_SYSTEM_FOCUSABLE |
@@ -391,7 +391,7 @@ TEST_F(AccessibilityTest, TestStarBtnStatusOnNewTab) {
std::wstring test_file1 = test_data_directory_;
file_util::AppendToPath(&test_file1, L"title1.html");
tab1->NavigateToURL(net::FilePathToFileURL(test_file1));
- Sleep(kWaitForActionMsec);
+ Sleep(sleep_timeout_ms());
EXPECT_EQ(STATE_SYSTEM_FOCUSABLE, GetState(acc_obj));
// Add empty new tab and check status.
@@ -400,10 +400,10 @@ TEST_F(AccessibilityTest, TestStarBtnStatusOnNewTab) {
ASSERT_TRUE(window->ApplyAccelerator(IDC_NEW_TAB));
int new_tab_count;
ASSERT_TRUE(window->WaitForTabCountToChange(old_tab_count, &new_tab_count,
- kWaitForActionMsec * 5));
+ action_max_timeout_ms()));
// Check tab count. Also, check accessibility object's state.
ASSERT_GE(new_tab_count, old_tab_count);
- Sleep(kWaitForActionMsec);
+ Sleep(sleep_timeout_ms());
EXPECT_EQ(STATE_SYSTEM_FOCUSABLE, GetState(acc_obj));
// Add new tab with URL and check status.
@@ -412,10 +412,10 @@ TEST_F(AccessibilityTest, TestStarBtnStatusOnNewTab) {
file_util::AppendToPath(&test_file2, L"title1.html");
ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(test_file2)));
ASSERT_TRUE(window->WaitForTabCountToChange(old_tab_count, &new_tab_count,
- kWaitForActionMsec * 5));
+ action_max_timeout_ms()));
// Check tab count. Also, check accessibility object's state.
ASSERT_GE(new_tab_count, old_tab_count);
- Sleep(kWaitForActionMsec);
+ Sleep(sleep_timeout_ms());
EXPECT_EQ(STATE_SYSTEM_FOCUSABLE, GetState(acc_obj));
CHK_RELEASE(acc_obj);
diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.cc b/chrome/test/automated_ui_tests/automated_ui_tests.cc
index 3f1f317..dcbac5b 100644
--- a/chrome/test/automated_ui_tests/automated_ui_tests.cc
+++ b/chrome/test/automated_ui_tests/automated_ui_tests.cc
@@ -398,7 +398,7 @@ bool AutomatedUITest::OpenAndActivateNewBrowserWindow() {
return false;
}
bool is_timeout;
- if (!browser->ActivateTabWithTimeout(0, kWaitForActionMaxMsec,
+ if (!browser->ActivateTabWithTimeout(0, action_max_timeout_ms(),
&is_timeout)) {
AddWarningAttribute("failed_to_activate_tab");
return false;
@@ -439,7 +439,8 @@ bool AutomatedUITest::CloseActiveTab() {
int browser_windows_count;
int tab_count;
bool is_timeout;
- browser->GetTabCountWithTimeout(&tab_count, kWaitForActionMaxMsec,
+ browser->GetTabCountWithTimeout(&tab_count,
+ action_max_timeout_ms(),
&is_timeout);
automation()->GetBrowserWindowCount(&browser_windows_count);
// Avoid quitting the application by not closing the last window.
@@ -447,8 +448,9 @@ bool AutomatedUITest::CloseActiveTab() {
int new_tab_count;
return_value = browser->RunCommand(IDC_CLOSE_TAB);
// Wait for the tab to close before we continue.
- if (!browser->WaitForTabCountToChange(
- tab_count, &new_tab_count, kWaitForActionMaxMsec)) {
+ if (!browser->WaitForTabCountToChange(tab_count,
+ &new_tab_count,
+ action_max_timeout_ms())) {
AddWarningAttribute("tab_count_failed_to_change");
return false;
}
@@ -456,8 +458,9 @@ bool AutomatedUITest::CloseActiveTab() {
int new_window_count;
return_value = browser->RunCommand(IDC_CLOSE_TAB);
// Wait for the window to close before we continue.
- if (!automation()->WaitForWindowCountToChange(
- browser_windows_count, &new_window_count, kWaitForActionMaxMsec)) {
+ if (!automation()->WaitForWindowCountToChange(browser_windows_count,
+ &new_window_count,
+ action_max_timeout_ms())) {
AddWarningAttribute("window_count_failed_to_change");
return false;
}
@@ -504,7 +507,7 @@ bool AutomatedUITest::Navigate() {
}
bool did_timeout;
scoped_ptr<TabProxy> tab(
- browser->GetActiveTabWithTimeout(kWaitForActionMaxMsec, &did_timeout));
+ browser->GetActiveTabWithTimeout(action_max_timeout_ms(), &did_timeout));
// TODO(devint): This might be masking a bug. I can't think of many
// valid cases where we would get a browser window, but not be able
// to return an active tab. Yet this has happened and has triggered crashes.
@@ -519,7 +522,9 @@ bool AutomatedUITest::Navigate() {
}
GURL test_url(url);
did_timeout = false;
- tab->NavigateToURLWithTimeout(test_url, kMaxTestExecutionTime, &did_timeout);
+ tab->NavigateToURLWithTimeout(test_url,
+ command_execution_timeout_ms(),
+ &did_timeout);
if (did_timeout) {
AddWarningAttribute("timeout");
@@ -537,13 +542,15 @@ bool AutomatedUITest::NewTab() {
int old_tab_count;
int new_tab_count;
bool is_timeout;
- browser->GetTabCountWithTimeout(&old_tab_count, kWaitForActionMaxMsec,
- &is_timeout);
+ browser->GetTabCountWithTimeout(&old_tab_count,
+ action_max_timeout_ms(),
+ &is_timeout);
// Apply accelerator and wait for a new tab to open, if either
// fails, return false. Apply Accelerator takes care of logging its failure.
bool return_value = RunCommand(IDC_NEW_TAB);
- if (!browser->WaitForTabCountToChange(
- old_tab_count, &new_tab_count, kWaitForActionMaxMsec)) {
+ if (!browser->WaitForTabCountToChange(old_tab_count,
+ &new_tab_count,
+ action_max_timeout_ms())) {
AddWarningAttribute("tab_count_failed_to_change");
return false;
}
@@ -746,7 +753,8 @@ bool AutomatedUITest::DragActiveTab(bool drag_right, bool drag_out) {
return false;
}
int tab_count;
- browser->GetTabCountWithTimeout(&tab_count, kWaitForActionMaxMsec,
+ browser->GetTabCountWithTimeout(&tab_count,
+ action_max_timeout_ms(),
&is_timeout);
// As far as we're concerned, if we can't get a view for a tab, it doesn't
// exist, so cap tab_count at the number of tab view ids there are.
@@ -754,7 +762,7 @@ bool AutomatedUITest::DragActiveTab(bool drag_right, bool drag_out) {
int tab_index;
if (!browser->GetActiveTabIndexWithTimeout(&tab_index,
- kWaitForActionMaxMsec,
+ action_max_timeout_ms(),
&is_timeout)) {
AddWarningAttribute("no_active_tab");
return false;
@@ -763,7 +771,7 @@ bool AutomatedUITest::DragActiveTab(bool drag_right, bool drag_out) {
gfx::Rect dragged_tab_bounds;
if (!window->GetViewBoundsWithTimeout(VIEW_ID_TAB_0 + tab_index,
&dragged_tab_bounds, false,
- kWaitForActionMaxMsec,
+ action_max_timeout_ms(),
&is_timeout)) {
AddWarningAttribute("no_tab_view_found");
return false;
@@ -794,7 +802,7 @@ bool AutomatedUITest::DragActiveTab(bool drag_right, bool drag_out) {
if (!browser->SimulateDragWithTimeout(dragged_tab_point,
destination_point,
views::Event::EF_LEFT_BUTTON_DOWN,
- kWaitForActionMaxMsec,
+ action_max_timeout_ms(),
&is_timeout, false)) {
AddWarningAttribute("failed_to_simulate_drag");
return false;
@@ -820,7 +828,7 @@ WindowProxy* AutomatedUITest::GetAndActivateWindowForBrowser(
WindowProxy* window = automation()->GetWindowForBrowser(browser);
bool did_timeout;
- if (!browser->BringToFrontWithTimeout(kWaitForActionMaxMsec, &did_timeout)) {
+ if (!browser->BringToFrontWithTimeout(action_max_timeout_ms(), &did_timeout)) {
AddWarningAttribute("failed_to_bring_window_to_front");
return NULL;
}
diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc
index 053e69c..33c6a30 100644
--- a/chrome/test/automation/automation_proxy_uitest.cc
+++ b/chrome/test/automation/automation_proxy_uitest.cc
@@ -489,7 +489,7 @@ TEST_F(AutomationProxyTest, AcceleratorNewTab) {
std::wstring title;
int i;
for (i = 0; i < 10; ++i) {
- Sleep(kWaitForActionMaxMsec / 10);
+ Sleep(sleep_timeout_ms());
ASSERT_TRUE(tab->GetTabTitle(&title));
if (title == L"Destinations" || title == L"New Tab")
break;
@@ -626,7 +626,7 @@ TEST_F(AutomationProxyTest3, FrameDocumentCanBeAccessed) {
std::wstring title;
int i;
for (i = 0; i < 10; ++i) {
- Sleep(kWaitForActionMaxMsec / 10);
+ Sleep(sleep_timeout_ms());
ASSERT_TRUE(tab->GetTabTitle(&title));
if (title == L"Destinations")
break;
diff --git a/chrome/test/reliability/page_load_test.cc b/chrome/test/reliability/page_load_test.cc
index 16b32b5..353c599 100644
--- a/chrome/test/reliability/page_load_test.cc
+++ b/chrome/test/reliability/page_load_test.cc
@@ -102,8 +102,6 @@ bool save_debug_log = false;
std::wstring chrome_log_path;
std::wstring v8_log_path;
-int kWaitForActionMsec = 4000;
-
class PageLoadTest : public UITest {
public:
enum NavigationResult {
@@ -160,13 +158,13 @@ class PageLoadTest : public UITest {
automation()->GetWindowForBrowser(browser.get()));
if (window.get()) {
bool activation_timeout;
- browser->BringToFrontWithTimeout(kWaitForActionMsec,
+ browser->BringToFrontWithTimeout(action_max_timeout_ms(),
&activation_timeout);
if (!activation_timeout) {
window->SimulateOSKeyPress(VK_NEXT, 0);
- Sleep(kWaitForActionMsec);
+ Sleep(sleep_timeout_ms());
window->SimulateOSKeyPress(VK_NEXT, 0);
- Sleep(kWaitForActionMsec);
+ Sleep(sleep_timeout_ms());
}
}
}
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index b35305d..3393d69 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -38,10 +38,10 @@
using base::TimeTicks;
// Delay to let browser complete a requested action.
-const int UITest::kWaitForActionMsec = 2000;
-const int UITest::kWaitForActionMaxMsec = 10000;
+static const int kWaitForActionMsec = 2000;
+static const int kWaitForActionMaxMsec = 10000;
// Delay to let the browser complete the test.
-const int UITest::kMaxTestExecutionTime = 30000;
+static const int kMaxTestExecutionTime = 30000;
const wchar_t UITest::kFailedNoCrashService[] =
L"NOTE: This test is expected to fail if crash_service.exe is not "
@@ -85,7 +85,7 @@ bool UITest::DieFileDie(const std::wstring& file, bool recurse) {
for (int i = 0; i < 10; ++i) {
if (file_util::Delete(file, recurse))
return true;
- PlatformThread::Sleep(kWaitForActionMaxMsec / 10);
+ PlatformThread::Sleep(action_max_timeout_ms() / 10);
}
return false;
}
@@ -520,7 +520,7 @@ bool UITest::WaitForFindWindowVisibilityChange(TabProxy* tab,
return true; // Find window visibility change complete.
// Give it a chance to catch up.
- Sleep(kWaitForActionMaxMsec / kCycles);
+ Sleep(sleep_timeout_ms() / kCycles);
}
return false;
}
@@ -537,7 +537,7 @@ bool UITest::WaitForBookmarkBarVisibilityChange(BrowserProxy* browser,
return true; // Bookmark bar visibility change complete.
// Give it a chance to catch up.
- Sleep(kWaitForActionMaxMsec / kCycles);
+ Sleep(sleep_timeout_ms() / kCycles);
}
return false;
}
@@ -671,7 +671,7 @@ std::string UITest::WaitUntilCookieNonEmpty(TabProxy* tab,
void UITest::WaitUntilTabCount(int tab_count) {
for (int i = 0; i < 10; ++i) {
- Sleep(kWaitForActionMaxMsec / 10);
+ Sleep(sleep_timeout_ms() / 10);
if (GetTabCount() == tab_count)
break;
}
diff --git a/chrome/test/ui/ui_test.h b/chrome/test/ui/ui_test.h
index 7baeb60..7f6c906 100644
--- a/chrome/test/ui/ui_test.h
+++ b/chrome/test/ui/ui_test.h
@@ -45,21 +45,10 @@ class TabProxy;
class UITest : public testing::Test {
protected:
- // Delay to let browser complete a requested action.
- static const int kWaitForActionMsec;
- static const int kWaitForActionMaxMsec;
- // Delay to let the browser complete the test.
- static const int kMaxTestExecutionTime;
-
// String to display when a test fails because the crash service isn't
// running.
static const wchar_t kFailedNoCrashService[];
- // Tries to delete the specified file/directory returning true on success.
- // This differs from file_util::Delete in that it repeatedly invokes Delete
- // until successful, or a timeout is reached. Returns true on success.
- static bool DieFileDie(const std::wstring& file, bool recurse);
-
// Constructor
UITest();
@@ -75,6 +64,11 @@ class UITest : public testing::Test {
// ********* Utility functions *********
+ // Tries to delete the specified file/directory returning true on success.
+ // This differs from file_util::Delete in that it repeatedly invokes Delete
+ // until successful, or a timeout is reached. Returns true on success.
+ bool DieFileDie(const std::wstring& file, bool recurse);
+
// Launches the browser and IPC testing server.
void LaunchBrowserAndServer();