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, |