Chromium Code Reviews| Index: chrome/browser/ui/ash/multi_user/user_switch_util_unittest.cc |
| diff --git a/chrome/browser/ui/ash/multi_user/user_switch_util_unittest.cc b/chrome/browser/ui/ash/multi_user/user_switch_util_unittest.cc |
| index 4e8fba931f777413152ac5bbbeb3036726f61b8f..063dbc76426ea46d27223a5d3970b1023000944e 100644 |
| --- a/chrome/browser/ui/ash/multi_user/user_switch_util_unittest.cc |
| +++ b/chrome/browser/ui/ash/multi_user/user_switch_util_unittest.cc |
| @@ -4,8 +4,11 @@ |
| #include "ash/common/system/chromeos/screen_security/screen_tray_item.h" |
| #include "ash/common/system/tray/system_tray.h" |
| +#include "ash/common/wm/overview/window_selector_controller.h" |
| +#include "ash/common/wm_shell.h" |
| #include "ash/test/ash_test_base.h" |
| #include "chrome/browser/ui/ash/multi_user/user_switch_util.h" |
| +#include "ui/aura/window.h" |
| namespace ash { |
| @@ -83,6 +86,13 @@ class TrySwitchingUserTest : public ash::test::AshTestBase { |
| // Called when the user will get actually switched. |
| void SwitchCallback() { switch_callback_hit_count_++; } |
| + // Methods needed to test with overview mode. |
| + WindowSelectorController* window_selector_controller() { |
| + return WmShell::Get()->window_selector_controller(); |
| + } |
| + void ToggleOverview() { window_selector_controller()->ToggleOverview(); } |
| + bool IsSelecting() { return window_selector_controller()->IsSelecting(); } |
|
oshima
2016/08/25 21:29:39
nit: const?
varkha
2016/08/26 03:28:53
Done.
|
| + |
| // Various counter accessors. |
| int stop_capture_callback_hit_count() const { |
| return stop_capture_callback_hit_count_; |
| @@ -211,4 +221,16 @@ TEST_F(TrySwitchingUserTest, BothActiveAccepted) { |
| EXPECT_EQ(1, stop_share_callback_hit_count()); |
| } |
| +// Test that overview mode is dismissed before switching user profile. |
| +TEST_F(TrySwitchingUserTest, OverviewModeDismissed) { |
| + EXPECT_EQ(0, switch_callback_hit_count()); |
| + gfx::Rect bounds(0, 0, 100, 100); |
| + std::unique_ptr<aura::Window> w(CreateTestWindowInShellWithBounds(bounds)); |
| + ToggleOverview(); |
| + ASSERT_TRUE(IsSelecting()); |
| + SwitchUser(TrySwitchingUserTest::NO_DIALOG); |
| + ASSERT_FALSE(IsSelecting()); |
| + EXPECT_EQ(1, switch_callback_hit_count()); |
| +} |
| + |
| } // namespace ash |