Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2857)

Unified Diff: chrome/browser/automation/automation_provider.cc

Issue 174396: Fix another source of flakiness in ErrorPageTest (Closed)
Patch Set: Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/automation/automation_provider.cc
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 6a22a23aa73355ff8c2b7b9fe40a163efc75fb0e..c271ba944a03ea9377d83e91df34e684ecbe0eb5 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);

Powered by Google App Engine
This is Rietveld 408576698