chromeos: Make touchscreen global state default to enabled.
Update ash::TouchDevicesController's
global_touchscreen_enabled_ member to default to true rather
than false. In practice, it's usually initialized just after
startup based on powerd's initial backlights-forced-off
state, but it feels safer to leave the touchscreen enabled
by default if initialization fails for some reason.
Bug: 778156
Change-Id: I8518783b2d2366ca3a48d42023d862bb0e073530
Reviewed-on: https://chromium-review.googlesource.com/739959
Reviewed-by: Qiang(Joe) Xu <[email protected]>
Commit-Queue: Dan Erat <[email protected]>
Cr-Commit-Position: refs/heads/master@{#511921}
diff --git a/ash/touch/touch_devices_controller_unittest.cc b/ash/touch/touch_devices_controller_unittest.cc
index 75851df..9ab02fe6 100644
--- a/ash/touch/touch_devices_controller_unittest.cc
+++ b/ash/touch/touch_devices_controller_unittest.cc
@@ -91,22 +91,30 @@
// Tests that touchscreen enabled user pref works properly under debug
// accelerator.
TEST_F(TouchDevicesControllerTest, SetTouchscreenEnabled) {
- const bool kInitialGlobalTouchscreenEnabled = GetGlobalTouchscreenEnabled();
+ ASSERT_TRUE(GetGlobalTouchscreenEnabled());
ASSERT_TRUE(GetUserPrefTouchscreenEnabled());
+
debug::PerformDebugActionIfEnabled(DEBUG_TOGGLE_TOUCH_SCREEN);
+ EXPECT_TRUE(GetGlobalTouchscreenEnabled());
EXPECT_FALSE(GetUserPrefTouchscreenEnabled());
- EXPECT_EQ(kInitialGlobalTouchscreenEnabled, GetGlobalTouchscreenEnabled());
// Switch to user 2 and switch back.
SwitchActiveUser(kUser2Email);
EXPECT_TRUE(GetUserPrefTouchscreenEnabled());
SwitchActiveUser(kUser1Email);
+ EXPECT_TRUE(GetGlobalTouchscreenEnabled());
EXPECT_FALSE(GetUserPrefTouchscreenEnabled());
- EXPECT_EQ(kInitialGlobalTouchscreenEnabled, GetGlobalTouchscreenEnabled());
debug::PerformDebugActionIfEnabled(DEBUG_TOGGLE_TOUCH_SCREEN);
EXPECT_TRUE(GetUserPrefTouchscreenEnabled());
- EXPECT_EQ(kInitialGlobalTouchscreenEnabled, GetGlobalTouchscreenEnabled());
+ EXPECT_TRUE(GetGlobalTouchscreenEnabled());
+
+ // The global setting should be preserved when switching users.
+ Shell::Get()->touch_devices_controller()->SetTouchscreenEnabled(
+ false, TouchscreenEnabledSource::GLOBAL);
+ EXPECT_FALSE(GetGlobalTouchscreenEnabled());
+ SwitchActiveUser(kUser2Email);
+ EXPECT_FALSE(GetGlobalTouchscreenEnabled());
}
} // namespace ash