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 |