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

Unified Diff: ash/wm/power_button_controller_unittest.cc

Issue 10382211: chromeos: Ignore power button presses when screen is off. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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/wm/power_button_controller.cc ('k') | chrome/browser/chromeos/power/brightness_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/power_button_controller_unittest.cc
diff --git a/ash/wm/power_button_controller_unittest.cc b/ash/wm/power_button_controller_unittest.cc
index 81a583068ed20428f71b7850b02f8e5f8a7f4899..3a326fafe490156e1988c71ff9af097bb24756de 100644
--- a/ash/wm/power_button_controller_unittest.cc
+++ b/ash/wm/power_button_controller_unittest.cc
@@ -539,5 +539,22 @@ TEST_F(PowerButtonControllerTest, ResizeBackgroundLayer) {
test_api_->GetBackgroundLayerBounds().ToString());
}
+// Test that we ignore power button presses when the screen is turned off.
+TEST_F(PowerButtonControllerTest, IgnorePowerButtonIfScreenIsOff) {
+ controller_->OnLoginStateChanged(user::LOGGED_IN_USER);
+
+ // When the screen brightness is at 0%, we shouldn't do anything in response
+ // to power button presses.
+ controller_->OnScreenBrightnessChanged(0.0);
+ controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
+ EXPECT_FALSE(test_api_->lock_timer_is_running());
+
+ // After increasing the brightness to 10%, we should start the timer like
+ // usual.
+ controller_->OnScreenBrightnessChanged(10.0);
+ controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
+ EXPECT_TRUE(test_api_->lock_timer_is_running());
+}
+
} // namespace test
} // namespace ash
« no previous file with comments | « ash/wm/power_button_controller.cc ('k') | chrome/browser/chromeos/power/brightness_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698