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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
494 void ProfileSyncServiceHarness::OnStateChanged() { | 494 void ProfileSyncServiceHarness::OnStateChanged() { |
495 RunStateChangeMachine(); | 495 RunStateChangeMachine(); |
496 } | 496 } |
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 const syncer::ObjectIdInvalidationMap& invalidation_map = | 504 syncer::ModelTypeSet model_types = |
505 ModelTypeInvalidationMapToObjectIdInvalidationMap( | 505 snap.model_neutral_state().commit_request_types; |
tim (not reviewing)
2013/08/01 17:16:38
Am I correct that we only need commit_request_type
rlarocque
2013/08/01 21:01:41
Yep, it's only for tests. I wish I could have avo
| |
506 snap.source().types); | 506 syncer::ObjectIdSet ids = ModelTypeSetToObjectIdSet(model_types); |
507 syncer::ObjectIdInvalidationMap invalidation_map = | |
508 syncer::ObjectIdSetToInvalidationMap( | |
509 ids, | |
510 syncer::Invalidation::kUnknownVersion, | |
511 ""); | |
507 p2p_invalidation_service_->SendInvalidation(invalidation_map); | 512 p2p_invalidation_service_->SendInvalidation(invalidation_map); |
508 } | 513 } |
509 | 514 |
510 OnStateChanged(); | 515 OnStateChanged(); |
511 } | 516 } |
512 | 517 |
513 void ProfileSyncServiceHarness::OnMigrationStateChange() { | 518 void ProfileSyncServiceHarness::OnMigrationStateChange() { |
514 // Update migration state. | 519 // Update migration state. |
515 if (HasPendingBackendMigration()) { | 520 if (HasPendingBackendMigration()) { |
516 // Merge current pending migration types into | 521 // Merge current pending migration types into |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1157 | 1162 |
1158 std::string ProfileSyncServiceHarness::GetServiceStatus() { | 1163 std::string ProfileSyncServiceHarness::GetServiceStatus() { |
1159 scoped_ptr<DictionaryValue> value( | 1164 scoped_ptr<DictionaryValue> value( |
1160 sync_ui_util::ConstructAboutInformation(service_)); | 1165 sync_ui_util::ConstructAboutInformation(service_)); |
1161 std::string service_status; | 1166 std::string service_status; |
1162 base::JSONWriter::WriteWithOptions(value.get(), | 1167 base::JSONWriter::WriteWithOptions(value.get(), |
1163 base::JSONWriter::OPTIONS_PRETTY_PRINT, | 1168 base::JSONWriter::OPTIONS_PRETTY_PRINT, |
1164 &service_status); | 1169 &service_status); |
1165 return service_status; | 1170 return service_status; |
1166 } | 1171 } |
OLD | NEW |