Index: device/geolocation/mock_location_provider.h |
diff --git a/device/geolocation/mock_location_provider.h b/device/geolocation/mock_location_provider.h |
index b83ed8a407c4645b0ab79dd965ec6e3ff00706a9..f130a335d099b05c385b9778b1fdd64e93555bbf 100644 |
--- a/device/geolocation/mock_location_provider.h |
+++ b/device/geolocation/mock_location_provider.h |
@@ -1,46 +1,29 @@ |
-// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Copyright 2016 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_MOCK_LOCATION_PROVIDER_H_ |
#define DEVICE_GEOLOCATION_MOCK_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" |
+#include "device/geolocation/location_provider.h" |
+#include "testing/gmock/include/gmock/gmock.h" |
namespace device { |
-// Mock implementation of a location provider for testing. |
-class MockLocationProvider : public LocationProviderBase { |
+class MockLocationProvider : public device::LocationProvider { |
public: |
- enum State { STOPPED, LOW_ACCURACY, HIGH_ACCURACY } state_; |
- |
MockLocationProvider(); |
~MockLocationProvider() override; |
- bool is_started() const { return state_ != STOPPED; } |
- bool is_permission_granted() const { return is_permission_granted_; } |
- const Geoposition& position() const { return position_; } |
- |
- // Updates listeners with the new position. |
- void HandlePositionChanged(const Geoposition& position); |
- |
- // LocationProvider implementation. |
- bool StartProvider(bool high_accuracy) override; |
- void StopProvider() override; |
- const Geoposition& GetPosition() override; |
- void OnPermissionGranted() override; |
+ MOCK_METHOD1(SetUpdateCallback, |
+ void(const LocationProviderUpdateCallback& callback)); |
+ MOCK_METHOD1(StartProvider, bool(bool high_accuracy)); |
+ MOCK_METHOD0(StopProvider, void()); |
+ MOCK_METHOD0(GetPosition, const device::Geoposition&()); |
+ MOCK_METHOD0(OnPermissionGranted, void()); |
private: |
- bool is_permission_granted_; |
- Geoposition position_; |
- scoped_refptr<base::SingleThreadTaskRunner> provider_task_runner_; |
- |
DISALLOW_COPY_AND_ASSIGN(MockLocationProvider); |
}; |