blob: ca6c5c49a35451a4655da332e5cfb3a0717125ec [file] [log] [blame]
// chromeos/components/sensors/mojom/sensor.mojom-test-utils.h is auto generated by mojom_bindings_generator.py, do not edit
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMEOS_COMPONENTS_SENSORS_MOJOM_SENSOR_MOJOM_TEST_UTILS_H_
#define CHROMEOS_COMPONENTS_SENSORS_MOJOM_SENSOR_MOJOM_TEST_UTILS_H_
#include "chromeos/components/sensors/mojom/sensor.mojom.h"
namespace chromeos::sensors::mojom {
class SensorServiceInterceptorForTesting : public SensorService {
virtual SensorService* GetForwardingInterface() = 0;
void GetDeviceIds(DeviceType type, GetDeviceIdsCallback callback) override;
void GetAllDeviceIds(GetAllDeviceIdsCallback callback) override;
void GetDevice(int32_t iio_device_id, ::mojo::PendingReceiver<SensorDevice> device_request) override;
void RegisterNewDevicesObserver(::mojo::PendingRemote<SensorServiceNewDevicesObserver> observer) override;
};
class SensorServiceAsyncWaiter {
public:
explicit SensorServiceAsyncWaiter(SensorService* proxy);
SensorServiceAsyncWaiter(const SensorServiceAsyncWaiter&) = delete;
SensorServiceAsyncWaiter& operator=(const SensorServiceAsyncWaiter&) = delete;
~SensorServiceAsyncWaiter();
void GetDeviceIds(
DeviceType type, std::vector<int32_t>* out_iio_device_ids);
std::vector<int32_t> GetDeviceIds(DeviceType type);
void GetAllDeviceIds(
base::flat_map<int32_t, std::vector<DeviceType>>* out_iio_device_ids_types);
base::flat_map<int32_t, std::vector<DeviceType>> GetAllDeviceIds();
private:
SensorService* const proxy_;
};
class SensorDeviceInterceptorForTesting : public SensorDevice {
virtual SensorDevice* GetForwardingInterface() = 0;
void SetTimeout(uint32_t timeout) override;
void GetAttributes(const std::vector<std::string>& attr_names, GetAttributesCallback callback) override;
void SetFrequency(double frequency, SetFrequencyCallback callback) override;
void StartReadingSamples(::mojo::PendingRemote<SensorDeviceSamplesObserver> observer) override;
void StopReadingSamples() override;
void GetAllChannelIds(GetAllChannelIdsCallback callback) override;
void SetChannelsEnabled(const std::vector<int32_t>& iio_chn_indices, bool en, SetChannelsEnabledCallback callback) override;
void GetChannelsEnabled(const std::vector<int32_t>& iio_chn_indices, GetChannelsEnabledCallback callback) override;
void GetChannelsAttributes(const std::vector<int32_t>& iio_chn_indices, const std::string& attr_name, GetChannelsAttributesCallback callback) override;
};
class SensorDeviceAsyncWaiter {
public:
explicit SensorDeviceAsyncWaiter(SensorDevice* proxy);
SensorDeviceAsyncWaiter(const SensorDeviceAsyncWaiter&) = delete;
SensorDeviceAsyncWaiter& operator=(const SensorDeviceAsyncWaiter&) = delete;
~SensorDeviceAsyncWaiter();
void GetAttributes(
const std::vector<std::string>& attr_names, std::vector<std::optional<std::string>>* out_values);
std::vector<std::optional<std::string>> GetAttributes(const std::vector<std::string>& attr_names);
void SetFrequency(
double frequency, double* out_result_freq);
double SetFrequency(double frequency);
void GetAllChannelIds(
std::vector<std::string>* out_iio_chn_ids);
std::vector<std::string> GetAllChannelIds();
void SetChannelsEnabled(
const std::vector<int32_t>& iio_chn_indices, bool en, std::vector<int32_t>* out_failed_indices);
std::vector<int32_t> SetChannelsEnabled(const std::vector<int32_t>& iio_chn_indices, bool en);
void GetChannelsEnabled(
const std::vector<int32_t>& iio_chn_indices, std::vector<bool>* out_enabled);
std::vector<bool> GetChannelsEnabled(const std::vector<int32_t>& iio_chn_indices);
void GetChannelsAttributes(
const std::vector<int32_t>& iio_chn_indices, const std::string& attr_name, std::vector<std::optional<std::string>>* out_values);
std::vector<std::optional<std::string>> GetChannelsAttributes(const std::vector<int32_t>& iio_chn_indices, const std::string& attr_name);
private:
SensorDevice* const proxy_;
};
class SensorDeviceSamplesObserverInterceptorForTesting : public SensorDeviceSamplesObserver {
virtual SensorDeviceSamplesObserver* GetForwardingInterface() = 0;
void OnSampleUpdated(const base::flat_map<int32_t, int64_t>& sample) override;
void OnErrorOccurred(ObserverErrorType type) override;
};
class SensorDeviceSamplesObserverAsyncWaiter {
public:
explicit SensorDeviceSamplesObserverAsyncWaiter(SensorDeviceSamplesObserver* proxy);
SensorDeviceSamplesObserverAsyncWaiter(const SensorDeviceSamplesObserverAsyncWaiter&) = delete;
SensorDeviceSamplesObserverAsyncWaiter& operator=(const SensorDeviceSamplesObserverAsyncWaiter&) = delete;
~SensorDeviceSamplesObserverAsyncWaiter();
private:
SensorDeviceSamplesObserver* const proxy_;
};
class SensorServiceNewDevicesObserverInterceptorForTesting : public SensorServiceNewDevicesObserver {
virtual SensorServiceNewDevicesObserver* GetForwardingInterface() = 0;
void OnNewDeviceAdded(int32_t iio_device_id, const std::vector<DeviceType>& types) override;
};
class SensorServiceNewDevicesObserverAsyncWaiter {
public:
explicit SensorServiceNewDevicesObserverAsyncWaiter(SensorServiceNewDevicesObserver* proxy);
SensorServiceNewDevicesObserverAsyncWaiter(const SensorServiceNewDevicesObserverAsyncWaiter&) = delete;
SensorServiceNewDevicesObserverAsyncWaiter& operator=(const SensorServiceNewDevicesObserverAsyncWaiter&) = delete;
~SensorServiceNewDevicesObserverAsyncWaiter();
private:
SensorServiceNewDevicesObserver* const proxy_;
};
} // chromeos::sensors::mojom
#endif // CHROMEOS_COMPONENTS_SENSORS_MOJOM_SENSOR_MOJOM_TEST_UTILS_H_