OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "device/generic_sensor/platform_sensor_provider_android.h" |
| 6 |
| 7 #include "base/macros.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 |
| 10 namespace device { |
| 11 |
| 12 class PlatformSensorProviderTestAndroid : public testing::Test { |
| 13 public: |
| 14 PlatformSensorProviderTestAndroid() = default; |
| 15 |
| 16 void SetUp() override { |
| 17 provider_ = PlatformSensorProviderAndroid::GetInstance(); |
| 18 ASSERT_TRUE(provider_); |
| 19 } |
| 20 |
| 21 void CreateSensorCallback(scoped_refptr<PlatformSensor> sensor) { |
| 22 EXPECT_FALSE(sensor); |
| 23 } |
| 24 |
| 25 protected: |
| 26 PlatformSensorProviderAndroid* provider_; |
| 27 |
| 28 private: |
| 29 DISALLOW_COPY_AND_ASSIGN(PlatformSensorProviderTestAndroid); |
| 30 }; |
| 31 |
| 32 TEST_F(PlatformSensorProviderTestAndroid, SensorManagerIsNull) { |
| 33 provider_->SetSensorManagerToNullForTesting(); |
| 34 provider_->CreateSensor( |
| 35 device::mojom::SensorType::AMBIENT_LIGHT, |
| 36 base::Bind(&PlatformSensorProviderTestAndroid::CreateSensorCallback, |
| 37 base::Unretained(this))); |
| 38 } |
| 39 |
| 40 } // namespace device |
OLD | NEW |