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