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

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\":\"\",\"timestamp\":\"0\"},"
198 "\"payload\":\"\"}},"
198 "{\"objectId\":{\"name\":\"THEME\",\"source\":1004}," 199 "{\"objectId\":{\"name\":\"THEME\",\"source\":1004},"
199 "\"state\":{\"ackHandle\":{},\"payload\":\"\"}}" 200 "\"state\":{\"ackHandle\":{\"state\":\"\",\"timestamp\":\"0\"},"
201 "\"payload\":\"\"}}"
200 "],\"notificationType\":\"notifyAll\"," 202 "],\"notificationType\":\"notifyAll\","
201 "\"senderId\":\"sender\",\"source\":1}", notification_data_str); 203 "\"senderId\":\"sender\",\"source\":1}", notification_data_str);
202 204
203 P2PNotificationData notification_data_parsed; 205 P2PNotificationData notification_data_parsed;
204 EXPECT_TRUE(notification_data_parsed.ResetFromString(notification_data_str)); 206 EXPECT_TRUE(notification_data_parsed.ResetFromString(notification_data_str));
205 EXPECT_TRUE(notification_data.Equals(notification_data_parsed)); 207 EXPECT_TRUE(notification_data.Equals(notification_data_parsed));
206 } 208 }
207 209
208 // Set up the P2PInvalidator, simulate a successful connection, and send 210 // Set up the P2PInvalidator, simulate a successful connection, and send
209 // a notification with the default target (NOTIFY_OTHERS). The 211 // 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()); 371 EXPECT_EQ(5, fake_handler_.GetInvalidationCount());
370 } 372 }
371 373
372 INSTANTIATE_TYPED_TEST_CASE_P( 374 INSTANTIATE_TYPED_TEST_CASE_P(
373 P2PInvalidatorTest, InvalidatorTest, 375 P2PInvalidatorTest, InvalidatorTest,
374 P2PInvalidatorTestDelegate); 376 P2PInvalidatorTestDelegate);
375 377
376 } // namespace 378 } // namespace
377 379
378 } // namespace syncer 380 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/notifier/invalidation_state_tracker.cc ('k') | sync/notifier/sync_invalidation_listener.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698