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 <cstddef> | 7 #include <cstddef> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <ostream> | 9 #include <ostream> |
10 #include <set> | 10 #include <set> |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
646 } | 646 } |
647 } | 647 } |
648 AwaitStatusChangeWithTimeout(kLiveSyncOperationTimeoutMs, | 648 AwaitStatusChangeWithTimeout(kLiveSyncOperationTimeoutMs, |
649 "Wait for migration to finish"); | 649 "Wait for migration to finish"); |
650 if (wait_state_ != WAITING_FOR_NOTHING) { | 650 if (wait_state_ != WAITING_FOR_NOTHING) { |
651 DVLOG(1) << profile_debug_name_ | 651 DVLOG(1) << profile_debug_name_ |
652 << ": wait state = " << wait_state_ | 652 << ": wait state = " << wait_state_ |
653 << " after migration finish is not WAITING_FOR_NOTHING"; | 653 << " after migration finish is not WAITING_FOR_NOTHING"; |
654 return false; | 654 return false; |
655 } | 655 } |
656 if (!AwaitFullSyncCompletion( | 656 // We must use AwaitDataSyncCompletion rather than the more common |
657 // AwaitFullSyncCompletion. As long as crbug.com/97780 is open, we will | |
658 // rely on self-notifiations to ensure that timestamps are udpated, which | |
akalin
2012/01/20 23:09:29
self-notifiations -> self-notifications
| |
659 // allows AwaitFullSyncCompletion to return. However, in some migration | |
660 // tests these notifications are completely disabled, so the timestamps do | |
661 // not get updated. This is why we must use the less strict condition, | |
662 // AwaitDataSyncCompletion. | |
663 if (!AwaitDataSyncCompletion( | |
657 "Config sync cycle after migration cycle")) { | 664 "Config sync cycle after migration cycle")) { |
658 return false; | 665 return false; |
659 } | 666 } |
660 } | 667 } |
661 } | 668 } |
662 | 669 |
663 bool ProfileSyncServiceHarness::AwaitMutualSyncCycleCompletion( | 670 bool ProfileSyncServiceHarness::AwaitMutualSyncCycleCompletion( |
664 ProfileSyncServiceHarness* partner) { | 671 ProfileSyncServiceHarness* partner) { |
665 DVLOG(1) << GetClientInfoString("AwaitMutualSyncCycleCompletion"); | 672 DVLOG(1) << GetClientInfoString("AwaitMutualSyncCycleCompletion"); |
666 if (!AwaitFullSyncCompletion("Sync cycle completion on active client.")) | 673 if (!AwaitFullSyncCompletion("Sync cycle completion on active client.")) |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
883 service()->GetPreferredDataTypes(); | 890 service()->GetPreferredDataTypes(); |
884 if (synced_datatypes.Has(datatype)) { | 891 if (synced_datatypes.Has(datatype)) { |
885 DVLOG(1) << "EnableSyncForDatatype(): Sync already enabled for datatype " | 892 DVLOG(1) << "EnableSyncForDatatype(): Sync already enabled for datatype " |
886 << syncable::ModelTypeToString(datatype) | 893 << syncable::ModelTypeToString(datatype) |
887 << " on " << profile_debug_name_ << "."; | 894 << " on " << profile_debug_name_ << "."; |
888 return true; | 895 return true; |
889 } | 896 } |
890 | 897 |
891 synced_datatypes.Put(syncable::ModelTypeFromInt(datatype)); | 898 synced_datatypes.Put(syncable::ModelTypeFromInt(datatype)); |
892 service()->OnUserChoseDatatypes(false, synced_datatypes); | 899 service()->OnUserChoseDatatypes(false, synced_datatypes); |
893 if (AwaitFullSyncCompletion("Datatype configuration.")) { | 900 if (AwaitDataSyncCompletion("Datatype configuration.")) { |
894 DVLOG(1) << "EnableSyncForDatatype(): Enabled sync for datatype " | 901 DVLOG(1) << "EnableSyncForDatatype(): Enabled sync for datatype " |
895 << syncable::ModelTypeToString(datatype) | 902 << syncable::ModelTypeToString(datatype) |
896 << " on " << profile_debug_name_ << "."; | 903 << " on " << profile_debug_name_ << "."; |
897 return true; | 904 return true; |
898 } | 905 } |
899 | 906 |
900 DVLOG(0) << GetClientInfoString("EnableSyncForDatatype failed"); | 907 DVLOG(0) << GetClientInfoString("EnableSyncForDatatype failed"); |
901 return false; | 908 return false; |
902 } | 909 } |
903 | 910 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1086 return service_->GetPreferredDataTypes().Has(type); | 1093 return service_->GetPreferredDataTypes().Has(type); |
1087 } | 1094 } |
1088 | 1095 |
1089 std::string ProfileSyncServiceHarness::GetServiceStatus() { | 1096 std::string ProfileSyncServiceHarness::GetServiceStatus() { |
1090 DictionaryValue value; | 1097 DictionaryValue value; |
1091 sync_ui_util::ConstructAboutInformation(service_, &value); | 1098 sync_ui_util::ConstructAboutInformation(service_, &value); |
1092 std::string service_status; | 1099 std::string service_status; |
1093 base::JSONWriter::Write(&value, true, &service_status); | 1100 base::JSONWriter::Write(&value, true, &service_status); |
1094 return service_status; | 1101 return service_status; |
1095 } | 1102 } |
OLD | NEW |