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

Unified Diff: device/geolocation/mock_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 nyquist's #79 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/mock_location_provider.h
diff --git a/device/geolocation/mock_location_provider.h b/device/geolocation/mock_location_provider.h
index d78b4ae2c1e83064125626f85a854375e190b955..65b0f291a5358a396d56938ba5074da7e28987dc 100644
--- a/device/geolocation/mock_location_provider.h
+++ b/device/geolocation/mock_location_provider.h
@@ -1,65 +1,33 @@
-// 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 IsProviderStarted() const;
-
- // 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;
-
- bool is_permission_granted_;
- Geoposition position_;
- scoped_refptr<base::SingleThreadTaskRunner> provider_task_runner_;
+ 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(RequestRefresh, void());
Wez 2016/08/19 18:50:26 Didn't we remove RequestRefresh from the LocationP
CJ 2016/08/19 22:22:34 I think this is more of me learning how to merge r
Wez 2016/08/20 01:42:11 Acknowledged.
+ MOCK_METHOD0(OnPermissionGranted, void());
private:
DISALLOW_COPY_AND_ASSIGN(MockLocationProvider);
};
-// Factory functions for the various sorts of mock location providers,
-// for use with LocationArbitrator::SetProviderFactoryForTest (i.e.
-// not intended for test code to use to get access to the mock, you can use
-// MockLocationProvider::instance_ for this, or make a custom factory method).
-
-// Creates a mock location provider with no default behavior.
-LocationProvider* NewMockLocationProvider();
-// Creates a mock location provider that automatically notifies its
-// listeners with a valid location when StartProvider is called.
-LocationProvider* NewAutoSuccessMockLocationProvider();
-// Creates a mock location provider that automatically notifies its
-// listeners with an error when StartProvider is called.
-LocationProvider* NewAutoFailMockLocationProvider();
-// Similar to NewAutoSuccessMockLocationProvider but mimicks the behavior of
-// the Network Location provider, in deferring making location updates until
-// a permission request has been confirmed.
-LocationProvider* NewAutoSuccessMockNetworkLocationProvider();
-
} // namespace device
#endif // DEVICE_GEOLOCATION_MOCK_LOCATION_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698