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

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

Issue 219383006: Never create an app list for an incognito profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix cros Created 6 years, 9 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_controller_browsertest.cc
diff --git a/chrome/browser/ui/app_list/app_list_controller_browsertest.cc b/chrome/browser/ui/app_list/app_list_controller_browsertest.cc
index 77477b927167054476f5b1a5d132429e77fe2f20..ea0e0cb227a38c9d0bcfd842b6684cc72eeafcab 100644
--- a/chrome/browser/ui/app_list/app_list_controller_browsertest.cc
+++ b/chrome/browser/ui/app_list/app_list_controller_browsertest.cc
@@ -44,6 +44,46 @@ IN_PROC_BROWSER_TEST_F(AppListControllerBrowserTest, CreateNewWindow) {
browser()->profile()->GetOffTheRecordProfile(), desktop));
}
+// Test creating the app list for an incognito version of the current profile.
+IN_PROC_BROWSER_TEST_F(AppListControllerBrowserTest, RegularThenIncognito) {
+ AppListService* service = test::GetAppListService();
+ // On Ash, the app list always has a profile.
+ if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH)
+ EXPECT_TRUE(service->GetCurrentAppListProfile());
+ else
+ EXPECT_FALSE(service->GetCurrentAppListProfile());
+
+ service->ShowForProfile(browser()->profile());
+ EXPECT_EQ(browser()->profile(), service->GetCurrentAppListProfile());
+
+ AppListControllerDelegate* controller = service->GetControllerDelegate();
+ service->ShowForProfile(browser()->profile()->GetOffTheRecordProfile());
+
+ // Should be showing the same profile.
+ EXPECT_EQ(browser()->profile(), service->GetCurrentAppListProfile());
+
+ // Should not have been reconstructed.
+ EXPECT_EQ(controller, service->GetControllerDelegate());
+
+ // Same checks for CreateForProfile().
+ service->CreateForProfile(browser()->profile()->GetOffTheRecordProfile());
+ EXPECT_EQ(browser()->profile(), service->GetCurrentAppListProfile());
+ EXPECT_EQ(controller, service->GetControllerDelegate());
+}
+
+// Test creating the initial app list for incognito profile.
+IN_PROC_BROWSER_TEST_F(AppListControllerBrowserTest, Incognito) {
+ AppListService* service = test::GetAppListService();
+ if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH)
+ EXPECT_TRUE(service->GetCurrentAppListProfile());
+ else
+ EXPECT_FALSE(service->GetCurrentAppListProfile());
+
+ service->ShowForProfile(browser()->profile()->GetOffTheRecordProfile());
+ // Initial load should have picked the non-incongito profile.
+ EXPECT_EQ(browser()->profile(), service->GetCurrentAppListProfile());
+}
+
// Browser Test for AppListController that observes search result changes.
class AppListControllerSearchResultsBrowserTest
: public ExtensionBrowserTest,
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/app_list_service_mac.mm » ('j') | chrome/browser/ui/app_list/app_list_shower.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698