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 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 ProfileSyncService::Status ProfileSyncServiceHarness::GetStatus() { | 768 ProfileSyncService::Status ProfileSyncServiceHarness::GetStatus() { |
769 DCHECK(service() != NULL) << "GetStatus(): service() is NULL."; | 769 DCHECK(service() != NULL) << "GetStatus(): service() is NULL."; |
770 return service()->QueryDetailedSyncStatus(); | 770 return service()->QueryDetailedSyncStatus(); |
771 } | 771 } |
772 | 772 |
773 // We use this function to share code between IsFullySynced and IsDataSynced | 773 // We use this function to share code between IsFullySynced and IsDataSynced |
774 // while ensuring that all conditions are evaluated using on the same snapshot. | 774 // while ensuring that all conditions are evaluated using on the same snapshot. |
775 bool ProfileSyncServiceHarness::IsDataSyncedImpl( | 775 bool ProfileSyncServiceHarness::IsDataSyncedImpl( |
776 const browser_sync::sessions::SyncSessionSnapshot *snap) { | 776 const browser_sync::sessions::SyncSessionSnapshot *snap) { |
777 return snap && | 777 return snap && |
778 snap->num_blocking_conflicting_updates == 0 && | 778 snap->num_simple_conflicting_updates == 0 && |
779 ServiceIsPushingChanges() && | 779 ServiceIsPushingChanges() && |
780 GetStatus().notifications_enabled && | 780 GetStatus().notifications_enabled && |
781 !service()->HasUnsyncedItems() && | 781 !service()->HasUnsyncedItems() && |
782 !snap->has_more_to_sync && | 782 !snap->has_more_to_sync && |
783 !HasPendingBackendMigration(); | 783 !HasPendingBackendMigration(); |
784 } | 784 } |
785 | 785 |
786 bool ProfileSyncServiceHarness::IsDataSynced() { | 786 bool ProfileSyncServiceHarness::IsDataSynced() { |
787 if (service() == NULL) { | 787 if (service() == NULL) { |
788 DVLOG(1) << GetClientInfoString("IsDataSynced(): false"); | 788 DVLOG(1) << GetClientInfoString("IsDataSynced(): false"); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 if (snap) { | 1009 if (snap) { |
1010 // Capture select info from the sync session snapshot and syncer status. | 1010 // Capture select info from the sync session snapshot and syncer status. |
1011 os << "has_more_to_sync: " | 1011 os << "has_more_to_sync: " |
1012 << snap->has_more_to_sync | 1012 << snap->has_more_to_sync |
1013 << ", has_unsynced_items: " | 1013 << ", has_unsynced_items: " |
1014 << service()->HasUnsyncedItems() | 1014 << service()->HasUnsyncedItems() |
1015 << ", unsynced_count: " | 1015 << ", unsynced_count: " |
1016 << snap->unsynced_count | 1016 << snap->unsynced_count |
1017 << ", num_conflicting_updates: " | 1017 << ", num_conflicting_updates: " |
1018 << snap->num_conflicting_updates | 1018 << snap->num_conflicting_updates |
1019 << ", num_blocking_conflicting_updates: " | 1019 << ", num_simple_conflicting_updates: " |
1020 << snap->num_blocking_conflicting_updates | 1020 << snap->num_simple_conflicting_updates |
1021 << ", num_updates_downloaded : " | 1021 << ", num_updates_downloaded : " |
1022 << snap->syncer_status.num_updates_downloaded_total | 1022 << snap->syncer_status.num_updates_downloaded_total |
1023 << ", passphrase_required_reason: " | 1023 << ", passphrase_required_reason: " |
1024 << sync_api::PassphraseRequiredReasonToString( | 1024 << sync_api::PassphraseRequiredReasonToString( |
1025 service()->passphrase_required_reason()) | 1025 service()->passphrase_required_reason()) |
1026 << ", notifications_enabled: " | 1026 << ", notifications_enabled: " |
1027 << status.notifications_enabled | 1027 << status.notifications_enabled |
1028 << ", service_is_pushing_changes: " | 1028 << ", service_is_pushing_changes: " |
1029 << ServiceIsPushingChanges() | 1029 << ServiceIsPushingChanges() |
1030 << ", has_pending_backend_migration: " | 1030 << ", has_pending_backend_migration: " |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 return state_map.size(); | 1116 return state_map.size(); |
1117 } | 1117 } |
1118 | 1118 |
1119 std::string ProfileSyncServiceHarness::GetServiceStatus() { | 1119 std::string ProfileSyncServiceHarness::GetServiceStatus() { |
1120 DictionaryValue value; | 1120 DictionaryValue value; |
1121 sync_ui_util::ConstructAboutInformation(service_, &value); | 1121 sync_ui_util::ConstructAboutInformation(service_, &value); |
1122 std::string service_status; | 1122 std::string service_status; |
1123 base::JSONWriter::Write(&value, true, &service_status); | 1123 base::JSONWriter::Write(&value, true, &service_status); |
1124 return service_status; | 1124 return service_status; |
1125 } | 1125 } |
OLD | NEW |