Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: device/generic_sensor/platform_sensor_and_provider_unittest_win.cc

Issue 2465363004: [Sensors] Consider maximum supported frequency (Closed)
Patch Set: Comment from Tim Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 returns fallback value.
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
OLDNEW
« no previous file with comments | « device/generic_sensor/platform_sensor.cc ('k') | device/generic_sensor/platform_sensor_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698