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

Unified Diff: chrome/browser/sync/profile_sync_service_harness.cc

Issue 10696087: [Sync] Move ModelType and related classes to 'syncer' namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort headers, update copyrights Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/profile_sync_service_harness.h ('k') | chrome/browser/sync/profile_sync_service_mock.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/profile_sync_service_harness.cc
diff --git a/chrome/browser/sync/profile_sync_service_harness.cc b/chrome/browser/sync/profile_sync_service_harness.cc
index 1457a623cebef098e427b008aadbe702d2d55115..1bfa704a6732f9b00a39b8eea403f74da87bc110 100644
--- a/chrome/browser/sync/profile_sync_service_harness.cc
+++ b/chrome/browser/sync/profile_sync_service_harness.cc
@@ -101,7 +101,7 @@ ProfileSyncServiceHarness::ProfileSyncServiceHarness(
Profile* profile,
const std::string& username,
const std::string& password)
- : waiting_for_encryption_type_(syncable::UNSPECIFIED),
+ : waiting_for_encryption_type_(syncer::UNSPECIFIED),
wait_state_(INITIAL_WAIT_STATE),
profile_(profile),
service_(NULL),
@@ -144,7 +144,7 @@ bool ProfileSyncServiceHarness::IsSyncAlreadySetup() {
}
bool ProfileSyncServiceHarness::SetupSync() {
- bool result = SetupSync(syncable::ModelTypeSet::All());
+ bool result = SetupSync(syncer::ModelTypeSet::All());
if (result == false) {
std::string status = GetServiceStatus();
LOG(ERROR) << profile_debug_name_
@@ -156,7 +156,7 @@ bool ProfileSyncServiceHarness::SetupSync() {
}
bool ProfileSyncServiceHarness::SetupSync(
- syncable::ModelTypeSet synced_datatypes) {
+ syncer::ModelTypeSet synced_datatypes) {
// Initialize the sync client's profile sync service object.
service_ =
ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_);
@@ -192,7 +192,7 @@ bool ProfileSyncServiceHarness::SetupSync(
// Choose the datatypes to be synced. If all datatypes are to be synced,
// set sync_everything to true; otherwise, set it to false.
bool sync_everything =
- synced_datatypes.Equals(syncable::ModelTypeSet::All());
+ synced_datatypes.Equals(syncer::ModelTypeSet::All());
service()->OnUserChoseDatatypes(sync_everything, synced_datatypes);
// Subscribe sync client to notifications from the backend migrator
@@ -449,14 +449,14 @@ void ProfileSyncServiceHarness::OnMigrationStateChange() {
service()->GetBackendMigratorForTest()->
GetPendingMigrationTypesForTest());
DVLOG(1) << profile_debug_name_ << ": new pending migration types "
- << syncable::ModelTypeSetToString(pending_migration_types_);
+ << syncer::ModelTypeSetToString(pending_migration_types_);
} else {
// Merge just-finished pending migration types into
// |migration_types_|.
migrated_types_.PutAll(pending_migration_types_);
pending_migration_types_.Clear();
DVLOG(1) << profile_debug_name_ << ": new migrated types "
- << syncable::ModelTypeSetToString(migrated_types_);
+ << syncer::ModelTypeSetToString(migrated_types_);
}
RunStateChangeMachine();
}
@@ -607,16 +607,16 @@ bool ProfileSyncServiceHarness::AwaitActionableError() {
}
bool ProfileSyncServiceHarness::AwaitMigration(
- syncable::ModelTypeSet expected_migrated_types) {
+ syncer::ModelTypeSet expected_migrated_types) {
DVLOG(1) << GetClientInfoString("AwaitMigration");
DVLOG(1) << profile_debug_name_ << ": waiting until migration is done for "
- << syncable::ModelTypeSetToString(expected_migrated_types);
+ << syncer::ModelTypeSetToString(expected_migrated_types);
while (true) {
bool migration_finished = migrated_types_.HasAll(expected_migrated_types);
DVLOG(1) << "Migrated types "
- << syncable::ModelTypeSetToString(migrated_types_)
+ << syncer::ModelTypeSetToString(migrated_types_)
<< (migration_finished ? " contains " : " does not contain ")
- << syncable::ModelTypeSetToString(expected_migrated_types);
+ << syncer::ModelTypeSetToString(expected_migrated_types);
if (migration_finished) {
return true;
}
@@ -825,13 +825,13 @@ bool ProfileSyncServiceHarness::MatchesOtherClient(
// Only look for a match if we have at least one enabled datatype in
// common with the partner client.
- const syncable::ModelTypeSet common_types =
+ const syncer::ModelTypeSet common_types =
Intersection(service()->GetPreferredDataTypes(),
partner->service()->GetPreferredDataTypes());
DVLOG(2) << profile_debug_name_ << ", " << partner->profile_debug_name_
<< ": common types are "
- << syncable::ModelTypeSetToString(common_types);
+ << syncer::ModelTypeSetToString(common_types);
if (!common_types.Empty() && !partner->IsFullySynced()) {
DVLOG(2) << "non-empty common types and "
@@ -839,7 +839,7 @@ bool ProfileSyncServiceHarness::MatchesOtherClient(
return false;
}
- for (syncable::ModelTypeSet::Iterator i = common_types.First();
+ for (syncer::ModelTypeSet::Iterator i = common_types.First();
i.Good(); i.Inc()) {
const std::string timestamp = GetUpdatedTimestamp(i.Get());
const std::string partner_timestamp = partner->GetUpdatedTimestamp(i.Get());
@@ -853,7 +853,7 @@ bool ProfileSyncServiceHarness::MatchesOtherClient(
partner_timestamp, &partner_timestamp_base64)) {
NOTREACHED();
}
- DVLOG(2) << syncable::ModelTypeToString(i.Get()) << ": "
+ DVLOG(2) << syncer::ModelTypeToString(i.Get()) << ": "
<< profile_debug_name_ << " timestamp = "
<< timestamp_base64 << ", "
<< partner->profile_debug_name_
@@ -875,13 +875,13 @@ SyncSessionSnapshot ProfileSyncServiceHarness::GetLastSessionSnapshot() const {
}
bool ProfileSyncServiceHarness::EnableSyncForDatatype(
- syncable::ModelType datatype) {
+ syncer::ModelType datatype) {
DVLOG(1) << GetClientInfoString(
"EnableSyncForDatatype("
- + std::string(syncable::ModelTypeToString(datatype)) + ")");
+ + std::string(syncer::ModelTypeToString(datatype)) + ")");
if (wait_state_ == SYNC_DISABLED) {
- return SetupSync(syncable::ModelTypeSet(datatype));
+ return SetupSync(syncer::ModelTypeSet(datatype));
}
if (service() == NULL) {
@@ -889,20 +889,19 @@ bool ProfileSyncServiceHarness::EnableSyncForDatatype(
return false;
}
- syncable::ModelTypeSet synced_datatypes =
- service()->GetPreferredDataTypes();
+ syncer::ModelTypeSet synced_datatypes = service()->GetPreferredDataTypes();
if (synced_datatypes.Has(datatype)) {
DVLOG(1) << "EnableSyncForDatatype(): Sync already enabled for datatype "
- << syncable::ModelTypeToString(datatype)
+ << syncer::ModelTypeToString(datatype)
<< " on " << profile_debug_name_ << ".";
return true;
}
- synced_datatypes.Put(syncable::ModelTypeFromInt(datatype));
+ synced_datatypes.Put(syncer::ModelTypeFromInt(datatype));
service()->OnUserChoseDatatypes(false, synced_datatypes);
if (AwaitDataSyncCompletion("Datatype configuration.")) {
DVLOG(1) << "EnableSyncForDatatype(): Enabled sync for datatype "
- << syncable::ModelTypeToString(datatype)
+ << syncer::ModelTypeToString(datatype)
<< " on " << profile_debug_name_ << ".";
return true;
}
@@ -912,21 +911,20 @@ bool ProfileSyncServiceHarness::EnableSyncForDatatype(
}
bool ProfileSyncServiceHarness::DisableSyncForDatatype(
- syncable::ModelType datatype) {
+ syncer::ModelType datatype) {
DVLOG(1) << GetClientInfoString(
"DisableSyncForDatatype("
- + std::string(syncable::ModelTypeToString(datatype)) + ")");
+ + std::string(syncer::ModelTypeToString(datatype)) + ")");
if (service() == NULL) {
LOG(ERROR) << "DisableSyncForDatatype(): service() is null.";
return false;
}
- syncable::ModelTypeSet synced_datatypes =
- service()->GetPreferredDataTypes();
+ syncer::ModelTypeSet synced_datatypes = service()->GetPreferredDataTypes();
if (!synced_datatypes.Has(datatype)) {
DVLOG(1) << "DisableSyncForDatatype(): Sync already disabled for datatype "
- << syncable::ModelTypeToString(datatype)
+ << syncer::ModelTypeToString(datatype)
<< " on " << profile_debug_name_ << ".";
return true;
}
@@ -935,7 +933,7 @@ bool ProfileSyncServiceHarness::DisableSyncForDatatype(
service()->OnUserChoseDatatypes(false, synced_datatypes);
if (AwaitFullSyncCompletion("Datatype reconfiguration.")) {
DVLOG(1) << "DisableSyncForDatatype(): Disabled sync for datatype "
- << syncable::ModelTypeToString(datatype)
+ << syncer::ModelTypeToString(datatype)
<< " on " << profile_debug_name_ << ".";
return true;
}
@@ -956,7 +954,7 @@ bool ProfileSyncServiceHarness::EnableSyncForAllDatatypes() {
return false;
}
- service()->OnUserChoseDatatypes(true, syncable::ModelTypeSet::All());
+ service()->OnUserChoseDatatypes(true, syncer::ModelTypeSet::All());
if (AwaitFullSyncCompletion("Datatype reconfiguration.")) {
DVLOG(1) << "EnableSyncForAllDatatypes(): Enabled sync for all datatypes "
<< "on " << profile_debug_name_ << ".";
@@ -983,7 +981,7 @@ bool ProfileSyncServiceHarness::DisableSyncForAllDatatypes() {
}
std::string ProfileSyncServiceHarness::GetUpdatedTimestamp(
- syncable::ModelType model_type) {
+ syncer::ModelType model_type) {
const SyncSessionSnapshot& snap = GetLastSessionSnapshot();
return snap.download_progress_markers()[model_type];
}
@@ -1031,8 +1029,8 @@ std::string ProfileSyncServiceHarness::GetClientInfoString(
// TODO(zea): Rename this EnableEncryption, since we no longer turn on
// encryption for individual types but for all.
bool ProfileSyncServiceHarness::EnableEncryptionForType(
- syncable::ModelType type) {
- const syncable::ModelTypeSet encrypted_types =
+ syncer::ModelType type) {
+ const syncer::ModelTypeSet encrypted_types =
service_->GetEncryptedDataTypes();
if (encrypted_types.Has(type))
return true;
@@ -1040,18 +1038,17 @@ bool ProfileSyncServiceHarness::EnableEncryptionForType(
// In order to kick off the encryption we have to reconfigure. Just grab the
// currently synced types and use them.
- const syncable::ModelTypeSet synced_datatypes =
+ const syncer::ModelTypeSet synced_datatypes =
service_->GetPreferredDataTypes();
bool sync_everything =
- synced_datatypes.Equals(syncable::ModelTypeSet::All());
+ synced_datatypes.Equals(syncer::ModelTypeSet::All());
service_->OnUserChoseDatatypes(sync_everything, synced_datatypes);
// Wait some time to let the enryption finish.
return WaitForTypeEncryption(type);
}
-bool ProfileSyncServiceHarness::WaitForTypeEncryption(
- syncable::ModelType type) {
+bool ProfileSyncServiceHarness::WaitForTypeEncryption(syncer::ModelType type) {
// The correctness of this if condition depends on the ordering of its
// sub-expressions. See crbug.com/95619.
// TODO(rlarocque): Figure out a less brittle way of detecting this.
@@ -1074,25 +1071,25 @@ bool ProfileSyncServiceHarness::WaitForTypeEncryption(
return IsTypeEncrypted(type);
}
-bool ProfileSyncServiceHarness::IsTypeEncrypted(syncable::ModelType type) {
- const syncable::ModelTypeSet encrypted_types =
+bool ProfileSyncServiceHarness::IsTypeEncrypted(syncer::ModelType type) {
+ const syncer::ModelTypeSet encrypted_types =
service_->GetEncryptedDataTypes();
bool is_type_encrypted = service_->GetEncryptedDataTypes().Has(type);
- DVLOG(2) << syncable::ModelTypeToString(type) << " is "
+ DVLOG(2) << syncer::ModelTypeToString(type) << " is "
<< (is_type_encrypted ? "" : "not ") << "encrypted; "
<< "encrypted types = "
- << syncable::ModelTypeSetToString(encrypted_types);
+ << syncer::ModelTypeSetToString(encrypted_types);
return is_type_encrypted;
}
-bool ProfileSyncServiceHarness::IsTypeRunning(syncable::ModelType type) {
+bool ProfileSyncServiceHarness::IsTypeRunning(syncer::ModelType type) {
browser_sync::DataTypeController::StateMap state_map;
service_->GetDataTypeControllerStates(&state_map);
return (state_map.count(type) != 0 &&
state_map[type] == browser_sync::DataTypeController::RUNNING);
}
-bool ProfileSyncServiceHarness::IsTypePreferred(syncable::ModelType type) {
+bool ProfileSyncServiceHarness::IsTypePreferred(syncer::ModelType type) {
return service_->GetPreferredDataTypes().Has(type);
}
« no previous file with comments | « chrome/browser/sync/profile_sync_service_harness.h ('k') | chrome/browser/sync/profile_sync_service_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698