Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1006)

Unified Diff: content/browser/geolocation/geolocation_provider.cc

Issue 10070012: Geolocation support for chromedriver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/geolocation/geolocation_provider.cc
diff --git a/content/browser/geolocation/geolocation_provider.cc b/content/browser/geolocation/geolocation_provider.cc
index e090ac9b76c1175774a78908447ec86174098835..b491826177bfe12d08e5b14498fbcb16d47ae421 100644
--- a/content/browser/geolocation/geolocation_provider.cc
+++ b/content/browser/geolocation/geolocation_provider.cc
@@ -18,6 +18,7 @@ GeolocationProvider::GeolocationProvider()
: base::Thread("Geolocation"),
client_loop_(base::MessageLoopProxy::current()),
is_permission_granted_(false),
+ ignore_location_updates_(false),
arbitrator_(NULL) {
}
@@ -127,12 +128,23 @@ void GeolocationProvider::CleanUp() {
void GeolocationProvider::OnLocationUpdate(const Geoposition& position) {
DCHECK(OnGeolocationThread());
+ // Will be true only in testing.
+ if (ignore_location_updates_)
+ return;
client_loop_->PostTask(
FROM_HERE,
base::Bind(&GeolocationProvider::NotifyObservers,
base::Unretained(this), position));
}
+void GeolocationProvider::OverrideLocationForTesting(
+ const Geoposition& position) {
+ DCHECK(OnClientThread());
+ position_ = position;
+ ignore_location_updates_ = true;
+ NotifyObservers(position);
+}
+
bool GeolocationProvider::HasPermissionBeenGranted() const {
DCHECK(OnClientThread());
return is_permission_granted_;
« no previous file with comments | « content/browser/geolocation/geolocation_provider.h ('k') | content/browser/geolocation/geolocation_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698