Chromium Code Reviews| Index: chrome/test/webdriver/webdriver_automation.cc |
| diff --git a/chrome/test/webdriver/webdriver_automation.cc b/chrome/test/webdriver/webdriver_automation.cc |
| index 72cb45f916828b1c6abc305eb514ee6df83242b8..006cacf5bcb8c365695e6d2fb39d7bd03df0c793 100644 |
| --- a/chrome/test/webdriver/webdriver_automation.cc |
| +++ b/chrome/test/webdriver/webdriver_automation.cc |
| @@ -185,7 +185,8 @@ namespace webdriver { |
| Automation::BrowserOptions::BrowserOptions() |
| : command(CommandLine::NO_PROGRAM), |
| - detach_process(false) {} |
| + detach_process(false), |
| + cert_revocation_checking(true) {} |
| Automation::BrowserOptions::~BrowserOptions() {} |
| @@ -743,6 +744,64 @@ void Automation::InstallExtension( |
| *error = new Error(kUnknownError, error_msg); |
| } |
| +void Automation::SetLocalStatePreference(const std::string& pref, |
| + base::Value* value, |
| + Error** error) { |
| + scoped_ptr<Value> scoped_value(value); |
| + bool has_new_local_state_api = false; |
| + *error = CompareVersion(927, 0, &has_new_local_state_api); |
|
Huyen
2011/12/09 23:56:55
maybe move the version # out into a constant and/o
kkania
2011/12/10 00:37:44
Done.
|
| + if (*error) |
| + return; |
| + |
| + if (has_new_local_state_api) { |
| + std::string error_msg; |
| + if (!SendSetLocalStatePreferenceJSONRequest( |
| + automation(), pref, scoped_value.release(), &error_msg)) |
| + *error = new Error(kUnknownError, error_msg); |
| + } else { |
| + std::string request, response; |
| + DictionaryValue request_dict; |
| + request_dict.SetString("command", "SetLocalStatePrefs"); |
| + request_dict.SetString("path", pref); |
| + request_dict.Set("value", scoped_value.release()); |
| + base::JSONWriter::Write(&request_dict, false, &request); |
| + if (!automation()->GetBrowserWindow(0)->SendJSONRequest( |
| + request, -1, &response)) { |
| + *error = new Error(kUnknownError, base::StringPrintf( |
| + "Failed to set local state pref '%s'", pref.c_str())); |
| + } |
| + } |
| +} |
| + |
| +void Automation::SetPreference(const std::string& pref, |
| + base::Value* value, |
| + Error** error) { |
| + scoped_ptr<Value> scoped_value(value); |
| + bool has_new_pref_api = false; |
| + *error = CompareVersion(964, 0, &has_new_pref_api); |
|
Huyen
2011/12/09 23:56:55
same comment as above
kkania
2011/12/10 00:37:44
Done.
|
| + if (*error) |
| + return; |
| + |
| + if (has_new_pref_api) { |
| + std::string error_msg; |
| + if (!SendSetPreferenceJSONRequest( |
| + automation(), pref, scoped_value.release(), &error_msg)) |
| + *error = new Error(kUnknownError, error_msg); |
| + } else { |
| + std::string request, response; |
| + DictionaryValue request_dict; |
| + request_dict.SetString("command", "SetPrefs"); |
| + request_dict.SetString("path", pref); |
| + request_dict.Set("value", scoped_value.release()); |
| + base::JSONWriter::Write(&request_dict, false, &request); |
| + if (!automation()->GetBrowserWindow(0)->SendJSONRequest( |
| + request, -1, &response)) { |
| + *error = new Error(kUnknownError, base::StringPrintf( |
| + "Failed to set pref '%s'", pref.c_str())); |
| + } |
| + } |
| +} |
| + |
| AutomationProxy* Automation::automation() const { |
| return launcher_->automation(); |
| } |