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

Unified Diff: chrome/test/chromedriver/window_commands.cc

Issue 114403005: Adding a LaunchApp command to Chromedriver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reuploading again since some files weren't included Created 6 years, 11 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/test/chromedriver/window_commands.cc
diff --git a/chrome/test/chromedriver/window_commands.cc b/chrome/test/chromedriver/window_commands.cc
index 266361b4c9555dfc49b4a62e1a71f66d7ab5568f..2a8da83bbd5a9cbbed88a9c91b7d466a6846df54 100644
--- a/chrome/test/chromedriver/window_commands.cc
+++ b/chrome/test/chromedriver/window_commands.cc
@@ -247,6 +247,43 @@ Status ExecuteGet(
return web_view->Load(url);
}
+Status ExecuteLaunchApp(
+ Session* session,
+ WebView* web_view,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ std::string id;
+ if (!params.GetString("id", &id))
+ return Status(kUnknownError, "'id' must be a string");
+
+ if (!session->chrome->GetAsDesktop())
+ return Status(kUnknownError,
+ "apps can only be launched on desktop platforms");
+
+ AutomationExtension* extension = NULL;
+ Status status =
+ session->chrome->GetAsDesktop()->GetAutomationExtension(&extension);
+ if (status.IsError())
+ return status;
+
+ status = extension->LaunchApp(id);
+ if (status.IsError())
+ return status;
+
+ std::list<std::string> web_view_ids;
+ status = session->chrome->GetWebViewIds(&web_view_ids);
+ if (status.IsError())
+ return status;
+
+ // Switch the active window to the last one opened.
+ session->chrome->ActivateWebView(web_view_ids.back());
chrisgao (Use stgao instead) 2014/01/15 21:39:56 The activation might fail. maybe need to check the
bustamante 2014/01/15 23:51:38 Thanks, per the other comment I removed this code
+ session->window = web_view_ids.back();
+ session->SwitchToTopFrame();
+ session->mouse_position = WebPoint(0, 0);
+
+ return status;
+}
+
Status ExecuteExecuteScript(
Session* session,
WebView* web_view,
« chrome/test/chromedriver/window_commands.h ('K') | « chrome/test/chromedriver/window_commands.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698