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

Side by Side Diff: chrome/browser/chromeos/login/user_image_manager_browsertest.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/memory/ref_counted_memory.h" 9 #include "base/memory/ref_counted_memory.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); 55 command_line->AppendSwitchASCII(switches::kLoginProfile, "user");
56 } 56 }
57 57
58 // content::NotificationObserver overrides: 58 // content::NotificationObserver overrides:
59 virtual void Observe(int type, 59 virtual void Observe(int type,
60 const content::NotificationSource& source, 60 const content::NotificationSource& source,
61 const content::NotificationDetails& details) OVERRIDE { 61 const content::NotificationDetails& details) OVERRIDE {
62 DCHECK(type == chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED); 62 DCHECK(type == chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED);
63 registrar_.Remove(this, chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, 63 registrar_.Remove(this, chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED,
64 content::NotificationService::AllSources()); 64 content::NotificationService::AllSources());
65 MessageLoopForUI::current()->Quit(); 65 base::MessageLoopForUI::current()->Quit();
66 } 66 }
67 67
68 // UserManager::Observer overrides: 68 // UserManager::Observer overrides:
69 virtual void LocalStateChanged(UserManager* user_manager) OVERRIDE { 69 virtual void LocalStateChanged(UserManager* user_manager) OVERRIDE {
70 MessageLoopForUI::current()->Quit(); 70 base::MessageLoopForUI::current()->Quit();
71 } 71 }
72 72
73 // Adds given user to Local State, if not there. 73 // Adds given user to Local State, if not there.
74 void AddUser(const std::string& username) { 74 void AddUser(const std::string& username) {
75 ListPrefUpdate users_pref(local_state_, "LoggedInUsers"); 75 ListPrefUpdate users_pref(local_state_, "LoggedInUsers");
76 users_pref->AppendIfNotPresent(new base::StringValue(username)); 76 users_pref->AppendIfNotPresent(new base::StringValue(username));
77 } 77 }
78 78
79 // Logs in |username|. 79 // Logs in |username|.
80 void LogIn(const std::string& username) { 80 void LogIn(const std::string& username) {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 const User* user = UserManager::Get()->FindUser(kTestUser1); 259 const User* user = UserManager::Get()->FindUser(kTestUser1);
260 ASSERT_TRUE(user); 260 ASSERT_TRUE(user);
261 EXPECT_TRUE(user->image_is_safe_format()); 261 EXPECT_TRUE(user->image_is_safe_format());
262 // Check image dimensions. Images can't be compared since JPEG is lossy. 262 // Check image dimensions. Images can't be compared since JPEG is lossy.
263 const gfx::ImageSkia& saved_image = GetDefaultImage(kFirstDefaultImageIndex); 263 const gfx::ImageSkia& saved_image = GetDefaultImage(kFirstDefaultImageIndex);
264 EXPECT_EQ(saved_image.width(), user->image().width()); 264 EXPECT_EQ(saved_image.width(), user->image().width());
265 EXPECT_EQ(saved_image.height(), user->image().height()); 265 EXPECT_EQ(saved_image.height(), user->image().height());
266 } 266 }
267 267
268 } // namespace chromeos 268 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_image_loader.cc ('k') | chrome/browser/chromeos/login/user_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698