| 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() override {} | 45 ~TabletPowerButtonControllerTest() override {} |
| 46 | 46 |
| 47 void SetUp() override { | 47 void SetUp() override { |
| 48 // This also initializes DBusThreadManager. | 48 // This also initializes DBusThreadManager. |
| 49 std::unique_ptr<chromeos::DBusThreadManagerSetter> dbus_setter = | 49 std::unique_ptr<chromeos::DBusThreadManagerSetter> dbus_setter = |
| 50 chromeos::DBusThreadManager::GetSetterForTesting(); | 50 chromeos::DBusThreadManager::GetSetterForTesting(); |
| 51 power_manager_client_ = new chromeos::FakePowerManagerClient(); | 51 power_manager_client_ = new chromeos::FakePowerManagerClient(); |
| 52 dbus_setter->SetPowerManagerClient(base::WrapUnique(power_manager_client_)); | 52 dbus_setter->SetPowerManagerClient(base::WrapUnique(power_manager_client_)); |
| 53 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 53 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 54 switches::kAshEnableTouchViewTesting); | 54 switches::kAshEnableTouchViewTesting); |
| 55 base::CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 56 switches::kAshEnableTabletPowerButton); | |
| 57 AshTestBase::SetUp(); | 55 AshTestBase::SetUp(); |
| 58 | 56 |
| 59 lock_state_controller_ = Shell::GetInstance()->lock_state_controller(); | 57 lock_state_controller_ = Shell::GetInstance()->lock_state_controller(); |
| 60 tablet_controller_ = Shell::GetInstance() | 58 tablet_controller_ = Shell::GetInstance() |
| 61 ->power_button_controller() | 59 ->power_button_controller() |
| 62 ->tablet_power_button_controller_for_test(); | 60 ->tablet_power_button_controller_for_test(); |
| 63 test_api_ = base::MakeUnique<TabletPowerButtonController::TestApi>( | 61 test_api_ = base::MakeUnique<TabletPowerButtonController::TestApi>( |
| 64 tablet_controller_); | 62 tablet_controller_); |
| 65 lock_state_test_api_ = | 63 lock_state_test_api_ = |
| 66 base::MakeUnique<LockStateControllerTestApi>(lock_state_controller_); | 64 base::MakeUnique<LockStateControllerTestApi>(lock_state_controller_); |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 tablet_controller_->OnLeaveMaximizeMode(); | 447 tablet_controller_->OnLeaveMaximizeMode(); |
| 450 EXPECT_FALSE(lock_state_test_api_->shutdown_timer_is_running()); | 448 EXPECT_FALSE(lock_state_test_api_->shutdown_timer_is_running()); |
| 451 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(4500)); | 449 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(4500)); |
| 452 power_manager_client_->SendPowerButtonEvent(false, tick_clock_->NowTicks()); | 450 power_manager_client_->SendPowerButtonEvent(false, tick_clock_->NowTicks()); |
| 453 EXPECT_FALSE(GetLockedState()); | 451 EXPECT_FALSE(GetLockedState()); |
| 454 EXPECT_FALSE(GetBacklightsForcedOff()); | 452 EXPECT_FALSE(GetBacklightsForcedOff()); |
| 455 } | 453 } |
| 456 | 454 |
| 457 } // namespace test | 455 } // namespace test |
| 458 } // namespace ash | 456 } // namespace ash |
| OLD | NEW |