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

Unified Diff: device/geolocation/fake_location_provider.h

Issue 2161223003: Adds GeolocationFeature for Blimp Geolocation project. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@engine_feature_prep
Patch Set: Addresses kmarshall's #82 comments. Created 4 years, 4 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: device/geolocation/fake_location_provider.h
diff --git a/device/geolocation/fake_location_provider.h b/device/geolocation/fake_location_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..27a4fef78add6e92f7f1ee77c860c54167181eec
--- /dev/null
+++ b/device/geolocation/fake_location_provider.h
@@ -0,0 +1,50 @@
+// 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.
+
+#ifndef DEVICE_GEOLOCATION_FAKE_LOCATION_PROVIDER_H_
+#define DEVICE_GEOLOCATION_FAKE_LOCATION_PROVIDER_H_
+
+#include "base/compiler_specific.h"
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/single_thread_task_runner.h"
+#include "base/threading/thread.h"
+#include "device/geolocation/geoposition.h"
+#include "device/geolocation/location_provider_base.h"
+
+namespace device {
+
+// Fake implementation of a location provider for testing.
+class FakeLocationProvider : public LocationProviderBase {
+ public:
+ enum State { STOPPED, LOW_ACCURACY, HIGH_ACCURACY } state_ = STOPPED;
+
+ FakeLocationProvider();
+ ~FakeLocationProvider() override;
+
+ // Updates listeners with the new position.
+ void HandlePositionChanged(const Geoposition& position);
+
+ bool get_state() const { return state_; }
Wez 2016/08/20 01:42:11 |state_| isn't a bool; do you mean: State get_sta
CJ 2016/08/22 17:56:39 State state(). Done.
+ bool get_is_permission_granted() const { return is_permission_granted_; }
Wez 2016/08/20 01:42:11 Simple getters and setters are named along the lin
CJ 2016/08/22 17:56:39 Done.
+ const Geoposition& get_position() const { return position_; }
Wez 2016/08/20 01:42:11 Isn't this exactly what GetPosition does?
CJ 2016/08/22 17:56:39 Good point.
+
+ // LocationProvider implementation.
+ bool StartProvider(bool high_accuracy) override;
+ void StopProvider() override;
+ const Geoposition& GetPosition() override;
+ void OnPermissionGranted() override;
+
+ scoped_refptr<base::SingleThreadTaskRunner> provider_task_runner_;
+
+ private:
+ bool is_permission_granted_ = false;
+ Geoposition position_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeLocationProvider);
+};
+
+} // namespace device
+
+#endif // DEVICE_GEOLOCATION_FAKE_LOCATION_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698