Chromium Code Reviews| Index: ash/wm/maximize_mode/maximize_mode_controller_unittest.cc |
| diff --git a/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc b/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc |
| index 251885b7212fc2907158ccc625f6a02efdc56235..a09c707587cb57377d2f658ebf40b20ea2ec7ec8 100644 |
| --- a/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc |
| +++ b/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc |
| @@ -155,6 +155,15 @@ class MaximizeModeControllerTest : public test::AshTestBase { |
| return maximize_mode_controller()->WasLidOpenedRecently(); |
| } |
| + void ToggleTabletMode(const bool on) { |
|
Daniel Erat
2016/06/06 17:23:08
nit: rename this to SetTabletMode (toggling would
jcliang
2016/06/06 18:19:25
Done.
|
| + maximize_mode_controller()->TabletModeEventReceived( |
| + on, maximize_mode_controller()->tick_clock_->NowTicks()); |
| + } |
| + |
| + bool IsTabletModeOn() { |
|
Daniel Erat
2016/06/06 17:23:08
i'd delete this method and the calls to it. checki
jcliang
2016/06/06 18:19:25
Done.
|
| + return maximize_mode_controller()->tablet_mode_switch_is_on_; |
| + } |
| + |
| bool AreEventsBlocked() { |
| return !!maximize_mode_controller()->event_blocker_.get(); |
| } |
| @@ -266,6 +275,30 @@ TEST_F(MaximizeModeControllerTest, WasLidOpenedRecentlyOverTime) { |
| EXPECT_FALSE(WasLidOpenedRecently()); |
| } |
| +TEST_F(MaximizeModeControllerTest, TabletModeTransition) { |
| + ASSERT_FALSE(IsTabletModeOn()); |
| + |
| + OpenLidToAngle(90.0f); |
| + EXPECT_FALSE(IsMaximizeModeStarted()); |
| + |
| + OpenLidToAngle(355.0f); |
| + EXPECT_FALSE(IsMaximizeModeStarted()); |
|
Daniel Erat
2016/06/06 17:23:07
why didn't this trigger maximize mode? it is becau
jcliang
2016/06/06 18:19:25
I meant to trigger an unstable reading and make su
|
| + |
| + ToggleTabletMode(true); |
| + EXPECT_TRUE(IsTabletModeOn()); |
| + EXPECT_TRUE(IsMaximizeModeStarted()); |
| + |
| + ToggleTabletMode(false); |
| + EXPECT_FALSE(IsTabletModeOn()); |
| + EXPECT_TRUE(IsMaximizeModeStarted()); |
| + |
| + OpenLidToAngle(300.0f); |
| + EXPECT_TRUE(IsMaximizeModeStarted()); |
| + |
| + OpenLidToAngle(90.0f); |
| + EXPECT_FALSE(IsMaximizeModeStarted()); |
| +} |
|
Daniel Erat
2016/06/06 17:23:07
can you open the lid to a large angle at the end o
jcliang
2016/06/06 18:19:25
Done.
|
| + |
| // Verify the maximize mode enter/exit thresholds for stable angles. |
| TEST_F(MaximizeModeControllerTest, StableHingeAnglesWithLidOpened) { |
| ASSERT_FALSE(IsMaximizeModeStarted()); |