Chromium Code Reviews| Index: chrome/browser/ui/app_list/app_list_service_interactive_uitest.cc |
| diff --git a/chrome/browser/ui/app_list/app_list_service_interactive_uitest.cc b/chrome/browser/ui/app_list/app_list_service_interactive_uitest.cc |
| index f8690d71d2cfab2defa6a590b125ddb1b68890ef..3f66558f77d9f53d99deef183126383b93338768 100644 |
| --- a/chrome/browser/ui/app_list/app_list_service_interactive_uitest.cc |
| +++ b/chrome/browser/ui/app_list/app_list_service_interactive_uitest.cc |
| @@ -12,17 +12,21 @@ |
| #include "base/strings/utf_string_conversions.h" |
| #include "chrome/browser/browser_process.h" |
| #include "chrome/browser/profiles/profile.h" |
| +#include "chrome/browser/profiles/profile_info_cache.h" |
| #include "chrome/browser/profiles/profile_manager.h" |
| #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
| #include "chrome/browser/ui/app_list/test/chrome_app_list_test_support.h" |
| #include "chrome/browser/ui/browser.h" |
| #include "chrome/browser/ui/host_desktop.h" |
| #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| +#include "chrome/browser/ui/user_manager.h" |
| #include "chrome/common/chrome_constants.h" |
| #include "chrome/common/chrome_paths.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/pref_names.h" |
| #include "chrome/test/base/in_process_browser_test.h" |
| +#include "chrome/test/base/testing_browser_process.h" |
| +#include "chrome/test/base/testing_profile_manager.h" |
| #include "content/public/test/test_utils.h" |
| #include "ui/app_list/app_list_model.h" |
| #include "ui/app_list/search_box_model.h" |
| @@ -39,6 +43,9 @@ class AppListServiceInteractiveTest : public InProcessBrowserTest { |
| protected: |
| Profile* profile2_; |
| + ProfileInfoCache* profile_info_cache() { |
| + return &(g_browser_process->profile_manager()->GetProfileInfoCache()); |
| + } |
| private: |
| DISALLOW_COPY_AND_ASSIGN(AppListServiceInteractiveTest); |
| @@ -49,6 +56,7 @@ class AppListServiceInteractiveTest : public InProcessBrowserTest { |
| #if defined(OS_CHROMEOS) |
| #define MAYBE_ShowAndDismiss DISABLED_ShowAndDismiss |
| #define MAYBE_SwitchAppListProfiles DISABLED_SwitchAppListProfiles |
| +#define MAYBE_SwitchAppListLockedProfile DISABLED_SwitchAppListLockedProfile |
| #define MAYBE_SwitchAppListProfilesDuringSearch \ |
| DISABLED_SwitchAppListProfilesDuringSearch |
| #define MAYBE_ShowAppListNonDefaultProfile \ |
| @@ -57,6 +65,7 @@ class AppListServiceInteractiveTest : public InProcessBrowserTest { |
| #else |
| #define MAYBE_ShowAndDismiss ShowAndDismiss |
| #define MAYBE_SwitchAppListProfiles SwitchAppListProfiles |
| +#define MAYBE_SwitchAppListLockedProfile SwitchAppListLockedProfile |
| #define MAYBE_SwitchAppListProfilesDuringSearch \ |
| SwitchAppListProfilesDuringSearch |
| #define MAYBE_ShowAppListNonDefaultProfile ShowAppListNonDefaultProfile |
| @@ -107,6 +116,55 @@ IN_PROC_BROWSER_TEST_F(AppListServiceInteractiveTest, |
| controller->DismissView(); |
| } |
| +// Switch profiles on the app list while it is showing. |
| +IN_PROC_BROWSER_TEST_F(AppListServiceInteractiveTest, |
| + MAYBE_SwitchAppListLockedProfile) { |
| + InitSecondProfile(); |
| + |
| + AppListService* service = test::GetAppListService(); |
| + ASSERT_TRUE(service); |
| + |
| + AppListControllerDelegate* controller(service->GetControllerDelegate()); |
| + ASSERT_TRUE(controller); |
| + |
| + // Open the app list with the browser's profile. |
| + EXPECT_FALSE(service->IsAppListVisible()); |
| + controller->ShowForProfileByPath(browser()->profile()->GetPath()); |
| + app_list::AppListModel* model = test::GetAppListModel(service); |
| + ASSERT_TRUE(model); |
| + |
| + base::RunLoop().RunUntilIdle(); |
| + |
| + EXPECT_TRUE(service->IsAppListVisible()); |
| + EXPECT_EQ(browser()->profile(), service->GetCurrentAppListProfile()); |
| + EXPECT_FALSE(UserManager::IsShowing()); |
| + |
| + // App list, go away, come against some other day. |
| + service->DismissAppList(); |
| + ASSERT_FALSE(service->IsAppListVisible()); |
| + |
| + // Pre-load the Guest Profile so the UserManager shows quickly. |
|
tapted
2015/01/27 02:52:55
why this change? If things were timing out it migh
Mike Lerman
2015/01/27 14:59:49
When something calls UserManager::Show(), there's
tapted
2015/01/27 22:40:26
Can you capture this in a code comment? Something
Mike Lerman
2015/01/28 20:26:46
Done.
|
| + g_browser_process->profile_manager()->GetProfile( |
| + ProfileManager::GetGuestProfilePath()); |
| + |
| + // Lock the second profile. |
| + profile_info_cache()->SetProfileSigninRequiredAtIndex( |
| + profile_info_cache()->GetIndexOfProfileWithPath(profile2_->GetPath()), |
| + true); |
| + |
| + // Attempt to open the app list with the second profile. |
| + controller->ShowForProfileByPath(profile2_->GetPath()); |
| + base::RunLoop().RunUntilIdle(); |
| + |
| + // App list stays hidden; the UserManager shows instead. |
| + EXPECT_FALSE(service->IsAppListVisible()); |
| + EXPECT_TRUE(UserManager::IsShowing()); |
| + |
| + controller->DismissView(); |
| + // We need to hide the User Manager or else the process can't die. |
| + UserManager::Hide(); |
| +} |
| + |
| // Test switching app list profiles while search results are visibile. |
| IN_PROC_BROWSER_TEST_F(AppListServiceInteractiveTest, |
| MAYBE_SwitchAppListProfilesDuringSearch) { |