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

Unified Diff: chrome/browser/ui/app_list/app_list_service_unittest.cc

Issue 1106453002: Fixed app launcher crashing trying to load guest profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Windows compile. Created 5 years, 7 months 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
Index: chrome/browser/ui/app_list/app_list_service_unittest.cc
diff --git a/chrome/browser/ui/app_list/app_list_service_unittest.cc b/chrome/browser/ui/app_list/app_list_service_unittest.cc
index 55f99687a8a0b0f9331738a177c7574d89f3258b..ef40d7fa7af44d74c567dc94ce9d7e270ba6cc86 100644
--- a/chrome/browser/ui/app_list/app_list_service_unittest.cc
+++ b/chrome/browser/ui/app_list/app_list_service_unittest.cc
@@ -168,6 +168,31 @@ TEST_F(AppListServiceUnitTest,
EXPECT_EQ(0, service_->destroy_app_list_call_count());
}
+TEST_F(AppListServiceUnitTest, RefusesToLoadGuestAppListProfile) {
+ // Unlikely, but if somehow the user's app_list.profile pref was set to the
+ // guest profile, make sure we refuse to load it (or it would crash).
+ local_state_->SetString(
+ prefs::kAppListProfile,
+ base::FilePath(chrome::kGuestProfileDir).MaybeAsASCII());
+ local_state_->SetString(prefs::kProfileLastUsed, "last-used");
+ base::FilePath last_used_profile_path =
+ user_data_dir_.AppendASCII("last-used");
+ EXPECT_EQ(last_used_profile_path,
+ service_->GetProfilePath(profile_store_->GetUserDataDir()));
+}
+
+TEST_F(AppListServiceUnitTest, RefusesToLoadGuestLastUsedProfile) {
+ // If the user's most recent browser session was a guest session, make sure we
+ // do not open a guest profile in the launcher (which would crash).
+ local_state_->SetString(
+ prefs::kProfileLastUsed,
+ base::FilePath(chrome::kGuestProfileDir).MaybeAsASCII());
+ base::FilePath initial_profile_path =
+ user_data_dir_.AppendASCII(chrome::kInitialProfile);
+ EXPECT_EQ(initial_profile_path,
+ service_->GetProfilePath(profile_store_->GetUserDataDir()));
+}
+
TEST_F(AppListServiceUnitTest, SwitchingProfilesPersists) {
profile_store_->LoadProfile(profile1_.get());
profile_store_->LoadProfile(profile2_.get());
« no previous file with comments | « chrome/browser/ui/app_list/app_list_service_mac.mm ('k') | chrome/browser/ui/app_list/app_list_service_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698