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

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: rebase Created 6 years, 1 month 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 | « no previous file | chrome/browser/ui/app_list/app_list_service_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 874f47fb44ba33d9219c00d0a537ca4b08362e69..77caf7e2616105fb12af7adbf74e5df8cf3958e3 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,50 @@ 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 set of tests using ShowForAppInstall, which the webstore uses and was
+ // traditionally where issues with incognito-mode app launchers started. Pass
+ // true for start_discovery_tracking to emulate what the webstore does on the
+ // first app install, to cover AppListServiceImpl::CreateForProfile().
+ service->ShowForAppInstall(
+ browser()->profile()->GetOffTheRecordProfile(), "", true);
+ 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698