diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-22 13:26:46 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-22 13:26:46 +0000 |
commit | 1a96b432de916d958dd03404701405c981fbaff3 (patch) | |
tree | 95b1e48eb425c67f139980834e61e848094786e7 /chrome/browser | |
parent | 99ad6c9c402c3453044928a6e4414e695feb9200 (diff) | |
download | chromium_src-1a96b432de916d958dd03404701405c981fbaff3.zip chromium_src-1a96b432de916d958dd03404701405c981fbaff3.tar.gz chromium_src-1a96b432de916d958dd03404701405c981fbaff3.tar.bz2 |
[GTTF] Reduce number of automation methods ending with WithTimeout.
They are just too easy to misuse. People started inventing their own
hardcoded timeouts all over the place.
Also, the is_timeout return parameter was not checked consistently.
Additionally, some calls actually had no timeout at all, making
hangs possible.
This change also removes useless DLOG statements. We should get the
required info from the ASSERT/EXPECT macros in test code, which is
quite well checked by WARN_UNUSED_RESULT.
TEST=all ui-based
BUG=none
Review URL: http://codereview.chromium.org/1076005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42213 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/cookie_modal_dialog_uitest.cc | 3 | ||||
-rw-r--r-- | chrome/browser/sessions/session_restore_uitest.cc | 4 | ||||
-rw-r--r-- | chrome/browser/tab_contents/view_source_uitest.cc | 7 | ||||
-rw-r--r-- | chrome/browser/tab_restore_uitest.cc | 16 | ||||
-rw-r--r-- | chrome/browser/unload_uitest.cc | 2 |
5 files changed, 14 insertions, 18 deletions
diff --git a/chrome/browser/cookie_modal_dialog_uitest.cc b/chrome/browser/cookie_modal_dialog_uitest.cc index bcd204c..1c85bed 100644 --- a/chrome/browser/cookie_modal_dialog_uitest.cc +++ b/chrome/browser/cookie_modal_dialog_uitest.cc @@ -32,8 +32,7 @@ class CookieModalDialogTest : public UITest { bool modal_dialog_showing = false; MessageBoxFlags::DialogButton available_buttons; - ASSERT_TRUE(automation()->WaitForAppModalDialog( - action_max_timeout_ms())); + ASSERT_TRUE(automation()->WaitForAppModalDialog()); ASSERT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing, &available_buttons)); ASSERT_TRUE(modal_dialog_showing); diff --git a/chrome/browser/sessions/session_restore_uitest.cc b/chrome/browser/sessions/session_restore_uitest.cc index 1947521..7d6f366 100644 --- a/chrome/browser/sessions/session_restore_uitest.cc +++ b/chrome/browser/sessions/session_restore_uitest.cc @@ -357,7 +357,7 @@ TEST_F(SessionRestoreUITest, DontRestoreWhileIncognito) { LaunchBrowser(launch_arguments_, false); // A new window should appear; - ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, action_timeout_ms())); + ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2)); // And it shouldn't have url1_ in it. browser_proxy = automation()->GetBrowserWindow(1); @@ -414,7 +414,7 @@ TEST_F(SessionRestoreUITest, app_launch_arguments.AppendSwitchWithValue(switches::kApp, UTF8ToWide(url2_.spec())); LaunchBrowser(app_launch_arguments, false); - ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, action_timeout_ms())); + ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2)); // Close the first window. The only window left is the App window. CloseWindow(0, 2); diff --git a/chrome/browser/tab_contents/view_source_uitest.cc b/chrome/browser/tab_contents/view_source_uitest.cc index e5d71b7..aec2b25 100644 --- a/chrome/browser/tab_contents/view_source_uitest.cc +++ b/chrome/browser/tab_contents/view_source_uitest.cc @@ -20,12 +20,13 @@ class ViewSourceTest : public UITest { bool IsPageMenuCommandEnabled(int command) { scoped_refptr<BrowserProxy> window_proxy(automation()->GetBrowserWindow(0)); + EXPECT_TRUE(window_proxy.get()); if (!window_proxy.get()) return false; - bool timed_out; - return window_proxy->IsPageMenuCommandEnabledWithTimeout( - command, 5000, &timed_out) && !timed_out; + bool enabled; + EXPECT_TRUE(window_proxy->IsPageMenuCommandEnabled(command, &enabled)); + return enabled; } protected: diff --git a/chrome/browser/tab_restore_uitest.cc b/chrome/browser/tab_restore_uitest.cc index c955eb3..56ff39f 100644 --- a/chrome/browser/tab_restore_uitest.cc +++ b/chrome/browser/tab_restore_uitest.cc @@ -283,8 +283,7 @@ TEST_F(TabRestoreUITest, MAYBE_BasicRestoreFromClosedWindow) { // Close the final tab in the first browser. EXPECT_TRUE(tab_proxy->Close(true)); - ASSERT_TRUE(automation()->WaitForWindowCountToBecome( - 1, action_max_timeout_ms())); + ASSERT_TRUE(automation()->WaitForWindowCountToBecome(1)); // Tab and browser are no longer valid. tab_proxy = NULL; @@ -333,12 +332,10 @@ TEST_F(TabRestoreUITest, DISABLED_DontLoadRestoredTab) { ASSERT_EQ(current_tab_count, starting_tab_count + 2); // Make sure that there's nothing else to restore. - bool is_timeout = false; - bool enabled = - browser_proxy->IsPageMenuCommandEnabledWithTimeout(IDC_RESTORE_TAB, - action_max_timeout_ms(), &is_timeout); - if (!is_timeout) - ASSERT_FALSE(enabled); + bool enabled; + ASSERT_TRUE(browser_proxy->IsPageMenuCommandEnabled(IDC_RESTORE_TAB, + &enabled)); + EXPECT_FALSE(enabled); } // Open a window with multiple tabs, close a tab, then close the window. @@ -434,8 +431,7 @@ TEST_F(TabRestoreUITest, RestoreIntoSameWindow) { tab_proxy = browser_proxy->GetTab(0); ASSERT_TRUE(tab_proxy.get()); EXPECT_TRUE(tab_proxy->Close(true)); - ASSERT_TRUE(automation()->WaitForWindowCountToBecome( - 1, action_max_timeout_ms())); + ASSERT_TRUE(automation()->WaitForWindowCountToBecome(1)); browser_proxy = NULL; tab_proxy = NULL; diff --git a/chrome/browser/unload_uitest.cc b/chrome/browser/unload_uitest.cc index 9447f1e..d4b3a54 100644 --- a/chrome/browser/unload_uitest.cc +++ b/chrome/browser/unload_uitest.cc @@ -169,7 +169,7 @@ class UnloadTest : public UITest { #if defined(OS_WIN) || defined(OS_LINUX) bool modal_dialog_showing = false; MessageBoxFlags::DialogButton available_buttons; - EXPECT_TRUE(automation()->WaitForAppModalDialog(action_timeout_ms())); + EXPECT_TRUE(automation()->WaitForAppModalDialog()); EXPECT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing, &available_buttons)); ASSERT_TRUE(modal_dialog_showing); |