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

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

Issue 2643643011: [Sync] Integ tests can't compare progress markers during configuration. (Closed)
Patch Set: Created 3 years, 11 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/quiesce_status_change_checker.h" 5 #include "chrome/browser/sync/test/integration/quiesce_status_change_checker.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/scoped_observer.h" 10 #include "base/scoped_observer.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "components/browser_sync/profile_sync_service.h" 13 #include "components/browser_sync/profile_sync_service.h"
14 #include "components/sync/engine/cycle/sync_cycle_snapshot.h" 14 #include "components/sync/engine/cycle/sync_cycle_snapshot.h"
15 15
16 namespace { 16 namespace {
17 17
18 // Returns true if this service is disabled. 18 // Returns true if this service is disabled.
19 bool IsSyncDisabled(browser_sync::ProfileSyncService* service) { 19 bool IsSyncDisabled(browser_sync::ProfileSyncService* service) {
20 return !service->IsSetupInProgress() && !service->IsFirstSetupComplete(); 20 return !service->IsSetupInProgress() && !service->IsFirstSetupComplete();
21 } 21 }
22 22
23 // Returns true if these services have matching progress markers. 23 // Returns true if these services have matching progress markers.
24 bool ProgressMarkersMatch(const browser_sync::ProfileSyncService* service1, 24 bool ProgressMarkersMatch(const browser_sync::ProfileSyncService* service1,
25 const browser_sync::ProfileSyncService* service2) { 25 const browser_sync::ProfileSyncService* service2) {
26 // GetActiveDataTypes() is always empty during configuration, so progress
27 // markers cannot be compared.
28 if (!service1->ConfigurationDone() || !service2->ConfigurationDone()) {
29 return false;
30 }
31
26 const syncer::ModelTypeSet common_types = 32 const syncer::ModelTypeSet common_types =
27 Intersection(service1->GetActiveDataTypes(), 33 Intersection(service1->GetActiveDataTypes(),
28 service2->GetActiveDataTypes()); 34 service2->GetActiveDataTypes());
29 35
30 const syncer::SyncCycleSnapshot& snap1 = service1->GetLastCycleSnapshot(); 36 const syncer::SyncCycleSnapshot& snap1 = service1->GetLastCycleSnapshot();
31 const syncer::SyncCycleSnapshot& snap2 = service2->GetLastCycleSnapshot(); 37 const syncer::SyncCycleSnapshot& snap2 = service2->GetLastCycleSnapshot();
32 38
33 for (syncer::ModelTypeSet::Iterator type_it = common_types.First(); 39 for (syncer::ModelTypeSet::Iterator type_it = common_types.First();
34 type_it.Good(); type_it.Inc()) { 40 type_it.Good(); type_it.Inc()) {
35 // Look up the progress markers. Fail if either one is missing. 41 // Look up the progress markers. Fail if either one is missing.
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 208
203 std::string QuiesceStatusChangeChecker::GetDebugMessage() const { 209 std::string QuiesceStatusChangeChecker::GetDebugMessage() const {
204 return base::StringPrintf("Waiting for quiescence of %" PRIuS " clients", 210 return base::StringPrintf("Waiting for quiescence of %" PRIuS " clients",
205 services_.size()); 211 services_.size());
206 } 212 }
207 213
208 void QuiesceStatusChangeChecker::OnServiceStateChanged( 214 void QuiesceStatusChangeChecker::OnServiceStateChanged(
209 browser_sync::ProfileSyncService* service) { 215 browser_sync::ProfileSyncService* service) {
210 CheckExitCondition(); 216 CheckExitCondition();
211 } 217 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698