Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2442)

Unified Diff: chrome/browser/profiles/profile_manager_unittest.cc

Issue 115073003: Test that Guest profile is Incognito (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase + comments Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/settings/device_settings_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « chrome/browser/chromeos/settings/device_settings_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698