Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Unified Diff: ash/wm/maximize_mode/maximize_mode_controller_unittest.cc

Issue 2020553003: Hook up TABLET_MODE switch to maximize_mode_controller (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..41b6bf9743bfd524214e6e1ff99272659f22887a 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) {
+ maximize_mode_controller()->TabletModeEventReceived(
+ on, maximize_mode_controller()->tick_clock_->NowTicks());
+ }
+
+ bool WasTabletModeOn() {
+ return maximize_mode_controller()->tablet_mode_switch_was_on_;
+ }
+
bool AreEventsBlocked() {
return !!maximize_mode_controller()->event_blocker_.get();
}
@@ -266,6 +275,32 @@ TEST_F(MaximizeModeControllerTest, WasLidOpenedRecentlyOverTime) {
EXPECT_FALSE(WasLidOpenedRecently());
}
+TEST_F(MaximizeModeControllerTest, TabletModeTransition) {
+ ASSERT_FALSE(WasTabletModeOn());
+
+ OpenLidToAngle(90.0f);
+ EXPECT_FALSE(IsMaximizeModeStarted());
+
+ OpenLidToAngle(355.0f);
+ EXPECT_FALSE(IsMaximizeModeStarted());
+
+ ToggleTabletMode(true);
+ EXPECT_FALSE(WasTabletModeOn());
+ EXPECT_TRUE(IsMaximizeModeStarted());
+
+ ToggleTabletMode(false);
+ EXPECT_TRUE(WasTabletModeOn());
+ EXPECT_TRUE(IsMaximizeModeStarted());
+
+ OpenLidToAngle(300.0f);
+ EXPECT_TRUE(WasTabletModeOn());
+ EXPECT_TRUE(IsMaximizeModeStarted());
+
+ OpenLidToAngle(90.0f);
+ EXPECT_FALSE(WasTabletModeOn());
+ EXPECT_FALSE(IsMaximizeModeStarted());
+}
+
// Verify the maximize mode enter/exit thresholds for stable angles.
TEST_F(MaximizeModeControllerTest, StableHingeAnglesWithLidOpened) {
ASSERT_FALSE(IsMaximizeModeStarted());

Powered by Google App Engine
This is Rietveld 408576698