Index: chrome/browser/profiles/profile_manager_unittest.cc |
diff --git a/chrome/browser/profiles/profile_manager_unittest.cc b/chrome/browser/profiles/profile_manager_unittest.cc |
index 205665c17411610eb9932fd1da22f3e4576f3014..fcc2d19730892b2bca9f09a699f1c7b71859ffc6 100644 |
--- a/chrome/browser/profiles/profile_manager_unittest.cc |
+++ b/chrome/browser/profiles/profile_manager_unittest.cc |
@@ -300,6 +300,59 @@ TEST_F(ProfileManagerTest, GetGuestProfilePath) { |
EXPECT_EQ(expected_path, guest_path); |
} |
+#if defined(OS_CHROMEOS) |
+class UnittestGuestProfileManager : public UnittestProfileManager { |
+ public: |
+ explicit UnittestGuestProfileManager(const base::FilePath& user_data_dir) |
+ : UnittestProfileManager(user_data_dir) {} |
+ |
+ protected: |
+ virtual Profile* CreateProfileHelper( |
+ const base::FilePath& file_path) OVERRIDE { |
+ TestingProfile* testing_profile = new TestingProfile(file_path, NULL); |
+ |
+ TestingProfile::Builder builder; |
+ builder.SetIncognito(); |
+ builder.SetGuestSession(); |
+ builder.SetPath(ProfileManager::GetGuestProfilePath()); |
+ testing_profile->SetOffTheRecordProfile(builder.Build().PassAs<Profile>()); |
+ |
+ return testing_profile; |
+ } |
+}; |
+ |
+class ProfileManagerGuestTest : public ProfileManagerTest { |
Nikita (slow)
2013/12/25 07:48:24
Please add another instance of this test that will
Dmitry Polukhin
2014/01/06 20:26:55
Guest profile is no allowed in multi-profile sessi
|
+ protected: |
+ virtual void SetUp() { |
+ // Create a new temporary directory, and store the path |
+ ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
+ TestingBrowserProcess::GetGlobal()->SetProfileManager( |
+ new UnittestGuestProfileManager(temp_dir_.path())); |
+ |
+ CommandLine* cl = CommandLine::ForCurrentProcess(); |
+ cl->AppendSwitch(switches::kTestType); |
+ cl->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); |
+ cl->AppendSwitch(chromeos::switches::kGuestSession); |
+ cl->AppendSwitch(::switches::kIncognito); |
+ |
+ chromeos::UserManager::Get()->UserLoggedIn( |
+ chromeos::UserManager::kGuestUserName, |
+ chromeos::UserManager::kGuestUserName, |
+ false); |
+ } |
+}; |
+ |
+TEST_F(ProfileManagerGuestTest, GuestProfileIngonito) { |
+ Profile* primary_profile = ProfileManager::GetPrimaryUserProfile(); |
+ EXPECT_TRUE(primary_profile->IsOffTheRecord()); |
+ |
+ Profile* active_profile = ProfileManager::GetActiveUserProfile(); |
+ EXPECT_TRUE(active_profile->IsOffTheRecord()); |
+ |
+ EXPECT_TRUE(active_profile->IsSameProfile(primary_profile)); |
+} |
+#endif |
+ |
TEST_F(ProfileManagerTest, AutoloadProfilesWithBackgroundApps) { |
ProfileManager* profile_manager = g_browser_process->profile_manager(); |
ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |