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

Side by Side Diff: ash/system/user/tray_user_unittest.cc

Issue 15718003: Add SessionStateObserver with ActiveUserChanged() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge & add SessionStateDelegateChromeos Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/system/user/tray_user.cc ('k') | ash/test/test_session_state_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <vector> 5 #include <vector>
6 6
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/shelf/shelf_layout_manager.h" 8 #include "ash/shelf/shelf_layout_manager.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_delegate.h" 10 #include "ash/shell_delegate.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 ShowTrayMenu(&generator); 133 ShowTrayMenu(&generator);
134 134
135 EXPECT_TRUE(tray()->HasSystemBubble()); 135 EXPECT_TRUE(tray()->HasSystemBubble());
136 EXPECT_TRUE(tray()->IsAnyBubbleVisible()); 136 EXPECT_TRUE(tray()->IsAnyBubbleVisible());
137 137
138 for (int i = 0; i <= delegate()->GetMaximumNumberOfLoggedInUsers(); i++) 138 for (int i = 0; i <= delegate()->GetMaximumNumberOfLoggedInUsers(); i++)
139 EXPECT_EQ(i == 0 ? ash::internal::TrayUser::SHOWN : 139 EXPECT_EQ(i == 0 ? ash::internal::TrayUser::SHOWN :
140 ash::internal::TrayUser::HIDDEN, 140 ash::internal::TrayUser::HIDDEN,
141 tray_user(i)->GetStateForTest()); 141 tray_user(i)->GetStateForTest());
142 142
143 tray()->CloseSystemBubbleForTest(); 143 tray()->CloseSystemBubble();
144 } 144 }
145 145
146 // Make sure that in multi user mode the user panel can be activated and there 146 // Make sure that in multi user mode the user panel can be activated and there
147 // will be one panel for each user plus a separator. 147 // will be one panel for each user plus a separator.
148 // Note: the mouse watcher (for automatic closing upon leave) cannot be tested 148 // Note: the mouse watcher (for automatic closing upon leave) cannot be tested
149 // here since it does not work with the event system in unit tests. 149 // here since it does not work with the event system in unit tests.
150 TEST_F(TrayUserTest, MutiUserModeDoesNotAllowToAddUser) { 150 TEST_F(TrayUserTest, MutiUserModeDoesNotAllowToAddUser) {
151 InitializeParameters(1, true); 151 InitializeParameters(1, true);
152 152
153 // Move the mouse over the status area and click to open the status menu. 153 // Move the mouse over the status area and click to open the status menu.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 ash::internal::TrayUser::ACTIVE_BUT_DISABLED : 200 ash::internal::TrayUser::ACTIVE_BUT_DISABLED :
201 ash::internal::TrayUser::ACTIVE, 201 ash::internal::TrayUser::ACTIVE,
202 tray_user(0)->GetStateForTest()); 202 tray_user(0)->GetStateForTest());
203 203
204 // Click the button again to see that the menu goes away. 204 // Click the button again to see that the menu goes away.
205 ClickUserItem(&generator, 0); 205 ClickUserItem(&generator, 0);
206 EXPECT_EQ(ash::internal::TrayUser::HOVERED, 206 EXPECT_EQ(ash::internal::TrayUser::HOVERED,
207 tray_user(0)->GetStateForTest()); 207 tray_user(0)->GetStateForTest());
208 208
209 // Close and check that everything is deleted. 209 // Close and check that everything is deleted.
210 tray()->CloseSystemBubbleForTest(); 210 tray()->CloseSystemBubble();
211 EXPECT_FALSE(tray()->IsAnyBubbleVisible()); 211 EXPECT_FALSE(tray()->IsAnyBubbleVisible());
212 for (int i = 0; i < delegate()->GetMaximumNumberOfLoggedInUsers(); i++) 212 for (int i = 0; i < delegate()->GetMaximumNumberOfLoggedInUsers(); i++)
213 EXPECT_EQ(ash::internal::TrayUser::HIDDEN, 213 EXPECT_EQ(ash::internal::TrayUser::HIDDEN,
214 tray_user(i)->GetStateForTest()); 214 tray_user(i)->GetStateForTest());
215 } 215 }
216 } 216 }
217 217
218 // Make sure that user changing gets properly executed. 218 // Make sure that user changing gets properly executed.
219 TEST_F(TrayUserTest, MutiUserModeButtonClicks) { 219 TEST_F(TrayUserTest, MutiUserModeButtonClicks) {
220 // Have two users. 220 // Have two users.
221 InitializeParameters(2, true); 221 InitializeParameters(2, true);
222 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); 222 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
223 ShowTrayMenu(&generator); 223 ShowTrayMenu(&generator);
224 224
225 // Switch to a new user. 225 // Switch to a new user.
226 ClickUserItem(&generator, 1); 226 ClickUserItem(&generator, 1);
227 227
228 EXPECT_EQ(delegate()->get_activated_user(), delegate()->GetUserEmail(1)); 228 EXPECT_EQ(delegate()->get_activated_user(), delegate()->GetUserEmail(1));
229 tray()->CloseSystemBubbleForTest(); 229 tray()->CloseSystemBubble();
230 } 230 }
231 231
232 } // namespace internal 232 } // namespace internal
233 } // namespace ash 233 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/user/tray_user.cc ('k') | ash/test/test_session_state_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698