chromium/services/device/generic_sensor/platform_sensor_and_provider_unittest.cc

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <memory>
#include "services/device/generic_sensor/platform_sensor_provider.h"

#include "base/functional/bind.h"
#include "base/memory/read_only_shared_memory_region.h"
#include "base/memory/shared_memory_mapping.h"
#include "base/test/task_environment.h"
#include "base/test/test_future.h"
#include "services/device/generic_sensor/fake_platform_sensor_and_provider.h"
#include "services/device/generic_sensor/generic_sensor_consts.h"
#include "services/device/generic_sensor/platform_sensor_util.h"
#include "services/device/public/cpp/generic_sensor/platform_sensor_configuration.h"
#include "services/device/public/cpp/generic_sensor/sensor_reading.h"
#include "services/device/public/cpp/generic_sensor/sensor_reading_shared_buffer.h"
#include "testing/gtest/include/gtest/gtest.h"

TestFuture;
_;
Invoke;
NiceMock;
Return;

namespace device {

SensorType;

namespace {

// Attempts to add a new reading to the sensor owned by |sensor_client|, and
// asserts that it does not lead to OnSensorReadingChanged() being called (i.e.
// PlatformSensor's significance check has failed).
void AddNewReadingAndExpectNoReadingChangedEvent(
    MockPlatformSensorClient* sensor_client,
    const SensorReading& new_reading) {}

// Add a new reading to the sensor owned by |sensor_client|, and expect reading
// change event.
void AddNewReadingAndExpectReadingChangedEvent(
    MockPlatformSensorClient* sensor_client,
    const SensorReading& new_reading) {}

}  // namespace

class PlatformSensorAndProviderTest : public testing::Test {};

TEST_F(PlatformSensorAndProviderTest, ResourcesAreFreed) {}

TEST_F(PlatformSensorAndProviderTest, ResourcesAreNotFreedOnPendingRequest) {}

// This test verifies that the shared buffer's default values are 0.
TEST_F(PlatformSensorAndProviderTest, SharedBufferDefaultValue) {}

// This test verifies that when sensor is stopped, shared buffer contents are
// filled with default values.
TEST_F(PlatformSensorAndProviderTest, SharedBufferCleared) {}

// Rounding to nearest 50 (see kAlsRoundingMultiple). 25 (see
// kAlsSignificanceThreshold) difference in values reported in significance
// test, if rounded values differs from previous rounded value.
TEST_F(PlatformSensorAndProviderTest, SensorValueValidityCheckAmbientLight) {}

TEST_F(PlatformSensorAndProviderTest, ResetLastReadingsOnStop) {}

TEST_F(PlatformSensorAndProviderTest, DoNotStoreReadingsWhenInactive) {}

// No rounding of values. Any change in values reported in significance test.
TEST_F(PlatformSensorAndProviderTest, SensorValueValidityCheckPressure) {}

// Rounding to nearest 0.1 (see kAccelerometerRoundingMultiple). New reading
// event is triggered if rounded values differs from previous rounded value.
TEST_F(PlatformSensorAndProviderTest, SensorValueValidityCheckAccelerometer) {}

TEST_F(PlatformSensorAndProviderTest, IsSignificantlyDifferentAmbientLight) {}

TEST_F(PlatformSensorAndProviderTest, IsSignificantlyDifferentPressure) {}

TEST_F(PlatformSensorAndProviderTest, IsSignificantlyDifferentMagnetometer) {}

}  // namespace device