diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-26 15:39:26 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-26 15:39:26 +0000 |
commit | 1126a1d3fea816b525e9b1e621b2890cf97b2b8a (patch) | |
tree | aa7a8a6831269674c06c9a751527b4d11da2dec4 /chrome/test/automation | |
parent | fe2b2b36d73c74db993d293538cb1bb6c08379fa (diff) | |
download | chromium_src-1126a1d3fea816b525e9b1e621b2890cf97b2b8a.zip chromium_src-1126a1d3fea816b525e9b1e621b2890cf97b2b8a.tar.gz chromium_src-1126a1d3fea816b525e9b1e621b2890cf97b2b8a.tar.bz2 |
Fix another source of flakiness in ErrorPageTest
We need to wait for correct number of navigations when going back or forward
to the LinkDoctor page.
Re-enable previously disabled tests and remove the now-duplicate browser test.
The test is still not very solid, because the LinkDoctor should be mocked.
TEST=Covered by ui_tests.
http://crbug.com/19361, http://crbug.com/19395
Review URL: http://codereview.chromium.org/174396
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24446 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/automation')
-rw-r--r-- | chrome/test/automation/automation_messages_internal.h | 40 | ||||
-rw-r--r-- | chrome/test/automation/tab_proxy.cc | 17 | ||||
-rw-r--r-- | chrome/test/automation/tab_proxy.h | 10 |
3 files changed, 59 insertions, 8 deletions
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h index 52eeb41..f668055 100644 --- a/chrome/test/automation/automation_messages_internal.h +++ b/chrome/test/automation/automation_messages_internal.h @@ -82,6 +82,9 @@ IPC_BEGIN_MESSAGES(Automation) // the tab resource. The second parameter is the target url. The return // value contains a status code which is nonnegative on success. // See AutomationMsg_NavigationResponseValues for the return value. + // + // Deprecated in favor of + // AutomationMsg_NavigateToURLBlockUntilNavigationsComplete. // TODO(phajdan.jr): Remove when the reference build gets updated. IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_NavigateToURL, int, GURL, AutomationMsg_NavigationResponseValues) @@ -95,19 +98,24 @@ IPC_BEGIN_MESSAGES(Automation) // This message notifies the AutomationProvider to navigate back in session // history in the tab with given handle. The first parameter is the handle - // to the tab resource. The return value contains a status code which is - // nonnegative on success. - // see AutomationMsg_NavigationResponseValues for the navigation response + // to the tab resource. + // See AutomationMsg_NavigationResponseValues for the navigation response // values. + // + // Deprecated in favor of AutomationMsg_GoBackBlockUntilNavigationsComplete. + // TODO(phajdan.jr): Remove when the reference build gets updated. IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_GoBack, int, AutomationMsg_NavigationResponseValues) // This message notifies the AutomationProvider to navigate forward in session // history in the tab with given handle. The first parameter is the handle - // to the tab resource. The response contains a status code which is - // nonnegative on success. - // see AutomationMsg_NavigationResponseValues for the navigation response + // to the tab resource. + // See AutomationMsg_NavigationResponseValues for the navigation response // values. + // + // Deprecated in favor of + // AutomationMsg_GoForwardBlockUntilNavigationsComplete. + // TODO(phajdan.jr): Remove when the reference build gets updated. IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_GoForward, int, AutomationMsg_NavigationResponseValues) @@ -1040,4 +1048,24 @@ IPC_BEGIN_MESSAGES(Automation) // - bool: whether the operation was successful IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_WaitForAppModalDialogToBeShown, bool) + // This message notifies the AutomationProvider to navigate back in session + // history in the tab with given handle. The first parameter is the handle + // to the tab resource. The second parameter is the number of navigations the + // provider will wait for. + // See AutomationMsg_NavigationResponseValues for the navigation response + // values. + IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_GoBackBlockUntilNavigationsComplete, + int, int, + AutomationMsg_NavigationResponseValues) + + // This message notifies the AutomationProvider to navigate forward in session + // history in the tab with given handle. The first parameter is the handle + // to the tab resource. The second parameter is the number of navigations + // the provider will wait for. + // See AutomationMsg_NavigationResponseValues for the navigation response + // values. + IPC_SYNC_MESSAGE_ROUTED2_1( + AutomationMsg_GoForwardBlockUntilNavigationsComplete, int, int, + AutomationMsg_NavigationResponseValues) + IPC_END_MESSAGES(Automation) diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc index f59f821..6a1cb0a 100644 --- a/chrome/test/automation/tab_proxy.cc +++ b/chrome/test/automation/tab_proxy.cc @@ -160,22 +160,35 @@ bool TabProxy::NeedsAuth() const { } AutomationMsg_NavigationResponseValues TabProxy::GoBack() { + return GoBackBlockUntilNavigationsComplete(1); +} + +AutomationMsg_NavigationResponseValues + TabProxy::GoBackBlockUntilNavigationsComplete(int number_of_navigations) { if (!is_valid()) return AUTOMATION_MSG_NAVIGATION_ERROR; AutomationMsg_NavigationResponseValues navigate_response = AUTOMATION_MSG_NAVIGATION_ERROR; - sender_->Send(new AutomationMsg_GoBack(0, handle_, &navigate_response)); + sender_->Send(new AutomationMsg_GoBackBlockUntilNavigationsComplete( + 0, handle_, number_of_navigations, &navigate_response)); return navigate_response; } AutomationMsg_NavigationResponseValues TabProxy::GoForward() { + return GoForwardBlockUntilNavigationsComplete(1); +} + +AutomationMsg_NavigationResponseValues + TabProxy::GoForwardBlockUntilNavigationsComplete( + int number_of_navigations) { if (!is_valid()) return AUTOMATION_MSG_NAVIGATION_ERROR; AutomationMsg_NavigationResponseValues navigate_response = AUTOMATION_MSG_NAVIGATION_ERROR; - sender_->Send(new AutomationMsg_GoForward(0, handle_, &navigate_response)); + sender_->Send(new AutomationMsg_GoForwardBlockUntilNavigationsComplete( + 0, handle_, number_of_navigations, &navigate_response)); return navigate_response; } diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h index 9b7232f..c8bb83e 100644 --- a/chrome/test/automation/tab_proxy.h +++ b/chrome/test/automation/tab_proxy.h @@ -120,10 +120,20 @@ class TabProxy : public AutomationResourceProxy { // hence blocks until the navigation completes. AutomationMsg_NavigationResponseValues GoBack(); + // Equivalent to hitting the Back button. This is a synchronous call and + // hence blocks until the |number_of_navigations| navigations complete. + AutomationMsg_NavigationResponseValues GoBackBlockUntilNavigationsComplete( + int number_of_navigations); + // Equivalent to hitting the Forward button. This is a synchronous call and // hence blocks until the navigation completes. AutomationMsg_NavigationResponseValues GoForward(); + // Equivalent to hitting the Forward button. This is a synchronous call and + // hence blocks until the |number_of_navigations| navigations complete. + AutomationMsg_NavigationResponseValues GoForwardBlockUntilNavigationsComplete( + int number_of_navigations); + // Equivalent to hitting the Reload button. This is a synchronous call and // hence blocks until the navigation completes. AutomationMsg_NavigationResponseValues Reload(); |