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

Unified Diff: device/generic_sensor/mock_platform_sensor.h

Issue 2306333002: [sensors] Add Generic Sensor platform unit tests. (Closed)
Patch Set: Generic Sensor Unittest 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..1ebce01b67c6bbd7c673ad4c2639a001a203621e
--- /dev/null
+++ b/device/generic_sensor/mock_platform_sensor.h
@@ -0,0 +1,50 @@
+// 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"
+
+#include "base/memory/singleton.h"
shalamov 2016/09/07 09:53:01 Is this needed?
maksims (do not use this acc) 2016/09/09 10:39:05 Put it in wrong header.
+
+namespace device {
+
+class MockPlatformSensor : public PlatformSensor {
+ public:
+ MockPlatformSensor(mojom::SensorType type,
+ mojo::ScopedSharedBufferMapping mapping,
+ uint64_t buffer_size,
+ PlatformSensorProvider* provider);
+
+ mojom::ReportingMode GetReportingMode() override;
+ PlatformSensorConfiguration GetDefaultConfiguration() override;
+
+ bool IsStarted() { return started_; }
Mikhail 2016/09/07 10:46:19 bool started() const {}
maksims (do not use this acc) 2016/09/09 10:39:05 Done.
+
+ void NotifySensorReadingChanged();
+ void NotifySensorError();
+
+ const ConfigMap& GetConfigMap() { return config_map_; }
Mikhail 2016/09/07 10:46:19 const ConfigMap& config_map() const {}
maksims (do not use this acc) 2016/09/09 10:39:06 Done.
+
+ protected:
+ ~MockPlatformSensor() override;
+ bool StartSensor(const PlatformSensorConfiguration& configuration) override;
+ void StopSensor() override;
+ bool CheckSensorConfiguration(
+ const PlatformSensorConfiguration& configuration) override;
+
+ private:
+ static constexpr double kMaxFrequencyValue = 50.0;
Mikhail 2016/09/07 10:46:19 why not use PlatformSensorConfiguration::kMaxAllow
maksims (do not use this acc) 2016/09/09 10:39:05 I though a bit different way. PlatformSensorConfig
+
+ PlatformSensorConfiguration config_;
+
+ bool started_;
+
+ DISALLOW_COPY_AND_ASSIGN(MockPlatformSensor);
+};
+
+} // namespace device
+
+#endif /* DEVICE_GENERIC_SENSOR_MOCK_PLATFORM_SENSOR_H_ */

Powered by Google App Engine
This is Rietveld 408576698