| 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 18 matching lines...) Expand all Loading... |
| 29 #include "chrome/browser/ui/browser.h" | 29 #include "chrome/browser/ui/browser.h" |
| 30 #include "chrome/common/chrome_constants.h" | 30 #include "chrome/common/chrome_constants.h" |
| 31 #include "chrome/common/chrome_paths.h" | 31 #include "chrome/common/chrome_paths.h" |
| 32 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
| 33 #include "chrome/common/pref_names.h" | 33 #include "chrome/common/pref_names.h" |
| 34 #include "chrome/test/base/scoped_testing_local_state.h" | 34 #include "chrome/test/base/scoped_testing_local_state.h" |
| 35 #include "chrome/test/base/test_browser_window.h" | 35 #include "chrome/test/base/test_browser_window.h" |
| 36 #include "chrome/test/base/testing_browser_process.h" | 36 #include "chrome/test/base/testing_browser_process.h" |
| 37 #include "chrome/test/base/testing_profile.h" | 37 #include "chrome/test/base/testing_profile.h" |
| 38 #include "content/public/browser/notification_service.h" | 38 #include "content/public/browser/notification_service.h" |
| 39 #include "content/public/common/content_switches.h" |
| 39 #include "content/public/test/test_browser_thread_bundle.h" | 40 #include "content/public/test/test_browser_thread_bundle.h" |
| 40 #include "grit/generated_resources.h" | 41 #include "grit/generated_resources.h" |
| 41 #include "testing/gmock/include/gmock/gmock.h" | 42 #include "testing/gmock/include/gmock/gmock.h" |
| 42 #include "testing/gtest/include/gtest/gtest.h" | 43 #include "testing/gtest/include/gtest/gtest.h" |
| 43 #include "ui/base/l10n/l10n_util.h" | 44 #include "ui/base/l10n/l10n_util.h" |
| 44 | 45 |
| 45 #if defined(OS_CHROMEOS) | 46 #if defined(OS_CHROMEOS) |
| 46 #include "chrome/browser/chromeos/login/mock_user_manager.h" | 47 #include "chrome/browser/chromeos/login/mock_user_manager.h" |
| 47 #include "chrome/browser/chromeos/login/user_manager.h" | 48 #include "chrome/browser/chromeos/login/user_manager.h" |
| 48 #include "chrome/browser/chromeos/settings/cros_settings.h" | 49 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 386 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 386 TestingBrowserProcess::GetGlobal()->SetProfileManager( | 387 TestingBrowserProcess::GetGlobal()->SetProfileManager( |
| 387 new UnittestGuestProfileManager(temp_dir_.path())); | 388 new UnittestGuestProfileManager(temp_dir_.path())); |
| 388 | 389 |
| 389 #if defined(OS_CHROMEOS) | 390 #if defined(OS_CHROMEOS) |
| 390 CommandLine* cl = CommandLine::ForCurrentProcess(); | 391 CommandLine* cl = CommandLine::ForCurrentProcess(); |
| 391 if (GetParam()) | 392 if (GetParam()) |
| 392 cl->AppendSwitch(switches::kMultiProfiles); | 393 cl->AppendSwitch(switches::kMultiProfiles); |
| 393 | 394 |
| 394 cl->AppendSwitch(switches::kTestType); | 395 cl->AppendSwitch(switches::kTestType); |
| 395 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles)) { | 396 if (profiles::IsMultipleProfilesEnabled()) { |
| 396 cl->AppendSwitchASCII(chromeos::switches::kLoginProfile, | 397 cl->AppendSwitchASCII(chromeos::switches::kLoginProfile, |
| 397 std::string(chrome::kProfileDirPrefix) + | 398 std::string(chrome::kProfileDirPrefix) + |
| 398 chromeos::UserManager::kGuestUserName); | 399 chromeos::UserManager::kGuestUserName); |
| 399 } else { | 400 } else { |
| 400 cl->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); | 401 cl->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); |
| 401 } | 402 } |
| 402 cl->AppendSwitch(chromeos::switches::kGuestSession); | 403 cl->AppendSwitch(chromeos::switches::kGuestSession); |
| 403 cl->AppendSwitch(::switches::kIncognito); | 404 cl->AppendSwitch(::switches::kIncognito); |
| 404 | 405 |
| 405 chromeos::UserManager::Get()->UserLoggedIn( | 406 chromeos::UserManager::Get()->UserLoggedIn( |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 dest_path2.BaseName().MaybeAsASCII()); | 1107 dest_path2.BaseName().MaybeAsASCII()); |
| 1107 profile_manager->ScheduleProfileForDeletion(dest_path2, | 1108 profile_manager->ScheduleProfileForDeletion(dest_path2, |
| 1108 ProfileManager::CreateCallback()); | 1109 ProfileManager::CreateCallback()); |
| 1109 // Spin the message loop so that all the callbacks can finish running. | 1110 // Spin the message loop so that all the callbacks can finish running. |
| 1110 base::RunLoop().RunUntilIdle(); | 1111 base::RunLoop().RunUntilIdle(); |
| 1111 | 1112 |
| 1112 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); | 1113 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); |
| 1113 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); | 1114 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); |
| 1114 } | 1115 } |
| 1115 #endif // !defined(OS_MACOSX) | 1116 #endif // !defined(OS_MACOSX) |
| OLD | NEW |