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

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: Hook up TABLET_MODE switch to maximize_mode_controller 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
« no previous file with comments | « ash/wm/maximize_mode/maximize_mode_controller.cc ('k') | chromeos/dbus/power_manager_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f866828cab5de080c53ad77baba7cbd081b7d06e..ce6e4a06815342504540f9657d469bc600338178 100644
--- a/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
+++ b/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
@@ -141,6 +141,12 @@ class MaximizeModeControllerTest : public test::AshTestBase {
TriggerBaseAndLidUpdate(base_vector, lid_vector);
}
+ void HoldDeviceVertical() {
+ gfx::Vector3dF base_vector(9.8f, 0.0f, 0.0f);
+ gfx::Vector3dF lid_vector(9.8f, 0.0f, 0.0f);
+ TriggerBaseAndLidUpdate(base_vector, lid_vector);
+ }
+
void OpenLid() {
maximize_mode_controller()->LidEventReceived(true /* open */,
maximize_mode_controller()->tick_clock_->NowTicks());
@@ -155,6 +161,11 @@ class MaximizeModeControllerTest : public test::AshTestBase {
return maximize_mode_controller()->WasLidOpenedRecently();
}
+ void SetTabletMode(bool on) {
+ maximize_mode_controller()->TabletModeEventReceived(
+ on, maximize_mode_controller()->tick_clock_->NowTicks());
+ }
+
bool AreEventsBlocked() {
return !!maximize_mode_controller()->event_blocker_.get();
}
@@ -266,6 +277,32 @@ TEST_F(MaximizeModeControllerTest, WasLidOpenedRecentlyOverTime) {
EXPECT_FALSE(WasLidOpenedRecently());
}
+TEST_F(MaximizeModeControllerTest, TabletModeTransition) {
+ OpenLidToAngle(90.0f);
+ EXPECT_FALSE(IsMaximizeModeStarted());
+
+ // Unstable reading. This should not trigger maximize mode.
+ HoldDeviceVertical();
+ EXPECT_FALSE(IsMaximizeModeStarted());
+
+ // When tablet mode switch is on it should force maximize mode even if the
+ // reading is not stable.
+ SetTabletMode(true);
+ EXPECT_TRUE(IsMaximizeModeStarted());
+
+ // After tablet mode switch is off it should stay in maximize mode if the
+ // reading is not stable.
+ SetTabletMode(false);
+ EXPECT_TRUE(IsMaximizeModeStarted());
+
+ // Should leave maximize mode when the lid angle is small enough.
+ OpenLidToAngle(90.0f);
+ EXPECT_FALSE(IsMaximizeModeStarted());
+
+ OpenLidToAngle(300.0f);
+ EXPECT_TRUE(IsMaximizeModeStarted());
+}
+
// Verify the maximize mode enter/exit thresholds for stable angles.
TEST_F(MaximizeModeControllerTest, StableHingeAnglesWithLidOpened) {
ASSERT_FALSE(IsMaximizeModeStarted());
« no previous file with comments | « ash/wm/maximize_mode/maximize_mode_controller.cc ('k') | chromeos/dbus/power_manager_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698