| OLD | NEW |
| 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/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 // Successfully create the profiles. | 208 // Successfully create the profiles. |
| 209 TestingProfile* profile1 = | 209 TestingProfile* profile1 = |
| 210 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path1)); | 210 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path1)); |
| 211 ASSERT_TRUE(profile1); | 211 ASSERT_TRUE(profile1); |
| 212 | 212 |
| 213 TestingProfile* profile2 = | 213 TestingProfile* profile2 = |
| 214 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path2)); | 214 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path2)); |
| 215 ASSERT_TRUE(profile2); | 215 ASSERT_TRUE(profile2); |
| 216 | 216 |
| 217 // Force lazy-init of some profile services to simulate use. | 217 // Force lazy-init of some profile services to simulate use. |
| 218 profile1->CreateHistoryService(true, false); | 218 ASSERT_TRUE(profile1->CreateHistoryService(true, false)); |
| 219 EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile1, | 219 EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile1, |
| 220 Profile::EXPLICIT_ACCESS)); | 220 Profile::EXPLICIT_ACCESS)); |
| 221 profile1->CreateBookmarkModel(true); | 221 profile1->CreateBookmarkModel(true); |
| 222 EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile1)); | 222 EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile1)); |
| 223 profile2->CreateBookmarkModel(true); | 223 profile2->CreateBookmarkModel(true); |
| 224 EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile2)); | 224 EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile2)); |
| 225 profile2->CreateHistoryService(true, false); | 225 ASSERT_TRUE(profile2->CreateHistoryService(true, false)); |
| 226 EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile2, | 226 EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile2, |
| 227 Profile::EXPLICIT_ACCESS)); | 227 Profile::EXPLICIT_ACCESS)); |
| 228 | 228 |
| 229 // Make sure any pending tasks run before we destroy the profiles. | 229 // Make sure any pending tasks run before we destroy the profiles. |
| 230 base::RunLoop().RunUntilIdle(); | 230 base::RunLoop().RunUntilIdle(); |
| 231 | 231 |
| 232 TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL); | 232 TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL); |
| 233 | 233 |
| 234 // Make sure history cleans up correctly. | 234 // Make sure history cleans up correctly. |
| 235 base::RunLoop().RunUntilIdle(); | 235 base::RunLoop().RunUntilIdle(); |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 dest_path2.BaseName().MaybeAsASCII()); | 764 dest_path2.BaseName().MaybeAsASCII()); |
| 765 profile_manager->ScheduleProfileForDeletion(dest_path2, | 765 profile_manager->ScheduleProfileForDeletion(dest_path2, |
| 766 ProfileManager::CreateCallback()); | 766 ProfileManager::CreateCallback()); |
| 767 // Spin the message loop so that all the callbacks can finish running. | 767 // Spin the message loop so that all the callbacks can finish running. |
| 768 base::RunLoop().RunUntilIdle(); | 768 base::RunLoop().RunUntilIdle(); |
| 769 | 769 |
| 770 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); | 770 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); |
| 771 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); | 771 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); |
| 772 } | 772 } |
| 773 #endif // !defined(OS_MACOSX) | 773 #endif // !defined(OS_MACOSX) |
| OLD | NEW |