#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "services/device/public/cpp/test/fake_sensor_and_provider.h"
#include <memory>
#include <utility>
#include "base/notreached.h"
#include "base/time/time.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "services/device/public/cpp/generic_sensor/sensor_reading_shared_buffer.h"
#include "services/device/public/cpp/generic_sensor/sensor_traits.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
const uint64_t kReadingBufferSize = …;
const uint64_t kSharedBufferSizeInBytes = …;
}
namespace device {
FakeSensor::FakeSensor(mojom::SensorType sensor_type,
SensorReadingSharedBuffer* buffer)
: … { … }
FakeSensor::~FakeSensor() = default;
void FakeSensor::AddConfiguration(
const PlatformSensorConfiguration& configuration,
AddConfigurationCallback callback) { … }
void FakeSensor::GetDefaultConfiguration(
GetDefaultConfigurationCallback callback) { … }
void FakeSensor::RemoveConfiguration(
const PlatformSensorConfiguration& configuration) { … }
void FakeSensor::Suspend() { … }
void FakeSensor::Resume() { … }
void FakeSensor::ConfigureReadingChangeNotifications(bool enabled) { … }
PlatformSensorConfiguration FakeSensor::GetDefaultConfiguration() { … }
mojom::ReportingMode FakeSensor::GetReportingMode() { … }
double FakeSensor::GetMaximumSupportedFrequency() { … }
double FakeSensor::GetMinimumSupportedFrequency() { … }
mojo::PendingReceiver<mojom::SensorClient> FakeSensor::GetClient() { … }
uint64_t FakeSensor::GetBufferOffset() { … }
void FakeSensor::SetReading(SensorReading reading) { … }
void FakeSensor::SensorReadingChanged() { … }
FakeSensorProvider::FakeSensorProvider() = default;
FakeSensorProvider::~FakeSensorProvider() = default;
void FakeSensorProvider::GetSensor(mojom::SensorType type,
GetSensorCallback callback) { … }
void FakeSensorProvider::Bind(
mojo::PendingReceiver<mojom::SensorProvider> receiver) { … }
bool FakeSensorProvider::is_bound() const { … }
void FakeSensorProvider::SetAmbientLightSensorData(double value) { … }
void FakeSensorProvider::SetAccelerometerData(double x, double y, double z) { … }
void FakeSensorProvider::SetLinearAccelerationSensorData(double x,
double y,
double z) { … }
void FakeSensorProvider::SetGravitySensorData(double x, double y, double z) { … }
void FakeSensorProvider::SetGyroscopeData(double x, double y, double z) { … }
void FakeSensorProvider::SetRelativeOrientationSensorData(double alpha,
double beta,
double gamma) { … }
void FakeSensorProvider::SetAbsoluteOrientationSensorData(double alpha,
double beta,
double gamma) { … }
void FakeSensorProvider::UpdateAmbientLightSensorData(double value) { … }
void FakeSensorProvider::UpdateAccelerometerData(double x, double y, double z) { … }
void FakeSensorProvider::UpdateLinearAccelerationSensorData(double x,
double y,
double z) { … }
void FakeSensorProvider::UpdateGravitySensorData(double x, double y, double z) { … }
void FakeSensorProvider::UpdateGyroscopeData(double x, double y, double z) { … }
void FakeSensorProvider::UpdateRelativeOrientationSensorData(double alpha,
double beta,
double gamma) { … }
void FakeSensorProvider::UpdateAbsoluteOrientationSensorData(double alpha,
double beta,
double gamma) { … }
bool FakeSensorProvider::CreateSharedBufferIfNeeded() { … }
SensorReadingSharedBuffer*
FakeSensorProvider::GetSensorReadingSharedBufferForType(
mojom::SensorType type) { … }
}