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

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

Issue 2911493002: cros: Pull user info from session_controller_client.mojom into separate mojom. (Closed)
Patch Set: Fix ordering in typemaps Created 3 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
« no previous file with comments | « ash/system/user/tray_user.cc ('k') | ash/system/user/user_card_view.cc » ('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 <utility> 5 #include <utility>
6 #include <vector> 6 #include <vector>
7 7
8 #include "ash/session/session_controller.h" 8 #include "ash/session/session_controller.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_delegate.h" 10 #include "ash/shell_delegate.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 gfx::Rect user_card_bounds = tray_user()->GetUserPanelBoundsInScreenForTest(); 250 gfx::Rect user_card_bounds = tray_user()->GetUserPanelBoundsInScreenForTest();
251 gfx::Point second_user_point = user_card_bounds.CenterPoint() + 251 gfx::Point second_user_point = user_card_bounds.CenterPoint() +
252 gfx::Vector2d(0, user_card_bounds.height()); 252 gfx::Vector2d(0, user_card_bounds.height());
253 generator.MoveMouseTo(second_user_point); 253 generator.MoveMouseTo(second_user_point);
254 generator.ClickLeftButton(); 254 generator.ClickLeftButton();
255 255
256 // SwitchActiverUser is an async mojo call. Spin the loop to let it finish. 256 // SwitchActiverUser is an async mojo call. Spin the loop to let it finish.
257 RunAllPendingInMessageLoop(); 257 RunAllPendingInMessageLoop();
258 258
259 const mojom::UserSession* active_user = controller()->GetUserSession(0); 259 const mojom::UserSession* active_user = controller()->GetUserSession(0);
260 EXPECT_EQ(active_user->account_id, second_user->account_id); 260 EXPECT_EQ(active_user->user_info->account_id,
261 second_user->user_info->account_id);
261 // Since the name is capitalized, the email should be different than the 262 // Since the name is capitalized, the email should be different than the
262 // user_id. 263 // user_id.
263 EXPECT_NE(active_user->account_id.GetUserEmail(), second_user->display_email); 264 EXPECT_NE(active_user->user_info->account_id.GetUserEmail(),
265 second_user->user_info->display_email);
264 tray()->CloseSystemBubble(); 266 tray()->CloseSystemBubble();
265 } 267 }
266 268
267 // Test SessionController updates avatar image. 269 // Test SessionController updates avatar image.
268 TEST_F(TrayUserTest, AvatarChange) { 270 TEST_F(TrayUserTest, AvatarChange) {
269 InitializeParameters(1, false); 271 InitializeParameters(1, false);
270 272
271 // Expect empty avatar initially (that is how the test sets up). 273 // Expect empty avatar initially (that is how the test sets up).
272 EXPECT_TRUE(tray_user()->avatar_view_for_test()->image_for_test().isNull()); 274 EXPECT_TRUE(tray_user()->avatar_view_for_test()->image_for_test().isNull());
273 275
274 // Change user avatar via SessionController and verify. 276 // Change user avatar via SessionController and verify.
275 const gfx::ImageSkia red_icon = 277 const gfx::ImageSkia red_icon =
276 CreateImageSkiaWithColor(kTrayItemSize, kTrayItemSize, SK_ColorRED); 278 CreateImageSkiaWithColor(kTrayItemSize, kTrayItemSize, SK_ColorRED);
277 mojom::UserSessionPtr user = controller()->GetUserSession(0)->Clone(); 279 mojom::UserSessionPtr user = controller()->GetUserSession(0)->Clone();
278 user->avatar = red_icon; 280 user->user_info->avatar = red_icon;
279 controller()->UpdateUserSession(std::move(user)); 281 controller()->UpdateUserSession(std::move(user));
280 EXPECT_TRUE(gfx::test::AreImagesEqual( 282 EXPECT_TRUE(gfx::test::AreImagesEqual(
281 gfx::Image(red_icon), 283 gfx::Image(red_icon),
282 gfx::Image(tray_user()->avatar_view_for_test()->image_for_test()))); 284 gfx::Image(tray_user()->avatar_view_for_test()->image_for_test())));
283 } 285 }
284 286
285 } // namespace ash 287 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/user/tray_user.cc ('k') | ash/system/user/user_card_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698