| 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 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 | 788 |
| 789 bool ProfileSyncServiceHarness::IsFullySynced() { | 789 bool ProfileSyncServiceHarness::IsFullySynced() { |
| 790 if (service() == NULL) { | 790 if (service() == NULL) { |
| 791 DVLOG(1) << GetClientInfoString("IsFullySynced: false"); | 791 DVLOG(1) << GetClientInfoString("IsFullySynced: false"); |
| 792 return false; | 792 return false; |
| 793 } | 793 } |
| 794 const SyncSessionSnapshot& snap = GetLastSessionSnapshot(); | 794 const SyncSessionSnapshot& snap = GetLastSessionSnapshot(); |
| 795 // If we didn't try to commit anything in the previous cycle, there's a | 795 // If we didn't try to commit anything in the previous cycle, there's a |
| 796 // good chance that we're now fully up to date. | 796 // good chance that we're now fully up to date. |
| 797 bool is_fully_synced = | 797 bool is_fully_synced = |
| 798 (snap.errors().last_post_commit_result == browser_sync::UNSET) | 798 snap.syncer_status().num_successful_commits == 0 |
| 799 && snap.errors().commit_result == browser_sync::SYNCER_OK |
| 799 && IsDataSyncedImpl(snap); | 800 && IsDataSyncedImpl(snap); |
| 800 | 801 |
| 801 DVLOG(1) << GetClientInfoString( | 802 DVLOG(1) << GetClientInfoString( |
| 802 is_fully_synced ? "IsFullySynced: true" : "IsFullySynced: false"); | 803 is_fully_synced ? "IsFullySynced: true" : "IsFullySynced: false"); |
| 803 return is_fully_synced; | 804 return is_fully_synced; |
| 804 } | 805 } |
| 805 | 806 |
| 806 bool ProfileSyncServiceHarness::HasPendingBackendMigration() { | 807 bool ProfileSyncServiceHarness::HasPendingBackendMigration() { |
| 807 browser_sync::BackendMigrator* migrator = | 808 browser_sync::BackendMigrator* migrator = |
| 808 service()->GetBackendMigratorForTest(); | 809 service()->GetBackendMigratorForTest(); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 std::stringstream os; | 993 std::stringstream os; |
| 993 os << profile_debug_name_ << ": " << message << ": "; | 994 os << profile_debug_name_ << ": " << message << ": "; |
| 994 if (service()) { | 995 if (service()) { |
| 995 const SyncSessionSnapshot& snap = GetLastSessionSnapshot(); | 996 const SyncSessionSnapshot& snap = GetLastSessionSnapshot(); |
| 996 const ProfileSyncService::Status& status = GetStatus(); | 997 const ProfileSyncService::Status& status = GetStatus(); |
| 997 // Capture select info from the sync session snapshot and syncer status. | 998 // Capture select info from the sync session snapshot and syncer status. |
| 998 os << "has_more_to_sync: " | 999 os << "has_more_to_sync: " |
| 999 << snap.has_more_to_sync() | 1000 << snap.has_more_to_sync() |
| 1000 << ", has_unsynced_items: " | 1001 << ", has_unsynced_items: " |
| 1001 << (service()->sync_initialized() ? service()->HasUnsyncedItems() : 0) | 1002 << (service()->sync_initialized() ? service()->HasUnsyncedItems() : 0) |
| 1003 << ", did_commit: " |
| 1004 << (snap.syncer_status().num_successful_commits == 0 |
| 1005 && snap.errors().commit_result == browser_sync::SYNCER_OK) |
| 1002 << ", encryption conflicts: " | 1006 << ", encryption conflicts: " |
| 1003 << snap.num_encryption_conflicts() | 1007 << snap.num_encryption_conflicts() |
| 1004 << ", hierarchy conflicts: " | 1008 << ", hierarchy conflicts: " |
| 1005 << snap.num_hierarchy_conflicts() | 1009 << snap.num_hierarchy_conflicts() |
| 1006 << ", simple conflicts: " | 1010 << ", simple conflicts: " |
| 1007 << snap.num_simple_conflicts() | 1011 << snap.num_simple_conflicts() |
| 1008 << ", server conflicts: " | 1012 << ", server conflicts: " |
| 1009 << snap.num_server_conflicts() | 1013 << snap.num_server_conflicts() |
| 1010 << ", num_updates_downloaded : " | 1014 << ", num_updates_downloaded : " |
| 1011 << snap.syncer_status().num_updates_downloaded_total | 1015 << snap.syncer_status().num_updates_downloaded_total |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 | 1108 |
| 1105 std::string ProfileSyncServiceHarness::GetServiceStatus() { | 1109 std::string ProfileSyncServiceHarness::GetServiceStatus() { |
| 1106 DictionaryValue value; | 1110 DictionaryValue value; |
| 1107 sync_ui_util::ConstructAboutInformation(service_, &value); | 1111 sync_ui_util::ConstructAboutInformation(service_, &value); |
| 1108 std::string service_status; | 1112 std::string service_status; |
| 1109 base::JSONWriter::WriteWithOptions(&value, | 1113 base::JSONWriter::WriteWithOptions(&value, |
| 1110 base::JSONWriter::OPTIONS_PRETTY_PRINT, | 1114 base::JSONWriter::OPTIONS_PRETTY_PRINT, |
| 1111 &service_status); | 1115 &service_status); |
| 1112 return service_status; | 1116 return service_status; |
| 1113 } | 1117 } |
| OLD | NEW |