| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "base/memory/ptr_util.h" | 6 #include "base/memory/ptr_util.h" |
| 7 #include "base/optional.h" | 7 #include "base/optional.h" |
| 8 #include "base/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
| 9 #include "chrome/browser/sync/chrome_sync_client.h" | 9 #include "chrome/browser/sync/chrome_sync_client.h" |
| 10 #include "chrome/browser/sync/profile_sync_service_factory.h" | 10 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 // A FakeModelTypeSyncBridge that supports observing ApplySyncChanges. | 58 // A FakeModelTypeSyncBridge that supports observing ApplySyncChanges. |
| 59 class TestModelTypeSyncBridge : public FakeModelTypeSyncBridge { | 59 class TestModelTypeSyncBridge : public FakeModelTypeSyncBridge { |
| 60 public: | 60 public: |
| 61 class Observer { | 61 class Observer { |
| 62 public: | 62 public: |
| 63 virtual void OnApplySyncChanges() = 0; | 63 virtual void OnApplySyncChanges() = 0; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 TestModelTypeSyncBridge() | 66 TestModelTypeSyncBridge() |
| 67 : FakeModelTypeSyncBridge(base::Bind(&ModelTypeChangeProcessor::Create)) { | 67 : FakeModelTypeSyncBridge(base::Bind(&ModelTypeChangeProcessor::Create, |
| 68 base::RepeatingClosure())) { |
| 68 change_processor()->ModelReadyToSync(db().CreateMetadataBatch()); | 69 change_processor()->ModelReadyToSync(db().CreateMetadataBatch()); |
| 69 } | 70 } |
| 70 | 71 |
| 71 base::Optional<syncer::ModelError> ApplySyncChanges( | 72 base::Optional<syncer::ModelError> ApplySyncChanges( |
| 72 std::unique_ptr<syncer::MetadataChangeList> metadata_changes, | 73 std::unique_ptr<syncer::MetadataChangeList> metadata_changes, |
| 73 syncer::EntityChangeList entity_changes) override { | 74 syncer::EntityChangeList entity_changes) override { |
| 74 auto error = FakeModelTypeSyncBridge::ApplySyncChanges( | 75 auto error = FakeModelTypeSyncBridge::ApplySyncChanges( |
| 75 std::move(metadata_changes), entity_changes); | 76 std::move(metadata_changes), entity_changes); |
| 76 NotifyObservers(); | 77 NotifyObservers(); |
| 77 return error; | 78 return error; |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 | 363 |
| 363 ASSERT_TRUE(DataChecker(model1, kKey1, kValue2).Wait()); | 364 ASSERT_TRUE(DataChecker(model1, kKey1, kValue2).Wait()); |
| 364 ASSERT_TRUE(DataChecker(model1, kKey2, kValue1).Wait()); | 365 ASSERT_TRUE(DataChecker(model1, kKey2, kValue1).Wait()); |
| 365 ASSERT_TRUE(DataChecker(model1, kKey4, kValue1).Wait()); | 366 ASSERT_TRUE(DataChecker(model1, kKey4, kValue1).Wait()); |
| 366 | 367 |
| 367 ASSERT_TRUE(DataChecker(model0, kKey1, kValue2).Wait()); | 368 ASSERT_TRUE(DataChecker(model0, kKey1, kValue2).Wait()); |
| 368 ASSERT_TRUE(DataChecker(model0, kKey3, kValue1).Wait()); | 369 ASSERT_TRUE(DataChecker(model0, kKey3, kValue1).Wait()); |
| 369 } | 370 } |
| 370 | 371 |
| 371 } // namespace | 372 } // namespace |
| OLD | NEW |