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/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 EXPECT_EQ(2u, cache.GetNumberOfProfiles()); | 350 EXPECT_EQ(2u, cache.GetNumberOfProfiles()); |
351 size_t managed_index = cache.GetIndexOfProfileWithPath(managed_path); | 351 size_t managed_index = cache.GetIndexOfProfileWithPath(managed_path); |
352 EXPECT_TRUE(cache.IsOmittedProfileAtIndex(managed_index)); | 352 EXPECT_TRUE(cache.IsOmittedProfileAtIndex(managed_index)); |
353 size_t nonmanaged_index = cache.GetIndexOfProfileWithPath(nonmanaged_path); | 353 size_t nonmanaged_index = cache.GetIndexOfProfileWithPath(nonmanaged_path); |
354 EXPECT_FALSE(cache.IsOmittedProfileAtIndex(nonmanaged_index)); | 354 EXPECT_FALSE(cache.IsOmittedProfileAtIndex(nonmanaged_index)); |
355 } | 355 } |
356 | 356 |
357 TEST_F(ProfileManagerTest, GetGuestProfilePath) { | 357 TEST_F(ProfileManagerTest, GetGuestProfilePath) { |
358 base::FilePath guest_path = ProfileManager::GetGuestProfilePath(); | 358 base::FilePath guest_path = ProfileManager::GetGuestProfilePath(); |
359 base::FilePath expected_path = temp_dir_.path(); | 359 base::FilePath expected_path = temp_dir_.path(); |
360 expected_path = expected_path.Append(chrome::kGuestProfileDir); | 360 expected_path = expected_path.AppendASCII(chrome::kGuestProfileDir); |
361 EXPECT_EQ(expected_path, guest_path); | 361 EXPECT_EQ(expected_path, guest_path); |
362 } | 362 } |
363 | 363 |
| 364 TEST_F(ProfileManagerTest, GetUserManagerProfilePath) { |
| 365 base::FilePath path = ProfileManager::GetUserManagerProfilePath(); |
| 366 base::FilePath expected_path = temp_dir_.path(); |
| 367 expected_path = expected_path.AppendASCII(chrome::kUserManagerProfileDir); |
| 368 EXPECT_EQ(expected_path, path); |
| 369 } |
| 370 |
364 class UnittestGuestProfileManager : public UnittestProfileManager { | 371 class UnittestGuestProfileManager : public UnittestProfileManager { |
365 public: | 372 public: |
366 explicit UnittestGuestProfileManager(const base::FilePath& user_data_dir) | 373 explicit UnittestGuestProfileManager(const base::FilePath& user_data_dir) |
367 : UnittestProfileManager(user_data_dir) {} | 374 : UnittestProfileManager(user_data_dir) {} |
368 | 375 |
369 protected: | 376 protected: |
370 virtual Profile* CreateProfileHelper( | 377 virtual Profile* CreateProfileHelper( |
371 const base::FilePath& file_path) OVERRIDE { | 378 const base::FilePath& file_path) OVERRIDE { |
372 TestingProfile::Builder builder; | 379 TestingProfile::Builder builder; |
373 builder.SetGuestSession(); | 380 builder.SetGuestSession(); |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 dest_path2.BaseName().MaybeAsASCII()); | 1113 dest_path2.BaseName().MaybeAsASCII()); |
1107 profile_manager->ScheduleProfileForDeletion(dest_path2, | 1114 profile_manager->ScheduleProfileForDeletion(dest_path2, |
1108 ProfileManager::CreateCallback()); | 1115 ProfileManager::CreateCallback()); |
1109 // Spin the message loop so that all the callbacks can finish running. | 1116 // Spin the message loop so that all the callbacks can finish running. |
1110 base::RunLoop().RunUntilIdle(); | 1117 base::RunLoop().RunUntilIdle(); |
1111 | 1118 |
1112 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); | 1119 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); |
1113 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); | 1120 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); |
1114 } | 1121 } |
1115 #endif // !defined(OS_MACOSX) | 1122 #endif // !defined(OS_MACOSX) |
OLD | NEW |