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

Side by Side Diff: chrome/test/chromedriver/session_commands.cc

Issue 114403005: Adding a LaunchApp command to Chromedriver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing additional comments 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 unified diff | Download patch
« no previous file with comments | « chrome/test/chromedriver/session_commands.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/test/chromedriver/session_commands.h" 5 #include "chrome/test/chromedriver/session_commands.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 WebView* web_view = NULL; 198 WebView* web_view = NULL;
199 Status status = session->GetTargetWindow(&web_view); 199 Status status = session->GetTargetWindow(&web_view);
200 if (status.IsError()) 200 if (status.IsError())
201 return status; 201 return status;
202 202
203 value->reset( 203 value->reset(
204 new base::StringValue(WebViewIdToWindowHandle(web_view->GetId()))); 204 new base::StringValue(WebViewIdToWindowHandle(web_view->GetId())));
205 return Status(kOk); 205 return Status(kOk);
206 } 206 }
207 207
208 Status ExecuteLaunchApp(
209 Session* session,
210 const base::DictionaryValue& params,
211 scoped_ptr<base::Value>* value) {
212 std::string id;
213 if (!params.GetString("id", &id))
214 return Status(kUnknownError, "'id' must be a string");
215
216 if (!session->chrome->GetAsDesktop())
217 return Status(kUnknownError,
218 "apps can only be launched on desktop platforms");
219
220 AutomationExtension* extension = NULL;
221 Status status =
222 session->chrome->GetAsDesktop()->GetAutomationExtension(&extension);
223 if (status.IsError())
224 return status;
225
226 return extension->LaunchApp(id);
227 }
228
208 Status ExecuteClose( 229 Status ExecuteClose(
209 Session* session, 230 Session* session,
210 const base::DictionaryValue& params, 231 const base::DictionaryValue& params,
211 scoped_ptr<base::Value>* value) { 232 scoped_ptr<base::Value>* value) {
212 std::list<std::string> web_view_ids; 233 std::list<std::string> web_view_ids;
213 Status status = session->chrome->GetWebViewIds(&web_view_ids); 234 Status status = session->chrome->GetWebViewIds(&web_view_ids);
214 if (status.IsError()) 235 if (status.IsError())
215 return status; 236 return status;
216 bool is_last_web_view = web_view_ids.size() == 1u; 237 bool is_last_web_view = web_view_ids.size() == 1u;
217 web_view_ids.clear(); 238 web_view_ids.clear();
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 } 624 }
604 std::string error_msg; 625 std::string error_msg;
605 base::FilePath upload; 626 base::FilePath upload;
606 Status status = UnzipSoleFile(upload_dir, zip_data, &upload); 627 Status status = UnzipSoleFile(upload_dir, zip_data, &upload);
607 if (status.IsError()) 628 if (status.IsError())
608 return Status(kUnknownError, "unable to unzip 'file'", status); 629 return Status(kUnknownError, "unable to unzip 'file'", status);
609 630
610 value->reset(new base::StringValue(upload.value())); 631 value->reset(new base::StringValue(upload.value()));
611 return Status(kOk); 632 return Status(kOk);
612 } 633 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/session_commands.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698