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

Side by Side Diff: chrome/browser/ui/ash/multi_user/user_switch_util_unittest.cc

Issue 2273103003: [ash-md] Cancels overview mode before switching user profiles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [ash-md] Cancels overview mode before switching user profiles (test) Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/ash/multi_user/user_switch_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
8 #include "ash/common/wm_shell.h"
7 #include "ash/test/ash_test_base.h" 9 #include "ash/test/ash_test_base.h"
8 #include "chrome/browser/ui/ash/multi_user/user_switch_util.h" 10 #include "chrome/browser/ui/ash/multi_user/user_switch_util.h"
11 #include "ui/aura/window.h"
9 12
10 namespace ash { 13 namespace ash {
11 14
12 class TrySwitchingUserTest : public ash::test::AshTestBase { 15 class TrySwitchingUserTest : public ash::test::AshTestBase {
13 public: 16 public:
14 // The action type to perform / check for upon user switching. 17 // The action type to perform / check for upon user switching.
15 enum ActionType { 18 enum ActionType {
16 NO_DIALOG, // No dialog should be shown. 19 NO_DIALOG, // No dialog should be shown.
17 ACCEPT_DIALOG, // A dialog should be shown and we should accept it. 20 ACCEPT_DIALOG, // A dialog should be shown and we should accept it.
18 DECLINE_DIALOG, // A dialog should be shown and we do not accept it. 21 DECLINE_DIALOG, // A dialog should be shown and we do not accept it.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 return; 79 return;
77 case DECLINE_DIALOG: 80 case DECLINE_DIALOG:
78 EXPECT_TRUE(TestAndTerminateDesktopCastingWarningForTest(false)); 81 EXPECT_TRUE(TestAndTerminateDesktopCastingWarningForTest(false));
79 return; 82 return;
80 } 83 }
81 } 84 }
82 85
83 // Called when the user will get actually switched. 86 // Called when the user will get actually switched.
84 void SwitchCallback() { switch_callback_hit_count_++; } 87 void SwitchCallback() { switch_callback_hit_count_++; }
85 88
89 // Methods needed to test with overview mode.
90 WindowSelectorController* window_selector_controller() {
91 return WmShell::Get()->window_selector_controller();
92 }
93 void ToggleOverview() { window_selector_controller()->ToggleOverview(); }
94 bool IsSelecting() { return window_selector_controller()->IsSelecting(); }
oshima 2016/08/25 21:29:39 nit: const?
varkha 2016/08/26 03:28:53 Done.
95
86 // Various counter accessors. 96 // Various counter accessors.
87 int stop_capture_callback_hit_count() const { 97 int stop_capture_callback_hit_count() const {
88 return stop_capture_callback_hit_count_; 98 return stop_capture_callback_hit_count_;
89 } 99 }
90 int stop_share_callback_hit_count() const { 100 int stop_share_callback_hit_count() const {
91 return stop_share_callback_hit_count_; 101 return stop_share_callback_hit_count_;
92 } 102 }
93 int switch_callback_hit_count() const { return switch_callback_hit_count_; } 103 int switch_callback_hit_count() const { return switch_callback_hit_count_; }
94 104
95 private: 105 private:
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 EXPECT_EQ(1, stop_capture_callback_hit_count()); 214 EXPECT_EQ(1, stop_capture_callback_hit_count());
205 EXPECT_EQ(1, stop_share_callback_hit_count()); 215 EXPECT_EQ(1, stop_share_callback_hit_count());
206 // Another stop should have no effect. 216 // Another stop should have no effect.
207 StopShareSession(); 217 StopShareSession();
208 StopCaptureSession(); 218 StopCaptureSession();
209 EXPECT_EQ(1, switch_callback_hit_count()); 219 EXPECT_EQ(1, switch_callback_hit_count());
210 EXPECT_EQ(1, stop_capture_callback_hit_count()); 220 EXPECT_EQ(1, stop_capture_callback_hit_count());
211 EXPECT_EQ(1, stop_share_callback_hit_count()); 221 EXPECT_EQ(1, stop_share_callback_hit_count());
212 } 222 }
213 223
224 // Test that overview mode is dismissed before switching user profile.
225 TEST_F(TrySwitchingUserTest, OverviewModeDismissed) {
226 EXPECT_EQ(0, switch_callback_hit_count());
227 gfx::Rect bounds(0, 0, 100, 100);
228 std::unique_ptr<aura::Window> w(CreateTestWindowInShellWithBounds(bounds));
229 ToggleOverview();
230 ASSERT_TRUE(IsSelecting());
231 SwitchUser(TrySwitchingUserTest::NO_DIALOG);
232 ASSERT_FALSE(IsSelecting());
233 EXPECT_EQ(1, switch_callback_hit_count());
234 }
235
214 } // namespace ash 236 } // namespace ash
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/multi_user/user_switch_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698