| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 } | 330 } |
| 331 break; | 331 break; |
| 332 } | 332 } |
| 333 case WAITING_FOR_ENCRYPTION: { | 333 case WAITING_FOR_ENCRYPTION: { |
| 334 DVLOG(1) << GetClientInfoString("WAITING_FOR_ENCRYPTION"); | 334 DVLOG(1) << GetClientInfoString("WAITING_FOR_ENCRYPTION"); |
| 335 // The correctness of this if condition may depend on the ordering of its | 335 // The correctness of this if condition may depend on the ordering of its |
| 336 // sub-expressions. See crbug.com/98607, crbug.com/95619. | 336 // sub-expressions. See crbug.com/98607, crbug.com/95619. |
| 337 // TODO(rlarocque): Figure out a less brittle way of detecting this. | 337 // TODO(rlarocque): Figure out a less brittle way of detecting this. |
| 338 if (IsTypeEncrypted(waiting_for_encryption_type_) && | 338 if (IsTypeEncrypted(waiting_for_encryption_type_) && |
| 339 IsFullySynced() && | 339 IsFullySynced() && |
| 340 GetLastSessionSnapshot()->num_encryption_conflicts == 0) { | 340 GetLastSessionSnapshot().num_encryption_conflicts() == 0) { |
| 341 // Encryption is now complete for the the type in which we were waiting. | 341 // Encryption is now complete for the the type in which we were waiting. |
| 342 SignalStateCompleteWithNextState(FULLY_SYNCED); | 342 SignalStateCompleteWithNextState(FULLY_SYNCED); |
| 343 break; | 343 break; |
| 344 } | 344 } |
| 345 break; | 345 break; |
| 346 } | 346 } |
| 347 case WAITING_FOR_SYNC_CONFIGURATION: { | 347 case WAITING_FOR_SYNC_CONFIGURATION: { |
| 348 DVLOG(1) << GetClientInfoString("WAITING_FOR_SYNC_CONFIGURATION"); | 348 DVLOG(1) << GetClientInfoString("WAITING_FOR_SYNC_CONFIGURATION"); |
| 349 if (service()->ShouldPushChanges()) { | 349 if (service()->ShouldPushChanges()) { |
| 350 // The Datatype manager is configured and sync is fully initialized. | 350 // The Datatype manager is configured and sync is fully initialized. |
| 351 SignalStateCompleteWithNextState(FULLY_SYNCED); | 351 SignalStateCompleteWithNextState(FULLY_SYNCED); |
| 352 } | 352 } |
| 353 break; | 353 break; |
| 354 } | 354 } |
| 355 case WAITING_FOR_SYNC_DISABLED: { | 355 case WAITING_FOR_SYNC_DISABLED: { |
| 356 DVLOG(1) << GetClientInfoString("WAITING_FOR_SYNC_DISABLED"); | 356 DVLOG(1) << GetClientInfoString("WAITING_FOR_SYNC_DISABLED"); |
| 357 if (service()->HasSyncSetupCompleted() == false) { | 357 if (service()->HasSyncSetupCompleted() == false) { |
| 358 // Sync has been disabled. | 358 // Sync has been disabled. |
| 359 SignalStateCompleteWithNextState(SYNC_DISABLED); | 359 SignalStateCompleteWithNextState(SYNC_DISABLED); |
| 360 } | 360 } |
| 361 break; | 361 break; |
| 362 } | 362 } |
| 363 case WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION: { | 363 case WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION: { |
| 364 DVLOG(1) << GetClientInfoString( | 364 DVLOG(1) << GetClientInfoString( |
| 365 "WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION"); | 365 "WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION"); |
| 366 const browser_sync::sessions::SyncSessionSnapshot *snap = | 366 const SyncSessionSnapshot& snap = GetLastSessionSnapshot(); |
| 367 GetLastSessionSnapshot(); | 367 retry_verifier_.VerifyRetryInterval(snap); |
| 368 CHECK(snap); | |
| 369 retry_verifier_.VerifyRetryInterval(*snap); | |
| 370 if (retry_verifier_.done()) { | 368 if (retry_verifier_.done()) { |
| 371 // Retry verifier is done verifying exponential backoff. | 369 // Retry verifier is done verifying exponential backoff. |
| 372 SignalStateCompleteWithNextState(WAITING_FOR_NOTHING); | 370 SignalStateCompleteWithNextState(WAITING_FOR_NOTHING); |
| 373 } | 371 } |
| 374 break; | 372 break; |
| 375 } | 373 } |
| 376 case WAITING_FOR_MIGRATION_TO_START: { | 374 case WAITING_FOR_MIGRATION_TO_START: { |
| 377 DVLOG(1) << GetClientInfoString("WAITING_FOR_MIGRATION_TO_START"); | 375 DVLOG(1) << GetClientInfoString("WAITING_FOR_MIGRATION_TO_START"); |
| 378 if (HasPendingBackendMigration()) { | 376 if (HasPendingBackendMigration()) { |
| 379 // There are pending migrations. Wait for them. | 377 // There are pending migrations. Wait for them. |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 | 571 |
| 574 bool ProfileSyncServiceHarness::AwaitSyncDisabled(const std::string& reason) { | 572 bool ProfileSyncServiceHarness::AwaitSyncDisabled(const std::string& reason) { |
| 575 DCHECK(service()->HasSyncSetupCompleted()); | 573 DCHECK(service()->HasSyncSetupCompleted()); |
| 576 DCHECK_NE(wait_state_, SYNC_DISABLED); | 574 DCHECK_NE(wait_state_, SYNC_DISABLED); |
| 577 wait_state_ = WAITING_FOR_SYNC_DISABLED; | 575 wait_state_ = WAITING_FOR_SYNC_DISABLED; |
| 578 AwaitStatusChangeWithTimeout(kLiveSyncOperationTimeoutMs, reason); | 576 AwaitStatusChangeWithTimeout(kLiveSyncOperationTimeoutMs, reason); |
| 579 return wait_state_ == SYNC_DISABLED; | 577 return wait_state_ == SYNC_DISABLED; |
| 580 } | 578 } |
| 581 | 579 |
| 582 bool ProfileSyncServiceHarness::AwaitExponentialBackoffVerification() { | 580 bool ProfileSyncServiceHarness::AwaitExponentialBackoffVerification() { |
| 583 const browser_sync::sessions::SyncSessionSnapshot *snap = | 581 const SyncSessionSnapshot& snap = GetLastSessionSnapshot(); |
| 584 GetLastSessionSnapshot(); | 582 retry_verifier_.Initialize(snap); |
| 585 CHECK(snap); | |
| 586 retry_verifier_.Initialize(*snap); | |
| 587 wait_state_ = WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION; | 583 wait_state_ = WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION; |
| 588 AwaitStatusChangeWithTimeout(kExponentialBackoffVerificationTimeoutMs, | 584 AwaitStatusChangeWithTimeout(kExponentialBackoffVerificationTimeoutMs, |
| 589 "Verify Exponential backoff"); | 585 "Verify Exponential backoff"); |
| 590 return (retry_verifier_.Succeeded()); | 586 return (retry_verifier_.Succeeded()); |
| 591 } | 587 } |
| 592 | 588 |
| 593 bool ProfileSyncServiceHarness::AwaitActionableError() { | 589 bool ProfileSyncServiceHarness::AwaitActionableError() { |
| 594 ProfileSyncService::Status status = GetStatus(); | 590 ProfileSyncService::Status status = GetStatus(); |
| 595 CHECK(status.sync_protocol_error.action == browser_sync::UNKNOWN_ACTION); | 591 CHECK(status.sync_protocol_error.action == browser_sync::UNKNOWN_ACTION); |
| 596 wait_state_ = WAITING_FOR_ACTIONABLE_ERROR; | 592 wait_state_ = WAITING_FOR_ACTIONABLE_ERROR; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 } | 743 } |
| 748 | 744 |
| 749 ProfileSyncService::Status ProfileSyncServiceHarness::GetStatus() { | 745 ProfileSyncService::Status ProfileSyncServiceHarness::GetStatus() { |
| 750 DCHECK(service() != NULL) << "GetStatus(): service() is NULL."; | 746 DCHECK(service() != NULL) << "GetStatus(): service() is NULL."; |
| 751 return service()->QueryDetailedSyncStatus(); | 747 return service()->QueryDetailedSyncStatus(); |
| 752 } | 748 } |
| 753 | 749 |
| 754 // We use this function to share code between IsFullySynced and IsDataSynced | 750 // We use this function to share code between IsFullySynced and IsDataSynced |
| 755 // while ensuring that all conditions are evaluated using on the same snapshot. | 751 // while ensuring that all conditions are evaluated using on the same snapshot. |
| 756 bool ProfileSyncServiceHarness::IsDataSyncedImpl( | 752 bool ProfileSyncServiceHarness::IsDataSyncedImpl( |
| 757 const browser_sync::sessions::SyncSessionSnapshot *snap) { | 753 const SyncSessionSnapshot& snap) { |
| 758 return snap && | 754 return snap.num_simple_conflicts() == 0 && |
| 759 snap->num_simple_conflicts == 0 && | 755 ServiceIsPushingChanges() && |
| 760 ServiceIsPushingChanges() && | 756 GetStatus().notifications_enabled && |
| 761 GetStatus().notifications_enabled && | 757 !service()->HasUnsyncedItems() && |
| 762 !service()->HasUnsyncedItems() && | 758 !snap.has_more_to_sync() && |
| 763 !snap->has_more_to_sync && | 759 !HasPendingBackendMigration(); |
| 764 !HasPendingBackendMigration(); | |
| 765 } | 760 } |
| 766 | 761 |
| 767 bool ProfileSyncServiceHarness::IsDataSynced() { | 762 bool ProfileSyncServiceHarness::IsDataSynced() { |
| 768 if (service() == NULL) { | 763 if (service() == NULL) { |
| 769 DVLOG(1) << GetClientInfoString("IsDataSynced(): false"); | 764 DVLOG(1) << GetClientInfoString("IsDataSynced(): false"); |
| 770 return false; | 765 return false; |
| 771 } | 766 } |
| 772 | 767 |
| 773 const SyncSessionSnapshot* snap = GetLastSessionSnapshot(); | 768 const SyncSessionSnapshot& snap = GetLastSessionSnapshot(); |
| 774 bool is_data_synced = IsDataSyncedImpl(snap); | 769 bool is_data_synced = IsDataSyncedImpl(snap); |
| 775 | 770 |
| 776 DVLOG(1) << GetClientInfoString( | 771 DVLOG(1) << GetClientInfoString( |
| 777 is_data_synced ? "IsDataSynced: true" : "IsDataSynced: false"); | 772 is_data_synced ? "IsDataSynced: true" : "IsDataSynced: false"); |
| 778 return is_data_synced; | 773 return is_data_synced; |
| 779 } | 774 } |
| 780 | 775 |
| 781 bool ProfileSyncServiceHarness::IsFullySynced() { | 776 bool ProfileSyncServiceHarness::IsFullySynced() { |
| 782 if (service() == NULL) { | 777 if (service() == NULL) { |
| 783 DVLOG(1) << GetClientInfoString("IsFullySynced: false"); | 778 DVLOG(1) << GetClientInfoString("IsFullySynced: false"); |
| 784 return false; | 779 return false; |
| 785 } | 780 } |
| 786 const SyncSessionSnapshot* snap = GetLastSessionSnapshot(); | 781 const SyncSessionSnapshot& snap = GetLastSessionSnapshot(); |
| 787 // snap->unsynced_count == 0 is a fairly reliable indicator of whether or not | 782 // snap.unsynced_count() == 0 is a fairly reliable indicator of whether or not |
| 788 // our timestamp is in sync with the server. | 783 // our timestamp is in sync with the server. |
| 789 bool is_fully_synced = IsDataSyncedImpl(snap) && | 784 bool is_fully_synced = IsDataSyncedImpl(snap) && |
| 790 snap->unsynced_count == 0; | 785 snap.unsynced_count() == 0; |
| 791 | 786 |
| 792 DVLOG(1) << GetClientInfoString( | 787 DVLOG(1) << GetClientInfoString( |
| 793 is_fully_synced ? "IsFullySynced: true" : "IsFullySynced: false"); | 788 is_fully_synced ? "IsFullySynced: true" : "IsFullySynced: false"); |
| 794 return is_fully_synced; | 789 return is_fully_synced; |
| 795 } | 790 } |
| 796 | 791 |
| 797 bool ProfileSyncServiceHarness::HasPendingBackendMigration() { | 792 bool ProfileSyncServiceHarness::HasPendingBackendMigration() { |
| 798 browser_sync::BackendMigrator* migrator = | 793 browser_sync::BackendMigrator* migrator = |
| 799 service()->GetBackendMigratorForTest(); | 794 service()->GetBackendMigratorForTest(); |
| 800 return migrator && migrator->state() != browser_sync::BackendMigrator::IDLE; | 795 return migrator && migrator->state() != browser_sync::BackendMigrator::IDLE; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 << partner->profile_debug_name_ | 844 << partner->profile_debug_name_ |
| 850 << " partner timestamp = " | 845 << " partner timestamp = " |
| 851 << partner_timestamp_base64; | 846 << partner_timestamp_base64; |
| 852 } | 847 } |
| 853 return false; | 848 return false; |
| 854 } | 849 } |
| 855 } | 850 } |
| 856 return true; | 851 return true; |
| 857 } | 852 } |
| 858 | 853 |
| 859 const SyncSessionSnapshot* | 854 SyncSessionSnapshot ProfileSyncServiceHarness::GetLastSessionSnapshot() const { |
| 860 ProfileSyncServiceHarness::GetLastSessionSnapshot() const { | |
| 861 DCHECK(service_ != NULL) << "Sync service has not yet been set up."; | 855 DCHECK(service_ != NULL) << "Sync service has not yet been set up."; |
| 862 if (service_->sync_initialized()) { | 856 if (service_->sync_initialized()) { |
| 863 return service_->GetLastSessionSnapshot(); | 857 return service_->GetLastSessionSnapshot(); |
| 864 } | 858 } |
| 865 return NULL; | 859 return SyncSessionSnapshot(); |
| 866 } | 860 } |
| 867 | 861 |
| 868 bool ProfileSyncServiceHarness::EnableSyncForDatatype( | 862 bool ProfileSyncServiceHarness::EnableSyncForDatatype( |
| 869 syncable::ModelType datatype) { | 863 syncable::ModelType datatype) { |
| 870 DVLOG(1) << GetClientInfoString( | 864 DVLOG(1) << GetClientInfoString( |
| 871 "EnableSyncForDatatype(" | 865 "EnableSyncForDatatype(" |
| 872 + std::string(syncable::ModelTypeToString(datatype)) + ")"); | 866 + std::string(syncable::ModelTypeToString(datatype)) + ")"); |
| 873 | 867 |
| 874 if (wait_state_ == SYNC_DISABLED) { | 868 if (wait_state_ == SYNC_DISABLED) { |
| 875 return SetupSync(syncable::ModelTypeSet(datatype)); | 869 return SetupSync(syncable::ModelTypeSet(datatype)); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 | 962 |
| 969 service()->DisableForUser(); | 963 service()->DisableForUser(); |
| 970 wait_state_ = SYNC_DISABLED; | 964 wait_state_ = SYNC_DISABLED; |
| 971 DVLOG(1) << "DisableSyncForAllDatatypes(): Disabled sync for all " | 965 DVLOG(1) << "DisableSyncForAllDatatypes(): Disabled sync for all " |
| 972 << "datatypes on " << profile_debug_name_; | 966 << "datatypes on " << profile_debug_name_; |
| 973 return true; | 967 return true; |
| 974 } | 968 } |
| 975 | 969 |
| 976 std::string ProfileSyncServiceHarness::GetUpdatedTimestamp( | 970 std::string ProfileSyncServiceHarness::GetUpdatedTimestamp( |
| 977 syncable::ModelType model_type) { | 971 syncable::ModelType model_type) { |
| 978 const SyncSessionSnapshot* snap = GetLastSessionSnapshot(); | 972 const SyncSessionSnapshot& snap = GetLastSessionSnapshot(); |
| 979 DCHECK(snap != NULL) << "GetUpdatedTimestamp(): Sync snapshot is NULL."; | 973 return snap.download_progress_markers()[model_type]; |
| 980 return snap->download_progress_markers[model_type]; | |
| 981 } | 974 } |
| 982 | 975 |
| 983 std::string ProfileSyncServiceHarness::GetClientInfoString( | 976 std::string ProfileSyncServiceHarness::GetClientInfoString( |
| 984 const std::string& message) { | 977 const std::string& message) { |
| 985 std::stringstream os; | 978 std::stringstream os; |
| 986 os << profile_debug_name_ << ": " << message << ": "; | 979 os << profile_debug_name_ << ": " << message << ": "; |
| 987 if (service()) { | 980 if (service()) { |
| 988 const SyncSessionSnapshot* snap = GetLastSessionSnapshot(); | 981 const SyncSessionSnapshot& snap = GetLastSessionSnapshot(); |
| 989 const ProfileSyncService::Status& status = GetStatus(); | 982 const ProfileSyncService::Status& status = GetStatus(); |
| 990 if (snap) { | 983 // Capture select info from the sync session snapshot and syncer status. |
| 991 // Capture select info from the sync session snapshot and syncer status. | 984 os << "has_more_to_sync: " |
| 992 os << "has_more_to_sync: " | 985 << snap.has_more_to_sync() |
| 993 << snap->has_more_to_sync | 986 << ", has_unsynced_items: " |
| 994 << ", has_unsynced_items: " | 987 << service()->HasUnsyncedItems() |
| 995 << service()->HasUnsyncedItems() | 988 << ", unsynced_count: " |
| 996 << ", unsynced_count: " | 989 << snap.unsynced_count() |
| 997 << snap->unsynced_count | 990 << ", encryption conflicts: " |
| 998 << ", encryption conflicts: " | 991 << snap.num_encryption_conflicts() |
| 999 << snap->num_encryption_conflicts | 992 << ", hierarchy conflicts: " |
| 1000 << ", hierarchy conflicts: " | 993 << snap.num_hierarchy_conflicts() |
| 1001 << snap->num_hierarchy_conflicts | 994 << ", simple conflicts: " |
| 1002 << ", simple conflicts: " | 995 << snap.num_simple_conflicts() |
| 1003 << snap->num_simple_conflicts | 996 << ", server conflicts: " |
| 1004 << ", server conflicts: " | 997 << snap.num_server_conflicts() |
| 1005 << snap->num_server_conflicts | 998 << ", num_updates_downloaded : " |
| 1006 << ", num_updates_downloaded : " | 999 << snap.syncer_status().num_updates_downloaded_total |
| 1007 << snap->syncer_status.num_updates_downloaded_total | 1000 << ", passphrase_required_reason: " |
| 1008 << ", passphrase_required_reason: " | 1001 << sync_api::PassphraseRequiredReasonToString( |
| 1009 << sync_api::PassphraseRequiredReasonToString( | 1002 service()->passphrase_required_reason()) |
| 1010 service()->passphrase_required_reason()) | 1003 << ", notifications_enabled: " |
| 1011 << ", notifications_enabled: " | 1004 << status.notifications_enabled |
| 1012 << status.notifications_enabled | 1005 << ", service_is_pushing_changes: " |
| 1013 << ", service_is_pushing_changes: " | 1006 << ServiceIsPushingChanges() |
| 1014 << ServiceIsPushingChanges() | 1007 << ", has_pending_backend_migration: " |
| 1015 << ", has_pending_backend_migration: " | 1008 << HasPendingBackendMigration(); |
| 1016 << HasPendingBackendMigration(); | |
| 1017 } else { | |
| 1018 os << "Sync session snapshot not available"; | |
| 1019 } | |
| 1020 } else { | 1009 } else { |
| 1021 os << "Sync service not available"; | 1010 os << "Sync service not available"; |
| 1022 } | 1011 } |
| 1023 return os.str(); | 1012 return os.str(); |
| 1024 } | 1013 } |
| 1025 | 1014 |
| 1026 // TODO(zea): Rename this EnableEncryption, since we no longer turn on | 1015 // TODO(zea): Rename this EnableEncryption, since we no longer turn on |
| 1027 // encryption for individual types but for all. | 1016 // encryption for individual types but for all. |
| 1028 bool ProfileSyncServiceHarness::EnableEncryptionForType( | 1017 bool ProfileSyncServiceHarness::EnableEncryptionForType( |
| 1029 syncable::ModelType type) { | 1018 syncable::ModelType type) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1045 return WaitForTypeEncryption(type); | 1034 return WaitForTypeEncryption(type); |
| 1046 } | 1035 } |
| 1047 | 1036 |
| 1048 bool ProfileSyncServiceHarness::WaitForTypeEncryption( | 1037 bool ProfileSyncServiceHarness::WaitForTypeEncryption( |
| 1049 syncable::ModelType type) { | 1038 syncable::ModelType type) { |
| 1050 // The correctness of this if condition depends on the ordering of its | 1039 // The correctness of this if condition depends on the ordering of its |
| 1051 // sub-expressions. See crbug.com/95619. | 1040 // sub-expressions. See crbug.com/95619. |
| 1052 // TODO(rlarocque): Figure out a less brittle way of detecting this. | 1041 // TODO(rlarocque): Figure out a less brittle way of detecting this. |
| 1053 if (IsTypeEncrypted(type) && | 1042 if (IsTypeEncrypted(type) && |
| 1054 IsFullySynced() && | 1043 IsFullySynced() && |
| 1055 GetLastSessionSnapshot()->num_encryption_conflicts == 0) { | 1044 GetLastSessionSnapshot().num_encryption_conflicts() == 0) { |
| 1056 // Encryption is already complete for |type|; do not wait. | 1045 // Encryption is already complete for |type|; do not wait. |
| 1057 return true; | 1046 return true; |
| 1058 } | 1047 } |
| 1059 | 1048 |
| 1060 std::string reason = "Waiting for encryption."; | 1049 std::string reason = "Waiting for encryption."; |
| 1061 wait_state_ = WAITING_FOR_ENCRYPTION; | 1050 wait_state_ = WAITING_FOR_ENCRYPTION; |
| 1062 waiting_for_encryption_type_ = type; | 1051 waiting_for_encryption_type_ = type; |
| 1063 if (!AwaitStatusChangeWithTimeout(kLiveSyncOperationTimeoutMs, reason)) { | 1052 if (!AwaitStatusChangeWithTimeout(kLiveSyncOperationTimeoutMs, reason)) { |
| 1064 LOG(ERROR) << "Did not receive EncryptionComplete notification after" | 1053 LOG(ERROR) << "Did not receive EncryptionComplete notification after" |
| 1065 << kLiveSyncOperationTimeoutMs / 1000 | 1054 << kLiveSyncOperationTimeoutMs / 1000 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1085 service_->GetDataTypeControllerStates(&state_map); | 1074 service_->GetDataTypeControllerStates(&state_map); |
| 1086 return (state_map.count(type) != 0 && | 1075 return (state_map.count(type) != 0 && |
| 1087 state_map[type] == browser_sync::DataTypeController::RUNNING); | 1076 state_map[type] == browser_sync::DataTypeController::RUNNING); |
| 1088 } | 1077 } |
| 1089 | 1078 |
| 1090 bool ProfileSyncServiceHarness::IsTypePreferred(syncable::ModelType type) { | 1079 bool ProfileSyncServiceHarness::IsTypePreferred(syncable::ModelType type) { |
| 1091 return service_->GetPreferredDataTypes().Has(type); | 1080 return service_->GetPreferredDataTypes().Has(type); |
| 1092 } | 1081 } |
| 1093 | 1082 |
| 1094 size_t ProfileSyncServiceHarness::GetNumEntries() const { | 1083 size_t ProfileSyncServiceHarness::GetNumEntries() const { |
| 1095 return GetLastSessionSnapshot()->num_entries; | 1084 return GetLastSessionSnapshot().num_entries(); |
| 1096 } | 1085 } |
| 1097 | 1086 |
| 1098 size_t ProfileSyncServiceHarness::GetNumDatatypes() const { | 1087 size_t ProfileSyncServiceHarness::GetNumDatatypes() const { |
| 1099 browser_sync::DataTypeController::StateMap state_map; | 1088 browser_sync::DataTypeController::StateMap state_map; |
| 1100 service_->GetDataTypeControllerStates(&state_map); | 1089 service_->GetDataTypeControllerStates(&state_map); |
| 1101 return state_map.size(); | 1090 return state_map.size(); |
| 1102 } | 1091 } |
| 1103 | 1092 |
| 1104 std::string ProfileSyncServiceHarness::GetServiceStatus() { | 1093 std::string ProfileSyncServiceHarness::GetServiceStatus() { |
| 1105 DictionaryValue value; | 1094 DictionaryValue value; |
| 1106 sync_ui_util::ConstructAboutInformation(service_, &value); | 1095 sync_ui_util::ConstructAboutInformation(service_, &value); |
| 1107 std::string service_status; | 1096 std::string service_status; |
| 1108 base::JSONWriter::WriteWithOptions(&value, | 1097 base::JSONWriter::WriteWithOptions(&value, |
| 1109 base::JSONWriter::OPTIONS_PRETTY_PRINT, | 1098 base::JSONWriter::OPTIONS_PRETTY_PRINT, |
| 1110 &service_status); | 1099 &service_status); |
| 1111 return service_status; | 1100 return service_status; |
| 1112 } | 1101 } |
| OLD | NEW |