diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-19 22:37:31 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-19 22:37:31 +0000 |
commit | d64295933cbfd3bc984e851412cc79c8a0870acf (patch) | |
tree | 8026b726dc498f4fa6f3e886b1612541ac6f0214 | |
parent | 4f2063cce10295e8b982e98d466c9130d754a540 (diff) | |
download | chromium_src-d64295933cbfd3bc984e851412cc79c8a0870acf.zip chromium_src-d64295933cbfd3bc984e851412cc79c8a0870acf.tar.gz chromium_src-d64295933cbfd3bc984e851412cc79c8a0870acf.tar.bz2 |
Remove action_max_timeout_ms and fix all the callers.
(This was a TODO for phajdan.jr).
BUG=None
TEST=trybots
Review URL: http://codereview.chromium.org/6354005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71861 0039d316-1c4b-4281-b951-d872f2087c98
29 files changed, 197 insertions, 150 deletions
diff --git a/chrome/browser/accessibility/accessibility_mac_uitest.mm b/chrome/browser/accessibility/accessibility_mac_uitest.mm index 5a790577..f88dd2b 100644 --- a/chrome/browser/accessibility/accessibility_mac_uitest.mm +++ b/chrome/browser/accessibility/accessibility_mac_uitest.mm @@ -1,10 +1,11 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #import <Cocoa/Cocoa.h> #include "base/scoped_nsobject.h" +#include "base/test/test_timeouts.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/ui/ui_test.h" @@ -40,7 +41,8 @@ class AccessibilityMacUITest : public UITest { void WaitAndAssertAllEventsObserved() { ASSERT_GE([expectedEvents count], 1U); CFRunLoopRunInMode( - kCFRunLoopDefaultMode, action_max_timeout_ms()/1000, false); + kCFRunLoopDefaultMode, + TestTimeouts::action_max_timeout_ms() / 1000, false); ASSERT_EQ(0U, [AccessibilityMacUITest::expectedEvents count]); } diff --git a/chrome/browser/dom_ui/bookmarks_ui_uitest.cc b/chrome/browser/dom_ui/bookmarks_ui_uitest.cc index 6b6ce8b..04c37f6 100644 --- a/chrome/browser/dom_ui/bookmarks_ui_uitest.cc +++ b/chrome/browser/dom_ui/bookmarks_ui_uitest.cc @@ -111,7 +111,8 @@ TEST_F(BookmarksUITest, CommandAgainGoesBackToBookmarksTab) { // Bring up the bookmarks manager tab. ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); - ASSERT_TRUE(browser->WaitForTabToBecomeActive(1, action_max_timeout_ms())); + ASSERT_TRUE(browser->WaitForTabToBecomeActive( + 1, TestTimeouts::action_max_timeout_ms())); ASSERT_TRUE(browser->GetTabCount(&tab_count)); ASSERT_EQ(2, tab_count); @@ -122,11 +123,13 @@ TEST_F(BookmarksUITest, CommandAgainGoesBackToBookmarksTab) { // Switch to first tab and run command again. ASSERT_TRUE(browser->ActivateTab(0)); - ASSERT_TRUE(browser->WaitForTabToBecomeActive(0, action_max_timeout_ms())); + ASSERT_TRUE(browser->WaitForTabToBecomeActive( + 0, TestTimeouts::action_max_timeout_ms())); ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); // Ensure the bookmarks ui tab is active. - ASSERT_TRUE(browser->WaitForTabToBecomeActive(1, action_max_timeout_ms())); + ASSERT_TRUE(browser->WaitForTabToBecomeActive( + 1, TestTimeouts::action_max_timeout_ms())); ASSERT_TRUE(browser->GetTabCount(&tab_count)); ASSERT_EQ(2, tab_count); } diff --git a/chrome/browser/dom_ui/new_tab_ui_uitest.cc b/chrome/browser/dom_ui/new_tab_ui_uitest.cc index 4828d90..5caf23e 100644 --- a/chrome/browser/dom_ui/new_tab_ui_uitest.cc +++ b/chrome/browser/dom_ui/new_tab_ui_uitest.cc @@ -1,9 +1,10 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/test/ui/ui_test.h" +#include "base/test/test_timeouts.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/dom_ui/new_tab_ui.h" #include "chrome/browser/prefs/pref_value_store.h" @@ -49,7 +50,7 @@ TEST_F(NewTabUITest, NTPHasThumbnails) { ASSERT_TRUE(WaitUntilJavaScriptCondition(tab, L"", L"window.domAutomationController.send(" L"document.getElementsByClassName('filler').length <= 5)", - action_max_timeout_ms())); + TestTimeouts::action_max_timeout_ms())); } // Sometimes hangs: http://crbug.com/70157 @@ -73,7 +74,7 @@ TEST_F(NewTabUITest, DISABLED_NTPHasLoginName) { ASSERT_TRUE(WaitUntilJavaScriptCondition(tab, L"", L"window.domAutomationController.send(" L"document.getElementById('login-username').innerText.length > 0)", - action_max_timeout_ms())); + TestTimeouts::action_max_timeout_ms())); ASSERT_TRUE(tab->ExecuteAndExtractString( L"", diff --git a/chrome/browser/dom_ui/options/options_ui_uitest.cc b/chrome/browser/dom_ui/options/options_ui_uitest.cc index b6c8bd2..abc022f 100644 --- a/chrome/browser/dom_ui/options/options_ui_uitest.cc +++ b/chrome/browser/dom_ui/options/options_ui_uitest.cc @@ -1,10 +1,11 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "app/l10n_util.h" #include "base/command_line.h" #include "base/string16.h" +#include "base/test/test_timeouts.h" #include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/common/chrome_switches.h" @@ -92,11 +93,13 @@ TEST_F(OptionsUITest, MAYBE_CommandAgainGoesBackToOptionsTab) { // Switch to first tab and run command again. ASSERT_TRUE(browser->ActivateTab(0)); - ASSERT_TRUE(browser->WaitForTabToBecomeActive(0, action_max_timeout_ms())); + ASSERT_TRUE(browser->WaitForTabToBecomeActive( + 0, TestTimeouts::action_max_timeout_ms())); ASSERT_TRUE(browser->RunCommand(IDC_OPTIONS)); // Ensure the options ui tab is active. - ASSERT_TRUE(browser->WaitForTabToBecomeActive(1, action_max_timeout_ms())); + ASSERT_TRUE(browser->WaitForTabToBecomeActive( + 1, TestTimeouts::action_max_timeout_ms())); ASSERT_TRUE(browser->GetTabCount(&tab_count)); ASSERT_EQ(2, tab_count); } diff --git a/chrome/browser/extensions/extension_uitest.cc b/chrome/browser/extensions/extension_uitest.cc index 845696e..ce8d46c 100644 --- a/chrome/browser/extensions/extension_uitest.cc +++ b/chrome/browser/extensions/extension_uitest.cc @@ -1,10 +1,11 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/command_line.h" #include "base/json/json_reader.h" #include "base/json/json_writer.h" +#include "base/test/test_timeouts.h" #include "base/values.h" #include "chrome/browser/automation/extension_automation_constants.h" #include "chrome/browser/extensions/extension_tabs_module_constants.h" @@ -144,7 +145,7 @@ TEST_F(ExtensionTestSimpleApiCall, FLAKY_RunTest) { GURL("chrome-extension://pmgpglkggjdpkpghhdmbdhababjpcohk/test.html"), GURL(""))); - loop_.RunFor(action_max_timeout_ms()); + loop_.RunFor(TestTimeouts::action_max_timeout_ms()); ASSERT_FALSE(message_received.empty()); scoped_ptr<Value> message_value(base::JSONReader::Read(message_received, @@ -297,7 +298,7 @@ TEST_F(ExtensionTestRoundtripApiCall, FLAKY_RunTest) { // CheckAndSendResponse (called by OnForwardMessageToExternalHost) // will end the loop once it has received both of our expected messages. - loop_.RunFor(action_max_timeout_ms()); + loop_.RunFor(TestTimeouts::action_max_timeout_ms()); } class ExtensionTestBrowserEvents : public ExtensionUITest { @@ -484,7 +485,7 @@ TEST_F(ExtensionTestBrowserEvents, FLAKY_RunTest) { // HandleMessageFromChrome (called by OnForwardMessageToExternalHost) ends // the loop when we've received the number of response messages we expect. - loop_.RunFor(action_max_timeout_ms()); + loop_.RunFor(TestTimeouts::action_max_timeout_ms()); // If this assert hits and the actual size is 0 then you need to look at: // src\chrome\test\data\extensions\uitest\event_sink\test.html and see if diff --git a/chrome/browser/in_process_webkit/dom_storage_uitest.cc b/chrome/browser/in_process_webkit/dom_storage_uitest.cc index 460d411..ac82728 100644 --- a/chrome/browser/in_process_webkit/dom_storage_uitest.cc +++ b/chrome/browser/in_process_webkit/dom_storage_uitest.cc @@ -1,9 +1,10 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/file_path.h" #include "base/file_util.h" +#include "base/test/test_timeouts.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/automation/tab_proxy.h" #include "chrome/test/ui/ui_layout_test.h" @@ -78,7 +79,8 @@ class DOMStorageTest : public UILayoutTest { ASSERT_TRUE(tab->SetCookie(url, "")); ASSERT_TRUE(tab->NavigateToURL(url)); - WaitUntilCookieNonEmpty(tab.get(), url, "cleared", action_max_timeout_ms()); + WaitUntilCookieNonEmpty(tab.get(), url, "cleared", + TestTimeouts::action_max_timeout_ms()); } // Runs each test in an array of strings until it hits a NULL. diff --git a/chrome/browser/process_singleton_uitest.cc b/chrome/browser/process_singleton_uitest.cc index f3ea3b4..cc9ec74 100644 --- a/chrome/browser/process_singleton_uitest.cc +++ b/chrome/browser/process_singleton_uitest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,6 +19,7 @@ #include "base/ref_counted.h" #include "base/scoped_temp_dir.h" #include "base/threading/thread.h" +#include "base/test/test_timeouts.h" #include "base/synchronization/waitable_event.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_constants.h" @@ -144,8 +145,8 @@ class ProcessSingletonTest : public UITest { for (size_t i = 0; i < kNbThreads; ++i) { chrome_starter_threads_[i].reset(new base::Thread("ChromeStarter")); ASSERT_TRUE(chrome_starter_threads_[i]->Start()); - chrome_starters_[i] = new ChromeStarter(action_max_timeout_ms(), - temp_profile_dir_.path()); + chrome_starters_[i] = new ChromeStarter( + TestTimeouts::action_max_timeout_ms(), temp_profile_dir_.path()); } } diff --git a/chrome/browser/sessions/session_restore_uitest.cc b/chrome/browser/sessions/session_restore_uitest.cc index 5dcbb77..54d2510 100644 --- a/chrome/browser/sessions/session_restore_uitest.cc +++ b/chrome/browser/sessions/session_restore_uitest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,6 +6,7 @@ #include "base/file_path.h" #include "base/scoped_ptr.h" #include "base/string_number_conversions.h" +#include "base/test/test_timeouts.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/defaults.h" #include "chrome/common/chrome_paths.h" @@ -76,7 +77,8 @@ class SessionRestoreUITest : public UITest { scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetActiveTab()); ASSERT_TRUE(tab_proxy.get()); - ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_max_timeout_ms())); + ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored( + TestTimeouts::action_max_timeout_ms())); ASSERT_TRUE(tab_proxy->GetCurrentURL(url)); } @@ -103,7 +105,8 @@ TEST_F(SessionRestoreUITest, Basic) { scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); ASSERT_TRUE(browser_proxy.get()); scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetTab(0)); - ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_max_timeout_ms())); + ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored( + TestTimeouts::action_max_timeout_ms())); ASSERT_EQ(url2_, GetActiveTabURL()); ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab_proxy->GoBack()); @@ -129,7 +132,8 @@ TEST_F(SessionRestoreUITest, RestoresForwardAndBackwardNavs) { scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); ASSERT_TRUE(browser_proxy.get()); scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetTab(0)); - ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_max_timeout_ms())); + ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored( + TestTimeouts::action_max_timeout_ms())); ASSERT_TRUE(GetActiveTabURL() == url2_); ASSERT_TRUE(tab_proxy->GoForward()); @@ -173,7 +177,8 @@ TEST_F(SessionRestoreUITest, RestoresCrossSiteForwardAndBackwardNavs) { ASSERT_EQ(1, tab_count); scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetTab(0)); ASSERT_TRUE(tab_proxy.get()); - ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_max_timeout_ms())); + ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored( + TestTimeouts::action_max_timeout_ms())); // Check that back and forward work as expected. GURL url; @@ -223,14 +228,16 @@ TEST_F(SessionRestoreUITest, TwoTabsSecondSelected) { scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetActiveTab()); ASSERT_TRUE(tab_proxy.get()); - ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_max_timeout_ms())); + ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored( + TestTimeouts::action_max_timeout_ms())); ASSERT_EQ(url2_, GetActiveTabURL()); ASSERT_TRUE(browser_proxy->ActivateTab(0)); tab_proxy = browser_proxy->GetActiveTab(); ASSERT_TRUE(tab_proxy.get()); - ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_max_timeout_ms())); + ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored( + TestTimeouts::action_max_timeout_ms())); ASSERT_EQ(url1_, GetActiveTabURL()); } @@ -370,7 +377,8 @@ TEST_F(SessionRestoreUITest, DontRestoreWhileIncognito) { ASSERT_TRUE(browser_proxy.get()); scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetTab(0)); ASSERT_TRUE(tab_proxy.get()); - ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_max_timeout_ms())); + ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored( + TestTimeouts::action_max_timeout_ms())); GURL url; ASSERT_TRUE(tab_proxy->GetCurrentURL(&url)); ASSERT_TRUE(url != url1_); @@ -477,10 +485,12 @@ TEST_F(SessionRestoreUITest, FLAKY_ShareProcessesOnRestore) { scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetTab(tab_count - 2)); ASSERT_TRUE(tab_proxy.get() != NULL); - ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_max_timeout_ms())); + ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored( + TestTimeouts::action_max_timeout_ms())); tab_proxy = browser_proxy->GetTab(tab_count - 1); ASSERT_TRUE(tab_proxy.get() != NULL); - ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_max_timeout_ms())); + ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored( + TestTimeouts::action_max_timeout_ms())); ASSERT_EQ(expected_process_count, GetBrowserProcessCount()); } diff --git a/chrome/browser/tab_restore_uitest.cc b/chrome/browser/tab_restore_uitest.cc index 5ea98eb..9e3dac0 100644 --- a/chrome/browser/tab_restore_uitest.cc +++ b/chrome/browser/tab_restore_uitest.cc @@ -92,7 +92,7 @@ class TabRestoreUITest : public UITest { ASSERT_TRUE(restored_tab_proxy.get()); // Wait for the restored tab to finish loading. ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored( - action_max_timeout_ms())); + TestTimeouts::action_max_timeout_ms())); // Ensure that the tab and window are active. CheckActiveWindow(browser_proxy.get()); diff --git a/chrome/browser/ui/tests/browser_uitest.cc b/chrome/browser/ui/tests/browser_uitest.cc index 3b9c92c..3320dd4 100644 --- a/chrome/browser/ui/tests/browser_uitest.cc +++ b/chrome/browser/ui/tests/browser_uitest.cc @@ -240,7 +240,7 @@ TEST_F(SecurityTest, DisallowFileUrlUniversalAccessTest) { ASSERT_TRUE(tab->NavigateToURL(url)); std::string value = WaitUntilCookieNonEmpty(tab.get(), url, - "status", action_max_timeout_ms()); + "status", TestTimeouts::action_max_timeout_ms()); ASSERT_STREQ("Disallowed", value.c_str()); } diff --git a/chrome/browser/unload_uitest.cc b/chrome/browser/unload_uitest.cc index a359e23..251693c 100644 --- a/chrome/browser/unload_uitest.cc +++ b/chrome/browser/unload_uitest.cc @@ -1,9 +1,10 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "app/message_box_flags.h" #include "base/file_util.h" +#include "base/test/test_timeouts.h" #include "chrome/browser/net/url_request_mock_http_job.h" #include "chrome/browser/ui/view_ids.h" #include "chrome/common/chrome_switches.h" @@ -104,7 +105,7 @@ class UnloadTest : public UITest { void WaitForBrowserClosed() { const int kCheckDelayMs = 100; - for (int max_wait_time = action_max_timeout_ms(); + for (int max_wait_time = TestTimeouts::action_max_timeout_ms(); max_wait_time > 0; max_wait_time -= kCheckDelayMs) { CrashAwareSleep(kCheckDelayMs); if (!IsBrowserRunning()) @@ -116,7 +117,7 @@ class UnloadTest : public UITest { void CheckTitle(const std::wstring& expected_title) { const int kCheckDelayMs = 100; - for (int max_wait_time = action_max_timeout_ms(); + for (int max_wait_time = TestTimeouts::action_max_timeout_ms(); max_wait_time > 0; max_wait_time -= kCheckDelayMs) { CrashAwareSleep(kCheckDelayMs); if (expected_title == GetActiveTabTitle()) diff --git a/chrome/renderer/external_extension_uitest.cc b/chrome/renderer/external_extension_uitest.cc index 1b622c2..d5f3885 100644 --- a/chrome/renderer/external_extension_uitest.cc +++ b/chrome/renderer/external_extension_uitest.cc @@ -1,7 +1,8 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/test/test_timeouts.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/url_constants.h" @@ -107,8 +108,10 @@ void SearchProviderTest::FinishIsSearchProviderInstalledTest( std::string cookie_name = data.host + "testResult"; std::string escaped_value = - WaitUntilCookieNonEmpty(data.tab, data.test_url, - cookie_name.c_str(), action_max_timeout_ms()); + WaitUntilCookieNonEmpty(data.tab, + data.test_url, + cookie_name.c_str(), + TestTimeouts::action_max_timeout_ms()); // Unescapes and normalizes the actual result. std::string value = UnescapeURLComponent( diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc index 0d47530..fcee17f 100644 --- a/chrome/test/automation/automation_proxy_uitest.cc +++ b/chrome/test/automation/automation_proxy_uitest.cc @@ -472,8 +472,8 @@ TEST_F(AutomationProxyTest, NavigateToURLAsync) { GURL newurl = net::FilePathToFileURL(filename); ASSERT_TRUE(tab->NavigateToURLAsync(newurl)); - std::string value = WaitUntilCookieNonEmpty(tab.get(), newurl, "foo", - action_max_timeout_ms()); + std::string value = WaitUntilCookieNonEmpty( + tab.get(), newurl, "foo", TestTimeouts::action_max_timeout_ms()); ASSERT_STREQ("baz", value.c_str()); } @@ -650,8 +650,8 @@ TEST_F(AutomationProxyTest, BlockedPopupTest) { ASSERT_TRUE(tab->NavigateToURL(net::FilePathToFileURL(filename))); - ASSERT_TRUE(tab->WaitForBlockedPopupCountToChangeTo(2, - action_max_timeout_ms())); + ASSERT_TRUE(tab->WaitForBlockedPopupCountToChangeTo( + 2, TestTimeouts::action_max_timeout_ms())); } // TODO(port): Remove HWND if possible @@ -914,7 +914,7 @@ TEST_F(ExternalTabUITest, FLAKY_CreateExternalTab1) { .WillOnce(QUIT_LOOP(&loop)); tab = mock_->CreateTabWithUrl(GURL(simple_data_url)); - loop.RunFor(action_max_timeout_ms()); + loop.RunFor(TestTimeouts::action_max_timeout_ms()); } // Create with empty url and then navigate @@ -938,7 +938,7 @@ TEST_F(ExternalTabUITest, FLAKY_CreateExternalTab2) { tab = mock_->CreateTabWithUrl(GURL()); mock_->NavigateInExternalTab(tab->handle(), GURL(simple_data_url)); - loop.RunFor(action_max_timeout_ms()); + loop.RunFor(TestTimeouts::action_max_timeout_ms()); } // FLAKY: http://crbug.com/60409 @@ -1024,7 +1024,7 @@ TEST_F(ExternalTabUITest, FLAKY_TabPostMessage) { EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); tab = mock_->CreateTabWithUrl(GURL(content)); - loop.RunFor(action_max_timeout_ms()); + loop.RunFor(TestTimeouts::action_max_timeout_ms()); } // Flaky: http://crbug.com/62143 @@ -1067,7 +1067,7 @@ TEST_F(ExternalTabUITest, FLAKY_PostMessageTarget) { s.load_requests_via_automation = false; s.initial_url = GURL("http://localhost:1337/files/post_message.html"); tab = mock_->CreateHostWindowAndTab(s); - loop.RunFor(action_max_timeout_ms()); + loop.RunFor(TestTimeouts::action_max_timeout_ms()); } // Flaky, http://crbug.com/42545. @@ -1138,7 +1138,7 @@ TEST_F(ExternalTabUITest, FLAKY_HostNetworkStack) { .WillOnce(QUIT_LOOP_SOON(&loop, 300)); tab = mock_->CreateTabWithUrl(GURL(url)); - loop.RunFor(action_max_timeout_ms()); + loop.RunFor(TestTimeouts::action_max_timeout_ms()); } // Flaky, http://crbug.com/61023. @@ -1180,7 +1180,7 @@ TEST_F(ExternalTabUITest, FLAKY_HostNetworkStackAbortRequest) { .WillOnce(QUIT_LOOP_SOON(&loop, 300)); tab = mock_->CreateTabWithUrl(GURL(url)); - loop.RunFor(action_max_timeout_ms()); + loop.RunFor(TestTimeouts::action_max_timeout_ms()); } // Flaky, http://crbug.com/61023. @@ -1249,7 +1249,7 @@ TEST_F(ExternalTabUITest, FLAKY_HostNetworkStackUnresponsiveRenderer) { EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); tab = mock_->CreateTabWithUrl(GURL(url)); - loop.RunFor(action_max_timeout_ms()); + loop.RunFor(TestTimeouts::action_max_timeout_ms()); mock_->DestroyHostWindow(); } @@ -1325,7 +1325,7 @@ TEST_F(ExternalTabUITestPopupEnabled, MAYBE_WindowDotOpen) { mock_->CreateTabWithUrl(main_url); - loop.RunFor(action_max_timeout_ms()); + loop.RunFor(TestTimeouts::action_max_timeout_ms()); EXPECT_CALL(*mock_, HandleClosed(1)); EXPECT_CALL(*mock_, HandleClosed(2)); @@ -1365,7 +1365,7 @@ TEST_F(ExternalTabUITestPopupEnabled, MAYBE_UserGestureTargetBlank) { .WillOnce(QUIT_LOOP_SOON(&loop, 500)); mock_->CreateTabWithUrl(main_url); - loop.RunFor(action_max_timeout_ms()); + loop.RunFor(TestTimeouts::action_max_timeout_ms()); EXPECT_CALL(*mock_, HandleClosed(1)); ::DestroyWindow(foo_host); @@ -1407,7 +1407,7 @@ TEST_F(AutomationProxyTest, AutocompleteParallelProxy) { browser2->GetAutocompleteEdit()); ASSERT_TRUE(edit2.get()); EXPECT_TRUE(browser2->GetTab(0)->WaitForTabToBeRestored( - action_max_timeout_ms())); + TestTimeouts::action_max_timeout_ms())); const std::wstring text_to_set1 = L"Lollerskates"; const std::wstring text_to_set2 = L"Roflcopter"; std::wstring actual_text1, actual_text2; @@ -1438,7 +1438,7 @@ TEST_F(AutomationProxyVisibleTest, AutocompleteMatchesTest) { EXPECT_TRUE(browser->ApplyAccelerator(IDC_FOCUS_LOCATION)); ASSERT_TRUE(edit->WaitForFocus()); EXPECT_TRUE(edit->SetText(L"Roflcopter")); - EXPECT_TRUE(edit->WaitForQuery(action_max_timeout_ms())); + EXPECT_TRUE(edit->WaitForQuery(TestTimeouts::action_max_timeout_ms())); bool query_in_progress; EXPECT_TRUE(edit->IsQueryInProgress(&query_in_progress)); EXPECT_FALSE(query_in_progress); diff --git a/chrome/test/interactive_ui/keyboard_access_uitest.cc b/chrome/test/interactive_ui/keyboard_access_uitest.cc index fe80efc..7e7b156 100644 --- a/chrome/test/interactive_ui/keyboard_access_uitest.cc +++ b/chrome/test/interactive_ui/keyboard_access_uitest.cc @@ -1,7 +1,8 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/test/test_timeouts.h" #include "chrome/test/automation/browser_proxy.h" #include "chrome/test/automation/tab_proxy.h" #include "chrome/test/automation/window_proxy.h" @@ -154,7 +155,8 @@ TEST_F(KeyboardAccessTest, MAYBE_ReserveKeyboardAccelerators) { ASSERT_TRUE(window); ASSERT_TRUE(window->SimulateOSKeyPress( ui::VKEY_TAB, views::Event::EF_CONTROL_DOWN)); - ASSERT_TRUE(browser->WaitForTabToBecomeActive(0, action_max_timeout_ms())); + ASSERT_TRUE(browser->WaitForTabToBecomeActive( + 0, TestTimeouts::action_max_timeout_ms())); #if !defined(OS_MACOSX) // see BrowserWindowCocoa::GetCommandId ASSERT_TRUE(browser->ActivateTab(1)); diff --git a/chrome/test/interactive_ui/mouseleave_interactive_uitest.cc b/chrome/test/interactive_ui/mouseleave_interactive_uitest.cc index 627e25e..2383d5b 100644 --- a/chrome/test/interactive_ui/mouseleave_interactive_uitest.cc +++ b/chrome/test/interactive_ui/mouseleave_interactive_uitest.cc @@ -1,8 +1,9 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/file_path.h" +#include "base/test/test_timeouts.h" #include "chrome/test/automation/browser_proxy.h" #include "chrome/test/automation/tab_proxy.h" #include "chrome/test/automation/window_proxy.h" @@ -58,12 +59,11 @@ TEST_F(MouseLeaveTest, MAYBE_TestOnMouseOut) { // Navigate to the test html page. ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(test_url)); - const int timeout_ms = 5 * action_max_timeout_ms(); - // Wait for the onload() handler to complete so we can do the // next part of the test. ASSERT_TRUE(WaitUntilCookieValue( - tab.get(), test_url, "__state", timeout_ms, "initial")); + tab.get(), test_url, "__state", + TestTimeouts::large_test_timeout_ms(), "initial")); // Move the cursor to the top-center of the content, which will trigger // a javascript onMouseOver event. @@ -71,7 +71,8 @@ TEST_F(MouseLeaveTest, MAYBE_TestOnMouseOut) { // Wait on the correct intermediate value of the cookie. ASSERT_TRUE(WaitUntilCookieValue( - tab.get(), test_url, "__state", timeout_ms, "initial,entered")); + tab.get(), test_url, "__state", + TestTimeouts::large_test_timeout_ms(), "initial,entered")); // Move the cursor above the content again, which should trigger // a javascript onMouseOut event. @@ -79,7 +80,8 @@ TEST_F(MouseLeaveTest, MAYBE_TestOnMouseOut) { // Wait on the correct final value of the cookie. ASSERT_TRUE(WaitUntilCookieValue( - tab.get(), test_url, "__state", timeout_ms, "initial,entered,left")); + tab.get(), test_url, "__state", + TestTimeouts::large_test_timeout_ms(), "initial,entered,left")); } } // namespace diff --git a/chrome/test/interactive_ui/npapi_interactive_test.cc b/chrome/test/interactive_ui/npapi_interactive_test.cc index 725e3a1..5d2204c 100644 --- a/chrome/test/interactive_ui/npapi_interactive_test.cc +++ b/chrome/test/interactive_ui/npapi_interactive_test.cc @@ -2,11 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// // NPAPI interactive UI tests. -// #include "base/file_path.h" +#include "base/test/test_timeouts.h" #include "chrome/browser/net/url_request_mock_http_job.h" #include "chrome/test/automation/window_proxy.h" #include "chrome/test/ui/npapi_test_helper.h" @@ -37,7 +36,7 @@ TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInvokeInSynchronousMouseMove) { WaitForFinish("execute_script_delete_in_mouse_move", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - action_max_timeout_ms()); + TestTimeouts::action_max_timeout_ms()); } // Flaky, http://crbug.com/60071. @@ -58,7 +57,7 @@ TEST_F(NPAPIVisiblePluginTester, FLAKY_GetURLRequest404Response) { ASSERT_TRUE(window->SimulateOSKeyPress(ui::VKEY_ESCAPE, 0)); WaitForFinish("geturl_404_response", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } // Tests if a plugin executing a self deleting script using Invoke with @@ -78,5 +77,5 @@ TEST_F(NPAPIVisiblePluginTester, DISABLED_SelfDeletePluginInvokeAlert) { WaitForFinish("self_delete_plugin_invoke_alert", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - action_max_timeout_ms()); + TestTimeouts::action_max_timeout_ms()); } diff --git a/chrome/test/nacl/nacl_sandbox_test.cc b/chrome/test/nacl/nacl_sandbox_test.cc index 9472ea0..28e6b87 100644 --- a/chrome/test/nacl/nacl_sandbox_test.cc +++ b/chrome/test/nacl/nacl_sandbox_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,6 +6,7 @@ #include "base/file_util.h" #include "base/path_service.h" +#include "base/test/test_timeouts.h" #include "chrome/common/chrome_switches.h" namespace { @@ -39,5 +40,5 @@ NaClSandboxTest::~NaClSandboxTest() { TEST_F(NaClSandboxTest, DISABLED_NaClOuterSBTest) { // Load a helloworld .nexe to trigger the nacl loader test. FilePath test_file(kSrpcHwHtmlFileName); - RunTest(test_file, action_max_timeout_ms()); + RunTest(test_file, TestTimeouts::action_max_timeout_ms()); } diff --git a/chrome/test/nacl/nacl_ui_test.cc b/chrome/test/nacl/nacl_ui_test.cc index 5299261..ab64f78 100644 --- a/chrome/test/nacl/nacl_ui_test.cc +++ b/chrome/test/nacl/nacl_ui_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,6 +7,7 @@ // TODO(jvoung) see what includes we really need. #include "base/file_util.h" #include "base/path_service.h" +#include "base/test/test_timeouts.h" #include "chrome/common/chrome_paths.h" namespace { @@ -37,47 +38,47 @@ NaClUITest::~NaClUITest() { TEST_F(NaClUITest, ServerTest) { FilePath test_file(kServerHtmlFileName); - RunTest(test_file, action_max_timeout_ms()); + RunTest(test_file, TestTimeouts::action_max_timeout_ms()); } TEST_F(NaClUITest, DISABLED_SrpcHelloWorld) { FilePath test_file(kSrpcHwHtmlFileName); - RunTest(test_file, action_max_timeout_ms()); + RunTest(test_file, TestTimeouts::action_max_timeout_ms()); } // http://crbug.com/64973 TEST_F(NaClUITest, DISABLED_SrpcBasicTest) { FilePath test_file(kSrpcBasicHtmlFileName); - RunTest(test_file, action_max_timeout_ms()); + RunTest(test_file, TestTimeouts::action_max_timeout_ms()); } TEST_F(NaClUITest, DISABLED_SrpcSockAddrTest) { FilePath test_file(kSrpcSockAddrHtmlFileName); - RunTest(test_file, action_max_timeout_ms()); + RunTest(test_file, TestTimeouts::action_max_timeout_ms()); } TEST_F(NaClUITest, DISABLED_SrpcShmTest) { FilePath test_file(kSrpcShmHtmlFileName); - RunTest(test_file, action_max_timeout_ms()); + RunTest(test_file, TestTimeouts::action_max_timeout_ms()); } TEST_F(NaClUITest, DISABLED_SrpcPluginTest) { FilePath test_file(kSrpcPluginHtmlFileName); - RunTest(test_file, action_max_timeout_ms()); + RunTest(test_file, TestTimeouts::action_max_timeout_ms()); } TEST_F(NaClUITest, DISABLED_SrpcNrdXferTest) { FilePath test_file(kSrpcNrdXferHtmlFileName); - RunTest(test_file, action_max_timeout_ms()); + RunTest(test_file, TestTimeouts::action_max_timeout_ms()); } TEST_F(NaClUITest, DISABLED_NpapiHwTest) { FilePath test_file(kNpapiHwHtmlFileName); - RunTest(test_file, action_max_timeout_ms()); + RunTest(test_file, TestTimeouts::action_max_timeout_ms()); } TEST_F(NaClUITest, DISABLED_MultiarchTest) { FilePath test_file(kSrpcHwHtmlFileName); - RunMultiarchTest(test_file, action_max_timeout_ms()); + RunMultiarchTest(test_file, TestTimeouts::action_max_timeout_ms()); } diff --git a/chrome/test/plugin/plugin_test.cpp b/chrome/test/plugin/plugin_test.cpp index 850c621..31b8d53 100644 --- a/chrome/test/plugin/plugin_test.cpp +++ b/chrome/test/plugin/plugin_test.cpp @@ -31,6 +31,7 @@ #include "base/file_util.h" #include "base/message_loop.h" #include "base/path_service.h" +#include "base/test/test_timeouts.h" #include "chrome/browser/net/url_request_mock_http_job.h" #include "chrome/browser/plugin_download_helper.h" #include "chrome/common/chrome_switches.h" @@ -139,7 +140,8 @@ TEST_F(PluginTest, Flash) { "libflashplayer.so" #endif ; - TestPlugin("flash.html?" + kFlashQuery, action_max_timeout_ms(), false); + TestPlugin("flash.html?" + kFlashQuery, + TestTimeouts::action_max_timeout_ms(), false); } class ClickToPlayPluginTest : public PluginTest { @@ -163,7 +165,7 @@ TEST_F(ClickToPlayPluginTest, Flash) { ASSERT_TRUE(tab->LoadBlockedPlugins()); - WaitForFinish(action_max_timeout_ms(), true); + WaitForFinish(TestTimeouts::action_max_timeout_ms(), true); } TEST_F(ClickToPlayPluginTest, FlashDocument) { @@ -184,13 +186,13 @@ TEST_F(ClickToPlayPluginTest, FlashDocument) { ASSERT_TRUE(tab->LoadBlockedPlugins()); - WaitForFinish(action_max_timeout_ms(), true); + WaitForFinish(TestTimeouts::action_max_timeout_ms(), true); } #if defined(OS_WIN) // Windows only test TEST_F(PluginTest, DISABLED_FlashSecurity) { - TestPlugin("flash.html", action_max_timeout_ms(), false); + TestPlugin("flash.html", TestTimeouts::action_max_timeout_ms(), false); } #endif // defined(OS_WIN) @@ -199,26 +201,27 @@ TEST_F(PluginTest, DISABLED_FlashSecurity) { // plugins. // Flaky: http://crbug.com/55915 TEST_F(PluginTest, FLAKY_Quicktime) { - TestPlugin("quicktime.html", action_max_timeout_ms(), false); + TestPlugin("quicktime.html", TestTimeouts::action_max_timeout_ms(), false); } // Disabled - http://crbug.com/44662 TEST_F(PluginTest, DISABLED_MediaPlayerNew) { - TestPlugin("wmp_new.html", action_max_timeout_ms(), false); + TestPlugin("wmp_new.html", TestTimeouts::action_max_timeout_ms(), false); } // http://crbug.com/4809 TEST_F(PluginTest, DISABLED_MediaPlayerOld) { - TestPlugin("wmp_old.html", action_max_timeout_ms(), false); + TestPlugin("wmp_old.html", TestTimeouts::action_max_timeout_ms(), false); } // Disabled - http://crbug.com/44673 TEST_F(PluginTest, DISABLED_Real) { - TestPlugin("real.html", action_max_timeout_ms(), false); + TestPlugin("real.html", TestTimeouts::action_max_timeout_ms(), false); } TEST_F(PluginTest, FlashOctetStream) { - TestPlugin("flash-octet-stream.html", action_max_timeout_ms(), false); + TestPlugin("flash-octet-stream.html", + TestTimeouts::action_max_timeout_ms(), false); } #if defined(OS_WIN) @@ -227,16 +230,17 @@ TEST_F(PluginTest, FLAKY_FlashLayoutWhilePainting) { #else TEST_F(PluginTest, FlashLayoutWhilePainting) { #endif - TestPlugin("flash-layout-while-painting.html", action_max_timeout_ms(), true); + TestPlugin("flash-layout-while-painting.html", + TestTimeouts::action_max_timeout_ms(), true); } // http://crbug.com/8690 TEST_F(PluginTest, DISABLED_Java) { - TestPlugin("Java.html", action_max_timeout_ms(), false); + TestPlugin("Java.html", TestTimeouts::action_max_timeout_ms(), false); } TEST_F(PluginTest, Silverlight) { - TestPlugin("silverlight.html", action_max_timeout_ms(), false); + TestPlugin("silverlight.html", TestTimeouts::action_max_timeout_ms(), false); } // This class provides functionality to test the plugin installer download diff --git a/chrome/test/pyautolib/pyautolib.h b/chrome/test/pyautolib/pyautolib.h index ac34b4b..3761aa8 100644 --- a/chrome/test/pyautolib/pyautolib.h +++ b/chrome/test/pyautolib/pyautolib.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -11,6 +11,7 @@ #include "base/message_loop.h" #include "base/mac/scoped_nsautorelease_pool.h" +#include "base/test/test_timeouts.h" #include "chrome/test/ui/ui_test.h" #include "chrome/test/ui/ui_test_suite.h" @@ -187,6 +188,10 @@ class PyUITestBase : public UITestBase { std::string GetCookie(const GURL& cookie_url, int window_index = 0, int tab_index = 0); + int action_max_timeout_ms() const { + return TestTimeouts::action_max_timeout_ms(); + } + private: // Enables PostTask to main thread. // Should be shared across multiple instances of PyUITestBase so that this diff --git a/chrome/test/ui/history_uitest.cc b/chrome/test/ui/history_uitest.cc index d947dbc7..b8c791b 100644 --- a/chrome/test/ui/history_uitest.cc +++ b/chrome/test/ui/history_uitest.cc @@ -1,10 +1,11 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // History UI tests #include "base/file_path.h" +#include "base/test/test_timeouts.h" #include "chrome/browser/ui/view_ids.h" #include "chrome/test/automation/browser_proxy.h" #include "chrome/test/automation/tab_proxy.h" @@ -41,7 +42,7 @@ TEST_F(HistoryTester, VerifyHistoryLength1) { GURL url_1 = ui_test_utils::GetTestUrl(FilePath(kHistoryDir), test_case_1); NavigateToURL(url_1); WaitForFinish("History_Length_Test_1", "1", url_1, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } TEST_F(HistoryTester, VerifyHistoryLength2) { @@ -53,7 +54,7 @@ TEST_F(HistoryTester, VerifyHistoryLength2) { GURL url_2 = ui_test_utils::GetTestUrl(FilePath(kHistoryDir), test_case_2); NavigateToURL(url_2); WaitForFinish("History_Length_Test_2", "1", url_2, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } TEST_F(HistoryTester, VerifyHistoryLength3) { @@ -66,21 +67,21 @@ TEST_F(HistoryTester, VerifyHistoryLength3) { GURL url_1 = ui_test_utils::GetTestUrl(FilePath(kHistoryDir), test_case_1); NavigateToURL(url_1); WaitForFinish("History_Length_Test_1", "1", url_1, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); const FilePath test_case_2( FILE_PATH_LITERAL("history_length_test_page_2.html")); GURL url_2 = ui_test_utils::GetTestUrl(FilePath(kHistoryDir), test_case_2); NavigateToURL(url_2); WaitForFinish("History_Length_Test_2", "1", url_2, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); const FilePath test_case_3( FILE_PATH_LITERAL("history_length_test_page_4.html")); GURL url_3 = ui_test_utils::GetTestUrl(FilePath(kHistoryDir), test_case_3); NavigateToURL(url_3); WaitForFinish("History_Length_Test_3", "1", url_3, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } #if defined(OS_WIN) || defined(OS_LINUX) @@ -98,7 +99,7 @@ TEST_F(HistoryTester, ConsiderRedirectAfterGestureAsUserInitiated) { GURL url = ui_test_utils::GetTestUrl(FilePath(kHistoryDir), test_case); NavigateToURL(url); WaitForFinish("History_Length_Test_11", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); // Simulate click. This only works for Windows. scoped_refptr<BrowserProxy> browser = automation()->GetBrowserWindow(0); @@ -114,7 +115,7 @@ TEST_F(HistoryTester, ConsiderRedirectAfterGestureAsUserInitiated) { NavigateToURL(GURL("javascript:redirectToPage12()")); WaitForFinish("History_Length_Test_12", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } #endif // defined(OS_WIN) || defined(OS_LINUX) @@ -132,5 +133,5 @@ TEST_F(HistoryTester, ConsiderSlowRedirectAsUserInitiated) { GURL url = ui_test_utils::GetTestUrl(FilePath(kHistoryDir), test_case); NavigateToURL(url); WaitForFinish("History_Length_Test_21", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } diff --git a/chrome/test/ui/layout_plugin_uitest.cc b/chrome/test/ui/layout_plugin_uitest.cc index 07fab43..0e173f8a 100644 --- a/chrome/test/ui/layout_plugin_uitest.cc +++ b/chrome/test/ui/layout_plugin_uitest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,6 +6,7 @@ #include "base/file_path.h" #include "base/path_service.h" +#include "base/test/test_timeouts.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/url_constants.h" #include "chrome/test/ui_test_utils.h" @@ -52,7 +53,7 @@ TEST_F(LayoutPluginTester, FLAKY_SelfDeletePluginGetUrl) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("self_delete_plugin_geturl", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - action_max_timeout_ms()); + TestTimeouts::action_max_timeout_ms()); } // Tests if a plugin executing a self deleting script using Invoke @@ -64,7 +65,7 @@ TEST_F(LayoutPluginTester, FLAKY_SelfDeletePluginInvoke) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("self_delete_plugin_invoke", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - action_max_timeout_ms()); + TestTimeouts::action_max_timeout_ms()); } TEST_F(LayoutPluginTester, NPObjectReleasedOnDestruction) { @@ -95,5 +96,5 @@ TEST_F(LayoutPluginTester, NPObjectSetException) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("npobject_set_exception", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - action_max_timeout_ms()); + TestTimeouts::action_max_timeout_ms()); } diff --git a/chrome/test/ui/npapi_uitest.cc b/chrome/test/ui/npapi_uitest.cc index d85b97d..9bdc0c2 100644 --- a/chrome/test/ui/npapi_uitest.cc +++ b/chrome/test/ui/npapi_uitest.cc @@ -42,7 +42,7 @@ TEST_F(NPAPITesterBase, Arguments) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("arguments", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } // Test invoking many plugins within a single page. @@ -53,10 +53,13 @@ TEST_F(NPAPITesterBase, ManyPlugins) { for (int i = 1; i <= 15; i++) { SCOPED_TRACE(StringPrintf("Waiting for plugin #%d", i)); - ASSERT_NO_FATAL_FAILURE(WaitForFinish("arguments", base::IntToString(i), - url, kTestCompleteCookie, - kTestCompleteSuccess, - action_max_timeout_ms())); + ASSERT_NO_FATAL_FAILURE(WaitForFinish( + "arguments", + base::IntToString(i), + url, + kTestCompleteCookie, + kTestCompleteSuccess, + TestTimeouts::action_max_timeout_ms())); } } @@ -66,7 +69,7 @@ TEST_F(NPAPITesterBase, GetURL) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("geturl", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } // Test various calls to GetURL for javascript URLs with @@ -76,7 +79,7 @@ TEST_F(NPAPITesterBase, GetJavaScriptURL) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("getjavascripturl", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } // Test that calling GetURL with a javascript URL and target=_self @@ -86,7 +89,7 @@ TEST_F(NPAPITesterBase, GetJavaScriptURL2) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("getjavascripturl2", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } TEST_F(NPAPITesterBase, GetURLRedirectNotification) { @@ -94,7 +97,7 @@ TEST_F(NPAPITesterBase, GetURLRedirectNotification) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("geturlredirectnotify", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } // Tests that if an NPObject is proxies back to its original process, the @@ -105,7 +108,7 @@ TEST_F(NPAPITesterBase, NPObjectProxy) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("npobject_proxy", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } #if defined(OS_WIN) || defined(OS_MACOSX) @@ -124,7 +127,7 @@ TEST_F(NPAPIVisiblePluginTester, ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("execute_script_delete_in_paint", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - action_max_timeout_ms()); + TestTimeouts::action_max_timeout_ms()); } #endif @@ -138,7 +141,7 @@ TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInNewStream) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("self_delete_plugin_stream", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - action_max_timeout_ms()); + TestTimeouts::action_max_timeout_ms()); } #if defined(OS_WIN) @@ -149,7 +152,7 @@ TEST_F(NPAPIVisiblePluginTester, VerifyPluginWindowRect) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("checkwindowrect", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } // Tests that creating a new instance of a plugin while another one is handling @@ -160,7 +163,7 @@ TEST_F(NPAPIVisiblePluginTester, CreateInstanceInPaint) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("create_instance_in_paint", "2", url, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } // Tests that putting up an alert in response to a paint doesn't deadlock. @@ -200,7 +203,7 @@ TEST_F(NPAPIVisiblePluginTester, VerifyNPObjectLifetimeTest) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("npobject_lifetime_test", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - action_max_timeout_ms()); + TestTimeouts::action_max_timeout_ms()); } // Tests that we don't crash or assert if NPP_New fails @@ -209,7 +212,7 @@ TEST_F(NPAPIVisiblePluginTester, NewFails) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("new_fails", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInNPNEvaluate) { @@ -222,7 +225,7 @@ TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInNPNEvaluate) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("npobject_delete_plugin_in_evaluate", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - action_max_timeout_ms()); + TestTimeouts::action_max_timeout_ms()); } TEST_F(NPAPIVisiblePluginTester, SelfDeleteCreatePluginInNPNEvaluate) { @@ -235,7 +238,7 @@ TEST_F(NPAPIVisiblePluginTester, SelfDeleteCreatePluginInNPNEvaluate) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("npobject_delete_create_plugin_in_evaluate", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - action_max_timeout_ms()); + TestTimeouts::action_max_timeout_ms()); } #endif @@ -265,7 +268,7 @@ TEST_F(NPAPITesterBase, PrivateDisabled) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("private", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } TEST_F(NPAPITesterBase, ScheduleTimer) { @@ -273,7 +276,7 @@ TEST_F(NPAPITesterBase, ScheduleTimer) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("schedule_timer", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } TEST_F(NPAPITesterBase, PluginThreadAsyncCall) { @@ -281,7 +284,7 @@ TEST_F(NPAPITesterBase, PluginThreadAsyncCall) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("plugin_thread_async_call", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } // Test checking the privacy mode is on. @@ -293,7 +296,7 @@ TEST_F(NPAPIIncognitoTester, PrivateEnabled) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("private", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } #if defined(OS_WIN) || defined(OS_MACOSX) @@ -308,7 +311,7 @@ TEST_F(NPAPIVisiblePluginTester, MultipleInstancesSyncCalls) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("multiple_instances_sync_calls", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } #endif @@ -323,7 +326,7 @@ TEST_F(NPAPIVisiblePluginTester, GetURLRequestFailWrite) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("geturl_fail_write", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } #if defined(OS_WIN) @@ -337,7 +340,7 @@ TEST_F(NPAPITesterBase, EnsureScriptingWorksInDestroy) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("ensure_scripting_works_in_destroy", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - action_max_timeout_ms()); + TestTimeouts::action_max_timeout_ms()); } // This test uses a Windows Event to signal to the plugin that it should crash @@ -358,7 +361,7 @@ TEST_F(NPAPITesterBase, NoHangIfInitCrashes) { NavigateToURL(url); WaitForFinish("no_hang_if_init_crashes", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - action_max_timeout_ms()); + TestTimeouts::action_max_timeout_ms()); CloseHandle(crash_event); } @@ -375,7 +378,7 @@ TEST_F(NPAPIVisiblePluginTester, PluginReferrerTest) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("plugin_referrer_test", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } #if defined(OS_MACOSX) @@ -397,7 +400,7 @@ TEST_F(NPAPIVisiblePluginTester, PluginConvertPointTest) { // change the test to trigger on mouse-down rather than window focus. ASSERT_TRUE(browser->BringToFront()); WaitForFinish("convert_point", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } #endif @@ -417,5 +420,5 @@ TEST_F(NPAPIVisiblePluginTester, ClickToPlay) { ASSERT_TRUE(tab->LoadBlockedPlugins()); WaitForFinish("setup", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, action_max_timeout_ms()); + kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); } diff --git a/chrome/test/ui/omnibox_uitest.cc b/chrome/test/ui/omnibox_uitest.cc index 86016bde..b30f91d 100644 --- a/chrome/test/ui/omnibox_uitest.cc +++ b/chrome/test/ui/omnibox_uitest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,6 +10,7 @@ #include "base/path_service.h" #include "base/perftimer.h" #include "base/string_util.h" +#include "base/test/test_timeouts.h" #include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/common/chrome_paths.h" @@ -93,7 +94,8 @@ void OmniboxTest::RunQueryChain(const std::wstring& input_text) { // matches to be returned to us. ASSERT_TRUE(autocomplete_edit->SetText(input_text.substr(0, i))); PerfTimer timer; - if (autocomplete_edit->WaitForQuery(action_max_timeout_ms())) { + if (autocomplete_edit->WaitForQuery( + TestTimeouts::action_max_timeout_ms())) { ASSERT_TRUE(autocomplete_edit->GetAutocompleteMatches(&matches)); int64 time_elapsed = timer.Elapsed().InMilliseconds(); diff --git a/chrome/test/ui/pepper_uitest.cc b/chrome/test/ui/pepper_uitest.cc index 590b5f3..f34346d 100644 --- a/chrome/test/ui/pepper_uitest.cc +++ b/chrome/test/ui/pepper_uitest.cc @@ -1,10 +1,11 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/file_path.h" #include "app/app_switches.h" +#include "base/test/test_timeouts.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/ui/npapi_test_helper.h" #include "chrome/test/ui_test_utils.h" @@ -41,6 +42,6 @@ TEST_F(PepperTester, FAILS_Pepper3D) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("pepper_3d", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - action_max_timeout_ms()); + TestTimeouts::action_max_timeout_ms()); } #endif diff --git a/chrome/test/ui/ppapi_uitest.cc b/chrome/test/ui/ppapi_uitest.cc index 911018a..3a5e304 100644 --- a/chrome/test/ui/ppapi_uitest.cc +++ b/chrome/test/ui/ppapi_uitest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -93,7 +93,7 @@ class PPAPITest : public UITest { // making sure we're making forward progress. std::string startup_cookie = WaitUntilCookieNonEmpty(tab.get(), test_url, - "STARTUP_COOKIE", action_max_timeout_ms()); + "STARTUP_COOKIE", TestTimeouts::action_max_timeout_ms()); // If this fails, the plugin couldn't be loaded in the given amount of // time. This may mean the plugin was not found or possibly the system diff --git a/chrome/test/ui/ui_layout_test.cc b/chrome/test/ui/ui_layout_test.cc index a4dffc9..ca55578 100644 --- a/chrome/test/ui/ui_layout_test.cc +++ b/chrome/test/ui/ui_layout_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,6 +8,7 @@ #include "base/path_service.h" #include "base/string_number_conversions.h" #include "base/test/test_file_util.h" +#include "base/test/test_timeouts.h" #include "base/utf_string_conversions.h" #include "chrome/common/chrome_paths.h" #include "chrome/test/automation/tab_proxy.h" @@ -220,7 +221,7 @@ void UILayoutTest::RunLayoutTest(const std::string& test_case_file_name, ASSERT_TRUE(tab->NavigateToURL(*new_test_url.get())); std::string escaped_value = WaitUntilCookieNonEmpty(tab.get(), *new_test_url.get(), - status_cookie.c_str(), action_max_timeout_ms()); + status_cookie.c_str(), TestTimeouts::action_max_timeout_ms()); // Unescapes and normalizes the actual result. std::string value = UnescapeURLComponent(escaped_value, diff --git a/chrome/test/ui/ui_test.h b/chrome/test/ui/ui_test.h index c248d0d..55763c9 100644 --- a/chrome/test/ui/ui_test.h +++ b/chrome/test/ui/ui_test.h @@ -249,9 +249,6 @@ class UITestBase { static int command_execution_timeout_ms() { return TestTimeouts::command_execution_timeout_ms(); } - static int action_max_timeout_ms() { - return TestTimeouts::action_max_timeout_ms(); - } // Fetch the state which determines whether the profile will be cleared on // next startup. diff --git a/chrome/worker/worker_uitest.cc b/chrome/worker/worker_uitest.cc index 936f134..cb83f77 100644 --- a/chrome/worker/worker_uitest.cc +++ b/chrome/worker/worker_uitest.cc @@ -48,7 +48,7 @@ class WorkerTest : public UILayoutTest { ASSERT_TRUE(tab->NavigateToURL(url)); std::string value = WaitUntilCookieNonEmpty(tab.get(), url, - kTestCompleteCookie, action_max_timeout_ms()); + kTestCompleteCookie, TestTimeouts::action_max_timeout_ms()); ASSERT_STREQ(kTestCompleteSuccess, value.c_str()); } @@ -71,7 +71,7 @@ class WorkerTest : public UILayoutTest { ASSERT_TRUE(tab->NavigateToURL(url)); std::string value = WaitUntilCookieNonEmpty(tab.get(), url, - kTestCompleteCookie, action_max_timeout_ms()); + kTestCompleteCookie, TestTimeouts::action_max_timeout_ms()); // Close the incognito window ASSERT_TRUE(incognito->RunCommand(IDC_CLOSE_WINDOW)); @@ -607,7 +607,7 @@ TEST_F(WorkerTest, FLAKY_WorkerClose) { FilePath(kWorkerClose)); ASSERT_TRUE(tab->NavigateToURL(url)); std::string value = WaitUntilCookieNonEmpty(tab.get(), url, - kTestCompleteCookie, action_max_timeout_ms()); + kTestCompleteCookie, TestTimeouts::action_max_timeout_ms()); ASSERT_STREQ(kTestCompleteSuccess, value.c_str()); ASSERT_TRUE(WaitForProcessCountToBe(1, 0)); } @@ -624,7 +624,7 @@ TEST_F(WorkerTest, QueuedSharedWorkerShutdown) { ASSERT_TRUE(tab.get()); ASSERT_TRUE(tab->NavigateToURL(url)); std::string value = WaitUntilCookieNonEmpty(tab.get(), url, - kTestCompleteCookie, action_max_timeout_ms()); + kTestCompleteCookie, TestTimeouts::action_max_timeout_ms()); ASSERT_STREQ(kTestCompleteSuccess, value.c_str()); ASSERT_TRUE(WaitForProcessCountToBe(1, max_workers_per_tab)); } @@ -658,7 +658,7 @@ TEST_F(WorkerTest, FLAKY_MultipleTabsQueuedSharedWorker) { ASSERT_TRUE(window->AppendTab(url2)); std::string value = WaitUntilCookieNonEmpty(tab.get(), url, - kTestCompleteCookie, action_max_timeout_ms()); + kTestCompleteCookie, TestTimeouts::action_max_timeout_ms()); ASSERT_STREQ(kTestCompleteSuccess, value.c_str()); ASSERT_TRUE(WaitForProcessCountToBe(3, max_workers_per_tab)); } @@ -687,7 +687,7 @@ TEST_F(WorkerTest, FLAKY_QueuedSharedWorkerStartedFromOtherTab) { ASSERT_TRUE(window->AppendTab(url2)); std::string value = WaitUntilCookieNonEmpty(tab.get(), url, - kTestCompleteCookie, action_max_timeout_ms()); + kTestCompleteCookie, TestTimeouts::action_max_timeout_ms()); ASSERT_STREQ(kTestCompleteSuccess, value.c_str()); ASSERT_TRUE(WaitForProcessCountToBe(2, max_workers_per_tab+1)); } |