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.
5 #ifndef CONTENT_BROWSER_GEOFENCING_MOCK_GEOFENCING_SERVICE_H_
6 #define CONTENT_BROWSER_GEOFENCING_MOCK_GEOFENCING_SERVICE_H_
10 #include "content/browser/geofencing/geofencing_service.h"
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.
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
{
23 MockGeofencingService(bool service_available
);
24 ~MockGeofencingService() override
;
26 void SetMockPosition(double latitude
, double longitude
);
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
;
38 std::map
<int64
, Registration
> registrations_
;
41 double last_latitude_
;
42 double last_longitude_
;
45 } // namespace content
47 #endif // CONTENT_BROWSER_GEOFENCING_MOCK_GEOFENCING_SERVICE_H_