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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 // OnPackageListRefreshed will be called. | 176 // OnPackageListRefreshed will be called. |
177 instance_map_[profile]->SendRefreshPackageList( | 177 instance_map_[profile]->SendRefreshPackageList( |
178 std::vector<arc::mojom::ArcPackageInfo>()); | 178 std::vector<arc::mojom::ArcPackageInfo>()); |
179 } | 179 } |
180 | 180 |
181 void SyncArcPackageHelper::InstallPackage( | 181 void SyncArcPackageHelper::InstallPackage( |
182 Profile* profile, | 182 Profile* profile, |
183 const mojom::ArcPackageInfo& package) { | 183 const mojom::ArcPackageInfo& package) { |
184 ArcAppListPrefs* arc_app_list_prefs = ArcAppListPrefs::Get(profile); | 184 ArcAppListPrefs* arc_app_list_prefs = ArcAppListPrefs::Get(profile); |
185 DCHECK(arc_app_list_prefs); | 185 DCHECK(arc_app_list_prefs); |
186 FakeAppInstance* fake_app_instance = static_cast<FakeAppInstance*>( | 186 FakeAppInstance* fake_app_instance = |
187 arc_app_list_prefs->app_instance_holder()->GetInstanceForMethod( | 187 static_cast<FakeAppInstance*>(GET_INSTANCE_FOR_METHOD( |
Yusuke Sato
2017/01/04 19:59:12
(not related to your CL, so no reply needed but..
Luis Héctor Chávez
2017/01/04 20:38:56
It's not. Removed.
| |
188 "InstallPackage")); | 188 arc_app_list_prefs->app_instance_holder(), InstallPackage)); |
189 | 189 |
190 DCHECK(fake_app_instance); | 190 DCHECK(fake_app_instance); |
191 // After this function, new package should be added to local sync service | 191 // After this function, new package should be added to local sync service |
192 // and install event should be sent to sync server. | 192 // and install event should be sent to sync server. |
193 fake_app_instance->InstallPackage(package.Clone()); | 193 fake_app_instance->InstallPackage(package.Clone()); |
194 } | 194 } |
195 | 195 |
196 void SyncArcPackageHelper::UninstallPackage(Profile* profile, | 196 void SyncArcPackageHelper::UninstallPackage(Profile* profile, |
197 const std::string& package_name) { | 197 const std::string& package_name) { |
198 ArcAppListPrefs* arc_app_list_prefs = ArcAppListPrefs::Get(profile); | 198 ArcAppListPrefs* arc_app_list_prefs = ArcAppListPrefs::Get(profile); |
199 DCHECK(arc_app_list_prefs); | 199 DCHECK(arc_app_list_prefs); |
200 FakeAppInstance* fake_app_instance = static_cast<FakeAppInstance*>( | 200 FakeAppInstance* fake_app_instance = |
201 arc_app_list_prefs->app_instance_holder()->GetInstanceForMethod( | 201 static_cast<FakeAppInstance*>(GET_INSTANCE_FOR_METHOD( |
202 "UninstallPackage")); | 202 arc_app_list_prefs->app_instance_holder(), UnInstallPackage)); |
203 DCHECK(fake_app_instance); | 203 DCHECK(fake_app_instance); |
204 // After this function, package should be removed from local sync service | 204 // After this function, package should be removed from local sync service |
205 // and uninstall event should be sent to sync server. | 205 // and uninstall event should be sent to sync server. |
206 fake_app_instance->UninstallPackage(package_name); | 206 fake_app_instance->UninstallPackage(package_name); |
207 } | 207 } |
208 | 208 |
209 // Packages from local pref are used for these test functions. Packages in local | 209 // Packages from local pref are used for these test functions. Packages in local |
210 // pref should be indentical to syncservice after syncservice is launched. | 210 // pref should be indentical to syncservice after syncservice is launched. |
211 // Packagd update behavior is not synced by design. | 211 // Packagd update behavior is not synced by design. |
212 bool SyncArcPackageHelper::ArcPackagesMatch(Profile* profile1, | 212 bool SyncArcPackageHelper::ArcPackagesMatch(Profile* profile1, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
250 if (package1_info->last_backup_android_id != | 250 if (package1_info->last_backup_android_id != |
251 package2_info->last_backup_android_id) | 251 package2_info->last_backup_android_id) |
252 return false; | 252 return false; |
253 if (package1_info->last_backup_time != package2_info->last_backup_time) | 253 if (package1_info->last_backup_time != package2_info->last_backup_time) |
254 return false; | 254 return false; |
255 } | 255 } |
256 return true; | 256 return true; |
257 } | 257 } |
258 | 258 |
259 } // namespace arc | 259 } // namespace arc |
OLD | NEW |