| 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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 ProfileSyncService::Status ProfileSyncServiceHarness::GetStatus() { | 763 ProfileSyncService::Status ProfileSyncServiceHarness::GetStatus() { |
| 764 DCHECK(service() != NULL) << "GetStatus(): service() is NULL."; | 764 DCHECK(service() != NULL) << "GetStatus(): service() is NULL."; |
| 765 return service()->QueryDetailedSyncStatus(); | 765 return service()->QueryDetailedSyncStatus(); |
| 766 } | 766 } |
| 767 | 767 |
| 768 // We use this function to share code between IsFullySynced and IsDataSynced | 768 // We use this function to share code between IsFullySynced and IsDataSynced |
| 769 // while ensuring that all conditions are evaluated using on the same snapshot. | 769 // while ensuring that all conditions are evaluated using on the same snapshot. |
| 770 bool ProfileSyncServiceHarness::IsDataSyncedImpl( | 770 bool ProfileSyncServiceHarness::IsDataSyncedImpl( |
| 771 const browser_sync::sessions::SyncSessionSnapshot *snap) { | 771 const browser_sync::sessions::SyncSessionSnapshot *snap) { |
| 772 return snap && | 772 return snap && |
| 773 snap->num_blocking_conflicting_updates == 0 && | 773 snap->num_simple_conflicting_updates == 0 && |
| 774 ServiceIsPushingChanges() && | 774 ServiceIsPushingChanges() && |
| 775 GetStatus().notifications_enabled && | 775 GetStatus().notifications_enabled && |
| 776 !service()->HasUnsyncedItems() && | 776 !service()->HasUnsyncedItems() && |
| 777 !snap->has_more_to_sync && | 777 !snap->has_more_to_sync && |
| 778 !HasPendingBackendMigration(); | 778 !HasPendingBackendMigration(); |
| 779 } | 779 } |
| 780 | 780 |
| 781 bool ProfileSyncServiceHarness::IsDataSynced() { | 781 bool ProfileSyncServiceHarness::IsDataSynced() { |
| 782 if (service() == NULL) { | 782 if (service() == NULL) { |
| 783 DVLOG(1) << GetClientInfoString("IsDataSynced(): false"); | 783 DVLOG(1) << GetClientInfoString("IsDataSynced(): false"); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 if (snap) { | 1000 if (snap) { |
| 1001 // Capture select info from the sync session snapshot and syncer status. | 1001 // Capture select info from the sync session snapshot and syncer status. |
| 1002 os << "has_more_to_sync: " | 1002 os << "has_more_to_sync: " |
| 1003 << snap->has_more_to_sync | 1003 << snap->has_more_to_sync |
| 1004 << ", has_unsynced_items: " | 1004 << ", has_unsynced_items: " |
| 1005 << service()->HasUnsyncedItems() | 1005 << service()->HasUnsyncedItems() |
| 1006 << ", unsynced_count: " | 1006 << ", unsynced_count: " |
| 1007 << snap->unsynced_count | 1007 << snap->unsynced_count |
| 1008 << ", num_conflicting_updates: " | 1008 << ", num_conflicting_updates: " |
| 1009 << snap->num_conflicting_updates | 1009 << snap->num_conflicting_updates |
| 1010 << ", num_blocking_conflicting_updates: " | 1010 << ", num_simple_conflicting_updates: " |
| 1011 << snap->num_blocking_conflicting_updates | 1011 << snap->num_simple_conflicting_updates |
| 1012 << ", num_updates_downloaded : " | 1012 << ", num_updates_downloaded : " |
| 1013 << snap->syncer_status.num_updates_downloaded_total | 1013 << snap->syncer_status.num_updates_downloaded_total |
| 1014 << ", passphrase_required_reason: " | 1014 << ", passphrase_required_reason: " |
| 1015 << sync_api::PassphraseRequiredReasonToString( | 1015 << sync_api::PassphraseRequiredReasonToString( |
| 1016 service()->passphrase_required_reason()) | 1016 service()->passphrase_required_reason()) |
| 1017 << ", notifications_enabled: " | 1017 << ", notifications_enabled: " |
| 1018 << status.notifications_enabled | 1018 << status.notifications_enabled |
| 1019 << ", service_is_pushing_changes: " | 1019 << ", service_is_pushing_changes: " |
| 1020 << ServiceIsPushingChanges() | 1020 << ServiceIsPushingChanges() |
| 1021 << ", has_pending_backend_migration: " | 1021 << ", has_pending_backend_migration: " |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 return state_map.size(); | 1107 return state_map.size(); |
| 1108 } | 1108 } |
| 1109 | 1109 |
| 1110 std::string ProfileSyncServiceHarness::GetServiceStatus() { | 1110 std::string ProfileSyncServiceHarness::GetServiceStatus() { |
| 1111 DictionaryValue value; | 1111 DictionaryValue value; |
| 1112 sync_ui_util::ConstructAboutInformation(service_, &value); | 1112 sync_ui_util::ConstructAboutInformation(service_, &value); |
| 1113 std::string service_status; | 1113 std::string service_status; |
| 1114 base::JSONWriter::Write(&value, true, &service_status); | 1114 base::JSONWriter::Write(&value, true, &service_status); |
| 1115 return service_status; | 1115 return service_status; |
| 1116 } | 1116 } |
| OLD | NEW |