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

Unified Diff: content/browser/geolocation/geolocation.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
« no previous file with comments | « chrome/test/base/ui_test_utils.cc ('k') | content/browser/geolocation/geolocation_provider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/geolocation/geolocation.cc
diff --git a/content/browser/geolocation/geolocation.cc b/content/browser/geolocation/geolocation.cc
new file mode 100644
index 0000000000000000000000000000000000000000..789d9a37a94071feb4ec8b8e688cb45b045b0b5c
--- /dev/null
+++ b/content/browser/geolocation/geolocation.cc
@@ -0,0 +1,54 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/public/browser/geolocation.h"
+
+#include "base/bind.h"
+#include "base/callback.h"
+#include "base/location.h"
+#include "base/memory/ref_counted.h"
+#include "base/message_loop_proxy.h"
+#include "content/browser/geolocation/geolocation_provider.h"
+#include "content/common/geoposition.h"
+#include "content/public/browser/browser_thread.h"
+
+namespace content {
+
+namespace {
+
+void OverrideLocationForTestingOnIOThread(
+ double latitude,
+ double longitude,
+ double altitude,
+ const base::Closure& completion_callback,
+ scoped_refptr<base::MessageLoopProxy> callback_loop) {
+ Geoposition position;
+ position.latitude = latitude;
+ position.longitude = longitude;
+ position.altitude = altitude;
+ position.accuracy = 0;
+ position.timestamp = base::Time::Now();
+ GeolocationProvider::GetInstance()->OverrideLocationForTesting(position);
+ callback_loop->PostTask(FROM_HERE, completion_callback);
+}
+
+} // namespace
+
+void OverrideLocationForTesting(
+ double latitude,
+ double longitude,
+ double altitude,
+ const base::Closure& completion_callback) {
+ base::Closure closure = base::Bind(
+ &OverrideLocationForTestingOnIOThread,
+ latitude, longitude, altitude, completion_callback,
+ base::MessageLoopProxy::current());
+ if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
+ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, closure);
+ } else {
+ closure.Run();
+ }
+}
+
+} // namespace content
« no previous file with comments | « chrome/test/base/ui_test_utils.cc ('k') | content/browser/geolocation/geolocation_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698