| 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 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 is_data_synced ? "IsDataSynced: true" : "IsDataSynced: false"); | 779 is_data_synced ? "IsDataSynced: true" : "IsDataSynced: false"); |
| 780 return is_data_synced; | 780 return is_data_synced; |
| 781 } | 781 } |
| 782 | 782 |
| 783 bool ProfileSyncServiceHarness::IsFullySynced() { | 783 bool ProfileSyncServiceHarness::IsFullySynced() { |
| 784 if (service() == NULL) { | 784 if (service() == NULL) { |
| 785 DVLOG(1) << GetClientInfoString("IsFullySynced: false"); | 785 DVLOG(1) << GetClientInfoString("IsFullySynced: false"); |
| 786 return false; | 786 return false; |
| 787 } | 787 } |
| 788 const SyncSessionSnapshot& snap = GetLastSessionSnapshot(); | 788 const SyncSessionSnapshot& snap = GetLastSessionSnapshot(); |
| 789 // snap.unsynced_count() == 0 is a fairly reliable indicator of whether or not | 789 // If we didn't try to commit anything in the previous cycle, there's a |
| 790 // our timestamp is in sync with the server. | 790 // good chance that we're now fully up to date. |
| 791 bool is_fully_synced = IsDataSyncedImpl(snap) && | 791 bool is_fully_synced = |
| 792 snap.unsynced_count() == 0; | 792 (snap.errors().last_post_commit_result == browser_sync::UNSET) |
| 793 && IsDataSyncedImpl(snap); |
| 793 | 794 |
| 794 DVLOG(1) << GetClientInfoString( | 795 DVLOG(1) << GetClientInfoString( |
| 795 is_fully_synced ? "IsFullySynced: true" : "IsFullySynced: false"); | 796 is_fully_synced ? "IsFullySynced: true" : "IsFullySynced: false"); |
| 796 return is_fully_synced; | 797 return is_fully_synced; |
| 797 } | 798 } |
| 798 | 799 |
| 799 bool ProfileSyncServiceHarness::HasPendingBackendMigration() { | 800 bool ProfileSyncServiceHarness::HasPendingBackendMigration() { |
| 800 browser_sync::BackendMigrator* migrator = | 801 browser_sync::BackendMigrator* migrator = |
| 801 service()->GetBackendMigratorForTest(); | 802 service()->GetBackendMigratorForTest(); |
| 802 return migrator && migrator->state() != browser_sync::BackendMigrator::IDLE; | 803 return migrator && migrator->state() != browser_sync::BackendMigrator::IDLE; |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 std::stringstream os; | 986 std::stringstream os; |
| 986 os << profile_debug_name_ << ": " << message << ": "; | 987 os << profile_debug_name_ << ": " << message << ": "; |
| 987 if (service()) { | 988 if (service()) { |
| 988 const SyncSessionSnapshot& snap = GetLastSessionSnapshot(); | 989 const SyncSessionSnapshot& snap = GetLastSessionSnapshot(); |
| 989 const ProfileSyncService::Status& status = GetStatus(); | 990 const ProfileSyncService::Status& status = GetStatus(); |
| 990 // Capture select info from the sync session snapshot and syncer status. | 991 // Capture select info from the sync session snapshot and syncer status. |
| 991 os << "has_more_to_sync: " | 992 os << "has_more_to_sync: " |
| 992 << snap.has_more_to_sync() | 993 << snap.has_more_to_sync() |
| 993 << ", has_unsynced_items: " | 994 << ", has_unsynced_items: " |
| 994 << service()->HasUnsyncedItems() | 995 << service()->HasUnsyncedItems() |
| 995 << ", unsynced_count: " | |
| 996 << snap.unsynced_count() | |
| 997 << ", encryption conflicts: " | 996 << ", encryption conflicts: " |
| 998 << snap.num_encryption_conflicts() | 997 << snap.num_encryption_conflicts() |
| 999 << ", hierarchy conflicts: " | 998 << ", hierarchy conflicts: " |
| 1000 << snap.num_hierarchy_conflicts() | 999 << snap.num_hierarchy_conflicts() |
| 1001 << ", simple conflicts: " | 1000 << ", simple conflicts: " |
| 1002 << snap.num_simple_conflicts() | 1001 << snap.num_simple_conflicts() |
| 1003 << ", server conflicts: " | 1002 << ", server conflicts: " |
| 1004 << snap.num_server_conflicts() | 1003 << snap.num_server_conflicts() |
| 1005 << ", num_updates_downloaded : " | 1004 << ", num_updates_downloaded : " |
| 1006 << snap.syncer_status().num_updates_downloaded_total | 1005 << snap.syncer_status().num_updates_downloaded_total |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 | 1098 |
| 1100 std::string ProfileSyncServiceHarness::GetServiceStatus() { | 1099 std::string ProfileSyncServiceHarness::GetServiceStatus() { |
| 1101 DictionaryValue value; | 1100 DictionaryValue value; |
| 1102 sync_ui_util::ConstructAboutInformation(service_, &value); | 1101 sync_ui_util::ConstructAboutInformation(service_, &value); |
| 1103 std::string service_status; | 1102 std::string service_status; |
| 1104 base::JSONWriter::WriteWithOptions(&value, | 1103 base::JSONWriter::WriteWithOptions(&value, |
| 1105 base::JSONWriter::OPTIONS_PRETTY_PRINT, | 1104 base::JSONWriter::OPTIONS_PRETTY_PRINT, |
| 1106 &service_status); | 1105 &service_status); |
| 1107 return service_status; | 1106 return service_status; |
| 1108 } | 1107 } |
| OLD | NEW |