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

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: nits 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
« no previous file with comments | « ash/system/power/tablet_power_button_controller.cc ('k') | chromeos/dbus/fake_power_manager_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..ea5cb6b15f35fb398f9a042cacca37b39bb5fe14 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 stop forcing off backlights.
+ power_manager_client_->SetLidState(
+ chromeos::PowerManagerClient::LidState::OPEN, tick_clock_->NowTicks());
+ EXPECT_FALSE(GetBacklightsForcedOff());
+}
+
} // namespace test
} // namespace ash
« no previous file with comments | « ash/system/power/tablet_power_button_controller.cc ('k') | chromeos/dbus/fake_power_manager_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698