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

Side by Side Diff: sync/notifier/p2p_invalidator_unittest.cc

Issue 11415049: Implement features needed for local ack handling in InvalidationStateTracker. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 "sender", NOTIFY_ALL, invalidation_map, LOCAL_INVALIDATION); 187 "sender", NOTIFY_ALL, invalidation_map, LOCAL_INVALIDATION);
188 EXPECT_TRUE(notification_data.IsTargeted("sender")); 188 EXPECT_TRUE(notification_data.IsTargeted("sender"));
189 EXPECT_TRUE(notification_data.IsTargeted("other1")); 189 EXPECT_TRUE(notification_data.IsTargeted("other1"));
190 EXPECT_TRUE(notification_data.IsTargeted("other2")); 190 EXPECT_TRUE(notification_data.IsTargeted("other2"));
191 EXPECT_THAT(invalidation_map, 191 EXPECT_THAT(invalidation_map,
192 Eq(notification_data.GetIdInvalidationMap())); 192 Eq(notification_data.GetIdInvalidationMap()));
193 const std::string& notification_data_str = notification_data.ToString(); 193 const std::string& notification_data_str = notification_data.ToString();
194 EXPECT_EQ( 194 EXPECT_EQ(
195 "{\"idInvalidationMap\":[" 195 "{\"idInvalidationMap\":["
196 "{\"objectId\":{\"name\":\"BOOKMARK\",\"source\":1004}," 196 "{\"objectId\":{\"name\":\"BOOKMARK\",\"source\":1004},"
197 "\"state\":{\"ackHandle\":{},\"payload\":\"\"}}," 197 "\"state\":{\"ackHandle\":{\"state\":\"\"},\"payload\":\"\"}},"
198 "{\"objectId\":{\"name\":\"THEME\",\"source\":1004}," 198 "{\"objectId\":{\"name\":\"THEME\",\"source\":1004},"
199 "\"state\":{\"ackHandle\":{},\"payload\":\"\"}}" 199 "\"state\":{\"ackHandle\":{\"state\":\"\"},\"payload\":\"\"}}"
200 "],\"notificationType\":\"notifyAll\"," 200 "],\"notificationType\":\"notifyAll\","
201 "\"senderId\":\"sender\",\"source\":1}", notification_data_str); 201 "\"senderId\":\"sender\",\"source\":1}", notification_data_str);
202 202
203 P2PNotificationData notification_data_parsed; 203 P2PNotificationData notification_data_parsed;
204 EXPECT_TRUE(notification_data_parsed.ResetFromString(notification_data_str)); 204 EXPECT_TRUE(notification_data_parsed.ResetFromString(notification_data_str));
205 EXPECT_TRUE(notification_data.Equals(notification_data_parsed)); 205 EXPECT_TRUE(notification_data.Equals(notification_data_parsed));
206 } 206 }
207 207
208 // Set up the P2PInvalidator, simulate a successful connection, and send 208 // Set up the P2PInvalidator, simulate a successful connection, and send
209 // a notification with the default target (NOTIFY_OTHERS). The 209 // a notification with the default target (NOTIFY_OTHERS). The
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 EXPECT_EQ(5, fake_handler_.GetInvalidationCount()); 369 EXPECT_EQ(5, fake_handler_.GetInvalidationCount());
370 } 370 }
371 371
372 INSTANTIATE_TYPED_TEST_CASE_P( 372 INSTANTIATE_TYPED_TEST_CASE_P(
373 P2PInvalidatorTest, InvalidatorTest, 373 P2PInvalidatorTest, InvalidatorTest,
374 P2PInvalidatorTestDelegate); 374 P2PInvalidatorTestDelegate);
375 375
376 } // namespace 376 } // namespace
377 377
378 } // namespace syncer 378 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698