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

Side by Side Diff: content/browser/geofencing/mock_geofencing_service.h

Issue 701953007: Expose mock geofencing service via testRunner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mention unifying bug in a comment Created 6 years 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 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 CONTENT_BROWSER_GEOFENCING_MOCK_GEOFENCING_SERVICE_H_
6 #define CONTENT_BROWSER_GEOFENCING_MOCK_GEOFENCING_SERVICE_H_
7
8 #include <map>
9
10 #include "content/browser/geofencing/geofencing_service.h"
11
12 namespace content {
13
14 // This class implements a geofencing service that doesn't rely on any
15 // underlying platform implementation. Instead whenever SetMockPosition is
16 // called this class will compare the provided position with all currently
17 // registered regions, and emit corresponding geofencing events.
18 //
19 // If an instance is created with |service_available| set to false, the mock
20 // will behave as if the platform does not support geofencing.
21 class MockGeofencingService : public GeofencingService {
22 public:
23 MockGeofencingService(bool service_available);
24 ~MockGeofencingService() override;
25
26 void SetMockPosition(double latitude, double longitude);
27
28 // GeofencingService implementation.
29 bool IsServiceAvailable() override;
30 int64 RegisterRegion(const blink::WebCircularGeofencingRegion& region,
31 GeofencingRegistrationDelegate* delegate) override;
32 void UnregisterRegion(int64 geofencing_registration_id) override;
33
34 private:
35 struct Registration;
36
37 bool available_;
38 std::map<int64, Registration> registrations_;
39 int64 next_id_;
40 bool has_position_;
41 double last_latitude_;
42 double last_longitude_;
43 };
44
45 } // namespace content
46
47 #endif // CONTENT_BROWSER_GEOFENCING_MOCK_GEOFENCING_SERVICE_H_
OLDNEW
« no previous file with comments | « content/browser/geofencing/geofencing_service.h ('k') | content/browser/geofencing/mock_geofencing_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698