summaryrefslogtreecommitdiffstats
path: root/chrome/browser/automation
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-26 15:39:26 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-26 15:39:26 +0000
commit1126a1d3fea816b525e9b1e621b2890cf97b2b8a (patch)
treeaa7a8a6831269674c06c9a751527b4d11da2dec4 /chrome/browser/automation
parentfe2b2b36d73c74db993d293538cb1bb6c08379fa (diff)
downloadchromium_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/browser/automation')
-rw-r--r--chrome/browser/automation/automation_provider.cc40
-rw-r--r--chrome/browser/automation/automation_provider.h8
2 files changed, 48 insertions, 0 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 6a22a23..c271ba9 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -1164,6 +1164,12 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER_DELAY_REPLY(
AutomationMsg_WaitForAppModalDialogToBeShown,
WaitForAppModalDialogToBeShown)
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(
+ AutomationMsg_GoBackBlockUntilNavigationsComplete,
+ GoBackBlockUntilNavigationsComplete)
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(
+ AutomationMsg_GoForwardBlockUntilNavigationsComplete,
+ GoForwardBlockUntilNavigationsComplete)
IPC_END_MESSAGE_MAP()
}
@@ -2728,6 +2734,40 @@ void AutomationProvider::WaitForAppModalDialogToBeShown(
new AppModalDialogShownObserver(this, reply_message);
}
+void AutomationProvider::GoBackBlockUntilNavigationsComplete(
+ int handle, int number_of_navigations, IPC::Message* reply_message) {
+ if (tab_tracker_->ContainsHandle(handle)) {
+ NavigationController* tab = tab_tracker_->GetResource(handle);
+ Browser* browser = FindAndActivateTab(tab);
+ if (browser && browser->command_updater()->IsCommandEnabled(IDC_BACK)) {
+ AddNavigationStatusListener(tab, reply_message, number_of_navigations);
+ browser->GoBack(CURRENT_TAB);
+ return;
+ }
+ }
+
+ AutomationMsg_GoBackBlockUntilNavigationsComplete::WriteReplyParams(
+ reply_message, AUTOMATION_MSG_NAVIGATION_ERROR);
+ Send(reply_message);
+}
+
+void AutomationProvider::GoForwardBlockUntilNavigationsComplete(
+ int handle, int number_of_navigations, IPC::Message* reply_message) {
+ if (tab_tracker_->ContainsHandle(handle)) {
+ NavigationController* tab = tab_tracker_->GetResource(handle);
+ Browser* browser = FindAndActivateTab(tab);
+ if (browser && browser->command_updater()->IsCommandEnabled(IDC_FORWARD)) {
+ AddNavigationStatusListener(tab, reply_message, number_of_navigations);
+ browser->GoForward(CURRENT_TAB);
+ return;
+ }
+ }
+
+ AutomationMsg_GoForwardBlockUntilNavigationsComplete::WriteReplyParams(
+ reply_message, AUTOMATION_MSG_NAVIGATION_ERROR);
+ Send(reply_message);
+}
+
RenderViewHost* AutomationProvider::GetViewForTab(int tab_handle) {
if (tab_tracker_->ContainsHandle(tab_handle)) {
NavigationController* tab = tab_tracker_->GetResource(tab_handle);
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index 510a91d..ca2d611 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -466,6 +466,14 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
void WaitForAppModalDialogToBeShown(IPC::Message* reply_message);
+ void GoBackBlockUntilNavigationsComplete(int handle,
+ int number_of_navigations,
+ IPC::Message* reply_message);
+
+ void GoForwardBlockUntilNavigationsComplete(int handle,
+ int number_of_navigations,
+ IPC::Message* reply_message);
+
// Convert a tab handle into a TabContents. If |tab| is non-NULL a pointer
// to the tab is also returned. Returns NULL in case of failure or if the tab
// is not of the TabContents type.