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

Unified Diff: components/sync_driver/device_info_service_unittest.cc

Issue 1763953002: [USS] Change the place where SharedModelTypeProcessor got created (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sky's review Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
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"
skym 2016/03/24 22:51:37 remove.
Gang Wu 2016/03/25 02:07:00 Done.
#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(
skym 2016/03/24 22:51:37 Name of method contains "Shared".
Gang Wu 2016/03/25 02:07:00 Done.
+ 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() {
maxbogue 2016/03/24 23:28:47 Could you rename this to CreateProcessorAndPump?
Gang Wu 2016/03/25 02:07:00 Done.
- processor_ = new FakeModelTypeChangeProcessor();
- service()->set_change_processor(make_scoped_ptr(processor_));
+ EXPECT_EQ(processor_, service_->GetOrCreateChangeProcessor());
skym 2016/03/24 22:51:37 Can you also put a TODO(skym): Shouldn't need to d
Gang Wu 2016/03/25 02:07:00 Done.
+ ASSERT_TRUE(processor_);
base::RunLoop().RunUntilIdle();
}

Powered by Google App Engine
This is Rietveld 408576698