OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "sync/notifier/p2p_invalidator.h" | 5 #include "sync/notifier/p2p_invalidator.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 | 8 |
9 #include "jingle/notifier/listener/fake_push_client.h" | 9 #include "jingle/notifier/listener/fake_push_client.h" |
10 #include "sync/internal_api/public/base/model_type.h" | 10 #include "sync/internal_api/public/base/model_type.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 171 |
172 P2PNotificationData notification_data_parsed; | 172 P2PNotificationData notification_data_parsed; |
173 EXPECT_TRUE(notification_data_parsed.ResetFromString(notification_data_str)); | 173 EXPECT_TRUE(notification_data_parsed.ResetFromString(notification_data_str)); |
174 EXPECT_TRUE(notification_data.Equals(notification_data_parsed)); | 174 EXPECT_TRUE(notification_data.Equals(notification_data_parsed)); |
175 } | 175 } |
176 | 176 |
177 // Make sure the P2PNotificationData <-> string conversions work for a | 177 // Make sure the P2PNotificationData <-> string conversions work for a |
178 // non-default-constructed P2PNotificationData. | 178 // non-default-constructed P2PNotificationData. |
179 TEST_F(P2PInvalidatorTest, P2PNotificationDataNonDefault) { | 179 TEST_F(P2PInvalidatorTest, P2PNotificationDataNonDefault) { |
180 ObjectIdInvalidationMap invalidation_map = | 180 ObjectIdInvalidationMap invalidation_map = |
181 MakeInvalidationMap(ModelTypeSet(BOOKMARKS, THEMES)); | 181 ObjectIdInvalidationMap::InvalidateAll( |
| 182 ModelTypeSetToObjectIdSet(ModelTypeSet(BOOKMARKS, THEMES))); |
182 const P2PNotificationData notification_data("sender", | 183 const P2PNotificationData notification_data("sender", |
183 NOTIFY_ALL, | 184 NOTIFY_ALL, |
184 invalidation_map); | 185 invalidation_map); |
185 EXPECT_TRUE(notification_data.IsTargeted("sender")); | 186 EXPECT_TRUE(notification_data.IsTargeted("sender")); |
186 EXPECT_TRUE(notification_data.IsTargeted("other1")); | 187 EXPECT_TRUE(notification_data.IsTargeted("other1")); |
187 EXPECT_TRUE(notification_data.IsTargeted("other2")); | 188 EXPECT_TRUE(notification_data.IsTargeted("other2")); |
188 EXPECT_EQ(invalidation_map, notification_data.GetIdInvalidationMap()); | 189 EXPECT_EQ(invalidation_map, notification_data.GetIdInvalidationMap()); |
189 const std::string& notification_data_str = notification_data.ToString(); | 190 const std::string& notification_data_str = notification_data.ToString(); |
190 EXPECT_EQ( | 191 EXPECT_EQ( |
191 "{\"invalidations\":[" | 192 "{\"invalidations\":[" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 EXPECT_EQ(5, fake_handler_.GetInvalidationCount()); | 346 EXPECT_EQ(5, fake_handler_.GetInvalidationCount()); |
346 } | 347 } |
347 | 348 |
348 INSTANTIATE_TYPED_TEST_CASE_P( | 349 INSTANTIATE_TYPED_TEST_CASE_P( |
349 P2PInvalidatorTest, InvalidatorTest, | 350 P2PInvalidatorTest, InvalidatorTest, |
350 P2PInvalidatorTestDelegate); | 351 P2PInvalidatorTestDelegate); |
351 | 352 |
352 } // namespace | 353 } // namespace |
353 | 354 |
354 } // namespace syncer | 355 } // namespace syncer |
OLD | NEW |