OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <SensorsApi.h> | 5 #include <SensorsApi.h> |
6 #include <Sensors.h> // NOLINT | 6 #include <Sensors.h> // NOLINT |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
479 | 479 |
480 auto client = base::MakeUnique<NiceMock<MockPlatformSensorClient>>(sensor); | 480 auto client = base::MakeUnique<NiceMock<MockPlatformSensorClient>>(sensor); |
481 PlatformSensorConfiguration configuration(10); | 481 PlatformSensorConfiguration configuration(10); |
482 EXPECT_TRUE(sensor->StartListening(client.get(), configuration)); | 482 EXPECT_TRUE(sensor->StartListening(client.get(), configuration)); |
483 EXPECT_CALL(*client, OnSensorError()).Times(0); | 483 EXPECT_CALL(*client, OnSensorError()).Times(0); |
484 | 484 |
485 GenerateStateChangeEvent(SENSOR_STATE_READY); | 485 GenerateStateChangeEvent(SENSOR_STATE_READY); |
486 base::RunLoop().RunUntilIdle(); | 486 base::RunLoop().RunUntilIdle(); |
487 } | 487 } |
488 | 488 |
489 // Tests that GetMaximumSupportedFrequency provides correct value. | |
490 TEST_F(PlatformSensorAndProviderTestWin, GetMaximumSupportedFrequency) { | |
491 SetSupportedReportingFrequency(20); | |
492 SetSupportedSensor(SENSOR_TYPE_AMBIENT_LIGHT); | |
493 auto sensor = CreateSensor(SensorType::AMBIENT_LIGHT); | |
494 EXPECT_TRUE(sensor); | |
495 EXPECT_THAT(sensor->GetMaximumSupportedFrequency(), 20); | |
496 } | |
497 | |
498 // Tests that GetMaximumSupportedFrequency is returns fallback value. | |
shalamov
2016/11/03 13:32:55
nit: is returns => returns
| |
499 TEST_F(PlatformSensorAndProviderTestWin, GetMaximumSupportedFrequencyFallback) { | |
500 SetSupportedReportingFrequency(0); | |
501 SetSupportedSensor(SENSOR_TYPE_AMBIENT_LIGHT); | |
502 auto sensor = CreateSensor(SensorType::AMBIENT_LIGHT); | |
503 EXPECT_TRUE(sensor); | |
504 EXPECT_THAT(sensor->GetMaximumSupportedFrequency(), 5); | |
505 } | |
506 | |
489 } // namespace device | 507 } // namespace device |
OLD | NEW |