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

Unified Diff: components/sync/device_info/device_info_sync_bridge_unittest.cc

Issue 2923363004: [Sync] Migrate bridge implementations to change list based MergeSyncData (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « components/sync/device_info/device_info_sync_bridge.cc ('k') | components/sync/model/entity_change.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/device_info/device_info_sync_bridge_unittest.cc
diff --git a/components/sync/device_info/device_info_sync_bridge_unittest.cc b/components/sync/device_info/device_info_sync_bridge_unittest.cc
index aa1d2936113262dc5864a8965fecda5670c02678..16630f186614d4f423526bd222c00eefdf628600 100644
--- a/components/sync/device_info/device_info_sync_bridge_unittest.cc
+++ b/components/sync/device_info/device_info_sync_bridge_unittest.cc
@@ -158,19 +158,6 @@ EntityChangeList EntityAddList(
return changes;
}
-// Similar helper to EntityAddList(...), only wraps in a EntityDataMap for a
-// merge call. Order is irrelevant, since the map sorts by key. Should not
-// contain multiple specifics with the same guid.
-EntityDataMap InlineEntityDataMap(
- const std::vector<DeviceInfoSpecifics>& specifics_list) {
- EntityDataMap map;
- for (const auto& specifics : specifics_list) {
- EXPECT_EQ(map.end(), map.find(specifics.cache_guid()));
- map[specifics.cache_guid()] = SpecificsToEntity(specifics);
- }
- return map;
-}
-
} // namespace
class DeviceInfoSyncBridgeTest : public testing::Test,
@@ -572,7 +559,7 @@ TEST_F(DeviceInfoSyncBridgeTest, MergeEmpty) {
InitializeAndPump();
EXPECT_EQ(1, change_count());
auto error = bridge()->MergeSyncData(bridge()->CreateMetadataChangeList(),
- EntityDataMap());
+ EntityChangeList());
EXPECT_FALSE(error);
EXPECT_EQ(1, change_count());
// TODO(skym): Stop sending local twice. The first of the two puts will
@@ -603,9 +590,9 @@ TEST_F(DeviceInfoSyncBridgeTest, MergeWithData) {
bridge()->CreateMetadataChangeList();
metadata_changes->UpdateModelTypeState(state);
- auto error = bridge()->MergeSyncData(
- std::move(metadata_changes),
- InlineEntityDataMap({conflict_remote, unique_remote}));
+ auto error =
+ bridge()->MergeSyncData(std::move(metadata_changes),
+ EntityAddList({conflict_remote, unique_remote}));
EXPECT_FALSE(error);
EXPECT_EQ(2, change_count());
@@ -639,7 +626,7 @@ TEST_F(DeviceInfoSyncBridgeTest, MergeLocalGuid) {
InitializeAndPump();
auto error = bridge()->MergeSyncData(bridge()->CreateMetadataChangeList(),
- InlineEntityDataMap({specifics}));
+ EntityAddList({specifics}));
EXPECT_FALSE(error);
EXPECT_EQ(0, change_count());
EXPECT_EQ(1u, bridge()->GetAllDeviceInfo().size());
@@ -655,7 +642,7 @@ TEST_F(DeviceInfoSyncBridgeTest, MergeLocalGuidBeforeReconcile) {
// EntityData because its cache guid is the same the local device's.
auto error = bridge()->MergeSyncData(
bridge()->CreateMetadataChangeList(),
- InlineEntityDataMap({CreateSpecifics(kDefaultLocalSuffix)}));
+ EntityAddList({CreateSpecifics(kDefaultLocalSuffix)}));
EXPECT_FALSE(error);
EXPECT_EQ(0, change_count());
EXPECT_EQ(0u, bridge()->GetAllDeviceInfo().size());
@@ -670,13 +657,13 @@ TEST_F(DeviceInfoSyncBridgeTest, ClearProviderAndMerge) {
local_device()->Clear();
auto error1 = bridge()->MergeSyncData(bridge()->CreateMetadataChangeList(),
- InlineEntityDataMap({specifics}));
+ EntityAddList({specifics}));
EXPECT_FALSE(error1);
EXPECT_EQ(1u, bridge()->GetAllDeviceInfo().size());
local_device()->Initialize(CreateModel(kDefaultLocalSuffix));
auto error2 = bridge()->MergeSyncData(bridge()->CreateMetadataChangeList(),
- InlineEntityDataMap({specifics}));
+ EntityAddList({specifics}));
EXPECT_FALSE(error2);
EXPECT_EQ(2u, bridge()->GetAllDeviceInfo().size());
}
« no previous file with comments | « components/sync/device_info/device_info_sync_bridge.cc ('k') | components/sync/model/entity_change.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698