| OLD | NEW |
| 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_controller.h" | 10 #include "ash/common/session/session_controller.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 void EnableMaximizeMode(bool enabled) { | 106 void EnableMaximizeMode(bool enabled) { |
| 107 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 107 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 108 enabled); | 108 enabled); |
| 109 } | 109 } |
| 110 | 110 |
| 111 bool GetLockedState() { | 111 bool GetLockedState() { |
| 112 // LockScreen is an async mojo call. Spin message loop to ensure it is | 112 // LockScreen is an async mojo call. Spin message loop to ensure it is |
| 113 // delivered. | 113 // delivered. |
| 114 SessionController* const session_controller = | 114 SessionController* const session_controller = |
| 115 WmShell::Get()->session_controller(); | 115 Shell::Get()->session_controller(); |
| 116 session_controller->FlushMojoForTest(); | 116 session_controller->FlushMojoForTest(); |
| 117 return session_controller->IsScreenLocked(); | 117 return session_controller->IsScreenLocked(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 bool GetBacklightsForcedOff() WARN_UNUSED_RESULT { | 120 bool GetBacklightsForcedOff() WARN_UNUSED_RESULT { |
| 121 bool forced_off = false; | 121 bool forced_off = false; |
| 122 power_manager_client_->GetBacklightsForcedOff( | 122 power_manager_client_->GetBacklightsForcedOff( |
| 123 base::Bind(&CopyResult, base::Unretained(&forced_off))); | 123 base::Bind(&CopyResult, base::Unretained(&forced_off))); |
| 124 base::RunLoop().RunUntilIdle(); | 124 base::RunLoop().RunUntilIdle(); |
| 125 return forced_off; | 125 return forced_off; |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 // Test that after another long duration, backlights should be forced off. | 478 // Test that after another long duration, backlights should be forced off. |
| 479 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(800)); | 479 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(800)); |
| 480 power_manager_client_->SendPowerButtonEvent(true, tick_clock_->NowTicks()); | 480 power_manager_client_->SendPowerButtonEvent(true, tick_clock_->NowTicks()); |
| 481 power_manager_client_->SendPowerButtonEvent(false, tick_clock_->NowTicks()); | 481 power_manager_client_->SendPowerButtonEvent(false, tick_clock_->NowTicks()); |
| 482 power_manager_client_->SendBrightnessChanged(0, false); | 482 power_manager_client_->SendBrightnessChanged(0, false); |
| 483 EXPECT_TRUE(GetBacklightsForcedOff()); | 483 EXPECT_TRUE(GetBacklightsForcedOff()); |
| 484 } | 484 } |
| 485 | 485 |
| 486 } // namespace test | 486 } // namespace test |
| 487 } // namespace ash | 487 } // namespace ash |
| OLD | NEW |