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

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

Issue 2389763003: arc: Fix race when arc package sync service starts. (Closed)
Patch Set: Add Check in case ArcAppListPrefs gets deleted early. Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/arc/arc_app_list_prefs.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 DCHECK(arc_app_list_prefs); 163 DCHECK(arc_app_list_prefs);
164 164
165 base::RunLoop run_loop; 165 base::RunLoop run_loop;
166 arc_app_list_prefs->SetDefaltAppsReadyCallback(run_loop.QuitClosure()); 166 arc_app_list_prefs->SetDefaltAppsReadyCallback(run_loop.QuitClosure());
167 run_loop.Run(); 167 run_loop.Run();
168 168
169 instance_map_[profile].reset(new FakeAppInstance(arc_app_list_prefs)); 169 instance_map_[profile].reset(new FakeAppInstance(arc_app_list_prefs));
170 DCHECK(instance_map_[profile].get()); 170 DCHECK(instance_map_[profile].get());
171 arc_app_list_prefs->app_instance_holder()->SetInstance( 171 arc_app_list_prefs->app_instance_holder()->SetInstance(
172 instance_map_[profile].get()); 172 instance_map_[profile].get());
173 // OnPackageListRefreshed will be called when AppInstance is ready.
174 // For fakeAppInstance we use SendRefreshPackageList to make sure that
175 // OnPackageListRefreshed will be called.
176 instance_map_[profile]->SendRefreshPackageList(
177 std::vector<arc::mojom::ArcPackageInfo>());
173 } 178 }
174 179
175 void SyncArcPackageHelper::InstallPackage( 180 void SyncArcPackageHelper::InstallPackage(
176 Profile* profile, 181 Profile* profile,
177 const mojom::ArcPackageInfo& package) { 182 const mojom::ArcPackageInfo& package) {
178 ArcAppListPrefs* arc_app_list_prefs = ArcAppListPrefs::Get(profile); 183 ArcAppListPrefs* arc_app_list_prefs = ArcAppListPrefs::Get(profile);
179 DCHECK(arc_app_list_prefs); 184 DCHECK(arc_app_list_prefs);
180 FakeAppInstance* fake_app_instance = static_cast<FakeAppInstance*>( 185 FakeAppInstance* fake_app_instance = static_cast<FakeAppInstance*>(
181 arc_app_list_prefs->app_instance_holder()->GetInstanceForMethod( 186 arc_app_list_prefs->app_instance_holder()->GetInstanceForMethod(
182 "InstallPackage")); 187 "InstallPackage"));
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 if (package1_info->last_backup_android_id != 249 if (package1_info->last_backup_android_id !=
245 package2_info->last_backup_android_id) 250 package2_info->last_backup_android_id)
246 return false; 251 return false;
247 if (package1_info->last_backup_time != package2_info->last_backup_time) 252 if (package1_info->last_backup_time != package2_info->last_backup_time)
248 return false; 253 return false;
249 } 254 }
250 return true; 255 return true;
251 } 256 }
252 257
253 } // namespace arc 258 } // namespace arc
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/arc/arc_app_list_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698