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

Side by Side Diff: chrome/browser/sync/test/integration/sync_arc_package_helper.cc

Issue 2507073002: Split ArcSessionManager from ArcAuthService. (Closed)
Patch Set: Fix rebase mistake Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/sync/test/integration/sync_arc_package_helper.h" 5 #include "chrome/browser/sync/test/integration/sync_arc_package_helper.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "chrome/browser/chromeos/arc/arc_auth_service.h" 13 #include "chrome/browser/chromeos/arc/arc_session_manager.h"
14 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" 14 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
15 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 15 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
16 #include "chrome/browser/chromeos/profiles/profile_helper.h" 16 #include "chrome/browser/chromeos/profiles/profile_helper.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" 18 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h"
19 #include "chrome/browser/sync/test/integration/sync_test.h" 19 #include "chrome/browser/sync/test/integration/sync_test.h"
20 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" 20 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
21 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.h" 21 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.h"
22 #include "chrome/browser/ui/app_list/arc/arc_package_syncable_service.h" 22 #include "chrome/browser/ui/app_list/arc/arc_package_syncable_service.h"
23 #include "chromeos/chromeos_switches.h" 23 #include "chromeos/chromeos_switches.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 base::CommandLine::ForCurrentProcess()->AppendSwitch( 73 base::CommandLine::ForCurrentProcess()->AppendSwitch(
74 chromeos::switches::kEnableArc); 74 chromeos::switches::kEnableArc);
75 ArcAppListPrefsFactory::SetFactoryForSyncTest(); 75 ArcAppListPrefsFactory::SetFactoryForSyncTest();
76 size_t id = 0; 76 size_t id = 0;
77 for (auto* profile : test_->GetAllProfiles()) 77 for (auto* profile : test_->GetAllProfiles())
78 SetupArcService(profile, id++); 78 SetupArcService(profile, id++);
79 setup_completed_ = true; 79 setup_completed_ = true;
80 } 80 }
81 81
82 void SyncArcPackageHelper::CleanUp() { 82 void SyncArcPackageHelper::CleanUp() {
83 ArcAuthService::Get()->Shutdown(); 83 ArcSessionManager::Get()->Shutdown();
84 user_manager_enabler_.reset(); 84 user_manager_enabler_.reset();
85 } 85 }
86 86
87 void SyncArcPackageHelper::InstallPackageWithIndex(Profile* profile, 87 void SyncArcPackageHelper::InstallPackageWithIndex(Profile* profile,
88 size_t id) { 88 size_t id) {
89 std::string package_name = GetTestPackageName(id); 89 std::string package_name = GetTestPackageName(id);
90 90
91 mojom::ArcPackageInfo package; 91 mojom::ArcPackageInfo package;
92 package.package_name = package_name; 92 package.package_name = package_name;
93 package.package_version = id; 93 package.package_version = id;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 void SyncArcPackageHelper::SetupArcService(Profile* profile, size_t id) { 147 void SyncArcPackageHelper::SetupArcService(Profile* profile, size_t id) {
148 DCHECK(profile); 148 DCHECK(profile);
149 base::CommandLine::ForCurrentProcess()->AppendSwitch( 149 base::CommandLine::ForCurrentProcess()->AppendSwitch(
150 chromeos::switches::kEnableArc); 150 chromeos::switches::kEnableArc);
151 const user_manager::User* user = CreateUserAndLogin(profile, id); 151 const user_manager::User* user = CreateUserAndLogin(profile, id);
152 // Have the user-to-profile mapping ready to avoid using the real profile 152 // Have the user-to-profile mapping ready to avoid using the real profile
153 // manager (which is null). 153 // manager (which is null).
154 chromeos::ProfileHelper::Get()->SetUserToProfileMappingForTesting(user, 154 chromeos::ProfileHelper::Get()->SetUserToProfileMappingForTesting(user,
155 profile); 155 profile);
156 156
157 ArcAuthService* auth_service = ArcAuthService::Get(); 157 ArcSessionManager* arc_session_manager = ArcSessionManager::Get();
158 DCHECK(auth_service); 158 DCHECK(arc_session_manager);
159 ArcAuthService::DisableUIForTesting(); 159 ArcSessionManager::DisableUIForTesting();
160 auth_service->OnPrimaryUserProfilePrepared(profile); 160 arc_session_manager->OnPrimaryUserProfilePrepared(profile);
161 auth_service->EnableArc(); 161 arc_session_manager->EnableArc();
162 162
163 ArcAppListPrefs* arc_app_list_prefs = ArcAppListPrefs::Get(profile); 163 ArcAppListPrefs* arc_app_list_prefs = ArcAppListPrefs::Get(profile);
164 DCHECK(arc_app_list_prefs); 164 DCHECK(arc_app_list_prefs);
165 165
166 base::RunLoop run_loop; 166 base::RunLoop run_loop;
167 arc_app_list_prefs->SetDefaltAppsReadyCallback(run_loop.QuitClosure()); 167 arc_app_list_prefs->SetDefaltAppsReadyCallback(run_loop.QuitClosure());
168 run_loop.Run(); 168 run_loop.Run();
169 169
170 instance_map_[profile] = 170 instance_map_[profile] =
171 base::MakeUnique<FakeAppInstance>(arc_app_list_prefs); 171 base::MakeUnique<FakeAppInstance>(arc_app_list_prefs);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 if (package1_info->last_backup_android_id != 251 if (package1_info->last_backup_android_id !=
252 package2_info->last_backup_android_id) 252 package2_info->last_backup_android_id)
253 return false; 253 return false;
254 if (package1_info->last_backup_time != package2_info->last_backup_time) 254 if (package1_info->last_backup_time != package2_info->last_backup_time)
255 return false; 255 return false;
256 } 256 }
257 return true; 257 return true;
258 } 258 }
259 259
260 } // namespace arc 260 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/prefs/browser_prefs.cc ('k') | chrome/browser/ui/app_list/app_list_service_views_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698