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

Side by Side Diff: chrome/test/automation/automation_json_requests.cc

Issue 6995060: Change timeout for all ChromeDriver automation calls to infinite (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 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/automation/automation_json_requests.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
kkania 2011/06/07 22:55:28 overall stuff (I put it here because many people m
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/automation/automation_json_requests.h" 5 #include "chrome/test/automation/automation_json_requests.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
11 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/stringprintf.h" 13 #include "base/stringprintf.h"
14 #include "base/test/test_timeouts.h" 14 #include "base/test/test_timeouts.h"
15 #include "base/time.h" 15 #include "base/time.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "chrome/common/automation_messages.h" 17 #include "chrome/common/automation_messages.h"
18 #include "chrome/test/automation/automation_proxy.h" 18 #include "chrome/test/automation/automation_proxy.h"
19 #include "content/common/json_value_serializer.h" 19 #include "content/common/json_value_serializer.h"
20 20
21 namespace { 21 namespace {
22
23 bool SendAutomationJSONRequest(AutomationMessageSender* sender, 22 bool SendAutomationJSONRequest(AutomationMessageSender* sender,
24 const DictionaryValue& request_dict, 23 const DictionaryValue& request_dict,
25 DictionaryValue* reply_dict, 24 DictionaryValue* reply_dict,
25 int timeout_ms,
26 std::string* error_msg) { 26 std::string* error_msg) {
27 std::string request, reply; 27 std::string request, reply;
28 base::JSONWriter::Write(&request_dict, false, &request); 28 base::JSONWriter::Write(&request_dict, false, &request);
29 bool success = false; 29 bool success = false;
30 int timeout_ms = TestTimeouts::action_max_timeout_ms();
31 base::Time before_sending = base::Time::Now(); 30 base::Time before_sending = base::Time::Now();
32 if (!SendAutomationJSONRequest( 31 if (!SendAutomationJSONRequest(
33 sender, request, timeout_ms, &reply, &success)) { 32 sender, request, timeout_ms, &reply, &success)) {
34 int64 elapsed_ms = (base::Time::Now() - before_sending).InMilliseconds(); 33 int64 elapsed_ms = (base::Time::Now() - before_sending).InMilliseconds();
35 std::string command; 34 std::string command;
36 request_dict.GetString("command", &command); 35 request_dict.GetString("command", &command);
37 if (elapsed_ms >= timeout_ms) { 36 if (elapsed_ms >= timeout_ms) {
38 *error_msg = base::StringPrintf( 37 *error_msg = base::StringPrintf(
39 "Chrome did not respond to '%s'. Request may have timed out. " 38 "Chrome did not respond to '%s'. Request may have timed out. "
40 "Elapsed time was %" PRId64 " ms. Request timeout was %d ms. " 39 "Elapsed time was %" PRId64 " ms. Request timeout was %d ms. "
(...skipping 30 matching lines...) Expand all
71 error.c_str(), 70 error.c_str(),
72 request.c_str()); 71 request.c_str());
73 LOG(ERROR) << "JSON request failed: " << command << "\n" 72 LOG(ERROR) << "JSON request failed: " << command << "\n"
74 << " with error: " << error; 73 << " with error: " << error;
75 return false; 74 return false;
76 } 75 }
77 reply_dict->MergeDictionary(dict); 76 reply_dict->MergeDictionary(dict);
78 return true; 77 return true;
79 } 78 }
80 79
80 bool SendAutomationJSONRequest(AutomationMessageSender* sender,
81 const DictionaryValue& request_dict,
82 DictionaryValue* reply_dict,
83 std::string* error_msg) {
84 int timeout_ms = TestTimeouts::action_max_timeout_ms();
kkania 2011/06/07 22:55:28 make this one call sender->Send(msg) instead of se
85 return SendAutomationJSONRequest(sender, request_dict,
86 reply_dict, timeout_ms, error_msg);
87 }
81 } // namespace 88 } // namespace
82 89
83 WebKeyEvent::WebKeyEvent(automation::KeyEventTypes type, 90 WebKeyEvent::WebKeyEvent(automation::KeyEventTypes type,
84 ui::KeyboardCode key_code, 91 ui::KeyboardCode key_code,
85 const std::string& unmodified_text, 92 const std::string& unmodified_text,
86 const std::string& modified_text, 93 const std::string& modified_text,
87 int modifiers) 94 int modifiers)
88 : type(type), 95 : type(type),
89 key_code(key_code), 96 key_code(key_code),
90 unmodified_text(unmodified_text), 97 unmodified_text(unmodified_text),
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 int navigation_count, 153 int navigation_count,
147 AutomationMsg_NavigationResponseValues* nav_response, 154 AutomationMsg_NavigationResponseValues* nav_response,
148 std::string* error_msg) { 155 std::string* error_msg) {
149 DictionaryValue dict; 156 DictionaryValue dict;
150 dict.SetString("command", "NavigateToURL"); 157 dict.SetString("command", "NavigateToURL");
151 dict.SetInteger("windex", browser_index); 158 dict.SetInteger("windex", browser_index);
152 dict.SetInteger("tab_index", tab_index); 159 dict.SetInteger("tab_index", tab_index);
153 dict.SetString("url", url.possibly_invalid_spec()); 160 dict.SetString("url", url.possibly_invalid_spec());
154 dict.SetInteger("navigation_count", navigation_count); 161 dict.SetInteger("navigation_count", navigation_count);
155 DictionaryValue reply_dict; 162 DictionaryValue reply_dict;
156 if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg)) 163 if (!SendAutomationJSONRequest(sender, dict, &reply_dict,
164 base::kNoTimeout, error_msg)) {
157 return false; 165 return false;
166 }
158 int response = 0; 167 int response = 0;
159 if (!reply_dict.GetInteger("result", &response)) 168 if (!reply_dict.GetInteger("result", &response))
160 return false; 169 return false;
161 *nav_response = static_cast<AutomationMsg_NavigationResponseValues>(response); 170 *nav_response = static_cast<AutomationMsg_NavigationResponseValues>(response);
162 return true; 171 return true;
163 } 172 }
164 173
165 bool SendExecuteJavascriptJSONRequest( 174 bool SendExecuteJavascriptJSONRequest(
166 AutomationMessageSender* sender, 175 AutomationMessageSender* sender,
167 int browser_index, 176 int browser_index,
168 int tab_index, 177 int tab_index,
169 const std::string& frame_xpath, 178 const std::string& frame_xpath,
170 const std::string& javascript, 179 const std::string& javascript,
171 Value** result, 180 Value** result,
172 std::string* error_msg) { 181 std::string* error_msg) {
173 DictionaryValue dict; 182 DictionaryValue dict;
174 dict.SetString("command", "ExecuteJavascript"); 183 dict.SetString("command", "ExecuteJavascript");
175 dict.SetInteger("windex", browser_index); 184 dict.SetInteger("windex", browser_index);
176 dict.SetInteger("tab_index", tab_index); 185 dict.SetInteger("tab_index", tab_index);
177 dict.SetString("frame_xpath", frame_xpath); 186 dict.SetString("frame_xpath", frame_xpath);
178 dict.SetString("javascript", javascript); 187 dict.SetString("javascript", javascript);
179 DictionaryValue reply_dict; 188 DictionaryValue reply_dict;
180 if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg)) 189 if (!SendAutomationJSONRequest(sender, dict, &reply_dict,
190 base::kNoTimeout, error_msg)) {
181 return false; 191 return false;
192 }
182 193
183 std::string json; 194 std::string json;
184 if (!reply_dict.GetString("result", &json)) { 195 if (!reply_dict.GetString("result", &json)) {
185 LOG(ERROR) << "Executed javascript but received no 'result'"; 196 LOG(ERROR) << "Executed javascript but received no 'result'";
186 return false; 197 return false;
187 } 198 }
188 // Wrap |json| in an array before deserializing because valid JSON has an 199 // Wrap |json| in an array before deserializing because valid JSON has an
189 // array or an object as the root. 200 // array or an object as the root.
190 json.insert(0, "["); 201 json.insert(0, "[");
191 json.append("]"); 202 json.append("]");
(...skipping 11 matching lines...) Expand all
203 bool SendGoForwardJSONRequest( 214 bool SendGoForwardJSONRequest(
204 AutomationMessageSender* sender, 215 AutomationMessageSender* sender,
205 int browser_index, 216 int browser_index,
206 int tab_index, 217 int tab_index,
207 std::string* error_msg) { 218 std::string* error_msg) {
208 DictionaryValue dict; 219 DictionaryValue dict;
209 dict.SetString("command", "GoForward"); 220 dict.SetString("command", "GoForward");
210 dict.SetInteger("windex", browser_index); 221 dict.SetInteger("windex", browser_index);
211 dict.SetInteger("tab_index", tab_index); 222 dict.SetInteger("tab_index", tab_index);
212 DictionaryValue reply_dict; 223 DictionaryValue reply_dict;
213 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg); 224 return SendAutomationJSONRequest(sender, dict, &reply_dict,
225 base::kNoTimeout, error_msg);
214 } 226 }
215 227
216 bool SendGoBackJSONRequest( 228 bool SendGoBackJSONRequest(
217 AutomationMessageSender* sender, 229 AutomationMessageSender* sender,
218 int browser_index, 230 int browser_index,
219 int tab_index, 231 int tab_index,
220 std::string* error_msg) { 232 std::string* error_msg) {
221 DictionaryValue dict; 233 DictionaryValue dict;
222 dict.SetString("command", "GoBack"); 234 dict.SetString("command", "GoBack");
223 dict.SetInteger("windex", browser_index); 235 dict.SetInteger("windex", browser_index);
224 dict.SetInteger("tab_index", tab_index); 236 dict.SetInteger("tab_index", tab_index);
225 DictionaryValue reply_dict; 237 DictionaryValue reply_dict;
226 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg); 238 return SendAutomationJSONRequest(sender, dict, &reply_dict,
239 base::kNoTimeout, error_msg);
227 } 240 }
228 241
229 bool SendReloadJSONRequest( 242 bool SendReloadJSONRequest(
230 AutomationMessageSender* sender, 243 AutomationMessageSender* sender,
231 int browser_index, 244 int browser_index,
232 int tab_index, 245 int tab_index,
233 std::string* error_msg) { 246 std::string* error_msg) {
234 DictionaryValue dict; 247 DictionaryValue dict;
235 dict.SetString("command", "Reload"); 248 dict.SetString("command", "Reload");
236 dict.SetInteger("windex", browser_index); 249 dict.SetInteger("windex", browser_index);
237 dict.SetInteger("tab_index", tab_index); 250 dict.SetInteger("tab_index", tab_index);
238 DictionaryValue reply_dict; 251 DictionaryValue reply_dict;
239 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg); 252 return SendAutomationJSONRequest(sender, dict, &reply_dict,
253 base::kNoTimeout, error_msg);
240 } 254 }
241 255
242 bool SendCaptureEntirePageJSONRequest( 256 bool SendCaptureEntirePageJSONRequest(
243 AutomationMessageSender* sender, 257 AutomationMessageSender* sender,
244 int browser_index, 258 int browser_index,
245 int tab_index, 259 int tab_index,
246 const FilePath& path, 260 const FilePath& path,
247 std::string* error_msg) { 261 std::string* error_msg) {
248 DictionaryValue dict; 262 DictionaryValue dict;
249 dict.SetString("command", "CaptureEntirePage"); 263 dict.SetString("command", "CaptureEntirePage");
250 dict.SetInteger("windex", browser_index); 264 dict.SetInteger("windex", browser_index);
251 dict.SetInteger("tab_index", tab_index); 265 dict.SetInteger("tab_index", tab_index);
252 dict.SetString("path", path.value()); 266 dict.SetString("path", path.value());
253 DictionaryValue reply_dict; 267 DictionaryValue reply_dict;
254 268
255 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg); 269 return SendAutomationJSONRequest(sender, dict, &reply_dict,
270 base::kNoTimeout, error_msg);
256 } 271 }
257 272
258 bool SendGetTabURLJSONRequest( 273 bool SendGetTabURLJSONRequest(
259 AutomationMessageSender* sender, 274 AutomationMessageSender* sender,
260 int browser_index, 275 int browser_index,
261 int tab_index, 276 int tab_index,
262 std::string* url, 277 std::string* url,
263 std::string* error_msg) { 278 std::string* error_msg) {
264 DictionaryValue dict; 279 DictionaryValue dict;
265 dict.SetString("command", "GetTabURL"); 280 dict.SetString("command", "GetTabURL");
(...skipping 23 matching lines...) Expand all
289 304
290 bool SendGetCookiesJSONRequest( 305 bool SendGetCookiesJSONRequest(
291 AutomationMessageSender* sender, 306 AutomationMessageSender* sender,
292 const std::string& url, 307 const std::string& url,
293 ListValue** cookies, 308 ListValue** cookies,
294 std::string* error_msg) { 309 std::string* error_msg) {
295 DictionaryValue dict; 310 DictionaryValue dict;
296 dict.SetString("command", "GetCookies"); 311 dict.SetString("command", "GetCookies");
297 dict.SetString("url", url); 312 dict.SetString("url", url);
298 DictionaryValue reply_dict; 313 DictionaryValue reply_dict;
299 if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg)) 314 if (!SendAutomationJSONRequest(sender, dict, &reply_dict,
315 base::kNoTimeout, error_msg))
300 return false; 316 return false;
301 Value* cookies_unscoped_value; 317 Value* cookies_unscoped_value;
302 if (!reply_dict.Remove("cookies", &cookies_unscoped_value)) 318 if (!reply_dict.Remove("cookies", &cookies_unscoped_value))
303 return false; 319 return false;
304 scoped_ptr<Value> cookies_value(cookies_unscoped_value); 320 scoped_ptr<Value> cookies_value(cookies_unscoped_value);
305 if (!cookies_value->IsType(Value::TYPE_LIST)) 321 if (!cookies_value->IsType(Value::TYPE_LIST))
306 return false; 322 return false;
307 *cookies = static_cast<ListValue*>(cookies_value.release()); 323 *cookies = static_cast<ListValue*>(cookies_value.release());
308 return true; 324 return true;
309 } 325 }
310 326
311 bool SendGetCookiesJSONRequestDeprecated( 327 bool SendGetCookiesJSONRequestDeprecated(
312 AutomationMessageSender* sender, 328 AutomationMessageSender* sender,
313 int browser_index, 329 int browser_index,
314 const std::string& url, 330 const std::string& url,
315 std::string* cookies) { 331 std::string* cookies) {
316 DictionaryValue dict; 332 DictionaryValue dict;
317 dict.SetString("command", "GetCookies"); 333 dict.SetString("command", "GetCookies");
318 dict.SetInteger("windex", browser_index); 334 dict.SetInteger("windex", browser_index);
319 dict.SetString("url", url); 335 dict.SetString("url", url);
320 DictionaryValue reply_dict; 336 DictionaryValue reply_dict;
321 std::string error_msg; 337 std::string error_msg;
322 if (!SendAutomationJSONRequest(sender, dict, &reply_dict, &error_msg)) 338 if (!SendAutomationJSONRequest(sender, dict, &reply_dict,
kkania 2011/06/07 22:55:28 you can forget adding custom timeout to the deprec
339 base::kNoTimeout, &error_msg)) {
323 return false; 340 return false;
341 }
324 return reply_dict.GetString("cookies", cookies); 342 return reply_dict.GetString("cookies", cookies);
325 } 343 }
326 344
327 bool SendDeleteCookieJSONRequest( 345 bool SendDeleteCookieJSONRequest(
328 AutomationMessageSender* sender, 346 AutomationMessageSender* sender,
329 const std::string& url, 347 const std::string& url,
330 const std::string& cookie_name, 348 const std::string& cookie_name,
331 std::string* error_msg) { 349 std::string* error_msg) {
332 DictionaryValue dict; 350 DictionaryValue dict;
333 dict.SetString("command", "DeleteCookie"); 351 dict.SetString("command", "DeleteCookie");
334 dict.SetString("url", url); 352 dict.SetString("url", url);
335 dict.SetString("name", cookie_name); 353 dict.SetString("name", cookie_name);
336 DictionaryValue reply_dict; 354 DictionaryValue reply_dict;
337 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg); 355 return SendAutomationJSONRequest(sender, dict, &reply_dict,
356 base::kNoTimeout, error_msg);
338 } 357 }
339 358
340 bool SendDeleteCookieJSONRequestDeprecated( 359 bool SendDeleteCookieJSONRequestDeprecated(
341 AutomationMessageSender* sender, 360 AutomationMessageSender* sender,
342 int browser_index, 361 int browser_index,
343 const std::string& url, 362 const std::string& url,
344 const std::string& cookie_name) { 363 const std::string& cookie_name) {
345 DictionaryValue dict; 364 DictionaryValue dict;
346 dict.SetString("command", "DeleteCookie"); 365 dict.SetString("command", "DeleteCookie");
347 dict.SetInteger("windex", browser_index); 366 dict.SetInteger("windex", browser_index);
348 dict.SetString("url", url); 367 dict.SetString("url", url);
349 dict.SetString("name", cookie_name); 368 dict.SetString("name", cookie_name);
350 DictionaryValue reply_dict; 369 DictionaryValue reply_dict;
351 std::string error_msg; 370 std::string error_msg;
352 return SendAutomationJSONRequest(sender, dict, &reply_dict, &error_msg); 371 return SendAutomationJSONRequest(sender, dict, &reply_dict,
372 base::kNoTimeout, &error_msg);
353 } 373 }
354 374
355 bool SendSetCookieJSONRequest( 375 bool SendSetCookieJSONRequest(
356 AutomationMessageSender* sender, 376 AutomationMessageSender* sender,
357 const std::string& url, 377 const std::string& url,
358 DictionaryValue* cookie_dict, 378 DictionaryValue* cookie_dict,
359 std::string* error_msg) { 379 std::string* error_msg) {
360 DictionaryValue dict; 380 DictionaryValue dict;
361 dict.SetString("command", "SetCookie"); 381 dict.SetString("command", "SetCookie");
362 dict.SetString("url", url); 382 dict.SetString("url", url);
363 dict.Set("cookie", cookie_dict->DeepCopy()); 383 dict.Set("cookie", cookie_dict->DeepCopy());
364 DictionaryValue reply_dict; 384 DictionaryValue reply_dict;
365 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg); 385 return SendAutomationJSONRequest(sender, dict, &reply_dict,
386 base::kNoTimeout, error_msg);
366 } 387 }
367 388
368 bool SendSetCookieJSONRequestDeprecated( 389 bool SendSetCookieJSONRequestDeprecated(
369 AutomationMessageSender* sender, 390 AutomationMessageSender* sender,
370 int browser_index, 391 int browser_index,
371 const std::string& url, 392 const std::string& url,
372 const std::string& cookie) { 393 const std::string& cookie) {
373 DictionaryValue dict; 394 DictionaryValue dict;
374 dict.SetString("command", "SetCookie"); 395 dict.SetString("command", "SetCookie");
375 dict.SetInteger("windex", browser_index); 396 dict.SetInteger("windex", browser_index);
376 dict.SetString("url", url); 397 dict.SetString("url", url);
377 dict.SetString("cookie", cookie); 398 dict.SetString("cookie", cookie);
378 DictionaryValue reply_dict; 399 DictionaryValue reply_dict;
379 std::string error_msg; 400 std::string error_msg;
380 return SendAutomationJSONRequest(sender, dict, &reply_dict, &error_msg); 401 return SendAutomationJSONRequest(sender, dict, &reply_dict,
402 base::kNoTimeout, &error_msg);
381 } 403 }
382 404
383 bool SendGetTabIdsJSONRequest( 405 bool SendGetTabIdsJSONRequest(
384 AutomationMessageSender* sender, 406 AutomationMessageSender* sender,
385 std::vector<int>* tab_ids, 407 std::vector<int>* tab_ids,
386 std::string* error_msg) { 408 std::string* error_msg) {
387 DictionaryValue dict; 409 DictionaryValue dict;
388 dict.SetString("command", "GetTabIds"); 410 dict.SetString("command", "GetTabIds");
389 DictionaryValue reply_dict; 411 DictionaryValue reply_dict;
390 if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg)) 412 if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg))
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg); 602 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg);
581 } 603 }
582 604
583 bool SendGetAppModalDialogMessageJSONRequest( 605 bool SendGetAppModalDialogMessageJSONRequest(
584 AutomationMessageSender* sender, 606 AutomationMessageSender* sender,
585 std::string* message, 607 std::string* message,
586 std::string* error_msg) { 608 std::string* error_msg) {
587 DictionaryValue dict; 609 DictionaryValue dict;
588 dict.SetString("command", "GetAppModalDialogMessage"); 610 dict.SetString("command", "GetAppModalDialogMessage");
589 DictionaryValue reply_dict; 611 DictionaryValue reply_dict;
590 if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg)) 612 if (!SendAutomationJSONRequest(sender, dict, &reply_dict,
kkania 2011/06/07 22:55:28 I don't think need custom timeout here
613 base::kNoTimeout, error_msg)) {
591 return false; 614 return false;
615 }
592 return reply_dict.GetString("message", message); 616 return reply_dict.GetString("message", message);
593 } 617 }
594 618
595 bool SendAcceptOrDismissAppModalDialogJSONRequest( 619 bool SendAcceptOrDismissAppModalDialogJSONRequest(
596 AutomationMessageSender* sender, 620 AutomationMessageSender* sender,
597 bool accept, 621 bool accept,
598 std::string* error_msg) { 622 std::string* error_msg) {
599 DictionaryValue dict; 623 DictionaryValue dict;
600 dict.SetString("command", "AcceptOrDismissAppModalDialog"); 624 dict.SetString("command", "AcceptOrDismissAppModalDialog");
601 dict.SetBoolean("accept", accept); 625 dict.SetBoolean("accept", accept);
602 DictionaryValue reply_dict; 626 DictionaryValue reply_dict;
603 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg); 627 return SendAutomationJSONRequest(sender, dict, &reply_dict,
628 base::kNoTimeout, error_msg);
kkania 2011/06/07 22:55:28 or here
604 } 629 }
605 630
606 bool SendAcceptPromptAppModalDialogJSONRequest( 631 bool SendAcceptPromptAppModalDialogJSONRequest(
607 AutomationMessageSender* sender, 632 AutomationMessageSender* sender,
608 const std::string& prompt_text, 633 const std::string& prompt_text,
609 std::string* error_msg) { 634 std::string* error_msg) {
610 DictionaryValue dict; 635 DictionaryValue dict;
611 dict.SetString("command", "AcceptOrDismissAppModalDialog"); 636 dict.SetString("command", "AcceptOrDismissAppModalDialog");
612 dict.SetBoolean("accept", true); 637 dict.SetBoolean("accept", true);
613 dict.SetString("prompt_text", prompt_text); 638 dict.SetString("prompt_text", prompt_text);
614 DictionaryValue reply_dict; 639 DictionaryValue reply_dict;
615 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg); 640 return SendAutomationJSONRequest(sender, dict, &reply_dict,
641 base::kNoTimeout, error_msg);
kkania 2011/06/07 22:55:28 or here
616 } 642 }
617 643
618 bool SendWaitForAllTabsToStopLoadingJSONRequest( 644 bool SendWaitForAllTabsToStopLoadingJSONRequest(
619 AutomationMessageSender* sender, 645 AutomationMessageSender* sender,
620 std::string* error_msg) { 646 std::string* error_msg) {
621 DictionaryValue dict; 647 DictionaryValue dict;
622 dict.SetString("command", "WaitForAllTabsToStopLoading"); 648 dict.SetString("command", "WaitForAllTabsToStopLoading");
623 DictionaryValue reply_dict; 649 DictionaryValue reply_dict;
624 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg); 650 return SendAutomationJSONRequest(sender, dict, &reply_dict,
651 base::kNoTimeout, error_msg);
625 } 652 }
626 653
627 bool SendGetChromeDriverAutomationVersion( 654 bool SendGetChromeDriverAutomationVersion(
628 AutomationMessageSender* sender, 655 AutomationMessageSender* sender,
629 int* version, 656 int* version,
630 std::string* error_msg) { 657 std::string* error_msg) {
631 DictionaryValue dict; 658 DictionaryValue dict;
632 dict.SetString("command", "GetChromeDriverAutomationVersion"); 659 dict.SetString("command", "GetChromeDriverAutomationVersion");
633 DictionaryValue reply_dict; 660 DictionaryValue reply_dict;
634 if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg)) 661 if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg))
635 return false; 662 return false;
636 return reply_dict.GetInteger("version", version); 663 return reply_dict.GetInteger("version", version);
637 } 664 }
OLDNEW
« no previous file with comments | « chrome/test/automation/automation_json_requests.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698