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

Unified Diff: chrome/browser/ui/app_list/arc/arc_app_test.cc

Issue 2150583002: Fix ArcAppModelBuilderTest (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Addressed feedback Created 4 years, 5 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
« no previous file with comments | « chrome/browser/ui/app_list/arc/arc_app_test.h ('k') | chrome/browser/ui/app_list/arc/arc_app_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/arc/arc_app_test.cc
diff --git a/chrome/browser/ui/app_list/arc/arc_app_test.cc b/chrome/browser/ui/app_list/arc/arc_app_test.cc
index a32626c60987cd3c25a1ce62e90ba6fce916abb3..2f0be2f8e1712f85be5fe75b35f4f0edec6c665d 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_test.cc
+++ b/chrome/browser/ui/app_list/arc/arc_app_test.cc
@@ -8,6 +8,7 @@
#include "base/strings/stringprintf.h"
#include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
#include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
+#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
#include "chromeos/chromeos_switches.h"
@@ -50,7 +51,13 @@ void ArcAppTest::SetUp(Profile* profile) {
chromeos::switches::kEnableArc);
DCHECK(!profile_);
profile_ = profile;
- CreateUserAndLogin();
+ const user_manager::User* user = CreateUserAndLogin();
+
+ // If for any reason the garbage collector kicks in while we are waiting for
+ // an icon, have the user-to-profile mapping ready to avoid using the real
+ // profile manager (which is null).
+ chromeos::ProfileHelper::Get()->SetUserToProfileMappingForTesting(user,
+ profile_);
// Make sure we have enough data for test.
for (int i = 0; i < 3; ++i) {
@@ -129,11 +136,12 @@ void ArcAppTest::TearDown() {
auth_service_.reset();
}
-void ArcAppTest::CreateUserAndLogin() {
+const user_manager::User* ArcAppTest::CreateUserAndLogin() {
const AccountId account_id(AccountId::FromUserEmailGaiaId(
profile_->GetProfileUserName(), "1234567890"));
- GetUserManager()->AddUser(account_id);
+ const user_manager::User* user = GetUserManager()->AddUser(account_id);
GetUserManager()->LoginUser(account_id);
+ return user;
}
void ArcAppTest::AddPackage(const arc::mojom::ArcPackageInfo& package) {
« no previous file with comments | « chrome/browser/ui/app_list/arc/arc_app_test.h ('k') | chrome/browser/ui/app_list/arc/arc_app_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698