| Index: chrome/test/chromedriver/session_commands.cc
|
| diff --git a/chrome/test/chromedriver/session_commands.cc b/chrome/test/chromedriver/session_commands.cc
|
| index 99f5f028eec82e248844c63c060f46159331f4f3..f5d8c52d650abab0c4a72cc2b3f9de4716b4fc97 100644
|
| --- a/chrome/test/chromedriver/session_commands.cc
|
| +++ b/chrome/test/chromedriver/session_commands.cc
|
| @@ -195,6 +195,40 @@ Status InitSessionHelper(
|
| return CheckSessionCreated(session);
|
| }
|
|
|
| +Status SwitchToWebView(Session* session, const std::string& web_view_id) {
|
| + if (session->overridden_geoposition) {
|
| + WebView* web_view;
|
| + Status status = session->chrome->GetWebViewById(web_view_id, &web_view);
|
| + if (status.IsError())
|
| + return status;
|
| + status = web_view->ConnectIfNecessary();
|
| + if (status.IsError())
|
| + return status;
|
| + status = web_view->OverrideGeolocation(*session->overridden_geoposition);
|
| + if (status.IsError())
|
| + return status;
|
| + }
|
| +
|
| + if (session->overridden_network_conditions) {
|
| + WebView* web_view;
|
| + Status status = session->chrome->GetWebViewById(web_view_id, &web_view);
|
| + if (status.IsError())
|
| + return status;
|
| + status = web_view->ConnectIfNecessary();
|
| + if (status.IsError())
|
| + return status;
|
| + status = web_view->OverrideNetworkConditions(
|
| + *session->overridden_network_conditions);
|
| + if (status.IsError())
|
| + return status;
|
| + }
|
| +
|
| + session->window = web_view_id;
|
| + session->SwitchToTopFrame();
|
| + session->mouse_position = WebPoint(0, 0);
|
| + return Status(kOk);
|
| +}
|
| +
|
| } // namespace
|
|
|
| Status ExecuteInitSession(
|
| @@ -263,7 +297,17 @@ Status ExecuteLaunchApp(
|
| if (status.IsError())
|
| return status;
|
|
|
| - return extension->LaunchApp(id);
|
| + status = extension->LaunchApp(id);
|
| + if (status.IsError())
|
| + return status;
|
| +
|
| + std::string web_view_id;
|
| + base::TimeDelta timeout = base::TimeDelta::FromSeconds(60);
|
| + status = desktop->WaitForNewAppWindow(timeout, id, &web_view_id);
|
| + if (status.IsError())
|
| + return status;
|
| +
|
| + return SwitchToWebView(session, web_view_id);
|
| }
|
|
|
| Status ExecuteClose(
|
| @@ -369,38 +413,7 @@ Status ExecuteSwitchToWindow(
|
|
|
| if (!found)
|
| return Status(kNoSuchWindow);
|
| -
|
| - if (session->overridden_geoposition) {
|
| - WebView* web_view;
|
| - status = session->chrome->GetWebViewById(web_view_id, &web_view);
|
| - if (status.IsError())
|
| - return status;
|
| - status = web_view->ConnectIfNecessary();
|
| - if (status.IsError())
|
| - return status;
|
| - status = web_view->OverrideGeolocation(*session->overridden_geoposition);
|
| - if (status.IsError())
|
| - return status;
|
| - }
|
| -
|
| - if (session->overridden_network_conditions) {
|
| - WebView* web_view;
|
| - status = session->chrome->GetWebViewById(web_view_id, &web_view);
|
| - if (status.IsError())
|
| - return status;
|
| - status = web_view->ConnectIfNecessary();
|
| - if (status.IsError())
|
| - return status;
|
| - status = web_view->OverrideNetworkConditions(
|
| - *session->overridden_network_conditions);
|
| - if (status.IsError())
|
| - return status;
|
| - }
|
| -
|
| - session->window = web_view_id;
|
| - session->SwitchToTopFrame();
|
| - session->mouse_position = WebPoint(0, 0);
|
| - return Status(kOk);
|
| + return SwitchToWebView(session, web_view_id);
|
| }
|
|
|
| Status ExecuteSetTimeout(
|
|
|