diff options
Diffstat (limited to 'chrome/test/webdriver/webdriver_automation.cc')
| -rw-r--r-- | chrome/test/webdriver/webdriver_automation.cc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/chrome/test/webdriver/webdriver_automation.cc b/chrome/test/webdriver/webdriver_automation.cc index 95e9cad..05addd1 100644 --- a/chrome/test/webdriver/webdriver_automation.cc +++ b/chrome/test/webdriver/webdriver_automation.cc @@ -908,6 +908,35 @@ void Automation::SetPreference(const std::string& pref, } } +void Automation::GetGeolocation(scoped_ptr<DictionaryValue>* geolocation, + Error** error) { + *error = CheckGeolocationSupported(); + if (*error) + return; + + if (geolocation_.get()) { + geolocation->reset(geolocation_->DeepCopy()); + } else { + *error = new Error(kUnknownError, + "Location must be set before it can be retrieved"); + } +} + +void Automation::OverrideGeolocation(DictionaryValue* geolocation, + Error** error) { + *error = CheckGeolocationSupported(); + if (*error) + return; + + automation::Error auto_error; + if (SendOverrideGeolocationJSONRequest( + automation(), geolocation, &auto_error)) { + geolocation_.reset(geolocation->DeepCopy()); + } else { + *error = Error::FromAutomationError(auto_error); + } +} + AutomationProxy* Automation::automation() const { return launcher_->automation(); } @@ -967,4 +996,11 @@ Error* Automation::CheckNewExtensionInterfaceSupported() { return CheckVersion(947, message); } +Error* Automation::CheckGeolocationSupported() { + const char* message = + "Geolocation automation interface is not supported for this version of " + "Chrome."; + return CheckVersion(1119, message); +} + } // namespace webdriver |
