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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 #if defined(OS_CHROMEOS) | 50 #if defined(OS_CHROMEOS) |
51 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" | 51 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
52 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" | 52 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" |
53 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 53 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
54 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 54 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
55 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 55 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
56 #include "chrome/browser/chromeos/settings/cros_settings.h" | 56 #include "chrome/browser/chromeos/settings/cros_settings.h" |
57 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 57 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
58 #include "chromeos/chromeos_switches.h" | 58 #include "chromeos/chromeos_switches.h" |
59 #include "chromeos/login/user_names.h" | |
60 #include "components/user_manager/user_manager.h" | 59 #include "components/user_manager/user_manager.h" |
| 60 #include "components/user_manager/user_names.h" |
61 #endif // defined(OS_CHROMEOS) | 61 #endif // defined(OS_CHROMEOS) |
62 | 62 |
63 using base::ASCIIToUTF16; | 63 using base::ASCIIToUTF16; |
64 using content::BrowserThread; | 64 using content::BrowserThread; |
65 | 65 |
66 namespace { | 66 namespace { |
67 | 67 |
68 // This global variable is used to check that value returned to different | 68 // This global variable is used to check that value returned to different |
69 // observers is the same. | 69 // observers is the same. |
70 Profile* g_created_profile; | 70 Profile* g_created_profile; |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 #if defined(OS_CHROMEOS) | 508 #if defined(OS_CHROMEOS) |
509 base::CommandLine* cl = base::CommandLine::ForCurrentProcess(); | 509 base::CommandLine* cl = base::CommandLine::ForCurrentProcess(); |
510 // This switch is needed to skip non-test specific behavior in | 510 // This switch is needed to skip non-test specific behavior in |
511 // ProfileManager (accessing DBusThreadManager). | 511 // ProfileManager (accessing DBusThreadManager). |
512 cl->AppendSwitch(switches::kTestType); | 512 cl->AppendSwitch(switches::kTestType); |
513 | 513 |
514 cl->AppendSwitch(chromeos::switches::kGuestSession); | 514 cl->AppendSwitch(chromeos::switches::kGuestSession); |
515 cl->AppendSwitch(::switches::kIncognito); | 515 cl->AppendSwitch(::switches::kIncognito); |
516 | 516 |
517 chromeos::WallpaperManager::Initialize(); | 517 chromeos::WallpaperManager::Initialize(); |
518 RegisterUser(chromeos::login::kGuestUserName); | 518 RegisterUser(user_manager::kGuestUserName); |
519 #endif | 519 #endif |
520 } | 520 } |
521 }; | 521 }; |
522 | 522 |
523 TEST_F(ProfileManagerGuestTest, GetLastUsedProfileAllowedByPolicy) { | 523 TEST_F(ProfileManagerGuestTest, GetLastUsedProfileAllowedByPolicy) { |
524 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 524 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
525 ASSERT_TRUE(profile_manager); | 525 ASSERT_TRUE(profile_manager); |
526 | 526 |
527 Profile* profile = profile_manager->GetLastUsedProfileAllowedByPolicy(); | 527 Profile* profile = profile_manager->GetLastUsedProfileAllowedByPolicy(); |
528 ASSERT_TRUE(profile); | 528 ASSERT_TRUE(profile); |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 dest_path2.BaseName().MaybeAsASCII()); | 1442 dest_path2.BaseName().MaybeAsASCII()); |
1443 profile_manager->ScheduleProfileForDeletion(dest_path2, | 1443 profile_manager->ScheduleProfileForDeletion(dest_path2, |
1444 ProfileManager::CreateCallback()); | 1444 ProfileManager::CreateCallback()); |
1445 // Spin the message loop so that all the callbacks can finish running. | 1445 // Spin the message loop so that all the callbacks can finish running. |
1446 base::RunLoop().RunUntilIdle(); | 1446 base::RunLoop().RunUntilIdle(); |
1447 | 1447 |
1448 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); | 1448 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); |
1449 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); | 1449 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); |
1450 } | 1450 } |
1451 #endif // !defined(OS_MACOSX) | 1451 #endif // !defined(OS_MACOSX) |
OLD | NEW |