| OLD | NEW |
| 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/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" |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 DictionaryValue dict; | 568 DictionaryValue dict; |
| 569 dict.SetString("command", "SendOSLevelKeyEventToTab"); | 569 dict.SetString("command", "SendOSLevelKeyEventToTab"); |
| 570 dict.SetInteger("windex", browser_index); | 570 dict.SetInteger("windex", browser_index); |
| 571 dict.SetInteger("tab_index", tab_index); | 571 dict.SetInteger("tab_index", tab_index); |
| 572 dict.SetInteger("keyCode", key_code); | 572 dict.SetInteger("keyCode", key_code); |
| 573 dict.SetInteger("modifiers", modifiers); | 573 dict.SetInteger("modifiers", modifiers); |
| 574 DictionaryValue reply_dict; | 574 DictionaryValue reply_dict; |
| 575 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg); | 575 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg); |
| 576 } | 576 } |
| 577 | 577 |
| 578 bool SendDragAndDropFilePathsJSONRequest( |
| 579 AutomationMessageSender* sender, |
| 580 int browser_index, |
| 581 int tab_index, |
| 582 int x, |
| 583 int y, |
| 584 const std::vector<std::string>& paths, |
| 585 std::string* error_msg) { |
| 586 DictionaryValue dict; |
| 587 dict.SetString("command", "DragAndDropFilePaths"); |
| 588 dict.SetInteger("windex", browser_index); |
| 589 dict.SetInteger("tab_index", tab_index); |
| 590 dict.SetInteger("x", x); |
| 591 dict.SetInteger("y", y); |
| 592 |
| 593 ListValue* list_value = new ListValue(); |
| 594 for (size_t path_index = 0; path_index < paths.size(); ++path_index) { |
| 595 list_value->Append(Value::CreateStringValue(paths[path_index])); |
| 596 } |
| 597 dict.Set("paths", list_value); |
| 598 |
| 599 DictionaryValue reply_dict; |
| 600 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg); |
| 601 } |
| 602 |
| 578 bool SendGetAppModalDialogMessageJSONRequest( | 603 bool SendGetAppModalDialogMessageJSONRequest( |
| 579 AutomationMessageSender* sender, | 604 AutomationMessageSender* sender, |
| 580 std::string* message, | 605 std::string* message, |
| 581 std::string* error_msg) { | 606 std::string* error_msg) { |
| 582 DictionaryValue dict; | 607 DictionaryValue dict; |
| 583 dict.SetString("command", "GetAppModalDialogMessage"); | 608 dict.SetString("command", "GetAppModalDialogMessage"); |
| 584 DictionaryValue reply_dict; | 609 DictionaryValue reply_dict; |
| 585 if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg)) | 610 if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg)) |
| 586 return false; | 611 return false; |
| 587 return reply_dict.GetString("message", message); | 612 return reply_dict.GetString("message", message); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 AutomationMessageSender* sender, | 648 AutomationMessageSender* sender, |
| 624 int* version, | 649 int* version, |
| 625 std::string* error_msg) { | 650 std::string* error_msg) { |
| 626 DictionaryValue dict; | 651 DictionaryValue dict; |
| 627 dict.SetString("command", "GetChromeDriverAutomationVersion"); | 652 dict.SetString("command", "GetChromeDriverAutomationVersion"); |
| 628 DictionaryValue reply_dict; | 653 DictionaryValue reply_dict; |
| 629 if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg)) | 654 if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg)) |
| 630 return false; | 655 return false; |
| 631 return reply_dict.GetInteger("version", version); | 656 return reply_dict.GetInteger("version", version); |
| 632 } | 657 } |
| OLD | NEW |