OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/profile_sync_service_harness.h" | 5 #include "chrome/browser/sync/profile_sync_service_harness.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <iterator> | 9 #include <iterator> |
10 #include <ostream> | 10 #include <ostream> |
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
995 (syncable::MODEL_TYPE_COUNT - syncable::FIRST_REAL_MODEL_TYPE)); | 995 (syncable::MODEL_TYPE_COUNT - syncable::FIRST_REAL_MODEL_TYPE)); |
996 service_->OnUserChoseDatatypes(sync_everything, | 996 service_->OnUserChoseDatatypes(sync_everything, |
997 synced_datatypes); | 997 synced_datatypes); |
998 | 998 |
999 // Wait some time to let the enryption finish. | 999 // Wait some time to let the enryption finish. |
1000 return WaitForTypeEncryption(type); | 1000 return WaitForTypeEncryption(type); |
1001 } | 1001 } |
1002 | 1002 |
1003 bool ProfileSyncServiceHarness::WaitForTypeEncryption( | 1003 bool ProfileSyncServiceHarness::WaitForTypeEncryption( |
1004 syncable::ModelType type) { | 1004 syncable::ModelType type) { |
1005 if (IsSynced() && | 1005 if (IsTypeEncrypted(type) && |
akalin
2011/09/22 18:12:05
Can you add a comment for this? This can easily b
rlarocque
2011/09/22 19:05:58
Done.
| |
1006 IsTypeEncrypted(type) && | 1006 IsSynced() && |
1007 GetLastSessionSnapshot()->num_conflicting_updates == 0) { | 1007 GetLastSessionSnapshot()->num_conflicting_updates == 0) { |
1008 // Encryption is already complete for |type|; do not wait. | 1008 // Encryption is already complete for |type|; do not wait. |
1009 return true; | 1009 return true; |
1010 } | 1010 } |
1011 | 1011 |
1012 std::string reason = "Waiting for encryption."; | 1012 std::string reason = "Waiting for encryption."; |
1013 wait_state_ = WAITING_FOR_ENCRYPTION; | 1013 wait_state_ = WAITING_FOR_ENCRYPTION; |
1014 waiting_for_encryption_type_ = type; | 1014 waiting_for_encryption_type_ = type; |
1015 if (!AwaitStatusChangeWithTimeout(kLiveSyncOperationTimeoutMs, reason)) { | 1015 if (!AwaitStatusChangeWithTimeout(kLiveSyncOperationTimeoutMs, reason)) { |
1016 LOG(ERROR) << "Did not receive EncryptionComplete notification after" | 1016 LOG(ERROR) << "Did not receive EncryptionComplete notification after" |
(...skipping 22 matching lines...) Expand all Loading... | |
1039 return (synced_types.count(type) != 0); | 1039 return (synced_types.count(type) != 0); |
1040 } | 1040 } |
1041 | 1041 |
1042 std::string ProfileSyncServiceHarness::GetServiceStatus() { | 1042 std::string ProfileSyncServiceHarness::GetServiceStatus() { |
1043 DictionaryValue value; | 1043 DictionaryValue value; |
1044 sync_ui_util::ConstructAboutInformation(service_, &value); | 1044 sync_ui_util::ConstructAboutInformation(service_, &value); |
1045 std::string service_status; | 1045 std::string service_status; |
1046 base::JSONWriter::Write(&value, true, &service_status); | 1046 base::JSONWriter::Write(&value, true, &service_status); |
1047 return service_status; | 1047 return service_status; |
1048 } | 1048 } |
OLD | NEW |