| Index: sync/engine/download_unittest.cc
|
| diff --git a/sync/engine/download_unittest.cc b/sync/engine/download_unittest.cc
|
| index eae627791abd9fe533efd969607d444ccc3503b0..aa1516b62956966aa2e783a96425767d25ea1e8c 100644
|
| --- a/sync/engine/download_unittest.cc
|
| +++ b/sync/engine/download_unittest.cc
|
| @@ -25,9 +25,7 @@ using sessions::MockDebugInfoGetter;
|
| // A test fixture for tests exercising download updates functions.
|
| class DownloadUpdatesTest : public ::testing::Test {
|
| protected:
|
| - DownloadUpdatesTest()
|
| - : update_handler_map_deleter_(&update_handler_map_) {
|
| - }
|
| + DownloadUpdatesTest() {}
|
|
|
| virtual void SetUp() {
|
| dir_maker_.SetUp();
|
| @@ -42,20 +40,15 @@ class DownloadUpdatesTest : public ::testing::Test {
|
| }
|
|
|
| ModelTypeSet proto_request_types() {
|
| - ModelTypeSet types;
|
| - for (UpdateHandlerMap::iterator it = update_handler_map_.begin();
|
| - it != update_handler_map_.end(); ++it) {
|
| - types.Put(it->first);
|
| - }
|
| - return types;
|
| + return proto_request_types_;
|
| }
|
|
|
| syncable::Directory* directory() {
|
| return dir_maker_.directory();
|
| }
|
|
|
| - UpdateHandlerMap* update_handler_map() {
|
| - return &update_handler_map_;
|
| + UpdaterList* updater_list() {
|
| + return &updater_list_;
|
| }
|
|
|
| void InitFakeUpdateResponse(sync_pb::GetUpdatesResponse* response) {
|
| @@ -74,17 +67,20 @@ class DownloadUpdatesTest : public ::testing::Test {
|
| private:
|
| void AddUpdateHandler(ModelType type, ModelSafeGroup group) {
|
| DCHECK(directory());
|
| +
|
| + proto_request_types_.Put(type);
|
| +
|
| scoped_refptr<ModelSafeWorker> worker = new FakeModelWorker(group);
|
| SyncDirectoryUpdateHandler* handler =
|
| new SyncDirectoryUpdateHandler(directory(), type, worker);
|
| - update_handler_map_.insert(std::make_pair(type, handler));
|
| + updater_list_.RegisterTypeForTest(type, handler);
|
| }
|
|
|
| base::MessageLoop loop_; // Needed for directory init.
|
| TestDirectorySetterUpper dir_maker_;
|
|
|
| - UpdateHandlerMap update_handler_map_;
|
| - STLValueDeleter<UpdateHandlerMap> update_handler_map_deleter_;
|
| + ModelTypeSet proto_request_types_;
|
| + UpdaterList updater_list_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(DownloadUpdatesTest);
|
| };
|
| @@ -96,7 +92,7 @@ TEST_F(DownloadUpdatesTest, BookmarkNudge) {
|
|
|
| sync_pb::ClientToServerMessage msg;
|
| download::BuildNormalDownloadUpdatesImpl(proto_request_types(),
|
| - update_handler_map(),
|
| + updater_list(),
|
| nudge_tracker,
|
| msg.mutable_get_updates());
|
|
|
| @@ -144,7 +140,7 @@ TEST_F(DownloadUpdatesTest, NotifyMany) {
|
|
|
| sync_pb::ClientToServerMessage msg;
|
| download::BuildNormalDownloadUpdatesImpl(proto_request_types(),
|
| - update_handler_map(),
|
| + updater_list(),
|
| nudge_tracker,
|
| msg.mutable_get_updates());
|
|
|
| @@ -178,7 +174,7 @@ TEST_F(DownloadUpdatesTest, ConfigureTest) {
|
| sync_pb::ClientToServerMessage msg;
|
| download::BuildDownloadUpdatesForConfigureImpl(
|
| proto_request_types(),
|
| - update_handler_map(),
|
| + updater_list(),
|
| sync_pb::GetUpdatesCallerInfo::RECONFIGURATION,
|
| msg.mutable_get_updates());
|
|
|
| @@ -201,7 +197,7 @@ TEST_F(DownloadUpdatesTest, PollTest) {
|
| sync_pb::ClientToServerMessage msg;
|
| download::BuildDownloadUpdatesForPollImpl(
|
| proto_request_types(),
|
| - update_handler_map(),
|
| + updater_list(),
|
| msg.mutable_get_updates());
|
|
|
| const sync_pb::GetUpdatesMessage& gu_msg = msg.get_updates();
|
| @@ -231,7 +227,7 @@ TEST_F(DownloadUpdatesTest, InvalidResponse) {
|
| sessions::StatusController status;
|
| SyncerError error = download::ProcessResponse(gu_response,
|
| proto_request_types(),
|
| - update_handler_map(),
|
| + updater_list(),
|
| &status);
|
| EXPECT_EQ(error, SERVER_RESPONSE_VALIDATION_FAILED);
|
| }
|
| @@ -245,7 +241,7 @@ TEST_F(DownloadUpdatesTest, MoreToDownloadResponse) {
|
| sessions::StatusController status;
|
| SyncerError error = download::ProcessResponse(gu_response,
|
| proto_request_types(),
|
| - update_handler_map(),
|
| + updater_list(),
|
| &status);
|
| EXPECT_EQ(error, SERVER_MORE_TO_DOWNLOAD);
|
| }
|
| @@ -259,7 +255,7 @@ TEST_F(DownloadUpdatesTest, NormalResponseTest) {
|
| sessions::StatusController status;
|
| SyncerError error = download::ProcessResponse(gu_response,
|
| proto_request_types(),
|
| - update_handler_map(),
|
| + updater_list(),
|
| &status);
|
| EXPECT_EQ(error, SYNCER_OK);
|
| }
|
|
|