Index: device/generic_sensor/mock_platform_sensor.cc |
diff --git a/device/generic_sensor/mock_platform_sensor.cc b/device/generic_sensor/mock_platform_sensor.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a2fa173564b49f85e507b1256709a22833df74a0 |
--- /dev/null |
+++ b/device/generic_sensor/mock_platform_sensor.cc |
@@ -0,0 +1,51 @@ |
+// 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. |
+ |
+#include "device/generic_sensor/mock_platform_sensor.h" |
+ |
+namespace device { |
+ |
+MockPlatformSensor::MockPlatformSensor(mojom::SensorType type, |
+ mojo::ScopedSharedBufferMapping mapping, |
+ uint64_t buffer_size, |
+ PlatformSensorProvider* provider) |
+ : PlatformSensor(type, std::move(mapping), provider), started_(false) {} |
+ |
+MockPlatformSensor::~MockPlatformSensor() = default; |
+ |
+mojom::ReportingMode MockPlatformSensor::GetReportingMode() { |
+ return mojom::ReportingMode::CONTINUOUS; |
+} |
+ |
+PlatformSensorConfiguration MockPlatformSensor::GetDefaultConfiguration() { |
+ return PlatformSensorConfiguration(); |
+} |
+ |
+bool MockPlatformSensor::StartSensor( |
+ const PlatformSensorConfiguration& configuration) { |
+ config_ = configuration; |
+ started_ = true; |
+ return started_; |
+} |
+ |
+void MockPlatformSensor::StopSensor() { |
+ started_ = false; |
+} |
+ |
+bool MockPlatformSensor::CheckSensorConfiguration( |
+ const PlatformSensorConfiguration& configuration) { |
+ if (configuration.frequency() > kMaxFrequencyValue) |
shalamov
2016/09/07 09:53:01
return configuration.frequency() <= kMaxFrequencyV
Mikhail
2016/09/07 10:46:19
return configuration.frequency() <= kMaxFrequencyV
maksims (do not use this acc)
2016/09/09 10:39:05
Done.
maksims (do not use this acc)
2016/09/09 10:39:05
Done.
|
+ return false; |
+ return true; |
+} |
+ |
+void MockPlatformSensor::NotifySensorReadingChanged() { |
Mikhail
2016/09/07 10:46:19
why override this method?
maksims (do not use this acc)
2016/09/09 10:39:05
I cannot access them outside this code. Those meth
|
+ PlatformSensor::NotifySensorReadingChanged(); |
+} |
+ |
+void MockPlatformSensor::NotifySensorError() { |
Mikhail
2016/09/07 10:46:19
ditto.
|
+ PlatformSensor::NotifySensorError(); |
+} |
+ |
+} // namespace device |