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

Side by Side Diff: ash/system/chromeos/power/tablet_power_button_controller_unittest.cc

Issue 2864503002: [merge to m58] cros: Update touchscreen status with backlights forced off state during start (Closed)
Patch Set: 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
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/chromeos/power/tablet_power_button_controller.h" 5 #include "ash/system/chromeos/power/tablet_power_button_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "ash/common/ash_switches.h" 9 #include "ash/common/ash_switches.h"
10 #include "ash/common/session/session_state_delegate.h" 10 #include "ash/common/session/session_state_delegate.h"
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 EXPECT_FALSE(GetBacklightsForcedOff()); 470 EXPECT_FALSE(GetBacklightsForcedOff());
471 471
472 // Test that after another long duration, backlights should be forced off. 472 // Test that after another long duration, backlights should be forced off.
473 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(800)); 473 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(800));
474 power_manager_client_->SendPowerButtonEvent(true, tick_clock_->NowTicks()); 474 power_manager_client_->SendPowerButtonEvent(true, tick_clock_->NowTicks());
475 power_manager_client_->SendPowerButtonEvent(false, tick_clock_->NowTicks()); 475 power_manager_client_->SendPowerButtonEvent(false, tick_clock_->NowTicks());
476 power_manager_client_->SendBrightnessChanged(0, false); 476 power_manager_client_->SendBrightnessChanged(0, false);
477 EXPECT_TRUE(GetBacklightsForcedOff()); 477 EXPECT_TRUE(GetBacklightsForcedOff());
478 } 478 }
479 479
480 // Tests that with system reboot, the local state of touchscreen enabled state
481 // should be synced with new backlights forced off state from powerd.
482 TEST_F(TabletPowerButtonControllerTest, SyncTouchscreenStatus) {
483 shell_delegate_->SetTouchscreenEnabledInPrefs(false,
484 true /* use_local_state */);
485 ASSERT_FALSE(shell_delegate_->IsTouchscreenEnabledInPrefs(true));
486
487 // Simulate system reboot by resetting backlights forced off state in powerd
488 // and TabletPowerButtonController.
489 power_manager_client_->SetBacklightsForcedOff(false);
490 Shell::GetInstance()
491 ->power_button_controller()
492 ->ResetTabletPowerButtonControllerForTest();
493
494 // Check that the local state of touchscreen enabled state is in line with
495 // backlights forced off state.
496 EXPECT_FALSE(GetBacklightsForcedOff());
497 EXPECT_TRUE(shell_delegate_->IsTouchscreenEnabledInPrefs(true));
498 }
499
480 } // namespace test 500 } // namespace test
481 } // namespace ash 501 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/chromeos/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