| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "components/sync/user_events/user_event_sync_bridge.h" | 5 #include "components/sync/user_events/user_event_sync_bridge.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 121 |
| 122 EXPECT_EQ(4u, processor().put_multimap().size()); | 122 EXPECT_EQ(4u, processor().put_multimap().size()); |
| 123 std::set<std::string> unique_storage_keys; | 123 std::set<std::string> unique_storage_keys; |
| 124 for (const auto& kv : processor().put_multimap()) { | 124 for (const auto& kv : processor().put_multimap()) { |
| 125 unique_storage_keys.insert(kv.first); | 125 unique_storage_keys.insert(kv.first); |
| 126 } | 126 } |
| 127 EXPECT_EQ(2u, unique_storage_keys.size()); | 127 EXPECT_EQ(2u, unique_storage_keys.size()); |
| 128 bridge()->GetAllData(base::Bind(&VerifyDataBatchCount, 4)); | 128 bridge()->GetAllData(base::Bind(&VerifyDataBatchCount, 4)); |
| 129 } | 129 } |
| 130 | 130 |
| 131 TEST_F(UserEventSyncBridgeTest, ApplySyncChanges) { |
| 132 bridge()->RecordUserEvent(SpecificsUniquePtr(1u, 1u, 1u)); |
| 133 bridge()->RecordUserEvent(SpecificsUniquePtr(2u, 2u, 2u)); |
| 134 bridge()->GetAllData(base::Bind(&VerifyDataBatchCount, 2)); |
| 135 |
| 136 const std::string storage_key = processor().put_multimap().begin()->first; |
| 137 auto error_on_delete = |
| 138 bridge()->ApplySyncChanges(bridge()->CreateMetadataChangeList(), |
| 139 {EntityChange::CreateDelete(storage_key)}); |
| 140 EXPECT_FALSE(error_on_delete); |
| 141 bridge()->GetAllData(base::Bind(&VerifyDataBatchCount, 1)); |
| 142 } |
| 143 |
| 131 } // namespace | 144 } // namespace |
| 132 | 145 |
| 133 } // namespace syncer | 146 } // namespace syncer |
| OLD | NEW |