Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(764)

Side by Side Diff: chrome/browser/sync/profile_sync_service_harness.cc

Issue 10038041: sync: Loop committing items without downloading updates (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 is_data_synced ? "IsDataSynced: true" : "IsDataSynced: false"); 777 is_data_synced ? "IsDataSynced: true" : "IsDataSynced: false");
778 return is_data_synced; 778 return is_data_synced;
779 } 779 }
780 780
781 bool ProfileSyncServiceHarness::IsFullySynced() { 781 bool ProfileSyncServiceHarness::IsFullySynced() {
782 if (service() == NULL) { 782 if (service() == NULL) {
783 DVLOG(1) << GetClientInfoString("IsFullySynced: false"); 783 DVLOG(1) << GetClientInfoString("IsFullySynced: false");
784 return false; 784 return false;
785 } 785 }
786 const SyncSessionSnapshot* snap = GetLastSessionSnapshot(); 786 const SyncSessionSnapshot* snap = GetLastSessionSnapshot();
787 // snap->unsynced_count == 0 is a fairly reliable indicator of whether or not 787 // If we didn't try to commit anything in the previous cycle, there's a
788 // our timestamp is in sync with the server. 788 // good chance that we're now fully up to date.
789 bool is_fully_synced = IsDataSyncedImpl(snap) && 789 bool is_fully_synced =
790 snap->unsynced_count == 0; 790 (snap->errors.last_post_commit_result == browser_sync::UNSET)
791 && IsDataSyncedImpl(snap);
791 792
792 DVLOG(1) << GetClientInfoString( 793 DVLOG(1) << GetClientInfoString(
793 is_fully_synced ? "IsFullySynced: true" : "IsFullySynced: false"); 794 is_fully_synced ? "IsFullySynced: true" : "IsFullySynced: false");
794 return is_fully_synced; 795 return is_fully_synced;
795 } 796 }
796 797
797 bool ProfileSyncServiceHarness::HasPendingBackendMigration() { 798 bool ProfileSyncServiceHarness::HasPendingBackendMigration() {
798 browser_sync::BackendMigrator* migrator = 799 browser_sync::BackendMigrator* migrator =
799 service()->GetBackendMigratorForTest(); 800 service()->GetBackendMigratorForTest();
800 return migrator && migrator->state() != browser_sync::BackendMigrator::IDLE; 801 return migrator && migrator->state() != browser_sync::BackendMigrator::IDLE;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if (snap) { 991 if (snap) {
991 // Capture select info from the sync session snapshot and syncer status. 992 // Capture select info from the sync session snapshot and syncer status.
992 os << "has_more_to_sync: " 993 os << "has_more_to_sync: "
993 << snap->has_more_to_sync 994 << snap->has_more_to_sync
994 << ", has_unsynced_items: " 995 << ", has_unsynced_items: "
995 << service()->HasUnsyncedItems() 996 << service()->HasUnsyncedItems()
996 << ", unsynced_count: "
997 << snap->unsynced_count
998 << ", encryption conflicts: " 997 << ", encryption conflicts: "
999 << snap->num_encryption_conflicts 998 << snap->num_encryption_conflicts
1000 << ", hierarchy conflicts: " 999 << ", hierarchy conflicts: "
1001 << snap->num_hierarchy_conflicts 1000 << snap->num_hierarchy_conflicts
1002 << ", simple conflicts: " 1001 << ", simple conflicts: "
1003 << snap->num_simple_conflicts 1002 << snap->num_simple_conflicts
1004 << ", server conflicts: " 1003 << ", server conflicts: "
1005 << snap->num_server_conflicts 1004 << snap->num_server_conflicts
1006 << ", num_updates_downloaded : " 1005 << ", num_updates_downloaded : "
1007 << snap->syncer_status.num_updates_downloaded_total 1006 << snap->syncer_status.num_updates_downloaded_total
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 1102
1104 std::string ProfileSyncServiceHarness::GetServiceStatus() { 1103 std::string ProfileSyncServiceHarness::GetServiceStatus() {
1105 DictionaryValue value; 1104 DictionaryValue value;
1106 sync_ui_util::ConstructAboutInformation(service_, &value); 1105 sync_ui_util::ConstructAboutInformation(service_, &value);
1107 std::string service_status; 1106 std::string service_status;
1108 base::JSONWriter::WriteWithOptions(&value, 1107 base::JSONWriter::WriteWithOptions(&value,
1109 base::JSONWriter::OPTIONS_PRETTY_PRINT, 1108 base::JSONWriter::OPTIONS_PRETTY_PRINT,
1110 &service_status); 1109 &service_status);
1111 return service_status; 1110 return service_status;
1112 } 1111 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698