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 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 if (!reply_dict.GetBoolean("success", &success)) { | 799 if (!reply_dict.GetBoolean("success", &success)) { |
800 *error_msg = "Missing or invalid 'success'"; | 800 *error_msg = "Missing or invalid 'success'"; |
801 return false; | 801 return false; |
802 } | 802 } |
803 if (!success) { | 803 if (!success) { |
804 *error_msg = "Extension uninstall not permitted"; | 804 *error_msg = "Extension uninstall not permitted"; |
805 return false; | 805 return false; |
806 } | 806 } |
807 return true; | 807 return true; |
808 } | 808 } |
| 809 |
| 810 bool SendSetLocalStatePreferenceJSONRequest( |
| 811 AutomationMessageSender* sender, |
| 812 const std::string& pref, |
| 813 base::Value* value, |
| 814 std::string* error_msg) { |
| 815 DictionaryValue dict; |
| 816 dict.SetString("command", "SetLocalStatePrefs"); |
| 817 dict.SetString("path", pref); |
| 818 dict.Set("value", value); |
| 819 DictionaryValue reply_dict; |
| 820 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg); |
| 821 } |
| 822 |
| 823 bool SendSetPreferenceJSONRequest( |
| 824 AutomationMessageSender* sender, |
| 825 const std::string& pref, |
| 826 base::Value* value, |
| 827 std::string* error_msg) { |
| 828 DictionaryValue dict; |
| 829 dict.SetString("command", "SetPrefs"); |
| 830 dict.SetInteger("windex", 0); |
| 831 dict.SetString("path", pref); |
| 832 dict.Set("value", value); |
| 833 DictionaryValue reply_dict; |
| 834 return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg); |
| 835 } |
OLD | NEW |