| OLD | NEW |
| 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 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/common/chrome_paths.h" | 23 #include "chrome/common/chrome_paths.h" |
| 24 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
| 25 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
| 26 #include "chrome/grit/chromium_strings.h" | 26 #include "chrome/grit/chromium_strings.h" |
| 27 #include "chrome/grit/generated_resources.h" | 27 #include "chrome/grit/generated_resources.h" |
| 28 #include "chrome/grit/theme_resources.h" | 28 #include "chrome/grit/theme_resources.h" |
| 29 #include "chrome/test/base/in_process_browser_test.h" | 29 #include "chrome/test/base/in_process_browser_test.h" |
| 30 #include "chrome/test/base/ui_test_utils.h" | 30 #include "chrome/test/base/ui_test_utils.h" |
| 31 #include "chromeos/chromeos_switches.h" | 31 #include "chromeos/chromeos_switches.h" |
| 32 #include "components/prefs/pref_service.h" | 32 #include "components/prefs/pref_service.h" |
| 33 #include "components/session_manager/core/session_manager.h" |
| 33 #include "components/signin/core/browser/signin_manager_base.h" | 34 #include "components/signin/core/browser/signin_manager_base.h" |
| 34 #include "content/public/browser/browser_context.h" | 35 #include "content/public/browser/browser_context.h" |
| 35 #include "content/public/browser/download_item.h" | 36 #include "content/public/browser/download_item.h" |
| 36 #include "content/public/browser/download_manager.h" | 37 #include "content/public/browser/download_manager.h" |
| 37 #include "content/public/test/download_test_observer.h" | 38 #include "content/public/test/download_test_observer.h" |
| 38 #include "net/test/embedded_test_server/embedded_test_server.h" | 39 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 39 #include "net/test/url_request/url_request_slow_download_job.h" | 40 #include "net/test/url_request/url_request_slow_download_job.h" |
| 40 #include "ui/base/l10n/l10n_util.h" | 41 #include "ui/base/l10n/l10n_util.h" |
| 41 #include "ui/message_center/message_center.h" | 42 #include "ui/message_center/message_center.h" |
| 42 #include "ui/message_center/message_center_observer.h" | 43 #include "ui/message_center/message_center_observer.h" |
| (...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 AddUser(kTestAccounts[i], i >= SECONDARY_ACCOUNT_INDEX_START); | 1177 AddUser(kTestAccounts[i], i >= SECONDARY_ACCOUNT_INDEX_START); |
| 1177 } | 1178 } |
| 1178 | 1179 |
| 1179 Profile* GetProfileByIndex(int index) { | 1180 Profile* GetProfileByIndex(int index) { |
| 1180 return chromeos::ProfileHelper::GetProfileByUserIdHash( | 1181 return chromeos::ProfileHelper::GetProfileByUserIdHash( |
| 1181 kTestAccounts[index].hash); | 1182 kTestAccounts[index].hash); |
| 1182 } | 1183 } |
| 1183 | 1184 |
| 1184 // Adds a new user for testing to the current session. | 1185 // Adds a new user for testing to the current session. |
| 1185 void AddUser(const TestAccountInfo& info, bool log_in) { | 1186 void AddUser(const TestAccountInfo& info, bool log_in) { |
| 1186 user_manager::UserManager* const user_manager = | 1187 if (log_in) { |
| 1187 user_manager::UserManager::Get(); | 1188 session_manager::SessionManager::Get()->CreateSession( |
| 1188 if (log_in) | 1189 AccountId::FromUserEmailGaiaId(info.email, info.gaia_id), info.hash); |
| 1189 user_manager->UserLoggedIn( | 1190 } |
| 1190 AccountId::FromUserEmailGaiaId(info.email, info.gaia_id), info.hash, | 1191 user_manager::UserManager::Get()->SaveUserDisplayName( |
| 1191 false); | |
| 1192 user_manager->SaveUserDisplayName( | |
| 1193 AccountId::FromUserEmailGaiaId(info.email, info.gaia_id), | 1192 AccountId::FromUserEmailGaiaId(info.email, info.gaia_id), |
| 1194 base::UTF8ToUTF16(info.display_name)); | 1193 base::UTF8ToUTF16(info.display_name)); |
| 1195 SigninManagerFactory::GetForProfile( | 1194 SigninManagerFactory::GetForProfile( |
| 1196 chromeos::ProfileHelper::GetProfileByUserIdHash(info.hash)) | 1195 chromeos::ProfileHelper::GetProfileByUserIdHash(info.hash)) |
| 1197 ->SetAuthenticatedAccountInfo(info.gaia_id, info.email); | 1196 ->SetAuthenticatedAccountInfo(info.gaia_id, info.email); |
| 1198 } | 1197 } |
| 1199 }; | 1198 }; |
| 1200 | 1199 |
| 1201 IN_PROC_BROWSER_TEST_F(MultiProfileDownloadNotificationTest, | 1200 IN_PROC_BROWSER_TEST_F(MultiProfileDownloadNotificationTest, |
| 1202 PRE_DownloadMultipleFiles) { | 1201 PRE_DownloadMultipleFiles) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1300 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, | 1299 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, |
| 1301 GetNotification(notification_id_user1)->type()); | 1300 GetNotification(notification_id_user1)->type()); |
| 1302 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, | 1301 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, |
| 1303 GetNotification(notification_id_user2_1)->type()); | 1302 GetNotification(notification_id_user2_1)->type()); |
| 1304 // Normal notifications for user2. | 1303 // Normal notifications for user2. |
| 1305 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, | 1304 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, |
| 1306 GetNotification(notification_id_user2_1)->type()); | 1305 GetNotification(notification_id_user2_1)->type()); |
| 1307 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, | 1306 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, |
| 1308 GetNotification(notification_id_user2_2)->type()); | 1307 GetNotification(notification_id_user2_2)->type()); |
| 1309 } | 1308 } |
| OLD | NEW |