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

Unified Diff: chrome/browser/sync/test/integration/sync_arc_package_helper.cc

Issue 2711033002: Fix Arc integration test. (Closed)
Patch Set: Pure rebase. Created 3 years, 10 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/sync/test/integration/sync_arc_package_helper.cc
diff --git a/chrome/browser/sync/test/integration/sync_arc_package_helper.cc b/chrome/browser/sync/test/integration/sync_arc_package_helper.cc
index 1012c0cfcb6f9b8daf9d12f1c34d9ae08e0d1348..7a4343ab1a7d1417889dea7011875e6cf6d3aeec 100644
--- a/chrome/browser/sync/test/integration/sync_arc_package_helper.cc
+++ b/chrome/browser/sync/test/integration/sync_arc_package_helper.cc
@@ -10,21 +10,13 @@
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
-#include "chrome/browser/chromeos/arc/arc_auth_notification.h"
-#include "chrome/browser/chromeos/arc/arc_service_launcher.h"
-#include "chrome/browser/chromeos/arc/arc_session_manager.h"
#include "chrome/browser/chromeos/arc/arc_util.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/sync/test/integration/sync_datatype_helper.h"
#include "chrome/browser/sync/test/integration/sync_test.h"
#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
-#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.h"
#include "chrome/browser/ui/app_list/arc/arc_package_syncable_service.h"
#include "chromeos/chromeos_switches.h"
-#include "components/arc/arc_bridge_service.h"
#include "components/arc/test/fake_app_instance.h"
namespace arc {
@@ -35,20 +27,6 @@ std::string GetTestPackageName(size_t id) {
return "testarcpackage" + base::SizeTToString(id);
}
-chromeos::FakeChromeUserManager* GetUserManager() {
- return static_cast<chromeos::FakeChromeUserManager*>(
- user_manager::UserManager::Get());
-}
-
-const user_manager::User* CreateUserAndLogin(Profile* profile, size_t id) {
- std::string gaia_id = "1234567890" + base::SizeTToString(id);
- const AccountId account_id(
- AccountId::FromUserEmailGaiaId(profile->GetProfileUserName(), gaia_id));
- const user_manager::User* user = GetUserManager()->AddUser(account_id);
- GetUserManager()->LoginUser(account_id);
- return user;
-}
-
} // namespace
SyncArcPackageHelper* SyncArcPackageHelper::GetInstance() {
@@ -59,7 +37,7 @@ SyncArcPackageHelper* SyncArcPackageHelper::GetInstance() {
}
SyncArcPackageHelper::SyncArcPackageHelper()
- : test_(nullptr), setup_completed_(false), user_manager_enabler_(nullptr) {}
+ : test_(nullptr), setup_completed_(false) {}
SyncArcPackageHelper::~SyncArcPackageHelper() {}
@@ -70,20 +48,11 @@ void SyncArcPackageHelper::SetupTest(SyncTest* test) {
}
test_ = test;
- user_manager_enabler_ = base::MakeUnique<chromeos::ScopedUserManagerEnabler>(
- new chromeos::FakeChromeUserManager());
- ArcAppListPrefsFactory::SetFactoryForSyncTest();
- size_t id = 0;
for (auto* profile : test_->GetAllProfiles())
- SetupArcService(profile, id++);
+ SetupArcService(profile);
setup_completed_ = true;
}
-void SyncArcPackageHelper::CleanUp() {
- ArcSessionManager::Get()->Shutdown();
- user_manager_enabler_.reset();
-}
-
void SyncArcPackageHelper::InstallPackageWithIndex(Profile* profile,
size_t id) {
std::string package_name = GetTestPackageName(id);
@@ -144,17 +113,8 @@ bool SyncArcPackageHelper::AllProfilesHaveSamePackageDetails() {
return true;
}
-void SyncArcPackageHelper::SetupArcService(Profile* profile, size_t id) {
+void SyncArcPackageHelper::SetupArcService(Profile* profile) {
DCHECK(profile);
- const user_manager::User* user = CreateUserAndLogin(profile, id);
- // Have the user-to-profile mapping ready to avoid using the real profile
- // manager (which is null).
- chromeos::ProfileHelper::Get()->SetUserToProfileMappingForTesting(user,
- profile);
-
- ArcSessionManager::DisableUIForTesting();
- ArcAuthNotification::DisableForTesting();
- arc::ArcServiceLauncher::Get()->OnPrimaryUserProfilePrepared(profile);
arc::SetArcPlayStoreEnabledForProfile(profile, true);
ArcAppListPrefs* arc_app_list_prefs = ArcAppListPrefs::Get(profile);
@@ -167,6 +127,7 @@ void SyncArcPackageHelper::SetupArcService(Profile* profile, size_t id) {
instance_map_[profile] =
base::MakeUnique<FakeAppInstance>(arc_app_list_prefs);
DCHECK(instance_map_[profile].get());
+ arc_app_list_prefs->app_instance_holder()->SetInstance(nullptr);
arc_app_list_prefs->app_instance_holder()->SetInstance(
instance_map_[profile].get());
// OnPackageListRefreshed will be called when AppInstance is ready.

Powered by Google App Engine
This is Rietveld 408576698