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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 std::unique_ptr<base::TickClock>(tick_clock_)); | 68 std::unique_ptr<base::TickClock>(tick_clock_)); |
69 shell_delegate_ = | 69 shell_delegate_ = |
70 static_cast<TestShellDelegate*>(WmShell::Get()->delegate()); | 70 static_cast<TestShellDelegate*>(WmShell::Get()->delegate()); |
71 generator_ = &AshTestBase::GetEventGenerator(); | 71 generator_ = &AshTestBase::GetEventGenerator(); |
72 power_manager_client_->SendBrightnessChanged(kNonZeroBrightness, false); | 72 power_manager_client_->SendBrightnessChanged(kNonZeroBrightness, false); |
73 EXPECT_FALSE(GetBacklightsForcedOff()); | 73 EXPECT_FALSE(GetBacklightsForcedOff()); |
74 } | 74 } |
75 | 75 |
76 void TearDown() override { | 76 void TearDown() override { |
77 generator_ = nullptr; | 77 generator_ = nullptr; |
| 78 const bool is_mash = WmShell::Get()->IsRunningInMash(); |
78 AshTestBase::TearDown(); | 79 AshTestBase::TearDown(); |
79 chromeos::DBusThreadManager::Shutdown(); | 80 // Mash shuts down dbus after each test. |
| 81 if (!is_mash) |
| 82 chromeos::DBusThreadManager::Shutdown(); |
80 } | 83 } |
81 | 84 |
82 protected: | 85 protected: |
83 void PressPowerButton() { | 86 void PressPowerButton() { |
84 tablet_controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); | 87 tablet_controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); |
85 } | 88 } |
86 | 89 |
87 void ReleasePowerButton() { | 90 void ReleasePowerButton() { |
88 tablet_controller_->OnPowerButtonEvent(false, base::TimeTicks::Now()); | 91 tablet_controller_->OnPowerButtonEvent(false, base::TimeTicks::Now()); |
89 } | 92 } |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 // Test that after another long duration, backlights should be forced off. | 472 // Test that after another long duration, backlights should be forced off. |
470 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(800)); | 473 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(800)); |
471 power_manager_client_->SendPowerButtonEvent(true, tick_clock_->NowTicks()); | 474 power_manager_client_->SendPowerButtonEvent(true, tick_clock_->NowTicks()); |
472 power_manager_client_->SendPowerButtonEvent(false, tick_clock_->NowTicks()); | 475 power_manager_client_->SendPowerButtonEvent(false, tick_clock_->NowTicks()); |
473 power_manager_client_->SendBrightnessChanged(0, false); | 476 power_manager_client_->SendBrightnessChanged(0, false); |
474 EXPECT_TRUE(GetBacklightsForcedOff()); | 477 EXPECT_TRUE(GetBacklightsForcedOff()); |
475 } | 478 } |
476 | 479 |
477 } // namespace test | 480 } // namespace test |
478 } // namespace ash | 481 } // namespace ash |
OLD | NEW |