| Index: components/sync_driver/device_info_service_unittest.cc
|
| diff --git a/components/sync_driver/device_info_service_unittest.cc b/components/sync_driver/device_info_service_unittest.cc
|
| index 4cd69c6e6db3d95cbd604986e490496148032718..1f73d2b43dbb5dd81fd2fbb04aef6375cc4058d5 100644
|
| --- a/components/sync_driver/device_info_service_unittest.cc
|
| +++ b/components/sync_driver/device_info_service_unittest.cc
|
| @@ -19,6 +19,7 @@
|
| #include "sync/api/entity_data.h"
|
| #include "sync/api/metadata_batch.h"
|
| #include "sync/api/model_type_store.h"
|
| +#include "sync/internal_api/public/shared_model_type_processor.h"
|
| #include "sync/internal_api/public/test/model_type_store_test_util.h"
|
| #include "sync/protocol/data_type_state.pb.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| @@ -135,6 +136,8 @@ class FakeModelTypeChangeProcessor : public ModelTypeChangeProcessor {
|
| std::swap(metadata_, batch);
|
| }
|
|
|
| + void OnSyncStarting(const StartCallback& callback) override {}
|
| +
|
| const std::map<std::string, scoped_ptr<EntityData>>& put_map() const {
|
| return put_map_;
|
| }
|
| @@ -163,7 +166,13 @@ class DeviceInfoServiceTest : public testing::Test,
|
|
|
| void OnDeviceInfoChange() override { change_count_++; }
|
|
|
| - protected:
|
| + scoped_ptr<ModelTypeChangeProcessor> CreateSharedModelTypeProcessor(
|
| + syncer::ModelType type,
|
| + ModelTypeService* service) {
|
| + processor_ = new FakeModelTypeChangeProcessor();
|
| + return make_scoped_ptr(processor_);
|
| + }
|
| +
|
| DeviceInfoServiceTest()
|
| : change_count_(0),
|
| store_(ModelTypeStoreTestUtil::CreateInMemoryStoreForTest()),
|
| @@ -182,7 +191,9 @@ class DeviceInfoServiceTest : public testing::Test,
|
| service_.reset(new DeviceInfoService(
|
| local_device_.get(),
|
| base::Bind(&ModelTypeStoreTestUtil::MoveStoreToCallback,
|
| - base::Passed(&store_))));
|
| + base::Passed(&store_)),
|
| + base::Bind(&DeviceInfoServiceTest::CreateSharedModelTypeProcessor,
|
| + base::Unretained(this))));
|
| service_->AddObserver(this);
|
| }
|
|
|
| @@ -197,8 +208,8 @@ class DeviceInfoServiceTest : public testing::Test,
|
| // pump in this scenario because metadata is going to need to be loading from
|
| // the store and given to the processor, which is async.
|
| void SetProcessorAndPump() {
|
| - processor_ = new FakeModelTypeChangeProcessor();
|
| - service()->set_change_processor(make_scoped_ptr(processor_));
|
| + EXPECT_EQ(processor_, service_->GetOrCreateChangeProcessor());
|
| + ASSERT_TRUE(processor_);
|
| base::RunLoop().RunUntilIdle();
|
| }
|
|
|
|
|