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/test | |
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/test')
-rw-r--r-- | chrome/test/automated_ui_tests/automated_ui_test_base.cc | 89 | ||||
-rw-r--r-- | chrome/test/automated_ui_tests/automated_ui_tests.cc | 9 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy.cc | 112 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy.h | 18 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy_uitest.cc | 63 | ||||
-rw-r--r-- | chrome/test/automation/browser_proxy.cc | 105 | ||||
-rw-r--r-- | chrome/test/automation/browser_proxy.h | 42 | ||||
-rw-r--r-- | chrome/test/automation/tab_proxy.cc | 35 | ||||
-rw-r--r-- | chrome/test/automation/tab_proxy.h | 13 | ||||
-rw-r--r-- | chrome/test/automation/window_proxy.cc | 15 | ||||
-rw-r--r-- | chrome/test/automation/window_proxy.h | 6 | ||||
-rw-r--r-- | chrome/test/interactive_ui/npapi_interactive_test.cc | 2 | ||||
-rw-r--r-- | chrome/test/memory_test/memory_test.cc | 8 | ||||
-rw-r--r-- | chrome/test/reliability/page_load_test.cc | 53 | ||||
-rw-r--r-- | chrome/test/ui/fast_shutdown_uitest.cc | 2 | ||||
-rw-r--r-- | chrome/test/ui/npapi_uitest.cc | 6 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.cc | 14 |
17 files changed, 141 insertions, 451 deletions
diff --git a/chrome/test/automated_ui_tests/automated_ui_test_base.cc b/chrome/test/automated_ui_tests/automated_ui_test_base.cc index 9665aa3..4dd0f41 100644 --- a/chrome/test/automated_ui_tests/automated_ui_test_base.cc +++ b/chrome/test/automated_ui_tests/automated_ui_test_base.cc @@ -38,16 +38,8 @@ bool AutomatedUITestBase::BackButton() { bool AutomatedUITestBase::CloseActiveTab() { BrowserProxy* browser = active_browser(); int tab_count; - bool is_timeout; - if (!browser->GetTabCountWithTimeout(&tab_count, - action_max_timeout_ms(), - &is_timeout)) { - LogErrorMessage("get_tab_count_with_timeout_failed"); - return false; - } - - if (is_timeout) { - LogInfoMessage("get_tab_count_timed_out"); + if (!browser->GetTabCount(&tab_count)) { + LogErrorMessage("get_tab_count_failed"); return false; } @@ -101,13 +93,10 @@ bool AutomatedUITestBase::DragTabOut() { LogErrorMessage("active_window_not_found"); return false; } - bool is_timeout; int tab_count; - if (!browser->GetTabCountWithTimeout(&tab_count, - action_max_timeout_ms(), - &is_timeout)) { - LogErrorMessage("get_tab_count_with_timeout_failed"); + if (!browser->GetTabCount(&tab_count)) { + LogErrorMessage("get_tab_count_failed"); return false; } @@ -117,9 +106,7 @@ bool AutomatedUITestBase::DragTabOut() { } int tab_index; - if (!browser->GetActiveTabIndexWithTimeout(&tab_index, - action_max_timeout_ms(), - &is_timeout)) { + if (!browser->GetActiveTabIndex(&tab_index)) { LogWarningMessage("no_active_tab"); return false; } @@ -130,19 +117,15 @@ bool AutomatedUITestBase::DragTabOut() { } gfx::Rect dragged_tab_bounds; - if (!window->GetViewBoundsWithTimeout(VIEW_ID_TAB_0 + tab_index, - &dragged_tab_bounds, false, - action_max_timeout_ms(), - &is_timeout)) { + if (!window->GetViewBounds(VIEW_ID_TAB_0 + tab_index, + &dragged_tab_bounds, false)) { LogWarningMessage("no_tab_view_found"); return false; } gfx::Rect urlbar_bounds; - if (!window->GetViewBoundsWithTimeout(VIEW_ID_LOCATION_BAR, - &urlbar_bounds, false, - action_max_timeout_ms(), - &is_timeout)) { + if (!window->GetViewBounds(VIEW_ID_LOCATION_BAR, + &urlbar_bounds, false)) { LogWarningMessage("no_location_bar_found"); return false; } @@ -155,10 +138,8 @@ bool AutomatedUITestBase::DragTabOut() { end.set_x(start.x()); end.set_y(start.y() + 3 * urlbar_bounds.height()); - if (!browser->SimulateDragWithTimeout(start, end, - views::Event::EF_LEFT_BUTTON_DOWN, - action_max_timeout_ms(), - &is_timeout, false)) { + if (!browser->SimulateDrag(start, end, views::Event::EF_LEFT_BUTTON_DOWN, + false)) { LogWarningMessage("failed_to_simulate_drag"); return false; } @@ -179,13 +160,10 @@ bool AutomatedUITestBase::DragActiveTab(bool drag_right) { LogErrorMessage("active_window_not_found"); return false; } - bool is_timeout; int tab_count; - if (!browser->GetTabCountWithTimeout(&tab_count, - action_max_timeout_ms(), - &is_timeout)) { - LogErrorMessage("get_tab_cound_with_timeout_failed"); + if (!browser->GetTabCount(&tab_count)) { + LogErrorMessage("get_tab_count_failed"); return false; } @@ -195,18 +173,14 @@ bool AutomatedUITestBase::DragActiveTab(bool drag_right) { } int tab_index; - if (!browser->GetActiveTabIndexWithTimeout(&tab_index, - action_max_timeout_ms(), - &is_timeout)) { + if (!browser->GetActiveTabIndex(&tab_index)) { LogWarningMessage("no_active_tab"); return false; } gfx::Rect dragged_tab_bounds; - if (!window->GetViewBoundsWithTimeout(VIEW_ID_TAB_0 + tab_index, - &dragged_tab_bounds, false, - action_max_timeout_ms(), - &is_timeout)) { + if (!window->GetViewBounds(VIEW_ID_TAB_0 + tab_index, + &dragged_tab_bounds, false)) { LogWarningMessage("no_tab_view_found"); return false; } @@ -232,11 +206,8 @@ bool AutomatedUITestBase::DragActiveTab(bool drag_right) { destination_point.Offset(-2 * dragged_tab_bounds.width() / 3, 0); } - if (!browser->SimulateDragWithTimeout(dragged_tab_point, - destination_point, - views::Event::EF_LEFT_BUTTON_DOWN, - action_max_timeout_ms(), - &is_timeout, false)) { + if (!browser->SimulateDrag(dragged_tab_point, destination_point, + views::Event::EF_LEFT_BUTTON_DOWN, false)) { LogWarningMessage("failed_to_simulate_drag"); return false; } @@ -288,9 +259,7 @@ bool AutomatedUITestBase::OpenAndActivateNewBrowserWindow( LogErrorMessage("browser_window_not_found"); return false; } - bool is_timeout; - if (!browser->ActivateTabWithTimeout(0, action_max_timeout_ms(), - &is_timeout)) { + if (!browser->ActivateTab(0)) { LogWarningMessage("failed_to_activate_tab"); return false; } @@ -310,19 +279,12 @@ bool AutomatedUITestBase::Navigate(const GURL& url) { LogErrorMessage("active_tab_not_found"); return false; } - bool did_timeout = false; - AutomationMsg_NavigationResponseValues result = - tab->NavigateToURLWithTimeout(url, 1, action_max_timeout_ms(), - &did_timeout); + AutomationMsg_NavigationResponseValues result = tab->NavigateToURL(url); if (result != AUTOMATION_MSG_NAVIGATION_SUCCESS) { LogErrorMessage("navigation_failed"); return false; } - if (did_timeout) { - LogWarningMessage("timeout"); - return false; - } return true; } @@ -410,19 +372,12 @@ scoped_refptr<TabProxy> AutomatedUITestBase::GetActiveTab() { return false; } - bool did_timeout; - scoped_refptr<TabProxy> tab = - browser->GetActiveTabWithTimeout(action_max_timeout_ms(), &did_timeout); - if (did_timeout) - return NULL; - return tab; + return browser->GetActiveTab(); } scoped_refptr<WindowProxy> AutomatedUITestBase::GetAndActivateWindowForBrowser( BrowserProxy* browser) { - bool did_timeout; - if (!browser->BringToFrontWithTimeout(action_max_timeout_ms(), - &did_timeout)) { + if (!browser->BringToFront()) { LogWarningMessage("failed_to_bring_window_to_front"); return NULL; } diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.cc b/chrome/test/automated_ui_tests/automated_ui_tests.cc index 9d9d0f0..fed3dba 100644 --- a/chrome/test/automated_ui_tests/automated_ui_tests.cc +++ b/chrome/test/automated_ui_tests/automated_ui_tests.cc @@ -593,18 +593,11 @@ bool AutomatedUITest::FuzzyTestDialog(int num_actions) { bool AutomatedUITest::ForceCrash() { scoped_refptr<TabProxy> tab(GetActiveTab()); GURL test_url(chrome::kAboutCrashURL); - bool did_timeout; - AutomationMsg_NavigationResponseValues result = - tab->NavigateToURLWithTimeout(test_url, 1, kDebuggingTimeoutMsec, - &did_timeout); + AutomationMsg_NavigationResponseValues result = tab->NavigateToURL(test_url); if (result != AUTOMATION_MSG_NAVIGATION_SUCCESS) { AddErrorAttribute("navigation_failed"); return false; } - if (!did_timeout) { - AddInfoAttribute("expected_crash"); - return false; - } return true; } diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc index d383443..46fcc3b 100644 --- a/chrome/test/automation/automation_proxy.cc +++ b/chrome/test/automation/automation_proxy.cc @@ -249,16 +249,7 @@ bool AutomationProxy::GetBrowserWindowCount(int* num_windows) { return false; } - bool succeeded = SendWithTimeout( - new AutomationMsg_BrowserWindowCount(0, num_windows), - command_execution_timeout_ms(), NULL); - - if (!succeeded) { - DLOG(ERROR) << "GetWindowCount did not complete in a timely fashion"; - return false; - } - - return succeeded; + return Send(new AutomationMsg_BrowserWindowCount(0, num_windows)); } bool AutomationProxy::GetNormalBrowserWindowCount(int* num_windows) { @@ -267,26 +258,16 @@ bool AutomationProxy::GetNormalBrowserWindowCount(int* num_windows) { return false; } - bool succeeded = SendWithTimeout( - new AutomationMsg_NormalBrowserWindowCount(0, num_windows), - command_execution_timeout_ms(), NULL); - - if (!succeeded) { - DLOG(ERROR) << "GetNormalWindowCount did not complete in a timely fashion"; - return false; - } - - return succeeded; + return Send(new AutomationMsg_NormalBrowserWindowCount(0, num_windows)); } -bool AutomationProxy::WaitForWindowCountToBecome(int count, - int wait_timeout) { +bool AutomationProxy::WaitForWindowCountToBecome(int count) { bool wait_success = false; - bool send_success = SendWithTimeout( - new AutomationMsg_WaitForBrowserWindowCountToBecome(0, count, - &wait_success), - wait_timeout, NULL); - return wait_success && send_success; + if (!Send(new AutomationMsg_WaitForBrowserWindowCountToBecome( + 0, count, &wait_success))) { + return false; + } + return wait_success; } bool AutomationProxy::GetShowingAppModalDialog( @@ -299,11 +280,8 @@ bool AutomationProxy::GetShowingAppModalDialog( int button_int = 0; - if (!SendWithTimeout( - new AutomationMsg_ShowingAppModalDialog( - 0, showing_app_modal_dialog, &button_int), - command_execution_timeout_ms(), NULL)) { - DLOG(ERROR) << "ShowingAppModalDialog did not complete in a timely fashion"; + if (!Send(new AutomationMsg_ShowingAppModalDialog( + 0, showing_app_modal_dialog, &button_int))) { return false; } @@ -315,22 +293,19 @@ bool AutomationProxy::ClickAppModalDialogButton( MessageBoxFlags::DialogButton button) { bool succeeded = false; - if (!SendWithTimeout( - new AutomationMsg_ClickAppModalDialogButton( - 0, button, &succeeded), - command_execution_timeout_ms(), NULL)) { + if (!Send(new AutomationMsg_ClickAppModalDialogButton( + 0, button, &succeeded))) { return false; } return succeeded; } -bool AutomationProxy::WaitForAppModalDialog(int wait_timeout) { +bool AutomationProxy::WaitForAppModalDialog() { bool wait_success = false; - bool send_success = SendWithTimeout( - new AutomationMsg_WaitForAppModalDialogToBeShown(0, &wait_success), - wait_timeout, NULL); - return wait_success && send_success; + if (!Send(new AutomationMsg_WaitForAppModalDialogToBeShown(0, &wait_success))) + return false; + return wait_success; } bool AutomationProxy::IsURLDisplayed(GURL url) { @@ -401,11 +376,8 @@ void AutomationProxy::OnChannelError() { scoped_refptr<WindowProxy> AutomationProxy::GetActiveWindow() { int handle = 0; - - if (!SendWithTimeout(new AutomationMsg_ActiveWindow(0, &handle), - command_execution_timeout_ms(), NULL)) { + if (!Send(new AutomationMsg_ActiveWindow(0, &handle))) return NULL; - } return ProxyObjectFromHandle<WindowProxy>(handle); } @@ -413,51 +385,32 @@ scoped_refptr<WindowProxy> AutomationProxy::GetActiveWindow() { scoped_refptr<BrowserProxy> AutomationProxy::GetBrowserWindow( int window_index) { int handle = 0; - - if (!SendWithTimeout(new AutomationMsg_BrowserWindow(0, window_index, - &handle), - command_execution_timeout_ms(), NULL)) { - DLOG(ERROR) << "GetBrowserWindow did not complete in a timely fashion"; + if (!Send(new AutomationMsg_BrowserWindow(0, window_index, &handle))) return NULL; - } return ProxyObjectFromHandle<BrowserProxy>(handle); } bool AutomationProxy::GetBrowserLocale(string16* locale) { DCHECK(locale != NULL); - if (!SendWithTimeout(new AutomationMsg_GetBrowserLocale(0, locale), - command_execution_timeout_ms(), NULL)) { - DLOG(ERROR) << "GetBrowserLocale did not complete in a timely fashion"; + if (!Send(new AutomationMsg_GetBrowserLocale(0, locale))) return false; - } - // An empty locale means that the browser has no UI language - // which is impossible. - DCHECK(!locale->empty()); return !locale->empty(); } scoped_refptr<BrowserProxy> AutomationProxy::FindNormalBrowserWindow() { int handle = 0; - - if (!SendWithTimeout(new AutomationMsg_FindNormalBrowserWindow(0, &handle), - command_execution_timeout_ms(), NULL)) { + if (!Send(new AutomationMsg_FindNormalBrowserWindow(0, &handle))) return NULL; - } return ProxyObjectFromHandle<BrowserProxy>(handle); } scoped_refptr<BrowserProxy> AutomationProxy::GetLastActiveBrowserWindow() { int handle = 0; - - if (!SendWithTimeout(new AutomationMsg_LastActiveBrowserWindow( - 0, &handle), command_execution_timeout_ms(), NULL)) { - DLOG(ERROR) << - "GetLastActiveBrowserWindow did not complete in a timely fashion"; + if (!Send(new AutomationMsg_LastActiveBrowserWindow(0, &handle))) return NULL; - } return ProxyObjectFromHandle<BrowserProxy>(handle); } @@ -473,26 +426,13 @@ base::file_handle_mapping_vector AutomationProxy::fds_to_map() const { #endif // defined(OS_POSIX) bool AutomationProxy::Send(IPC::Message* message) { - return SendWithTimeout(message, base::kNoTimeout, NULL); -} - -bool AutomationProxy::SendWithTimeout(IPC::Message* message, int timeout, - bool* is_timeout) { - // DCHECK_EQ(listener_thread_id_, PlatformThread::CurrentId()); - - if (is_timeout) - *is_timeout = false; - - if (channel_.get()) { - bool result = channel_->SendWithTimeout(message, timeout); - if (!result && is_timeout) - *is_timeout = true; - return result; + if (!channel_.get()) { + LOG(ERROR) << "Automation channel has been closed; dropping message!"; + delete message; + return false; } - DLOG(WARNING) << "Channel has been closed; dropping message!"; - delete message; - return false; + return channel_->SendWithTimeout(message, command_execution_timeout_ms()); } void AutomationProxy::InvalidateHandle(const IPC::Message& message) { diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h index 9000ec6..7809ec1 100644 --- a/chrome/test/automation/automation_proxy.h +++ b/chrome/test/automation/automation_proxy.h @@ -40,17 +40,14 @@ class AutomationMessageSender : public IPC::Message::Sender { // Sends a message synchronously; it doesn't return until a response has been // received or a timeout has expired. // - // Use base::kNoTimeout for no timeout. - // // The function returns true if a response is received, and returns false if - // there is a failure or timeout (in milliseconds). If return after timeout, - // is_timeout is set to true. + // there is a failure or timeout (in milliseconds). + // // NOTE: When timeout occurs, the connection between proxy provider may be // in transit state. Specifically, there might be pending IPC messages, // and the proxy provider might be still working on the previous // request. - virtual bool SendWithTimeout(IPC::Message* message, int timeout, - bool* is_timeout) = 0; + virtual bool Send(IPC::Message* message) = 0; }; // This is the interface that external processes can use to interact with @@ -99,8 +96,7 @@ class AutomationProxy : public IPC::Channel::Listener, // Block the thread until the window count becomes the provided value. // Returns true on success. - bool WaitForWindowCountToBecome(int target_count, - int wait_timeout) WARN_UNUSED_RESULT; + bool WaitForWindowCountToBecome(int target_count) WARN_UNUSED_RESULT; // Fills the number of open normal browser windows (normal type and // non-incognito mode) into the given variable, returning true on success. @@ -123,7 +119,7 @@ class AutomationProxy : public IPC::Channel::Listener, // Block the thread until a modal dialog is displayed. Returns true on // success. - bool WaitForAppModalDialog(int wait_timeout) WARN_UNUSED_RESULT; + bool WaitForAppModalDialog() WARN_UNUSED_RESULT; // Returns true if one of the tabs in any window displays given url. bool IsURLDisplayed(GURL url) WARN_UNUSED_RESULT; @@ -208,10 +204,8 @@ class AutomationProxy : public IPC::Channel::Listener, base::file_handle_mapping_vector fds_to_map() const; #endif - // AutomationMessageSender implementations. + // AutomationMessageSender implementation. virtual bool Send(IPC::Message* message) WARN_UNUSED_RESULT; - virtual bool SendWithTimeout(IPC::Message* message, int timeout, - bool* is_timeout) WARN_UNUSED_RESULT; // Wrapper over AutomationHandleTracker::InvalidateHandle. Receives the // message from AutomationProxy, unpacks the messages and routes that call to diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc index 9ff86df..004b99b 100644 --- a/chrome/test/automation/automation_proxy_uitest.cc +++ b/chrome/test/automation/automation_proxy_uitest.cc @@ -290,63 +290,6 @@ TEST_F(AutomationProxyTest, NavigateToURL) { // TODO(vibhor) : Add a test using testserver. } -TEST_F(AutomationProxyTest, NavigateToURLWithTimeout1) { - scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); - ASSERT_TRUE(window.get()); - scoped_refptr<TabProxy> tab(window->GetTab(0)); - ASSERT_TRUE(tab.get()); - - FilePath filename(test_data_directory_); - filename = filename.AppendASCII("title2.html"); - - bool is_timeout; - ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, - tab->NavigateToURLWithTimeout(net::FilePathToFileURL(filename), - 1, 5000, &is_timeout)); - ASSERT_FALSE(is_timeout); - - std::wstring title; - ASSERT_TRUE(tab->GetTabTitle(&title)); - ASSERT_STREQ(L"Title Of Awesomeness", title.c_str()); - - // Use timeout high enough to allow the browser to create a url request job. - const int kLowTimeoutMs = 250; - ASSERT_GE(URLRequestSlowHTTPJob::kDelayMs, kLowTimeoutMs); - ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_ERROR, - tab->NavigateToURLWithTimeout( - URLRequestSlowHTTPJob::GetMockUrl(filename), - 1, kLowTimeoutMs, &is_timeout)); - ASSERT_TRUE(is_timeout); -} - -TEST_F(AutomationProxyTest, NavigateToURLWithTimeout2) { - scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); - ASSERT_TRUE(window.get()); - scoped_refptr<TabProxy> tab(window->GetTab(0)); - ASSERT_TRUE(tab.get()); - - FilePath filename1(test_data_directory_); - filename1 = filename1.AppendASCII("title1.html"); - - bool is_timeout; - - // Use timeout high enough to allow the browser to create a url request job. - const int kLowTimeoutMs = 250; - ASSERT_GE(URLRequestSlowHTTPJob::kDelayMs, kLowTimeoutMs); - ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_ERROR, - tab->NavigateToURLWithTimeout( - URLRequestSlowHTTPJob::GetMockUrl(filename1), - 1, kLowTimeoutMs, &is_timeout)); - ASSERT_TRUE(is_timeout); - - FilePath filename2(test_data_directory_); - filename2 = filename2.AppendASCII("title1.html"); - ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, - tab->NavigateToURLWithTimeout(net::FilePathToFileURL(filename2), - 1, 5000, &is_timeout)); - ASSERT_FALSE(is_timeout); -} - TEST_F(AutomationProxyTest, GoBackForward) { scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); ASSERT_TRUE(window.get()); @@ -1439,7 +1382,7 @@ TEST_F(AutomationProxyTest, DISABLED_AppModalDialogTest) { "<body onload='onload()'></body></html>"; ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(GURL(content))); - EXPECT_TRUE(automation()->WaitForAppModalDialog(3000)); + EXPECT_TRUE(automation()->WaitForAppModalDialog()); EXPECT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing, &button)); EXPECT_TRUE(modal_dialog_showing); @@ -1467,7 +1410,7 @@ TEST_F(AutomationProxyTest, DISABLED_AppModalDialogTest) { "</head><body onload='onload()'></body></html>"; ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(GURL(content))); - EXPECT_TRUE(automation()->WaitForAppModalDialog(3000)); + EXPECT_TRUE(automation()->WaitForAppModalDialog()); EXPECT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing, &button)); EXPECT_TRUE(modal_dialog_showing); @@ -1488,7 +1431,7 @@ TEST_F(AutomationProxyTest, DISABLED_AppModalDialogTest) { // Try again. ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(GURL(content))); - EXPECT_TRUE(automation()->WaitForAppModalDialog(3000)); + EXPECT_TRUE(automation()->WaitForAppModalDialog()); EXPECT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing, &button)); EXPECT_TRUE(modal_dialog_showing); diff --git a/chrome/test/automation/browser_proxy.cc b/chrome/test/automation/browser_proxy.cc index 08759a9..6db138e 100644 --- a/chrome/test/automation/browser_proxy.cc +++ b/chrome/test/automation/browser_proxy.cc @@ -22,18 +22,15 @@ using base::TimeTicks; bool BrowserProxy::ActivateTab(int tab_index) { - return ActivateTabWithTimeout(tab_index, base::kNoTimeout, NULL); -} - -bool BrowserProxy::ActivateTabWithTimeout(int tab_index, uint32 timeout_ms, - bool* is_timeout) { if (!is_valid()) return false; int activate_tab_response = -1; - sender_->SendWithTimeout(new AutomationMsg_ActivateTab( - 0, handle_, tab_index, &activate_tab_response), timeout_ms, is_timeout); + if (!sender_->Send(new AutomationMsg_ActivateTab( + 0, handle_, tab_index, &activate_tab_response))) { + return false; + } if (activate_tab_response >= 0) return true; @@ -42,34 +39,25 @@ bool BrowserProxy::ActivateTabWithTimeout(int tab_index, uint32 timeout_ms, } bool BrowserProxy::BringToFront() { - return BringToFrontWithTimeout(base::kNoTimeout, NULL); -} - -bool BrowserProxy::BringToFrontWithTimeout(uint32 timeout_ms, - bool* is_timeout) { if (!is_valid()) return false; bool succeeded = false; - sender_->SendWithTimeout(new AutomationMsg_BringBrowserToFront( - 0, handle_, &succeeded), timeout_ms, is_timeout); + if (!sender_->Send(new AutomationMsg_BringBrowserToFront( + 0, handle_, &succeeded))) { + return false; + } return succeeded; } -bool BrowserProxy::IsPageMenuCommandEnabledWithTimeout(int id, - uint32 timeout_ms, - bool* is_timeout) { +bool BrowserProxy::IsPageMenuCommandEnabled(int id, bool* enabled) { if (!is_valid()) return false; - bool succeeded = false; - - sender_->SendWithTimeout(new AutomationMsg_IsPageMenuCommandEnabled( - 0, handle_, id, &succeeded), timeout_ms, is_timeout); - - return succeeded; + return sender_->Send(new AutomationMsg_IsPageMenuCommandEnabled( + 0, handle_, id, enabled)); } bool BrowserProxy::AppendTab(const GURL& tab_url) { @@ -84,12 +72,6 @@ bool BrowserProxy::AppendTab(const GURL& tab_url) { } bool BrowserProxy::GetActiveTabIndex(int* active_tab_index) const { - return GetActiveTabIndexWithTimeout(active_tab_index, base::kNoTimeout, NULL); -} - -bool BrowserProxy::GetActiveTabIndexWithTimeout(int* active_tab_index, - uint32 timeout_ms, - bool* is_timeout) const { if (!is_valid()) return false; @@ -100,17 +82,17 @@ bool BrowserProxy::GetActiveTabIndexWithTimeout(int* active_tab_index, int active_tab_index_response = -1; - bool succeeded = sender_->SendWithTimeout( - new AutomationMsg_ActiveTabIndex(0, handle_, &active_tab_index_response), - timeout_ms, is_timeout); + if (!sender_->Send(new AutomationMsg_ActiveTabIndex( + 0, handle_, &active_tab_index_response))) { + return false; + } if (active_tab_index_response >= 0) { *active_tab_index = active_tab_index_response; - } else { - succeeded = false; + return true; } - - return succeeded; + + return false; } scoped_refptr<TabProxy> BrowserProxy::GetTab(int tab_index) const { @@ -136,23 +118,13 @@ scoped_refptr<TabProxy> BrowserProxy::GetTab(int tab_index) const { } scoped_refptr<TabProxy> BrowserProxy::GetActiveTab() const { - return GetActiveTabWithTimeout(base::kNoTimeout, NULL); -} - -scoped_refptr<TabProxy> BrowserProxy::GetActiveTabWithTimeout(uint32 timeout_ms, - bool* is_timeout) const { int active_tab_index; - if (!GetActiveTabIndexWithTimeout(&active_tab_index, timeout_ms, is_timeout)) + if (!GetActiveTabIndex(&active_tab_index)) return NULL; return GetTab(active_tab_index); } bool BrowserProxy::GetTabCount(int* num_tabs) const { - return GetTabCountWithTimeout(num_tabs, base::kNoTimeout, NULL); -} - -bool BrowserProxy::GetTabCountWithTimeout(int* num_tabs, uint32 timeout_ms, - bool* is_timeout) const { if (!is_valid()) return false; @@ -163,16 +135,17 @@ bool BrowserProxy::GetTabCountWithTimeout(int* num_tabs, uint32 timeout_ms, int tab_count_response = -1; - bool succeeded = sender_->SendWithTimeout(new AutomationMsg_TabCount( - 0, handle_, &tab_count_response), timeout_ms, is_timeout); + if (!sender_->Send(new AutomationMsg_TabCount( + 0, handle_, &tab_count_response))) { + return false; + } if (tab_count_response >= 0) { *num_tabs = tab_count_response; - } else { - succeeded = false; + return true; } - return succeeded; + return false; } bool BrowserProxy::GetType(Browser::Type* type) const { @@ -185,11 +158,11 @@ bool BrowserProxy::GetType(Browser::Type* type) const { } int type_as_int; - bool succeeded = sender_->SendWithTimeout(new AutomationMsg_Type( - 0, handle_, &type_as_int), base::kNoTimeout, NULL); + if (!sender_->Send(new AutomationMsg_Type(0, handle_, &type_as_int))) + return false; *type = static_cast<Browser::Type>(type_as_int); - return succeeded; + return true; } bool BrowserProxy::ApplyAccelerator(int id) { @@ -200,16 +173,6 @@ bool BrowserProxy::SimulateDrag(const gfx::Point& start, const gfx::Point& end, int flags, bool press_escape_en_route) { - return SimulateDragWithTimeout(start, end, flags, base::kNoTimeout, NULL, - press_escape_en_route); -} - -bool BrowserProxy::SimulateDragWithTimeout(const gfx::Point& start, - const gfx::Point& end, - int flags, - uint32 timeout_ms, - bool* is_timeout, - bool press_escape_en_route) { if (!is_valid()) return false; @@ -219,9 +182,10 @@ bool BrowserProxy::SimulateDragWithTimeout(const gfx::Point& start, bool result = false; - sender_->SendWithTimeout(new AutomationMsg_WindowDrag( - 0, handle_, drag_path, flags, press_escape_en_route, &result), - timeout_ms, is_timeout); + if (!sender_->Send(new AutomationMsg_WindowDrag( + 0, handle_, drag_path, flags, press_escape_en_route, &result))) { + return false; + } return result; } @@ -231,11 +195,8 @@ bool BrowserProxy::WaitForTabCountToBecome(int count, int wait_timeout) { const TimeDelta timeout = TimeDelta::FromMilliseconds(wait_timeout); while (TimeTicks::Now() - start < timeout) { PlatformThread::Sleep(automation::kSleepTime); - bool is_timeout; int new_count; - bool succeeded = GetTabCountWithTimeout(&new_count, wait_timeout, - &is_timeout); - if (!succeeded) + if (!GetTabCount(&new_count)) return false; if (count == new_count) return true; diff --git a/chrome/test/automation/browser_proxy.h b/chrome/test/automation/browser_proxy.h index 674cf83..a21bfe6 100644 --- a/chrome/test/automation/browser_proxy.h +++ b/chrome/test/automation/browser_proxy.h @@ -43,25 +43,13 @@ class BrowserProxy : public AutomationResourceProxy { // successful. bool ActivateTab(int tab_index) WARN_UNUSED_RESULT; - // Like ActivateTab, but returns false if response is not received before - // the specified timeout. - bool ActivateTabWithTimeout(int tab_index, uint32 timeout_ms, - bool* is_timeout) WARN_UNUSED_RESULT; - // Bring the browser window to the front, activating it. Returns true on // success. bool BringToFront() WARN_UNUSED_RESULT; - // Like BringToFront, but returns false if action is not completed before - // the specified timeout. - bool BringToFrontWithTimeout(uint32 timeout_ms, - bool* is_timeout) WARN_UNUSED_RESULT; - - // Checks to see if a navigation command is active or not. Can also - // return false if action is not completed before the specified - // timeout; is_timeout will be set in those cases. - bool IsPageMenuCommandEnabledWithTimeout(int id, uint32 timeout_ms, - bool* is_timeout) WARN_UNUSED_RESULT; + // Checks to see if a navigation command is active or not. If the call was + // successful, puts the result in |enabled| and returns true. + bool IsPageMenuCommandEnabled(int id, bool* enabled) WARN_UNUSED_RESULT; // Append a new tab to the TabStrip. The new tab is selected. // The new tab navigates to the given tab_url. @@ -74,20 +62,10 @@ class BrowserProxy : public AutomationResourceProxy { // successful. bool GetActiveTabIndex(int* active_tab_index) const WARN_UNUSED_RESULT; - // Like GetActiveTabIndex, but returns false if active tab is not received - // before the specified timeout. - bool GetActiveTabIndexWithTimeout(int* active_tab_index, uint32 timeout_ms, - bool* is_timeout) const WARN_UNUSED_RESULT; - // Returns the number of tabs in the given window. Returns true if // the call was successful. bool GetTabCount(int* num_tabs) const WARN_UNUSED_RESULT; - // Like GetTabCount, but returns false if tab count is not received within the - // before timeout. - bool GetTabCountWithTimeout(int* num_tabs, uint32 timeout_ms, - bool* is_timeout) const WARN_UNUSED_RESULT; - // Returns the type of the given window. Returns true if the call was // successful. bool GetType(Browser::Type* type) const WARN_UNUSED_RESULT; @@ -103,11 +81,6 @@ class BrowserProxy : public AutomationResourceProxy { // ownership of the pointer to the caller. On failure, returns NULL. scoped_refptr<TabProxy> GetActiveTab() const; - // Like GetActiveTab, but returns NULL if no response is received before - // the specified timout. - scoped_refptr<TabProxy> GetActiveTabWithTimeout(uint32 timeout_ms, - bool* is_timeout) const; - // Returns the WindowProxy for this browser's window. It can be used to // retreive view bounds, simulate clicks and key press events. The caller // owns the returned WindowProxy. @@ -139,15 +112,6 @@ class BrowserProxy : public AutomationResourceProxy { int flags, bool press_escape_en_route) WARN_UNUSED_RESULT; - // Like SimulateDrag, but returns false if response is not received before - // the specified timeout. - virtual bool SimulateDragWithTimeout(const gfx::Point& start, - const gfx::Point& end, - int flags, uint32 timeout_ms, - bool* is_timeout, - bool press_escape_en_route) - WARN_UNUSED_RESULT; - // Block the thread until the tab count is |count|. // |wait_timeout| is the timeout, in milliseconds, for waiting. // Returns true on success. diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc index dbf4875..0f28409 100644 --- a/chrome/test/automation/tab_proxy.cc +++ b/chrome/test/automation/tab_proxy.cc @@ -77,33 +77,22 @@ AutomationMsg_NavigationResponseValues TabProxy::NavigateToURL( AutomationMsg_NavigationResponseValues TabProxy::NavigateToURLBlockUntilNavigationsComplete( const GURL& url, int number_of_navigations) { - return NavigateToURLWithTimeout(url, number_of_navigations, base::kNoTimeout, - NULL); -} - -AutomationMsg_NavigationResponseValues TabProxy::NavigateToURLWithTimeout( - const GURL& url, int number_of_navigations, uint32 timeout_ms, - bool* is_timeout) { if (!is_valid()) return AUTOMATION_MSG_NAVIGATION_ERROR; - + AutomationMsg_NavigationResponseValues navigate_response = AUTOMATION_MSG_NAVIGATION_ERROR; - + if (number_of_navigations == 1) { // TODO(phajdan.jr): Remove when the reference build gets updated. // This is only for backwards compatibility. - sender_->SendWithTimeout( - new AutomationMsg_NavigateToURL( - 0, handle_, url, &navigate_response), - timeout_ms, is_timeout); + sender_->Send(new AutomationMsg_NavigateToURL(0, handle_, url, + &navigate_response)); } else { - sender_->SendWithTimeout( - new AutomationMsg_NavigateToURLBlockUntilNavigationsComplete( - 0, handle_, url, number_of_navigations, &navigate_response), - timeout_ms, is_timeout); + sender_->Send(new AutomationMsg_NavigateToURLBlockUntilNavigationsComplete( + 0, handle_, url, number_of_navigations, &navigate_response)); } - + return navigate_response; } @@ -470,15 +459,17 @@ bool TabProxy::GetDownloadDirectory(FilePath* directory) { directory)); } -bool TabProxy::ShowInterstitialPage(const std::string& html_text, - int timeout_ms) { +bool TabProxy::ShowInterstitialPage(const std::string& html_text) { if (!is_valid()) return false; AutomationMsg_NavigationResponseValues result = AUTOMATION_MSG_NAVIGATION_ERROR; - sender_->SendWithTimeout(new AutomationMsg_ShowInterstitialPage( - 0, handle_, html_text, &result), timeout_ms, NULL); + if (!sender_->Send(new AutomationMsg_ShowInterstitialPage( + 0, handle_, html_text, &result))) { + return false; + } + return result == AUTOMATION_MSG_NAVIGATION_SUCCESS; } diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h index 8fe9318..15b5ab9 100644 --- a/chrome/test/automation/tab_proxy.h +++ b/chrome/test/automation/tab_proxy.h @@ -124,14 +124,6 @@ class TabProxy : public AutomationResourceProxy { NavigateToURLBlockUntilNavigationsComplete( const GURL& url, int number_of_navigations) WARN_UNUSED_RESULT; - // Navigates to a url. This is same as NavigateToURL with a timeout option. - // The function blocks until the |number_of_navigations| navigations - // completes or timeout (in milliseconds) occurs. If return after timeout, - // is_timeout is set to true. - AutomationMsg_NavigationResponseValues NavigateToURLWithTimeout( - const GURL& url, int number_of_navigations, uint32 timeout_ms, - bool* is_timeout) WARN_UNUSED_RESULT; - // Navigates to a url in an externally hosted tab. // This method accepts the same kinds of URL input that // can be passed to Chrome on the command line. This is a synchronous call and @@ -269,9 +261,8 @@ class TabProxy : public AutomationResourceProxy { bool GetDownloadDirectory(FilePath* download_directory) WARN_UNUSED_RESULT; // Shows an interstitial page. Blocks until the interstitial page - // has been loaded. Return false if a failure happens.3 - bool ShowInterstitialPage(const std::string& html_text, - int timeout_ms) WARN_UNUSED_RESULT; + // has been loaded. Return false if a failure happens. + bool ShowInterstitialPage(const std::string& html_text) WARN_UNUSED_RESULT; // Hides the currently shown interstitial page. Blocks until the interstitial // page has been hidden. Return false if a failure happens. diff --git a/chrome/test/automation/window_proxy.cc b/chrome/test/automation/window_proxy.cc index 65d6cf4..295f05b 100644 --- a/chrome/test/automation/window_proxy.cc +++ b/chrome/test/automation/window_proxy.cc @@ -75,14 +75,6 @@ bool WindowProxy::Activate() { bool WindowProxy::GetViewBounds(int view_id, gfx::Rect* bounds, bool screen_coordinates) { - return GetViewBoundsWithTimeout(view_id, bounds, screen_coordinates, - base::kNoTimeout, NULL); -} - -bool WindowProxy::GetViewBoundsWithTimeout(int view_id, gfx::Rect* bounds, - bool screen_coordinates, - uint32 timeout_ms, - bool* is_timeout) { if (!is_valid()) return false; @@ -93,9 +85,10 @@ bool WindowProxy::GetViewBoundsWithTimeout(int view_id, gfx::Rect* bounds, bool result = false; - sender_->SendWithTimeout(new AutomationMsg_WindowViewBounds( - 0, handle_, view_id, screen_coordinates, &result, bounds), - timeout_ms, is_timeout); + if (!sender_->Send(new AutomationMsg_WindowViewBounds( + 0, handle_, view_id, screen_coordinates, &result, bounds))) { + return false; + } return result; } diff --git a/chrome/test/automation/window_proxy.h b/chrome/test/automation/window_proxy.h index 92f74ae..3c5deca 100644 --- a/chrome/test/automation/window_proxy.h +++ b/chrome/test/automation/window_proxy.h @@ -78,12 +78,6 @@ class WindowProxy : public AutomationResourceProxy { // of the screen, if false in the coordinates of the browser. bool GetViewBounds(int view_id, gfx::Rect* bounds, bool screen_coordinates); - // Like GetViewBounds except returns false if timeout occurs before view - // bounds are obtained, and sets is_timeout accordingly. - bool GetViewBoundsWithTimeout(int view_id, gfx::Rect* bounds, - bool screen_coordinates, uint32 timeout_ms, - bool* is_timeout); - // Gets the position and size of the window. Returns true if setting the // bounds was successful. bool GetBounds(gfx::Rect* bounds); diff --git a/chrome/test/interactive_ui/npapi_interactive_test.cc b/chrome/test/interactive_ui/npapi_interactive_test.cc index e0b4dd8..3549d71 100644 --- a/chrome/test/interactive_ui/npapi_interactive_test.cc +++ b/chrome/test/interactive_ui/npapi_interactive_test.cc @@ -91,7 +91,7 @@ TEST_F(NPAPIVisiblePluginTester, GetURLRequest404Response) { NavigateToURL(url); // Wait for the alert dialog and then close it. - automation()->WaitForAppModalDialog(action_max_timeout_ms()); + automation()->WaitForAppModalDialog(); scoped_refptr<WindowProxy> window(automation()->GetActiveWindow()); ASSERT_TRUE(window.get()); ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_ESCAPE, 0)); diff --git a/chrome/test/memory_test/memory_test.cc b/chrome/test/memory_test/memory_test.cc index 1d5a3cd..ef1eebc 100644 --- a/chrome/test/memory_test/memory_test.cc +++ b/chrome/test/memory_test/memory_test.cc @@ -189,7 +189,7 @@ class MemoryTest : public UITest { show_window_)); int expected_window_count = window_count + 1; EXPECT_TRUE(automation()->WaitForWindowCountToBecome( - expected_window_count, 500)); + expected_window_count)); EXPECT_TRUE(automation()->GetBrowserWindowCount(&window_count)); EXPECT_EQ(expected_window_count, window_count); @@ -214,12 +214,8 @@ class MemoryTest : public UITest { continue; } - const int kMaxWaitTime = 5000; - bool timed_out = false; EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, - tab->NavigateToURLWithTimeout(GURL(urls[counter]), 1, kMaxWaitTime, - &timed_out)); - EXPECT_FALSE(timed_out); + tab->NavigateToURL(GURL(urls[counter]))); // TODO(mbelshe): Bug 2953 // The automation crashes periodically if we cycle too quickly. diff --git a/chrome/test/reliability/page_load_test.cc b/chrome/test/reliability/page_load_test.cc index bac5fa1..041ab1f 100644 --- a/chrome/test/reliability/page_load_test.cc +++ b/chrome/test/reliability/page_load_test.cc @@ -185,19 +185,16 @@ class PageLoadTest : public UITest { test_log << "browser_launched_seconds="; test_log << (time_now.ToDoubleT() - time_start) << std::endl; - bool is_timeout = false; int result = AUTOMATION_MSG_NAVIGATION_ERROR; // This is essentially what NavigateToURL does except we don't fire // assertion when page loading fails. We log the result instead. { // TabProxy should be released before Browser is closed. scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); - if (tab_proxy.get()) { - result = tab_proxy->NavigateToURLWithTimeout(url, 1, g_timeout_ms, - &is_timeout); - } + if (tab_proxy.get()) + result = tab_proxy->NavigateToURL(url); - if (!is_timeout && result == AUTOMATION_MSG_NAVIGATION_SUCCESS) { + if (result == AUTOMATION_MSG_NAVIGATION_SUCCESS) { if (g_page_down) { // Page down twice. scoped_refptr<BrowserProxy> browser( @@ -205,11 +202,7 @@ class PageLoadTest : public UITest { if (browser.get()) { scoped_refptr<WindowProxy> window(browser->GetWindow()); if (window.get()) { - bool activation_timeout; - bool success = - browser->BringToFrontWithTimeout(action_max_timeout_ms(), - &activation_timeout); - if (success && !activation_timeout) { + if (browser->BringToFront()) { window->SimulateOSKeyPress(base::VKEY_NEXT, 0); PlatformThread::Sleep(sleep_timeout_ms()); window->SimulateOSKeyPress(base::VKEY_NEXT, 0); @@ -241,31 +234,19 @@ class PageLoadTest : public UITest { // <url> <navigation_result> <browser_crash_count> <renderer_crash_count> // <plugin_crash_count> <crash_dump_count> [chrome_log=<path> // v8_log=<path>] crash_dump=<path> - if (is_timeout) { - metrics.result = NAVIGATION_TIME_OUT; - // After timeout, the test automation is in the transition state since - // there might be pending IPC messages and the browser (automation - // provider) is still working on the request. Here we just skip the url - // and send the next request. The pending IPC messages will be properly - // discarded by automation message filter. The browser will accept the - // new request and visit the next URL. - // We will revisit the issue if we encounter the situation where browser - // needs to be restarted after timeout. - } else { - switch (result) { - case AUTOMATION_MSG_NAVIGATION_ERROR: - metrics.result = NAVIGATION_ERROR; - break; - case AUTOMATION_MSG_NAVIGATION_SUCCESS: - metrics.result = NAVIGATION_SUCCESS; - break; - case AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED: - metrics.result = NAVIGATION_AUTH_NEEDED; - break; - default: - metrics.result = NAVIGATION_ERROR; - break; - } + switch (result) { + case AUTOMATION_MSG_NAVIGATION_ERROR: + metrics.result = NAVIGATION_ERROR; + break; + case AUTOMATION_MSG_NAVIGATION_SUCCESS: + metrics.result = NAVIGATION_SUCCESS; + break; + case AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED: + metrics.result = NAVIGATION_AUTH_NEEDED; + break; + default: + metrics.result = NAVIGATION_ERROR; + break; } if (log_file.is_open()) { diff --git a/chrome/test/ui/fast_shutdown_uitest.cc b/chrome/test/ui/fast_shutdown_uitest.cc index d7663f8..8b2b554 100644 --- a/chrome/test/ui/fast_shutdown_uitest.cc +++ b/chrome/test/ui/fast_shutdown_uitest.cc @@ -41,7 +41,7 @@ TEST_F(FastShutdown, DISABLED_SlowTermination) { // Close the browser. We should launch the unload handler, which is an // alert(). ASSERT_TRUE(browser->ApplyAccelerator(IDC_CLOSE_WINDOW)); - ASSERT_TRUE(automation()->WaitForAppModalDialog(action_max_timeout_ms())); + ASSERT_TRUE(automation()->WaitForAppModalDialog()); ASSERT_TRUE(automation()->ClickAppModalDialogButton( MessageBoxFlags::DIALOGBUTTON_OK)); } diff --git a/chrome/test/ui/npapi_uitest.cc b/chrome/test/ui/npapi_uitest.cc index 329c204..6d1d8ca 100644 --- a/chrome/test/ui/npapi_uitest.cc +++ b/chrome/test/ui/npapi_uitest.cc @@ -128,7 +128,7 @@ TEST_F(NPAPITester, DISABLED_SelfDeletePluginInvokeAlert) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); // Wait for the alert dialog and then close it. - ASSERT_TRUE(automation()->WaitForAppModalDialog(5000)); + ASSERT_TRUE(automation()->WaitForAppModalDialog()); scoped_refptr<WindowProxy> window(automation()->GetActiveWindow()); ASSERT_TRUE(window.get()); ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_ESCAPE, 0)); @@ -200,7 +200,7 @@ TEST_F(NPAPIVisiblePluginTester, AlertInWindowMessage) { bool modal_dialog_showing = false; MessageBoxFlags::DialogButton available_buttons; - ASSERT_TRUE(automation()->WaitForAppModalDialog(kShortWaitTimeout)); + ASSERT_TRUE(automation()->WaitForAppModalDialog()); ASSERT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing, &available_buttons)); ASSERT_TRUE(modal_dialog_showing); @@ -209,7 +209,7 @@ TEST_F(NPAPIVisiblePluginTester, AlertInWindowMessage) { MessageBoxFlags::DIALOGBUTTON_OK)); modal_dialog_showing = false; - ASSERT_TRUE(automation()->WaitForAppModalDialog(kShortWaitTimeout)); + ASSERT_TRUE(automation()->WaitForAppModalDialog()); ASSERT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing, &available_buttons)); ASSERT_TRUE(modal_dialog_showing); diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index f4dbfb0..83803ed 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -539,12 +539,9 @@ void UITestBase::NavigateToURLBlockUntilNavigationsComplete( const GURL& url, int number_of_navigations) { scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); ASSERT_TRUE(tab_proxy.get()); - bool is_timeout = true; EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, - tab_proxy->NavigateToURLWithTimeout( - url, number_of_navigations, action_max_timeout_ms(), - &is_timeout)) << url.spec(); - ASSERT_FALSE(is_timeout) << url.spec(); + tab_proxy->NavigateToURLBlockUntilNavigationsComplete( + url, number_of_navigations)) << url.spec(); } void UITestBase::NavigateToURLBlockUntilNavigationsComplete( @@ -555,12 +552,9 @@ void UITestBase::NavigateToURLBlockUntilNavigationsComplete( ASSERT_TRUE(window.get()); scoped_refptr<TabProxy> tab_proxy(window->GetTab(tab_index)); ASSERT_TRUE(tab_proxy.get()); - bool is_timeout = true; EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, - tab_proxy->NavigateToURLWithTimeout( - url, number_of_navigations, action_max_timeout_ms(), - &is_timeout)) << url.spec(); - ASSERT_FALSE(is_timeout) << url.spec(); + tab_proxy->NavigateToURLBlockUntilNavigationsComplete( + url, number_of_navigations)) << url.spec(); } bool UITestBase::WaitForDownloadShelfVisible(BrowserProxy* browser) { |