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, |