summaryrefslogtreecommitdiffstats
path: root/chrome/test/automated_ui_tests
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-22 13:26:46 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-22 13:26:46 +0000
commit1a96b432de916d958dd03404701405c981fbaff3 (patch)
tree95b1e48eb425c67f139980834e61e848094786e7 /chrome/test/automated_ui_tests
parent99ad6c9c402c3453044928a6e4414e695feb9200 (diff)
downloadchromium_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/automated_ui_tests')
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_test_base.cc89
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_tests.cc9
2 files changed, 23 insertions, 75 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;
}