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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 dict.SetBoolean("with_ui", with_ui); | 643 dict.SetBoolean("with_ui", with_ui); |
644 DictionaryValue reply_dict; | 644 DictionaryValue reply_dict; |
645 if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg)) | 645 if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg)) |
646 return false; | 646 return false; |
647 if (!reply_dict.GetString("id", extension_id)) { | 647 if (!reply_dict.GetString("id", extension_id)) { |
648 *error_msg = "Missing or invalid 'id'"; | 648 *error_msg = "Missing or invalid 'id'"; |
649 return false; | 649 return false; |
650 } | 650 } |
651 return true; | 651 return true; |
652 } | 652 } |
| 653 |
| 654 bool SendSetLocalStatePreferenceJSONRequest( |
| 655 AutomationMessageSender* sender, |
| 656 const std::string& pref, |
| 657 base::Value* value, |
| 658 std::string* error_msg) { |
| 659 DictionaryValue dict; |
| 660 dict.SetString("command", "SetLocalStatePrefs"); |
| 661 dict.SetString("path", pref); |
| 662 dict.Set("value", value); |
| 663 DictionaryValue reply_dict; |
| 664 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg); |
| 665 } |
| 666 |
| 667 bool SendSetPreferenceJSONRequest( |
| 668 AutomationMessageSender* sender, |
| 669 const std::string& pref, |
| 670 base::Value* value, |
| 671 std::string* error_msg) { |
| 672 DictionaryValue dict; |
| 673 dict.SetString("command", "SetPrefs"); |
| 674 dict.SetInteger("windex", 0); |
| 675 dict.SetString("path", pref); |
| 676 dict.Set("value", value); |
| 677 DictionaryValue reply_dict; |
| 678 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg); |
| 679 } |
OLD | NEW |