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/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
542 DictionaryValue dict; | 542 DictionaryValue dict; |
543 dict.SetString("command", "SendOSLevelKeyEventToTab"); | 543 dict.SetString("command", "SendOSLevelKeyEventToTab"); |
544 dict.SetInteger("windex", browser_index); | 544 dict.SetInteger("windex", browser_index); |
545 dict.SetInteger("tab_index", tab_index); | 545 dict.SetInteger("tab_index", tab_index); |
546 dict.SetInteger("keyCode", key_code); | 546 dict.SetInteger("keyCode", key_code); |
547 dict.SetInteger("modifiers", modifiers); | 547 dict.SetInteger("modifiers", modifiers); |
548 DictionaryValue reply_dict; | 548 DictionaryValue reply_dict; |
549 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg); | 549 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg); |
550 } | 550 } |
551 | 551 |
552 bool SendSetFilePathsToFileUploadControlJSONRequest( | |
553 AutomationMessageSender* sender, | |
554 int browser_index, | |
555 int tab_index, | |
556 int x, | |
557 int y, | |
558 const std::vector<std::string>& paths, | |
559 std::string* error_msg) { | |
560 DictionaryValue dict; | |
561 dict.SetString("command", "SetFilePathToFileUploadControl"); | |
562 dict.SetInteger("windex", browser_index); | |
563 dict.SetInteger("tab_index", tab_index); | |
564 dict.SetInteger("x", x); | |
565 dict.SetInteger("y", y); | |
566 | |
567 ListValue* list_value = new ListValue(); | |
568 for (size_t path_index = 0; path_index < paths.size(); ++path_index) { | |
569 const std::string& path = paths[path_index]; | |
kkania
2011/05/23 18:43:49
merge this and the next line
nodchip
2011/05/26 01:14:53
Done.
| |
570 list_value->Append(Value::CreateStringValue(path)); | |
571 } | |
572 dict.Set("paths", list_value); | |
573 | |
574 DictionaryValue reply_dict; | |
575 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg); | |
576 } | |
577 | |
552 bool SendGetAppModalDialogMessageJSONRequest( | 578 bool SendGetAppModalDialogMessageJSONRequest( |
553 AutomationMessageSender* sender, | 579 AutomationMessageSender* sender, |
554 std::string* message, | 580 std::string* message, |
555 std::string* error_msg) { | 581 std::string* error_msg) { |
556 DictionaryValue dict; | 582 DictionaryValue dict; |
557 dict.SetString("command", "GetAppModalDialogMessage"); | 583 dict.SetString("command", "GetAppModalDialogMessage"); |
558 DictionaryValue reply_dict; | 584 DictionaryValue reply_dict; |
559 if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg)) | 585 if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg)) |
560 return false; | 586 return false; |
561 return reply_dict.GetString("message", message); | 587 return reply_dict.GetString("message", message); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
597 AutomationMessageSender* sender, | 623 AutomationMessageSender* sender, |
598 int* version, | 624 int* version, |
599 std::string* error_msg) { | 625 std::string* error_msg) { |
600 DictionaryValue dict; | 626 DictionaryValue dict; |
601 dict.SetString("command", "GetChromeDriverAutomationVersion"); | 627 dict.SetString("command", "GetChromeDriverAutomationVersion"); |
602 DictionaryValue reply_dict; | 628 DictionaryValue reply_dict; |
603 if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg)) | 629 if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg)) |
604 return false; | 630 return false; |
605 return reply_dict.GetInteger("version", version); | 631 return reply_dict.GetInteger("version", version); |
606 } | 632 } |
OLD | NEW |