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

Side by Side Diff: chrome/browser/profiles/profile_manager_unittest.cc

Issue 2942043002: cros: Tighten profile loading (Closed)
Patch Set: update SystemClock header 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 | « chrome/browser/profiles/profile_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 user_manager::UserManager::Get()->UserLoggedIn( 313 user_manager::UserManager::Get()->UserLoggedIn(
314 AccountId::FromUserEmail(user_id), user_id_hash, false); 314 AccountId::FromUserEmail(user_id), user_id_hash, false);
315 315
316 // Sign-in profile should be returned at this stage. Otherwise, login code 316 // Sign-in profile should be returned at this stage. Otherwise, login code
317 // ends up in an invalid state. Strange things as in http://crbug.com/728683 317 // ends up in an invalid state. Strange things as in http://crbug.com/728683
318 // and http://crbug.com/718734 happens. 318 // and http://crbug.com/718734 happens.
319 EXPECT_TRUE( 319 EXPECT_TRUE(
320 ProfileManager::GetActiveUserProfile()->IsSameProfile(signin_profile)); 320 ProfileManager::GetActiveUserProfile()->IsSameProfile(signin_profile));
321 EXPECT_TRUE( 321 EXPECT_TRUE(
322 ProfileManager::GetPrimaryUserProfile()->IsSameProfile(signin_profile)); 322 ProfileManager::GetPrimaryUserProfile()->IsSameProfile(signin_profile));
323 EXPECT_TRUE( 323
324 ProfileManager::GetLastUsedProfile()->IsSameProfile(signin_profile)); 324 // GetLastUsedProfile() after login but before a user profile is loaded is
325 // fatal.
326 EXPECT_DEATH_IF_SUPPORTED(ProfileManager::GetLastUsedProfile(), ".*");
325 327
326 // Simulate UserSessionManager loads the profile. 328 // Simulate UserSessionManager loads the profile.
327 Profile* const user_profile = 329 Profile* const user_profile =
328 g_browser_process->profile_manager()->GetProfile( 330 g_browser_process->profile_manager()->GetProfile(
329 ProfileHelper::Get()->GetProfilePathByUserIdHash(user_id_hash)); 331 ProfileHelper::Get()->GetProfilePathByUserIdHash(user_id_hash));
330 ASSERT_FALSE(user_profile->IsSameProfile(signin_profile)); 332 ASSERT_FALSE(user_profile->IsSameProfile(signin_profile));
331 333
332 // User profile is returned thereafter. 334 // User profile is returned thereafter.
333 EXPECT_TRUE( 335 EXPECT_TRUE(
334 ProfileManager::GetActiveUserProfile()->IsSameProfile(user_profile)); 336 ProfileManager::GetActiveUserProfile()->IsSameProfile(user_profile));
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 dest_path2.BaseName().MaybeAsASCII()); 1506 dest_path2.BaseName().MaybeAsASCII());
1505 profile_manager->ScheduleProfileForDeletion(dest_path2, 1507 profile_manager->ScheduleProfileForDeletion(dest_path2,
1506 ProfileManager::CreateCallback()); 1508 ProfileManager::CreateCallback());
1507 // Spin the message loop so that all the callbacks can finish running. 1509 // Spin the message loop so that all the callbacks can finish running.
1508 base::RunLoop().RunUntilIdle(); 1510 base::RunLoop().RunUntilIdle();
1509 1511
1510 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); 1512 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath());
1511 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); 1513 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed));
1512 } 1514 }
1513 #endif // !defined(OS_MACOSX) 1515 #endif // !defined(OS_MACOSX)
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698