| 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/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 TestingProfile* profile1 = | 256 TestingProfile* profile1 = |
| 257 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path1)); | 257 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path1)); |
| 258 ASSERT_TRUE(profile1); | 258 ASSERT_TRUE(profile1); |
| 259 | 259 |
| 260 TestingProfile* profile2 = | 260 TestingProfile* profile2 = |
| 261 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path2)); | 261 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path2)); |
| 262 ASSERT_TRUE(profile2); | 262 ASSERT_TRUE(profile2); |
| 263 | 263 |
| 264 // Force lazy-init of some profile services to simulate use. | 264 // Force lazy-init of some profile services to simulate use. |
| 265 ASSERT_TRUE(profile1->CreateHistoryService(true, false)); | 265 ASSERT_TRUE(profile1->CreateHistoryService(true, false)); |
| 266 EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile1, | 266 EXPECT_TRUE(HistoryServiceFactory::GetForProfile( |
| 267 Profile::EXPLICIT_ACCESS)); | 267 profile1, ServiceAccessType::EXPLICIT_ACCESS)); |
| 268 profile1->CreateBookmarkModel(true); | 268 profile1->CreateBookmarkModel(true); |
| 269 EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile1)); | 269 EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile1)); |
| 270 profile2->CreateBookmarkModel(true); | 270 profile2->CreateBookmarkModel(true); |
| 271 EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile2)); | 271 EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile2)); |
| 272 ASSERT_TRUE(profile2->CreateHistoryService(true, false)); | 272 ASSERT_TRUE(profile2->CreateHistoryService(true, false)); |
| 273 EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile2, | 273 EXPECT_TRUE(HistoryServiceFactory::GetForProfile( |
| 274 Profile::EXPLICIT_ACCESS)); | 274 profile2, ServiceAccessType::EXPLICIT_ACCESS)); |
| 275 | 275 |
| 276 // Make sure any pending tasks run before we destroy the profiles. | 276 // Make sure any pending tasks run before we destroy the profiles. |
| 277 base::RunLoop().RunUntilIdle(); | 277 base::RunLoop().RunUntilIdle(); |
| 278 | 278 |
| 279 TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL); | 279 TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL); |
| 280 | 280 |
| 281 // Make sure history cleans up correctly. | 281 // Make sure history cleans up correctly. |
| 282 base::RunLoop().RunUntilIdle(); | 282 base::RunLoop().RunUntilIdle(); |
| 283 } | 283 } |
| 284 | 284 |
| (...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1291 dest_path2.BaseName().MaybeAsASCII()); | 1291 dest_path2.BaseName().MaybeAsASCII()); |
| 1292 profile_manager->ScheduleProfileForDeletion(dest_path2, | 1292 profile_manager->ScheduleProfileForDeletion(dest_path2, |
| 1293 ProfileManager::CreateCallback()); | 1293 ProfileManager::CreateCallback()); |
| 1294 // Spin the message loop so that all the callbacks can finish running. | 1294 // Spin the message loop so that all the callbacks can finish running. |
| 1295 base::RunLoop().RunUntilIdle(); | 1295 base::RunLoop().RunUntilIdle(); |
| 1296 | 1296 |
| 1297 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); | 1297 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); |
| 1298 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); | 1298 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); |
| 1299 } | 1299 } |
| 1300 #endif // !defined(OS_MACOSX) | 1300 #endif // !defined(OS_MACOSX) |
| OLD | NEW |