Chromium Code Reviews| 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 "ash/system/power/tablet_power_button_controller.h" | 5 #include "ash/system/power/tablet_power_button_controller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/public/cpp/config.h" | 10 #include "ash/public/cpp/config.h" |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 477 EXPECT_FALSE(GetBacklightsForcedOff()); | 477 EXPECT_FALSE(GetBacklightsForcedOff()); |
| 478 | 478 |
| 479 // Test that after another long duration, backlights should be forced off. | 479 // Test that after another long duration, backlights should be forced off. |
| 480 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(800)); | 480 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(800)); |
| 481 power_manager_client_->SendPowerButtonEvent(true, tick_clock_->NowTicks()); | 481 power_manager_client_->SendPowerButtonEvent(true, tick_clock_->NowTicks()); |
| 482 power_manager_client_->SendPowerButtonEvent(false, tick_clock_->NowTicks()); | 482 power_manager_client_->SendPowerButtonEvent(false, tick_clock_->NowTicks()); |
| 483 power_manager_client_->SendBrightnessChanged(0, false); | 483 power_manager_client_->SendBrightnessChanged(0, false); |
| 484 EXPECT_TRUE(GetBacklightsForcedOff()); | 484 EXPECT_TRUE(GetBacklightsForcedOff()); |
| 485 } | 485 } |
| 486 | 486 |
| 487 // Tests that lid closed/open events can properly stop forcing off backlights. | |
|
Daniel Erat
2017/04/13 04:31:16
nit: remove "can properly"
Qiang(Joe) Xu
2017/04/13 04:49:40
Done.
| |
| 488 TEST_F(TabletPowerButtonControllerTest, LidEventsStopForcingOff) { | |
| 489 // Pressing/releasing power button to set backlights forced off. | |
| 490 PressPowerButton(); | |
| 491 ReleasePowerButton(); | |
| 492 EXPECT_TRUE(GetBacklightsForcedOff()); | |
|
Daniel Erat
2017/04/13 04:31:16
nit: ASSERT_TRUE since this isn't the thing that t
Qiang(Joe) Xu
2017/04/13 04:49:40
Done.
| |
| 493 | |
| 494 // A lid closed event is received, we should stop forcing off backlights. | |
| 495 power_manager_client_->SendLidEvent( | |
| 496 chromeos::PowerManagerClient::LidState::CLOSED, tick_clock_->NowTicks()); | |
| 497 EXPECT_FALSE(GetBacklightsForcedOff()); | |
| 498 | |
| 499 // A lid open event is received, we should still get stopped forcing off | |
| 500 // backlights. | |
|
Qiang(Joe) Xu
2017/04/13 04:14:18
For testing lid open event, generally speaking if
Daniel Erat
2017/04/13 04:31:16
hmm. can you just press and release the power butt
Qiang(Joe) Xu
2017/04/13 04:49:40
Done.
| |
| 501 power_manager_client_->SendLidEvent( | |
| 502 chromeos::PowerManagerClient::LidState::OPEN, tick_clock_->NowTicks()); | |
| 503 EXPECT_FALSE(GetBacklightsForcedOff()); | |
| 504 } | |
| 505 | |
| 487 } // namespace test | 506 } // namespace test |
| 488 } // namespace ash | 507 } // namespace ash |
| OLD | NEW |