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

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

Issue 10168019: Adds an automation hook WaitUntilNavigationCompletes() which blocks until pending navigation comple… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed a possible race condition. Created 8 years, 8 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
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.h ('k') | chrome/test/functional/apptest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.h ('k') | chrome/test/functional/apptest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698