| 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 95eaff179992291f3dd132f4a1a61044bb8f72ec..7c482f01ff1b61a0f71b4ba67782660e430124fd 100644
|
| --- a/chrome/browser/sync/profile_sync_service_harness.cc
|
| +++ b/chrome/browser/sync/profile_sync_service_harness.cc
|
| @@ -288,6 +288,12 @@ bool ProfileSyncServiceHarness::RunStateChangeMachine() {
|
| LogClientInfo("SYNC_DISABLED");
|
| break;
|
| }
|
| + case WAITING_FOR_ENCRYPTION: {
|
| + // Sync has finished encrypting the datatypes. There is nothing to do.
|
| + LogClientInfo("WAITING_FOR_ENCRYPTION");
|
| + SignalStateCompleteWithNextState(FULLY_SYNCED);
|
| + break;
|
| + }
|
| default:
|
| // Invalid state during observer callback which may be triggered by other
|
| // classes using the the UI message loop. Defer to their handling.
|
| @@ -597,3 +603,38 @@ void ProfileSyncServiceHarness::LogClientInfo(std::string message) {
|
| << ": Sync service not available.";
|
| }
|
| }
|
| +
|
| +bool ProfileSyncServiceHarness::EnableEncryptionForType(
|
| + syncable::ModelType type) {
|
| + syncable::ModelTypeSet encrypted_types;
|
| + service_->GetEncryptedDataTypes(&encrypted_types);
|
| + encrypted_types.insert(type);
|
| + service_->EncryptDataTypes(encrypted_types);
|
| +
|
| + // Wait some time to let the enryption finish.
|
| + std::string reason = "Waiting for encryption.";
|
| + wait_state_ = WAITING_FOR_ENCRYPTION;
|
| + if (!AwaitStatusChangeWithTimeout(kLiveSyncOperationTimeoutMs, reason)) {
|
| + LOG(ERROR) << "Did not receive EncryptionComplete notification after"
|
| + << kLiveSyncOperationTimeoutMs / 1000
|
| + << " seconds.";
|
| + return false;
|
| + }
|
| +
|
| + syncable::ModelTypeSet newly_encrypted_types;
|
| + service_->GetEncryptedDataTypes(&newly_encrypted_types);
|
| + if (newly_encrypted_types != encrypted_types) {
|
| + return false;
|
| + }
|
| +
|
| + return true;
|
| +}
|
| +
|
| +bool ProfileSyncServiceHarness::IsTypeEncrypted(syncable::ModelType type) {
|
| + syncable::ModelTypeSet encrypted_types;
|
| + service_->GetEncryptedDataTypes(&encrypted_types);
|
| + if (encrypted_types.count(type) == 0) {
|
| + return false;
|
| + }
|
| + return true;
|
| +}
|
|
|