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

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

Issue 6685099: Removing command_execution_timeout_ms in favor of action_max_timeout_ms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/automation/automation_json_requests.h" 5 #include "chrome/test/automation/automation_json_requests.h"
6 6
7 #include "base/scoped_ptr.h" 7 #include "base/scoped_ptr.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
11 #include "base/test/test_timeouts.h"
11 #include "chrome/common/automation_messages.h" 12 #include "chrome/common/automation_messages.h"
12 #include "chrome/common/json_value_serializer.h" 13 #include "chrome/common/json_value_serializer.h"
13 #include "chrome/test/automation/automation_proxy.h" 14 #include "chrome/test/automation/automation_proxy.h"
14 15
15 namespace { 16 namespace {
16 17
17 bool SendAutomationJSONRequest(AutomationMessageSender* sender, 18 bool SendAutomationJSONRequest(AutomationMessageSender* sender,
18 const DictionaryValue& request_dict, 19 const DictionaryValue& request_dict,
19 DictionaryValue* reply_dict) { 20 DictionaryValue* reply_dict) {
20 std::string request, reply; 21 std::string request, reply;
21 base::JSONWriter::Write(&request_dict, false, &request); 22 base::JSONWriter::Write(&request_dict, false, &request);
22 bool success = false; 23 bool success = false;
23 if (!SendAutomationJSONRequest(sender, request, &reply, &success)) 24 if (!SendAutomationJSONRequest(sender, request, &reply, &success,
25 TestTimeouts::action_max_timeout_ms()))
24 return false; 26 return false;
25 scoped_ptr<Value> value(base::JSONReader::Read(reply, true)); 27 scoped_ptr<Value> value(base::JSONReader::Read(reply, true));
26 if (!value.get() || !value->IsType(Value::TYPE_DICTIONARY)) { 28 if (!value.get() || !value->IsType(Value::TYPE_DICTIONARY)) {
27 std::string command; 29 std::string command;
28 request_dict.GetString("command", &command); 30 request_dict.GetString("command", &command);
29 LOG(ERROR) << "JSON request did not return dict: " << command << "\n"; 31 LOG(ERROR) << "JSON request did not return dict: " << command << "\n";
30 return false; 32 return false;
31 } 33 }
32 DictionaryValue* dict = static_cast<DictionaryValue*>(value.get()); 34 DictionaryValue* dict = static_cast<DictionaryValue*>(value.get());
33 if (!success) { 35 if (!success) {
(...skipping 17 matching lines...) Expand all
51 int modifiers) 53 int modifiers)
52 : type(type), 54 : type(type),
53 key_code(key_code), 55 key_code(key_code),
54 unmodified_text(unmodified_text), 56 unmodified_text(unmodified_text),
55 modified_text(modified_text), 57 modified_text(modified_text),
56 modifiers(modifiers) {} 58 modifiers(modifiers) {}
57 59
58 bool SendAutomationJSONRequest(AutomationMessageSender* sender, 60 bool SendAutomationJSONRequest(AutomationMessageSender* sender,
59 const std::string& request, 61 const std::string& request,
60 std::string* reply, 62 std::string* reply,
61 bool* success) { 63 bool* success,
64 int timeout) {
62 return sender->Send(new AutomationMsg_SendJSONRequest( 65 return sender->Send(new AutomationMsg_SendJSONRequest(
63 -1, request, reply, success)); 66 -1, request, reply, success), timeout);
64 } 67 }
65 68
66 bool SendGetIndicesFromTabIdJSONRequest( 69 bool SendGetIndicesFromTabIdJSONRequest(
67 AutomationMessageSender* sender, 70 AutomationMessageSender* sender,
68 int tab_id, 71 int tab_id,
69 int* browser_index, 72 int* browser_index,
70 int* tab_index) { 73 int* tab_index) {
71 DictionaryValue request_dict; 74 DictionaryValue request_dict;
72 request_dict.SetString("command", "GetIndicesFromTab"); 75 request_dict.SetString("command", "GetIndicesFromTab");
73 request_dict.SetInteger("tab_id", tab_id); 76 request_dict.SetInteger("tab_id", tab_id);
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 return SendAutomationJSONRequest(sender, dict, &reply_dict); 392 return SendAutomationJSONRequest(sender, dict, &reply_dict);
390 } 393 }
391 394
392 bool SendWaitForAllTabsToStopLoadingJSONRequest( 395 bool SendWaitForAllTabsToStopLoadingJSONRequest(
393 AutomationMessageSender* sender) { 396 AutomationMessageSender* sender) {
394 DictionaryValue dict; 397 DictionaryValue dict;
395 dict.SetString("command", "WaitForAllTabsToStopLoading"); 398 dict.SetString("command", "WaitForAllTabsToStopLoading");
396 DictionaryValue reply_dict; 399 DictionaryValue reply_dict;
397 return SendAutomationJSONRequest(sender, dict, &reply_dict); 400 return SendAutomationJSONRequest(sender, dict, &reply_dict);
398 } 401 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698