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

Unified Diff: device/generic_sensor/mock_platform_sensor.h

Issue 2306333002: [sensors] Add Generic Sensor platform unit tests. (Closed)
Patch Set: Mikhail's comments Created 4 years, 3 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/generic_sensor/mock_platform_sensor.h
diff --git a/device/generic_sensor/mock_platform_sensor.h b/device/generic_sensor/mock_platform_sensor.h
new file mode 100644
index 0000000000000000000000000000000000000000..c3d9c7acdb0da2f691b9b8738ff5a330924f5940
--- /dev/null
+++ b/device/generic_sensor/mock_platform_sensor.h
@@ -0,0 +1,48 @@
+// 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_GENERIC_SENSOR_MOCK_PLATFORM_SENSOR_H_
+#define DEVICE_GENERIC_SENSOR_MOCK_PLATFORM_SENSOR_H_
+
+#include "device/generic_sensor/platform_sensor.h"
+
+namespace device {
+
+class MockPlatformSensor : public PlatformSensor {
timvolodine 2016/09/13 19:38:53 FakePlatformSensor?
maksims (do not use this acc) 2016/09/16 09:22:19 We better go with Mock names.
+ public:
+ MockPlatformSensor(mojom::SensorType type,
+ mojo::ScopedSharedBufferMapping mapping,
+ uint64_t buffer_size,
+ PlatformSensorProvider* provider);
+
+ mojom::ReportingMode GetReportingMode() override;
+ PlatformSensorConfiguration GetDefaultConfiguration() override;
+
+ bool started() { return started_; }
Mikhail 2016/09/13 10:31:16 nit: const method
maksims (do not use this acc) 2016/09/16 09:22:19 Done.
+
+ void NotifySensorReadingChanged();
+ void NotifySensorError();
+
+ const ConfigMap& config_map() const { return config_map_; }
+
+ protected:
+ ~MockPlatformSensor() override;
+ bool StartSensor(const PlatformSensorConfiguration& configuration) override;
+ void StopSensor() override;
+ bool CheckSensorConfiguration(
+ const PlatformSensorConfiguration& configuration) override;
+
+ private:
+ static constexpr double kMaxFrequencyValueForTests = 50.0;
+
+ PlatformSensorConfiguration config_;
+
+ bool started_;
+
+ DISALLOW_COPY_AND_ASSIGN(MockPlatformSensor);
+};
+
+} // namespace device
+
+#endif /* DEVICE_GENERIC_SENSOR_MOCK_PLATFORM_SENSOR_H_ */
timvolodine 2016/09/13 19:38:52 #endif // DEVICE_GENERIC_SENSOR_MOCK_PLATFORM_SEN
maksims (do not use this acc) 2016/09/16 09:22:19 Done.

Powered by Google App Engine
This is Rietveld 408576698