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

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

Issue 2855033004: cros: Update touchscreen status with backlights forced off state during start (Closed)
Patch Set: comments and test coverage 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') | ash/wm/power_button_controller.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 df64ebabf3993c2405a5c162978eb3e0ed4da327..6750c797bb4a28f9514917e1fc8f884089ae864a 100644
--- a/ash/system/power/tablet_power_button_controller_unittest.cc
+++ b/ash/system/power/tablet_power_button_controller_unittest.cc
@@ -507,5 +507,27 @@ TEST_F(TabletPowerButtonControllerTest, LidEventsStopForcingOff) {
EXPECT_FALSE(GetBacklightsForcedOff());
}
+// Tests that with system reboot, the local state of touchscreen enabled state
+// should be synced with new backlights forced off state from powerd.
+TEST_F(TabletPowerButtonControllerTest, SyncTouchscreenStatus) {
+ // Pressing/releasing power button to set backlights forced off.
+ PressPowerButton();
+ ReleasePowerButton();
+ ASSERT_TRUE(GetBacklightsForcedOff());
+ ASSERT_FALSE(shell_delegate_->IsTouchscreenEnabledInPrefs(true));
Daniel Erat 2017/05/03 03:28:39 i'm worried that this isn't testing the real case.
Qiang(Joe) Xu 2017/05/03 03:53:27 makes sense. Updated.
+
+ // Simulate system reboot by resetting backlights forced off state in powerd
+ // and TabletPowerButtonController.
+ power_manager_client_->SetBacklightsForcedOff(false);
+ Shell::Get()
+ ->power_button_controller()
+ ->ResetTabletPowerButtonControllerForTest();
+
+ // Check the local state of touchscreen enabled state is in line with
+ // backlights forced off state.
+ EXPECT_FALSE(GetBacklightsForcedOff());
+ EXPECT_TRUE(shell_delegate_->IsTouchscreenEnabledInPrefs(true));
+}
+
} // namespace test
} // namespace ash
« no previous file with comments | « ash/system/power/tablet_power_button_controller.cc ('k') | ash/wm/power_button_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698