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

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

Issue 2770723002: Fix MaximizeModeController startup race (Closed)
Patch Set: Verified on Device Created 3 years, 9 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/common/wm/maximize_mode/maximize_mode_controller.cc ('k') | no next file » | 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 9bd694a3b25f00451dbf52ea75bdecf4f6cceb9c..759f53a0e65e699b9af42f5e6afc5587d7e8be41 100644
--- a/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
+++ b/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
@@ -16,10 +16,13 @@
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "base/command_line.h"
+#include "base/run_loop.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/test/user_action_tester.h"
#include "chromeos/accelerometer/accelerometer_reader.h"
#include "chromeos/accelerometer/accelerometer_types.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_power_manager_client.h"
#include "ui/display/manager/display_manager.h"
#include "ui/display/test/display_manager_test_api.h"
#include "ui/events/event_handler.h"
@@ -583,4 +586,21 @@ TEST_F(MaximizeModeControllerTest, VerticalHingeUnstableAnglesTest) {
}
}
+// Tests that when a MaximizeModeController is created that cached tablet mode
+// state will trigger a mode update.
+TEST_F(MaximizeModeControllerTest, InitializedWhileTabletModeSwitchOn) {
+ base::RunLoop().RunUntilIdle();
+ // FakePowerManagerClient is always installed for tests
+ chromeos::FakePowerManagerClient* power_manager_client =
+ static_cast<chromeos::FakePowerManagerClient*>(
+ chromeos::DBusThreadManager::Get()->GetPowerManagerClient());
+ power_manager_client->set_tablet_mode(
+ chromeos::PowerManagerClient::TabletMode::ON);
+ MaximizeModeController controller;
+ EXPECT_FALSE(controller.IsMaximizeModeWindowManagerEnabled());
+ // PowerManagerClient callback is a posted task.
+ base::RunLoop().RunUntilIdle();
+ EXPECT_TRUE(controller.IsMaximizeModeWindowManagerEnabled());
+}
+
} // namespace ash
« no previous file with comments | « ash/common/wm/maximize_mode/maximize_mode_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698