| OLD | NEW |
| 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" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 void SyncArcPackageHelper::SetupTest(SyncTest* test) { | 63 void SyncArcPackageHelper::SetupTest(SyncTest* test) { |
| 64 if (setup_completed_) { | 64 if (setup_completed_) { |
| 65 DCHECK_EQ(test, test_); | 65 DCHECK_EQ(test, test_); |
| 66 return; | 66 return; |
| 67 } | 67 } |
| 68 test_ = test; | 68 test_ = test; |
| 69 | 69 |
| 70 user_manager_enabler_ = base::MakeUnique<chromeos::ScopedUserManagerEnabler>( | 70 user_manager_enabler_ = base::MakeUnique<chromeos::ScopedUserManagerEnabler>( |
| 71 new chromeos::FakeChromeUserManager()); | 71 new chromeos::FakeChromeUserManager()); |
| 72 base::CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 73 chromeos::switches::kEnableArc); | |
| 74 ArcAppListPrefsFactory::SetFactoryForSyncTest(); | 72 ArcAppListPrefsFactory::SetFactoryForSyncTest(); |
| 75 size_t id = 0; | 73 size_t id = 0; |
| 76 for (auto* profile : test_->GetAllProfiles()) | 74 for (auto* profile : test_->GetAllProfiles()) |
| 77 SetupArcService(profile, id++); | 75 SetupArcService(profile, id++); |
| 78 setup_completed_ = true; | 76 setup_completed_ = true; |
| 79 } | 77 } |
| 80 | 78 |
| 81 void SyncArcPackageHelper::CleanUp() { | 79 void SyncArcPackageHelper::CleanUp() { |
| 82 ArcSessionManager::Get()->Shutdown(); | 80 ArcSessionManager::Get()->Shutdown(); |
| 83 user_manager_enabler_.reset(); | 81 user_manager_enabler_.reset(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 DVLOG(1) << "Profile2: " | 136 DVLOG(1) << "Profile2: " |
| 139 << ArcPackageSyncableService::Get(profiles.front()); | 137 << ArcPackageSyncableService::Get(profiles.front()); |
| 140 return false; | 138 return false; |
| 141 } | 139 } |
| 142 } | 140 } |
| 143 return true; | 141 return true; |
| 144 } | 142 } |
| 145 | 143 |
| 146 void SyncArcPackageHelper::SetupArcService(Profile* profile, size_t id) { | 144 void SyncArcPackageHelper::SetupArcService(Profile* profile, size_t id) { |
| 147 DCHECK(profile); | 145 DCHECK(profile); |
| 148 base::CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 149 chromeos::switches::kEnableArc); | |
| 150 const user_manager::User* user = CreateUserAndLogin(profile, id); | 146 const user_manager::User* user = CreateUserAndLogin(profile, id); |
| 151 // Have the user-to-profile mapping ready to avoid using the real profile | 147 // Have the user-to-profile mapping ready to avoid using the real profile |
| 152 // manager (which is null). | 148 // manager (which is null). |
| 153 chromeos::ProfileHelper::Get()->SetUserToProfileMappingForTesting(user, | 149 chromeos::ProfileHelper::Get()->SetUserToProfileMappingForTesting(user, |
| 154 profile); | 150 profile); |
| 155 | 151 |
| 156 ArcSessionManager* arc_session_manager = ArcSessionManager::Get(); | 152 ArcSessionManager* arc_session_manager = ArcSessionManager::Get(); |
| 157 DCHECK(arc_session_manager); | 153 DCHECK(arc_session_manager); |
| 158 ArcSessionManager::DisableUIForTesting(); | 154 ArcSessionManager::DisableUIForTesting(); |
| 159 arc_session_manager->OnPrimaryUserProfilePrepared(profile); | 155 arc_session_manager->OnPrimaryUserProfilePrepared(profile); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 if (package1_info->last_backup_android_id != | 244 if (package1_info->last_backup_android_id != |
| 249 package2_info->last_backup_android_id) | 245 package2_info->last_backup_android_id) |
| 250 return false; | 246 return false; |
| 251 if (package1_info->last_backup_time != package2_info->last_backup_time) | 247 if (package1_info->last_backup_time != package2_info->last_backup_time) |
| 252 return false; | 248 return false; |
| 253 } | 249 } |
| 254 return true; | 250 return true; |
| 255 } | 251 } |
| 256 | 252 |
| 257 } // namespace arc | 253 } // namespace arc |
| OLD | NEW |