| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/common/system/chromeos/screen_security/screen_tray_item.h" | 5 #include "ash/common/system/chromeos/screen_security/screen_tray_item.h" |
| 6 #include "ash/common/system/tray/system_tray.h" | 6 #include "ash/common/system/tray/system_tray.h" |
| 7 #include "ash/common/wm/overview/window_selector_controller.h" | 7 #include "ash/common/wm/overview/window_selector_controller.h" |
| 8 #include "ash/common/wm_shell.h" | 8 #include "ash/common/wm_shell.h" |
| 9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 // Methods needed to test with overview mode. | 84 // Methods needed to test with overview mode. |
| 85 const WindowSelectorController* window_selector_controller() const { | 85 const WindowSelectorController* window_selector_controller() const { |
| 86 return WmShell::Get()->window_selector_controller(); | 86 return WmShell::Get()->window_selector_controller(); |
| 87 } | 87 } |
| 88 WindowSelectorController* window_selector_controller() { | 88 WindowSelectorController* window_selector_controller() { |
| 89 return const_cast<WindowSelectorController*>( | 89 return const_cast<WindowSelectorController*>( |
| 90 const_cast<const TrySwitchingUserTest*>(this) | 90 const_cast<const TrySwitchingUserTest*>(this) |
| 91 ->window_selector_controller()); | 91 ->window_selector_controller()); |
| 92 } | 92 } |
| 93 void ToggleOverview() { window_selector_controller()->ToggleOverview(); } | 93 bool ToggleOverview() { |
| 94 return window_selector_controller()->ToggleOverview(); |
| 95 } |
| 94 bool IsSelecting() const { | 96 bool IsSelecting() const { |
| 95 return window_selector_controller()->IsSelecting(); | 97 return window_selector_controller()->IsSelecting(); |
| 96 } | 98 } |
| 97 | 99 |
| 98 // Various counter accessors. | 100 // Various counter accessors. |
| 99 int stop_capture_callback_hit_count() const { | 101 int stop_capture_callback_hit_count() const { |
| 100 return stop_capture_callback_hit_count_; | 102 return stop_capture_callback_hit_count_; |
| 101 } | 103 } |
| 102 int stop_share_callback_hit_count() const { | 104 int stop_share_callback_hit_count() const { |
| 103 return stop_share_callback_hit_count_; | 105 return stop_share_callback_hit_count_; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 EXPECT_EQ(1, switch_callback_hit_count()); | 237 EXPECT_EQ(1, switch_callback_hit_count()); |
| 236 EXPECT_EQ(1, stop_capture_callback_hit_count()); | 238 EXPECT_EQ(1, stop_capture_callback_hit_count()); |
| 237 EXPECT_EQ(1, stop_share_callback_hit_count()); | 239 EXPECT_EQ(1, stop_share_callback_hit_count()); |
| 238 } | 240 } |
| 239 | 241 |
| 240 // Test that overview mode is dismissed before switching user profile. | 242 // Test that overview mode is dismissed before switching user profile. |
| 241 TEST_F(TrySwitchingUserTest, OverviewModeDismissed) { | 243 TEST_F(TrySwitchingUserTest, OverviewModeDismissed) { |
| 242 EXPECT_EQ(0, switch_callback_hit_count()); | 244 EXPECT_EQ(0, switch_callback_hit_count()); |
| 243 gfx::Rect bounds(0, 0, 100, 100); | 245 gfx::Rect bounds(0, 0, 100, 100); |
| 244 std::unique_ptr<aura::Window> w(CreateTestWindowInShellWithBounds(bounds)); | 246 std::unique_ptr<aura::Window> w(CreateTestWindowInShellWithBounds(bounds)); |
| 245 ToggleOverview(); | 247 ASSERT_TRUE(ToggleOverview()); |
| 246 ASSERT_TRUE(IsSelecting()); | 248 ASSERT_TRUE(IsSelecting()); |
| 247 SwitchUser(TrySwitchingUserTest::NO_DIALOG); | 249 SwitchUser(TrySwitchingUserTest::NO_DIALOG); |
| 248 ASSERT_FALSE(IsSelecting()); | 250 ASSERT_FALSE(IsSelecting()); |
| 249 EXPECT_EQ(1, switch_callback_hit_count()); | 251 EXPECT_EQ(1, switch_callback_hit_count()); |
| 250 } | 252 } |
| 251 | 253 |
| 252 } // namespace ash | 254 } // namespace ash |
| OLD | NEW |