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

Unified Diff: ash/system/power/tablet_power_button_controller_unittest.cc

Issue 2815453007: cros: Stop forcing off display when lid events are received (Closed)
Patch Set: feedback Created 3 years, 8 months 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 side-by-side diff with in-line comments
Download patch
Index: ash/system/power/tablet_power_button_controller_unittest.cc
diff --git a/ash/system/power/tablet_power_button_controller_unittest.cc b/ash/system/power/tablet_power_button_controller_unittest.cc
index 2805f9ff2ab5edde52f1ef9c46a89045e4b1b88b..9da173311074cea2b6b21d4377239981e75478be 100644
--- a/ash/system/power/tablet_power_button_controller_unittest.cc
+++ b/ash/system/power/tablet_power_button_controller_unittest.cc
@@ -484,5 +484,30 @@ TEST_F(TabletPowerButtonControllerTest, IgnoreRepeatedPowerButtonReleases) {
EXPECT_TRUE(GetBacklightsForcedOff());
}
+// Tests that lid closed/open events stop forcing off backlights.
+TEST_F(TabletPowerButtonControllerTest, LidEventsStopForcingOff) {
+ // Pressing/releasing power button to set backlights forced off.
+ PressPowerButton();
+ ReleasePowerButton();
+ ASSERT_TRUE(GetBacklightsForcedOff());
+
+ // A lid closed event is received, we should stop forcing off backlights.
+ power_manager_client_->SetLidState(
+ chromeos::PowerManagerClient::LidState::CLOSED, tick_clock_->NowTicks());
+ EXPECT_FALSE(GetBacklightsForcedOff());
+
+ // Pressing/releasing power button again to set backlights forced off. This is
+ // for testing purpose. In real life, powerd would not repond to this event
+ // with lid closed state.
+ PressPowerButton();
+ ReleasePowerButton();
+ ASSERT_TRUE(GetBacklightsForcedOff());
+
+ // A lid open event is received, we should get stopped forcing off backlights.
Daniel Erat 2017/04/13 05:10:03 nit: s/get stopped/stop/
Qiang(Joe) Xu 2017/04/13 17:08:47 Done.
+ power_manager_client_->SetLidState(
+ chromeos::PowerManagerClient::LidState::OPEN, tick_clock_->NowTicks());
+ EXPECT_FALSE(GetBacklightsForcedOff());
+}
+
} // namespace test
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698