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