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/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 base::FilePath dest_path2 = temp_dir_.path(); | 753 base::FilePath dest_path2 = temp_dir_.path(); |
754 dest_path2 = dest_path2.Append(FILE_PATH_LITERAL("New Profile 2")); | 754 dest_path2 = dest_path2.Append(FILE_PATH_LITERAL("New Profile 2")); |
755 | 755 |
756 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 756 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
757 | 757 |
758 // Successfully create the profiles. | 758 // Successfully create the profiles. |
759 TestingProfile* profile1 = | 759 TestingProfile* profile1 = |
760 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path1)); | 760 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path1)); |
761 ASSERT_TRUE(profile1); | 761 ASSERT_TRUE(profile1); |
762 | 762 |
763 // Incognito profiles should not be managed by the profile manager but by the | |
764 // original profile. | |
765 TestingProfile::Builder builder; | |
766 builder.SetIncognito(); | |
767 scoped_ptr<TestingProfile> profile2 = builder.Build(); | |
768 profile1->SetOffTheRecordProfile(profile2.PassAs<Profile>()); | |
769 | |
770 std::vector<Profile*> last_opened_profiles = | 763 std::vector<Profile*> last_opened_profiles = |
771 profile_manager->GetLastOpenedProfiles(); | 764 profile_manager->GetLastOpenedProfiles(); |
772 ASSERT_EQ(0U, last_opened_profiles.size()); | 765 ASSERT_EQ(0U, last_opened_profiles.size()); |
773 | 766 |
774 // Create a browser for profile1. | 767 // Create a browser for profile1. |
775 Browser::CreateParams profile1_params(profile1, chrome::GetActiveDesktop()); | 768 Browser::CreateParams profile1_params(profile1, chrome::GetActiveDesktop()); |
776 scoped_ptr<Browser> browser1( | 769 scoped_ptr<Browser> browser1( |
777 chrome::CreateBrowserWithTestWindowForParams(&profile1_params)); | 770 chrome::CreateBrowserWithTestWindowForParams(&profile1_params)); |
778 | 771 |
779 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); | 772 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1279 dest_path2.BaseName().MaybeAsASCII()); | 1272 dest_path2.BaseName().MaybeAsASCII()); |
1280 profile_manager->ScheduleProfileForDeletion(dest_path2, | 1273 profile_manager->ScheduleProfileForDeletion(dest_path2, |
1281 ProfileManager::CreateCallback()); | 1274 ProfileManager::CreateCallback()); |
1282 // Spin the message loop so that all the callbacks can finish running. | 1275 // Spin the message loop so that all the callbacks can finish running. |
1283 base::RunLoop().RunUntilIdle(); | 1276 base::RunLoop().RunUntilIdle(); |
1284 | 1277 |
1285 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); | 1278 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); |
1286 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); | 1279 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); |
1287 } | 1280 } |
1288 #endif // !defined(OS_MACOSX) | 1281 #endif // !defined(OS_MACOSX) |
OLD | NEW |