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

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: 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..efc80af5da8a090f318cfb68410020b1199b4d97 100644
--- a/chrome/browser/profiles/profile_manager_unittest.cc
+++ b/chrome/browser/profiles/profile_manager_unittest.cc
@@ -300,6 +300,62 @@ 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 {
+ 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) {
+ ProfileManager::AllowGetDefaultProfile();
Mr4D (OOO till 08-26) 2013/12/20 23:39:57 This function doesn't exist anymore (landed a patc
Dmitry Polukhin 2013/12/21 00:04:56 Excellent! This was artifact that has nothing with
+
+ ProfileManager* profile_manager = g_browser_process->profile_manager();
+ Profile* primary_profile = profile_manager->GetPrimaryUserProfile();
Mr4D (OOO till 08-26) 2013/12/20 23:39:57 Nit: Since Get*UserProfile function is static - an
Dmitry Polukhin 2013/12/21 00:04:56 Done. Because these functions are not virtual over
+ EXPECT_TRUE(primary_profile->IsOffTheRecord());
+
+ Profile* active_profile = profile_manager->GetActiveUserProfile();
Mr4D (OOO till 08-26) 2013/12/20 23:39:57 Same here.
Dmitry Polukhin 2013/12/21 00:04:56 Done.
+ 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