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

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

Issue 856733004: Loading the Launcher with a Locked Profile launched UserManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move ProfileLocked check. Add unit test. Created 5 years, 11 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_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..5751771c739d9d46cd554e86860770b6f3a7c1c1 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,48 @@ 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.
+ ASSERT_FALSE(service->IsAppListVisible());
tapted 2015/01/21 22:47:20 nit: ASSERT -> EXPECT (here and all following) I
Mike Lerman 2015/01/23 16:58:33 Done - all the NULL tests are ASSERTs and all the
+ controller->ShowForProfileByPath(browser()->profile()->GetPath());
+ app_list::AppListModel* model = test::GetAppListModel(service);
+ ASSERT_TRUE(model);
+
+ base::RunLoop().RunUntilIdle();
+
+ ASSERT_TRUE(service->IsAppListVisible());
+ ASSERT_EQ(browser()->profile(), service->GetCurrentAppListProfile());
+
+ // 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());
+ model = test::GetAppListModel(service);
+ ASSERT_TRUE(model);
tapted 2015/01/21 22:47:20 note I think this would mean that the app launcher
Mike Lerman 2015/01/23 16:58:33 Ah, too much blind copy-pasting. Thanks!
tapted 2015/01/27 02:52:54 Sorry, I meant that if that expectation is true it
Mike Lerman 2015/01/27 14:59:49 You mention that the fact that it's not-NULL is "i
tapted 2015/01/27 22:55:01 `AppListServiceImpl::OnProfileWillBeRemoved()` has
+ base::RunLoop().RunUntilIdle();
+
+ // App list stays hidden; the UserManager shows instead.
+ ASSERT_FALSE(service->IsAppListVisible());
+ ASSERT_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) {

Powered by Google App Engine
This is Rietveld 408576698