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

Side by Side Diff: chrome/browser/download/notification/download_notification_browsertest.cc

Issue 2918203002: cros: Fix loading user profile w/o UserSessionManager (Closed)
Patch Set: rebase 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h> 5 #include <stddef.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 1169
1170 // Loads all users to the current session and sets up necessary fields. 1170 // Loads all users to the current session and sets up necessary fields.
1171 // This is used for preparing all accounts in PRE_ test setup, and for testing 1171 // This is used for preparing all accounts in PRE_ test setup, and for testing
1172 // actual login behavior. 1172 // actual login behavior.
1173 void AddAllUsers() { 1173 void AddAllUsers() {
1174 for (size_t i = 0; i < arraysize(kTestAccounts); ++i) 1174 for (size_t i = 0; i < arraysize(kTestAccounts); ++i)
1175 AddUser(kTestAccounts[i], i >= SECONDARY_ACCOUNT_INDEX_START); 1175 AddUser(kTestAccounts[i], i >= SECONDARY_ACCOUNT_INDEX_START);
1176 } 1176 }
1177 1177
1178 Profile* GetProfileByIndex(int index) { 1178 Profile* GetProfileByIndex(int index) {
1179 return chromeos::ProfileHelper::GetProfileByUserIdHash( 1179 return chromeos::ProfileHelper::GetProfileByUserIdHashForTest(
1180 kTestAccounts[index].hash); 1180 kTestAccounts[index].hash);
1181 } 1181 }
1182 1182
1183 // Adds a new user for testing to the current session. 1183 // Adds a new user for testing to the current session.
1184 void AddUser(const TestAccountInfo& info, bool log_in) { 1184 void AddUser(const TestAccountInfo& info, bool log_in) {
1185 if (log_in) { 1185 if (log_in) {
1186 session_manager::SessionManager::Get()->CreateSession( 1186 session_manager::SessionManager::Get()->CreateSession(
1187 AccountId::FromUserEmailGaiaId(info.email, info.gaia_id), info.hash); 1187 AccountId::FromUserEmailGaiaId(info.email, info.gaia_id), info.hash);
1188 } 1188 }
1189 user_manager::UserManager::Get()->SaveUserDisplayName( 1189 user_manager::UserManager::Get()->SaveUserDisplayName(
1190 AccountId::FromUserEmailGaiaId(info.email, info.gaia_id), 1190 AccountId::FromUserEmailGaiaId(info.email, info.gaia_id),
1191 base::UTF8ToUTF16(info.display_name)); 1191 base::UTF8ToUTF16(info.display_name));
1192 SigninManagerFactory::GetForProfile( 1192 SigninManagerFactory::GetForProfile(
1193 chromeos::ProfileHelper::GetProfileByUserIdHash(info.hash)) 1193 chromeos::ProfileHelper::GetProfileByUserIdHashForTest(info.hash))
1194 ->SetAuthenticatedAccountInfo(info.gaia_id, info.email); 1194 ->SetAuthenticatedAccountInfo(info.gaia_id, info.email);
1195 } 1195 }
1196 }; 1196 };
1197 1197
1198 IN_PROC_BROWSER_TEST_F(MultiProfileDownloadNotificationTest, 1198 IN_PROC_BROWSER_TEST_F(MultiProfileDownloadNotificationTest,
1199 PRE_DownloadMultipleFiles) { 1199 PRE_DownloadMultipleFiles) {
1200 AddAllUsers(); 1200 AddAllUsers();
1201 } 1201 }
1202 1202
1203 IN_PROC_BROWSER_TEST_F(MultiProfileDownloadNotificationTest, 1203 IN_PROC_BROWSER_TEST_F(MultiProfileDownloadNotificationTest,
1204 DownloadMultipleFiles) { 1204 DownloadMultipleFiles) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, 1297 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT,
1298 GetNotification(notification_id_user1)->type()); 1298 GetNotification(notification_id_user1)->type());
1299 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, 1299 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT,
1300 GetNotification(notification_id_user2_1)->type()); 1300 GetNotification(notification_id_user2_1)->type());
1301 // Normal notifications for user2. 1301 // Normal notifications for user2.
1302 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, 1302 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT,
1303 GetNotification(notification_id_user2_1)->type()); 1303 GetNotification(notification_id_user2_1)->type());
1304 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, 1304 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT,
1305 GetNotification(notification_id_user2_2)->type()); 1305 GetNotification(notification_id_user2_2)->type());
1306 } 1306 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698