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/power/tablet_power_button_controller.h" | 5 #include "ash/system/power/tablet_power_button_controller.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/public/cpp/config.h" | 10 #include "ash/public/cpp/config.h" |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
561 // Tests that when backlights get forced off due to tablet power button, media | 561 // Tests that when backlights get forced off due to tablet power button, media |
562 // sessions should be suspended. | 562 // sessions should be suspended. |
563 TEST_F(TabletPowerButtonControllerTest, SuspendMediaSessions) { | 563 TEST_F(TabletPowerButtonControllerTest, SuspendMediaSessions) { |
564 ASSERT_FALSE(shell_delegate_->media_sessions_suspended()); | 564 ASSERT_FALSE(shell_delegate_->media_sessions_suspended()); |
565 PressPowerButton(); | 565 PressPowerButton(); |
566 ReleasePowerButton(); | 566 ReleasePowerButton(); |
567 ASSERT_TRUE(GetBacklightsForcedOff()); | 567 ASSERT_TRUE(GetBacklightsForcedOff()); |
568 EXPECT_TRUE(shell_delegate_->media_sessions_suspended()); | 568 EXPECT_TRUE(shell_delegate_->media_sessions_suspended()); |
569 } | 569 } |
570 | 570 |
571 // Tests that system is suspended with backlights forced off, and then system | |
Daniel Erat
2017/06/22 18:08:40
nit: s/Tests that system/Tests that when system/
Qiang(Joe) Xu
2017/06/22 18:36:35
Done.
| |
572 // resumes due to power button pressed without power button event fired | |
573 // (crbug.com/735291), that we shall still stop forcing off backlights. | |
Daniel Erat
2017/06/22 18:08:40
nit: remove "shall still"
Qiang(Joe) Xu
2017/06/22 18:36:36
Done.
| |
574 TEST_F(TabletPowerButtonControllerTest, SuspendDoneStopsForcingOff) { | |
575 PressPowerButton(); | |
576 ReleasePowerButton(); | |
577 power_manager_client_->SendBrightnessChanged(0, false); | |
578 ASSERT_TRUE(GetBacklightsForcedOff()); | |
579 | |
580 // Simulate an edge case that system resumes because of tablet power button | |
581 // pressed, but power button event is not delivered. | |
582 power_manager_client_->SendSuspendDone(); | |
583 | |
584 EXPECT_FALSE(GetBacklightsForcedOff()); | |
585 } | |
586 | |
571 } // namespace test | 587 } // namespace test |
572 } // namespace ash | 588 } // namespace ash |
OLD | NEW |