OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef DEVICE_GEOLOCATION_FAKE_LOCATION_PROVIDER_H_ | |
6 #define DEVICE_GEOLOCATION_FAKE_LOCATION_PROVIDER_H_ | |
7 | |
8 #include "base/compiler_specific.h" | |
9 #include "base/macros.h" | |
10 #include "base/memory/ref_counted.h" | |
11 #include "base/single_thread_task_runner.h" | |
12 #include "base/threading/thread.h" | |
13 #include "device/geolocation/geoposition.h" | |
14 #include "device/geolocation/location_provider_base.h" | |
15 | |
16 namespace device { | |
17 | |
18 // Fake implementation of a location provider for testing. | |
19 class FakeLocationProvider : public LocationProviderBase { | |
20 public: | |
21 enum State { STOPPED, LOW_ACCURACY, HIGH_ACCURACY } state_ = STOPPED; | |
22 | |
23 FakeLocationProvider(); | |
24 ~FakeLocationProvider() override; | |
25 | |
26 // Updates listeners with the new position. | |
27 void HandlePositionChanged(const Geoposition& position); | |
28 | |
29 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.
| |
30 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.
| |
31 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.
| |
32 | |
33 // LocationProvider implementation. | |
34 bool StartProvider(bool high_accuracy) override; | |
35 void StopProvider() override; | |
36 const Geoposition& GetPosition() override; | |
37 void OnPermissionGranted() override; | |
38 | |
39 scoped_refptr<base::SingleThreadTaskRunner> provider_task_runner_; | |
40 | |
41 private: | |
42 bool is_permission_granted_ = false; | |
43 Geoposition position_; | |
44 | |
45 DISALLOW_COPY_AND_ASSIGN(FakeLocationProvider); | |
46 }; | |
47 | |
48 } // namespace device | |
49 | |
50 #endif // DEVICE_GEOLOCATION_FAKE_LOCATION_PROVIDER_H_ | |
OLD | NEW |