Index: chrome/browser/automation/testing_automation_provider.cc |
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc |
index c5a5ba7d17365762daedd864260463b381920369..ab9d9571071f6c81dbc6fc723989a75e123598ef 100644 |
--- a/chrome/browser/automation/testing_automation_provider.cc |
+++ b/chrome/browser/automation/testing_automation_provider.cc |
@@ -2161,6 +2161,8 @@ void TestingAutomationProvider::SendJSONRequest(int handle, |
&TestingAutomationProvider::GetIndicesFromTab; |
handler_map["NavigateToURL"] = |
&TestingAutomationProvider::NavigateToURL; |
+ handler_map["WaitUntilNavigationCompletes"] = |
+ &TestingAutomationProvider::WaitUntilNavigationCompletes; |
handler_map["GetLocalStatePrefsInfo"] = |
&TestingAutomationProvider::GetLocalStatePrefsInfo; |
handler_map["SetLocalStatePrefs"] = |
@@ -6339,6 +6341,29 @@ void TestingAutomationProvider::NavigateToURL( |
content::PAGE_TRANSITION_TYPED, false)); |
} |
+void TestingAutomationProvider::WaitUntilNavigationCompletes( |
+ DictionaryValue* args, |
+ IPC::Message* reply_message) { |
+ if (SendErrorIfModalDialogActive(this, reply_message)) |
+ return; |
+ |
+ std::string error; |
+ Browser* browser; |
+ WebContents* web_contents; |
+ if (!GetBrowserAndTabFromJSONArgs(args, &browser, &web_contents, &error)) { |
+ AutomationJSONReply(this, reply_message).SendError(error); |
+ return; |
+ } |
+ NavigationNotificationObserver* observer = |
+ new NavigationNotificationObserver(&web_contents->GetController(), this, |
+ reply_message, 1, true, true); |
+ if (!web_contents->IsLoading()) { |
+ AutomationJSONReply(this, reply_message).SendSuccess(NULL); |
+ delete observer; |
+ return; |
+ } |
+} |
+ |
void TestingAutomationProvider::ExecuteJavascriptJSON( |
DictionaryValue* args, |
IPC::Message* reply_message) { |