| 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 26 matching lines...) Expand all Loading... |
| 37 #include "chrome/test/base/testing_profile.h" | 37 #include "chrome/test/base/testing_profile.h" |
| 38 #include "components/signin/core/common/profile_management_switches.h" | 38 #include "components/signin/core/common/profile_management_switches.h" |
| 39 #include "content/public/browser/notification_service.h" | 39 #include "content/public/browser/notification_service.h" |
| 40 #include "content/public/common/content_switches.h" | 40 #include "content/public/common/content_switches.h" |
| 41 #include "content/public/test/test_browser_thread_bundle.h" | 41 #include "content/public/test/test_browser_thread_bundle.h" |
| 42 #include "testing/gmock/include/gmock/gmock.h" | 42 #include "testing/gmock/include/gmock/gmock.h" |
| 43 #include "testing/gtest/include/gtest/gtest.h" | 43 #include "testing/gtest/include/gtest/gtest.h" |
| 44 #include "ui/base/l10n/l10n_util.h" | 44 #include "ui/base/l10n/l10n_util.h" |
| 45 | 45 |
| 46 #if defined(OS_CHROMEOS) | 46 #if defined(OS_CHROMEOS) |
| 47 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" | 47 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
| 48 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" | 48 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" |
| 49 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 49 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
| 50 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 50 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 51 #include "chrome/browser/chromeos/settings/cros_settings.h" | 51 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 52 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 52 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 53 #include "chromeos/chromeos_switches.h" | 53 #include "chromeos/chromeos_switches.h" |
| 54 #include "chromeos/login/user_names.h" | 54 #include "chromeos/login/user_names.h" |
| 55 #include "components/user_manager/user_manager.h" | 55 #include "components/user_manager/user_manager.h" |
| 56 #endif // defined(OS_CHROMEOS) | 56 #endif // defined(OS_CHROMEOS) |
| 57 | 57 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 215 |
| 216 // This functionality only exists on Chrome OS. | 216 // This functionality only exists on Chrome OS. |
| 217 TEST_F(ProfileManagerTest, LoggedInProfileDir) { | 217 TEST_F(ProfileManagerTest, LoggedInProfileDir) { |
| 218 base::FilePath expected_default = | 218 base::FilePath expected_default = |
| 219 base::FilePath().AppendASCII(chrome::kInitialProfile); | 219 base::FilePath().AppendASCII(chrome::kInitialProfile); |
| 220 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 220 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 221 EXPECT_EQ(expected_default.value(), | 221 EXPECT_EQ(expected_default.value(), |
| 222 profile_manager->GetInitialProfileDir().value()); | 222 profile_manager->GetInitialProfileDir().value()); |
| 223 | 223 |
| 224 const char kTestUserName[] = "test-user@example.com"; | 224 const char kTestUserName[] = "test-user@example.com"; |
| 225 chromeos::FakeUserManager* user_manager = new chromeos::FakeUserManager(); | 225 chromeos::FakeChromeUserManager* user_manager = |
| 226 new chromeos::FakeChromeUserManager(); |
| 226 chromeos::ScopedUserManagerEnabler enabler(user_manager); | 227 chromeos::ScopedUserManagerEnabler enabler(user_manager); |
| 227 | 228 |
| 228 const user_manager::User* active_user = user_manager->AddUser(kTestUserName); | 229 const user_manager::User* active_user = user_manager->AddUser(kTestUserName); |
| 229 user_manager->LoginUser(kTestUserName); | 230 user_manager->LoginUser(kTestUserName); |
| 230 user_manager->SwitchActiveUser(kTestUserName); | 231 user_manager->SwitchActiveUser(kTestUserName); |
| 231 | 232 |
| 232 profile_manager->Observe( | 233 profile_manager->Observe( |
| 233 chrome::NOTIFICATION_LOGIN_USER_CHANGED, | 234 chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
| 234 content::NotificationService::AllSources(), | 235 content::NotificationService::AllSources(), |
| 235 content::Details<const user_manager::User>(active_user)); | 236 content::Details<const user_manager::User>(active_user)); |
| (...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1298 dest_path2.BaseName().MaybeAsASCII()); | 1299 dest_path2.BaseName().MaybeAsASCII()); |
| 1299 profile_manager->ScheduleProfileForDeletion(dest_path2, | 1300 profile_manager->ScheduleProfileForDeletion(dest_path2, |
| 1300 ProfileManager::CreateCallback()); | 1301 ProfileManager::CreateCallback()); |
| 1301 // Spin the message loop so that all the callbacks can finish running. | 1302 // Spin the message loop so that all the callbacks can finish running. |
| 1302 base::RunLoop().RunUntilIdle(); | 1303 base::RunLoop().RunUntilIdle(); |
| 1303 | 1304 |
| 1304 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); | 1305 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); |
| 1305 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); | 1306 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); |
| 1306 } | 1307 } |
| 1307 #endif // !defined(OS_MACOSX) | 1308 #endif // !defined(OS_MACOSX) |
| OLD | NEW |