| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "chrome/browser/profiles/profile_info_cache.h" | 6 #include "chrome/browser/profiles/profile_info_cache.h" |
| 7 #include "chrome/browser/profiles/profile_manager.h" | 7 #include "chrome/browser/profiles/profile_manager.h" |
| 8 #include "chrome/test/base/in_process_browser_test.h" | 8 #include "chrome/test/base/in_process_browser_test.h" |
| 9 #include "chrome/test/base/testing_browser_process.h" | 9 #include "chrome/test/base/testing_browser_process.h" |
| 10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 // We should start out with 1 profile. | 38 // We should start out with 1 profile. |
| 39 ASSERT_EQ(cache.GetNumberOfProfiles(), 1U); | 39 ASSERT_EQ(cache.GetNumberOfProfiles(), 1U); |
| 40 | 40 |
| 41 // Delete singleton profile. | 41 // Delete singleton profile. |
| 42 FilePath singleton_profile_path = cache.GetPathOfProfileAtIndex(0); | 42 FilePath singleton_profile_path = cache.GetPathOfProfileAtIndex(0); |
| 43 EXPECT_FALSE(singleton_profile_path.empty()); | 43 EXPECT_FALSE(singleton_profile_path.empty()); |
| 44 profile_manager->ScheduleProfileForDeletion(singleton_profile_path); | 44 profile_manager->ScheduleProfileForDeletion(singleton_profile_path); |
| 45 | 45 |
| 46 // Spin things till profile is actually deleted. | 46 // Spin things till profile is actually deleted. |
| 47 ui_test_utils::RunAllPendingInMessageLoop(); | 47 content::RunAllPendingInMessageLoop(); |
| 48 | 48 |
| 49 // Make sure a new profile was created automatically. | 49 // Make sure a new profile was created automatically. |
| 50 EXPECT_EQ(cache.GetNumberOfProfiles(), 1U); | 50 EXPECT_EQ(cache.GetNumberOfProfiles(), 1U); |
| 51 FilePath new_profile_path = cache.GetPathOfProfileAtIndex(0); | 51 FilePath new_profile_path = cache.GetPathOfProfileAtIndex(0); |
| 52 EXPECT_NE(new_profile_path, singleton_profile_path); | 52 EXPECT_NE(new_profile_path, singleton_profile_path); |
| 53 | 53 |
| 54 // Make sure that last used profile preference is set correctly. | 54 // Make sure that last used profile preference is set correctly. |
| 55 Profile* last_used = ProfileManager::GetLastUsedProfile(); | 55 Profile* last_used = ProfileManager::GetLastUsedProfile(); |
| 56 EXPECT_EQ(new_profile_path, last_used->GetPath()); | 56 EXPECT_EQ(new_profile_path, last_used->GetPath()); |
| 57 } | 57 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 84 | 84 |
| 85 // Delete all profiles. | 85 // Delete all profiles. |
| 86 FilePath profile_path1 = cache.GetPathOfProfileAtIndex(0); | 86 FilePath profile_path1 = cache.GetPathOfProfileAtIndex(0); |
| 87 FilePath profile_path2 = cache.GetPathOfProfileAtIndex(1); | 87 FilePath profile_path2 = cache.GetPathOfProfileAtIndex(1); |
| 88 EXPECT_FALSE(profile_path1.empty()); | 88 EXPECT_FALSE(profile_path1.empty()); |
| 89 EXPECT_FALSE(profile_path2.empty()); | 89 EXPECT_FALSE(profile_path2.empty()); |
| 90 profile_manager->ScheduleProfileForDeletion(profile_path1); | 90 profile_manager->ScheduleProfileForDeletion(profile_path1); |
| 91 profile_manager->ScheduleProfileForDeletion(profile_path2); | 91 profile_manager->ScheduleProfileForDeletion(profile_path2); |
| 92 | 92 |
| 93 // Spin things so deletion can take place. | 93 // Spin things so deletion can take place. |
| 94 ui_test_utils::RunAllPendingInMessageLoop(); | 94 content::RunAllPendingInMessageLoop(); |
| 95 | 95 |
| 96 // Make sure a new profile was created automatically. | 96 // Make sure a new profile was created automatically. |
| 97 EXPECT_EQ(cache.GetNumberOfProfiles(), 1U); | 97 EXPECT_EQ(cache.GetNumberOfProfiles(), 1U); |
| 98 FilePath new_profile_path = cache.GetPathOfProfileAtIndex(0); | 98 FilePath new_profile_path = cache.GetPathOfProfileAtIndex(0); |
| 99 EXPECT_NE(new_profile_path, profile_path1); | 99 EXPECT_NE(new_profile_path, profile_path1); |
| 100 EXPECT_NE(new_profile_path, profile_path2); | 100 EXPECT_NE(new_profile_path, profile_path2); |
| 101 | 101 |
| 102 // Make sure that last used profile preference is set correctly. | 102 // Make sure that last used profile preference is set correctly. |
| 103 Profile* last_used = ProfileManager::GetLastUsedProfile(); | 103 Profile* last_used = ProfileManager::GetLastUsedProfile(); |
| 104 EXPECT_EQ(new_profile_path, last_used->GetPath()); | 104 EXPECT_EQ(new_profile_path, last_used->GetPath()); |
| 105 } | 105 } |
| 106 #endif // OS_MACOSX | 106 #endif // OS_MACOSX |
| OLD | NEW |