| 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 <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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 293 |
| 294 TestingProfile* profile2 = | 294 TestingProfile* profile2 = |
| 295 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path2)); | 295 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path2)); |
| 296 ASSERT_TRUE(profile2); | 296 ASSERT_TRUE(profile2); |
| 297 | 297 |
| 298 // Force lazy-init of some profile services to simulate use. | 298 // Force lazy-init of some profile services to simulate use. |
| 299 ASSERT_TRUE(profile1->CreateHistoryService(true, false)); | 299 ASSERT_TRUE(profile1->CreateHistoryService(true, false)); |
| 300 EXPECT_TRUE(HistoryServiceFactory::GetForProfile( | 300 EXPECT_TRUE(HistoryServiceFactory::GetForProfile( |
| 301 profile1, ServiceAccessType::EXPLICIT_ACCESS)); | 301 profile1, ServiceAccessType::EXPLICIT_ACCESS)); |
| 302 profile1->CreateBookmarkModel(true); | 302 profile1->CreateBookmarkModel(true); |
| 303 EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile1)); | 303 EXPECT_TRUE(BookmarkModelFactory::GetForBrowserContext(profile1)); |
| 304 profile2->CreateBookmarkModel(true); | 304 profile2->CreateBookmarkModel(true); |
| 305 EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile2)); | 305 EXPECT_TRUE(BookmarkModelFactory::GetForBrowserContext(profile2)); |
| 306 ASSERT_TRUE(profile2->CreateHistoryService(true, false)); | 306 ASSERT_TRUE(profile2->CreateHistoryService(true, false)); |
| 307 EXPECT_TRUE(HistoryServiceFactory::GetForProfile( | 307 EXPECT_TRUE(HistoryServiceFactory::GetForProfile( |
| 308 profile2, ServiceAccessType::EXPLICIT_ACCESS)); | 308 profile2, ServiceAccessType::EXPLICIT_ACCESS)); |
| 309 | 309 |
| 310 // Make sure any pending tasks run before we destroy the profiles. | 310 // Make sure any pending tasks run before we destroy the profiles. |
| 311 base::RunLoop().RunUntilIdle(); | 311 base::RunLoop().RunUntilIdle(); |
| 312 | 312 |
| 313 TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL); | 313 TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL); |
| 314 | 314 |
| 315 // Make sure history cleans up correctly. | 315 // Make sure history cleans up correctly. |
| (...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1442 dest_path2.BaseName().MaybeAsASCII()); | 1442 dest_path2.BaseName().MaybeAsASCII()); |
| 1443 profile_manager->ScheduleProfileForDeletion(dest_path2, | 1443 profile_manager->ScheduleProfileForDeletion(dest_path2, |
| 1444 ProfileManager::CreateCallback()); | 1444 ProfileManager::CreateCallback()); |
| 1445 // Spin the message loop so that all the callbacks can finish running. | 1445 // Spin the message loop so that all the callbacks can finish running. |
| 1446 base::RunLoop().RunUntilIdle(); | 1446 base::RunLoop().RunUntilIdle(); |
| 1447 | 1447 |
| 1448 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); | 1448 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); |
| 1449 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); | 1449 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); |
| 1450 } | 1450 } |
| 1451 #endif // !defined(OS_MACOSX) | 1451 #endif // !defined(OS_MACOSX) |
| OLD | NEW |