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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 | 497 |
498 void ProfileSyncServiceHarness::OnSyncCycleCompleted() { | 498 void ProfileSyncServiceHarness::OnSyncCycleCompleted() { |
499 // Integration tests still use p2p notifications. | 499 // Integration tests still use p2p notifications. |
500 const SyncSessionSnapshot& snap = GetLastSessionSnapshot(); | 500 const SyncSessionSnapshot& snap = GetLastSessionSnapshot(); |
501 bool is_notifiable_commit = | 501 bool is_notifiable_commit = |
502 (snap.model_neutral_state().num_successful_commits > 0); | 502 (snap.model_neutral_state().num_successful_commits > 0); |
503 if (is_notifiable_commit && p2p_invalidation_service_) { | 503 if (is_notifiable_commit && p2p_invalidation_service_) { |
504 syncer::ModelTypeSet model_types = | 504 syncer::ModelTypeSet model_types = |
505 snap.model_neutral_state().commit_request_types; | 505 snap.model_neutral_state().commit_request_types; |
506 syncer::ObjectIdSet ids = ModelTypeSetToObjectIdSet(model_types); | 506 syncer::ObjectIdSet ids = ModelTypeSetToObjectIdSet(model_types); |
507 syncer::ObjectIdInvalidationMap invalidation_map = | 507 p2p_invalidation_service_->SendInvalidation(ids); |
508 syncer::ObjectIdSetToInvalidationMap( | |
509 ids, | |
510 syncer::Invalidation::kUnknownVersion, | |
511 ""); | |
512 p2p_invalidation_service_->SendInvalidation(invalidation_map); | |
513 } | 508 } |
514 | 509 |
515 OnStateChanged(); | 510 OnStateChanged(); |
516 } | 511 } |
517 | 512 |
518 void ProfileSyncServiceHarness::OnMigrationStateChange() { | 513 void ProfileSyncServiceHarness::OnMigrationStateChange() { |
519 // Update migration state. | 514 // Update migration state. |
520 if (HasPendingBackendMigration()) { | 515 if (HasPendingBackendMigration()) { |
521 // Merge current pending migration types into | 516 // Merge current pending migration types into |
522 // |pending_migration_types_|. | 517 // |pending_migration_types_|. |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 | 1157 |
1163 std::string ProfileSyncServiceHarness::GetServiceStatus() { | 1158 std::string ProfileSyncServiceHarness::GetServiceStatus() { |
1164 scoped_ptr<DictionaryValue> value( | 1159 scoped_ptr<DictionaryValue> value( |
1165 sync_ui_util::ConstructAboutInformation(service_)); | 1160 sync_ui_util::ConstructAboutInformation(service_)); |
1166 std::string service_status; | 1161 std::string service_status; |
1167 base::JSONWriter::WriteWithOptions(value.get(), | 1162 base::JSONWriter::WriteWithOptions(value.get(), |
1168 base::JSONWriter::OPTIONS_PRETTY_PRINT, | 1163 base::JSONWriter::OPTIONS_PRETTY_PRINT, |
1169 &service_status); | 1164 &service_status); |
1170 return service_status; | 1165 return service_status; |
1171 } | 1166 } |
OLD | NEW |