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

Side by Side 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: nits Created 3 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/system/power/tablet_power_button_controller.h" 5 #include "ash/system/power/tablet_power_button_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/public/cpp/config.h" 10 #include "ash/public/cpp/config.h"
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 PressPowerButton(); 500 PressPowerButton();
501 ReleasePowerButton(); 501 ReleasePowerButton();
502 ASSERT_TRUE(GetBacklightsForcedOff()); 502 ASSERT_TRUE(GetBacklightsForcedOff());
503 503
504 // A lid open event is received, we should stop forcing off backlights. 504 // A lid open event is received, we should stop forcing off backlights.
505 power_manager_client_->SetLidState( 505 power_manager_client_->SetLidState(
506 chromeos::PowerManagerClient::LidState::OPEN, tick_clock_->NowTicks()); 506 chromeos::PowerManagerClient::LidState::OPEN, tick_clock_->NowTicks());
507 EXPECT_FALSE(GetBacklightsForcedOff()); 507 EXPECT_FALSE(GetBacklightsForcedOff());
508 } 508 }
509 509
510 // Tests that with system reboot, the local state of touchscreen enabled state
511 // should be synced with new backlights forced off state from powerd.
512 TEST_F(TabletPowerButtonControllerTest, SyncTouchscreenStatus) {
513 shell_delegate_->SetTouchscreenEnabledInPrefs(false,
514 true /* use_local_state */);
515 ASSERT_FALSE(shell_delegate_->IsTouchscreenEnabledInPrefs(true));
516
517 // Simulate system reboot by resetting backlights forced off state in powerd
518 // and TabletPowerButtonController.
519 power_manager_client_->SetBacklightsForcedOff(false);
520 Shell::Get()
521 ->power_button_controller()
522 ->ResetTabletPowerButtonControllerForTest();
523
524 // Check that the local state of touchscreen enabled state is in line with
525 // backlights forced off state.
526 EXPECT_FALSE(GetBacklightsForcedOff());
527 EXPECT_TRUE(shell_delegate_->IsTouchscreenEnabledInPrefs(true));
528 }
529
510 } // namespace test 530 } // namespace test
511 } // namespace ash 531 } // namespace ash
OLDNEW
« 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