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

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

Issue 12675002: [chromedriver] Implement command: executeAsyncScript and setScriptTimeout (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address +5000 timeout problem. Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/chromedriver/session_commands.h ('k') | chrome/test/chromedriver/status.h » ('j') | 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/callback.h" 9 #include "base/callback.h"
10 #include "base/logging.h" // For CHECK macros. 10 #include "base/logging.h" // For CHECK macros.
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 session->implicit_wait = ms; 177 session->implicit_wait = ms;
178 else if (type == "script") 178 else if (type == "script")
179 session->script_timeout = ms; 179 session->script_timeout = ms;
180 else if (type == "page load") 180 else if (type == "page load")
181 session->page_load_timeout = ms; 181 session->page_load_timeout = ms;
182 else 182 else
183 return Status(kUnknownError, "unknown type of timeout:" + type); 183 return Status(kUnknownError, "unknown type of timeout:" + type);
184 return Status(kOk); 184 return Status(kOk);
185 } 185 }
186 186
187 Status ExecuteSetScriptTimeout(
188 Session* session,
189 const base::DictionaryValue& params,
190 scoped_ptr<base::Value>* value) {
191 int ms;
192 if (!params.GetInteger("ms", &ms) || ms < 0)
193 return Status(kUnknownError, "'ms' must be a non-negative integer");
194 session->script_timeout = ms;
195 return Status(kOk);
196 }
197
187 Status ExecuteGetAlert( 198 Status ExecuteGetAlert(
188 Session* session, 199 Session* session,
189 const base::DictionaryValue& params, 200 const base::DictionaryValue& params,
190 scoped_ptr<base::Value>* value) { 201 scoped_ptr<base::Value>* value) {
191 bool is_open; 202 bool is_open;
192 Status status = session->chrome->IsJavaScriptDialogOpen(&is_open); 203 Status status = session->chrome->IsJavaScriptDialogOpen(&is_open);
193 if (status.IsError()) 204 if (status.IsError())
194 return status; 205 return status;
195 value->reset(base::Value::CreateBooleanValue(is_open)); 206 value->reset(base::Value::CreateBooleanValue(is_open));
196 return Status(kOk); 207 return Status(kOk);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 250
240 Status ExecuteDismissAlert( 251 Status ExecuteDismissAlert(
241 Session* session, 252 Session* session,
242 const base::DictionaryValue& params, 253 const base::DictionaryValue& params,
243 scoped_ptr<base::Value>* value) { 254 scoped_ptr<base::Value>* value) {
244 Status status = session->chrome->HandleJavaScriptDialog( 255 Status status = session->chrome->HandleJavaScriptDialog(
245 false, session->prompt_text); 256 false, session->prompt_text);
246 session->prompt_text = ""; 257 session->prompt_text = "";
247 return status; 258 return status;
248 } 259 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/session_commands.h ('k') | chrome/test/chromedriver/status.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698