| 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_state_delegate.h" | 10 #include "ash/common/session/session_state_delegate.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 TabletPowerButtonControllerTest() {} | 45 TabletPowerButtonControllerTest() {} |
| 46 ~TabletPowerButtonControllerTest() override {} | 46 ~TabletPowerButtonControllerTest() override {} |
| 47 | 47 |
| 48 void SetUp() override { | 48 void SetUp() override { |
| 49 // This also initializes DBusThreadManager. | 49 // This also initializes DBusThreadManager. |
| 50 std::unique_ptr<chromeos::DBusThreadManagerSetter> dbus_setter = | 50 std::unique_ptr<chromeos::DBusThreadManagerSetter> dbus_setter = |
| 51 chromeos::DBusThreadManager::GetSetterForTesting(); | 51 chromeos::DBusThreadManager::GetSetterForTesting(); |
| 52 power_manager_client_ = new chromeos::FakePowerManagerClient(); | 52 power_manager_client_ = new chromeos::FakePowerManagerClient(); |
| 53 dbus_setter->SetPowerManagerClient(base::WrapUnique(power_manager_client_)); | 53 dbus_setter->SetPowerManagerClient(base::WrapUnique(power_manager_client_)); |
| 54 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 54 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 55 switches::kAshEnableTouchViewTesting); | 55 switches::kAshEnableTouchView); |
| 56 AshTestBase::SetUp(); | 56 AshTestBase::SetUp(); |
| 57 WmShell::Get() |
| 58 ->maximize_mode_controller() |
| 59 ->set_force_can_enter_maximize_mode_for_tests(true); |
| 57 | 60 |
| 58 lock_state_controller_ = Shell::GetInstance()->lock_state_controller(); | 61 lock_state_controller_ = Shell::GetInstance()->lock_state_controller(); |
| 59 tablet_controller_ = Shell::GetInstance() | 62 tablet_controller_ = Shell::GetInstance() |
| 60 ->power_button_controller() | 63 ->power_button_controller() |
| 61 ->tablet_power_button_controller_for_test(); | 64 ->tablet_power_button_controller_for_test(); |
| 62 test_api_ = base::MakeUnique<TabletPowerButtonController::TestApi>( | 65 test_api_ = base::MakeUnique<TabletPowerButtonController::TestApi>( |
| 63 tablet_controller_); | 66 tablet_controller_); |
| 64 lock_state_test_api_ = | 67 lock_state_test_api_ = |
| 65 base::MakeUnique<LockStateControllerTestApi>(lock_state_controller_); | 68 base::MakeUnique<LockStateControllerTestApi>(lock_state_controller_); |
| 66 tick_clock_ = new base::SimpleTestTickClock; | 69 tick_clock_ = new base::SimpleTestTickClock; |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 tablet_controller_->OnMaximizeModeEnded(); | 461 tablet_controller_->OnMaximizeModeEnded(); |
| 459 EXPECT_FALSE(lock_state_test_api_->shutdown_timer_is_running()); | 462 EXPECT_FALSE(lock_state_test_api_->shutdown_timer_is_running()); |
| 460 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(4500)); | 463 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(4500)); |
| 461 power_manager_client_->SendPowerButtonEvent(false, tick_clock_->NowTicks()); | 464 power_manager_client_->SendPowerButtonEvent(false, tick_clock_->NowTicks()); |
| 462 EXPECT_FALSE(GetLockedState()); | 465 EXPECT_FALSE(GetLockedState()); |
| 463 EXPECT_FALSE(GetBacklightsForcedOff()); | 466 EXPECT_FALSE(GetBacklightsForcedOff()); |
| 464 } | 467 } |
| 465 | 468 |
| 466 } // namespace test | 469 } // namespace test |
| 467 } // namespace ash | 470 } // namespace ash |
| OLD | NEW |