blob: e742a9019b423d0a26ab1de9c5100f240e40c824 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// Copyright 2017 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 "services/device/generic_sensor/platform_sensor_provider_android.h"
#include <memory>
#include "base/bind.h"
#include "base/test/task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace device {
class PlatformSensorProviderTestAndroid : public testing::Test {
public:
PlatformSensorProviderTestAndroid() = default;
PlatformSensorProviderTestAndroid(PlatformSensorProviderTestAndroid&) =
delete;
PlatformSensorProviderTestAndroid& operator=(
PlatformSensorProviderTestAndroid&) = delete;
void SetUp() override {
provider_ = std::make_unique<PlatformSensorProviderAndroid>();
}
void CreateSensorCallback(scoped_refptr<PlatformSensor> sensor) {
EXPECT_FALSE(sensor);
}
protected:
std::unique_ptr<PlatformSensorProviderAndroid> provider_;
private:
base::test::TaskEnvironment task_environment;
};
TEST_F(PlatformSensorProviderTestAndroid, SensorManagerIsNull) {
provider_->SetSensorManagerToNullForTesting();
provider_->CreateSensor(
device::mojom::SensorType::AMBIENT_LIGHT,
base::BindOnce(&PlatformSensorProviderTestAndroid::CreateSensorCallback,
base::Unretained(this)));
}
} // namespace device
|