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

Side by Side Diff: chrome/browser/extensions/api/push_messaging/push_messaging_invalidation_handler_unittest.cc

Issue 19381005: Add version field to syncer::Invalidation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 5 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 unified diff | Download patch
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 "chrome/browser/extensions/api/push_messaging/push_messaging_invalidati on_handler.h" 5 #include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidati on_handler.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidati on_handler_delegate.h" 9 #include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidati on_handler_delegate.h"
10 #include "chrome/browser/invalidation/invalidation_service.h" 10 #include "chrome/browser/invalidation/invalidation_service.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 EXPECT_CALL(delegate_, 114 EXPECT_CALL(delegate_,
115 OnMessage("dddddddddddddddddddddddddddddddd", 0, "payload")); 115 OnMessage("dddddddddddddddddddddddddddddddd", 0, "payload"));
116 EXPECT_CALL(delegate_, 116 EXPECT_CALL(delegate_,
117 OnMessage("dddddddddddddddddddddddddddddddd", 3, "payload")); 117 OnMessage("dddddddddddddddddddddddddddddddd", 3, "payload"));
118 for (syncer::ObjectIdSet::const_iterator it = ids.begin(); it != ids.end(); 118 for (syncer::ObjectIdSet::const_iterator it = ids.begin(); it != ids.end();
119 ++it) { 119 ++it) {
120 EXPECT_CALL(service_, AcknowledgeInvalidation( 120 EXPECT_CALL(service_, AcknowledgeInvalidation(
121 *it, syncer::AckHandle::InvalidAckHandle())); 121 *it, syncer::AckHandle::InvalidAckHandle()));
122 } 122 }
123 handler_->OnIncomingInvalidation( 123 handler_->OnIncomingInvalidation(
124 ObjectIdSetToInvalidationMap(ids, "payload")); 124 ObjectIdSetToInvalidationMap(
125 ids,
dcheng 2013/07/16 21:28:15 Nit: wrapped lines should be indented 4 spaces.
Steve Condie 2013/07/16 21:49:47 Done.
126 syncer::Invalidation::kUnknownVersion,
127 "payload"));
125 } 128 }
126 129
127 // Tests that malformed object IDs don't trigger spurious callbacks. 130 // Tests that malformed object IDs don't trigger spurious callbacks.
128 TEST_F(PushMessagingInvalidationHandlerTest, DispatchInvalidObjectIds) { 131 TEST_F(PushMessagingInvalidationHandlerTest, DispatchInvalidObjectIds) {
129 syncer::ObjectIdSet ids; 132 syncer::ObjectIdSet ids;
130 // Completely incorrect format. 133 // Completely incorrect format.
131 ids.insert(invalidation::ObjectId( 134 ids.insert(invalidation::ObjectId(
132 ipc::invalidation::ObjectSource::TEST, 135 ipc::invalidation::ObjectSource::TEST,
133 "Invalid")); 136 "Invalid"));
134 // Incorrect source. 137 // Incorrect source.
(...skipping 16 matching lines...) Expand all
151 ids.insert(invalidation::ObjectId( 154 ids.insert(invalidation::ObjectId(
152 ipc::invalidation::ObjectSource::CHROME_PUSH_MESSAGING, 155 ipc::invalidation::ObjectSource::CHROME_PUSH_MESSAGING,
153 "U/dddddddddddddddddddddddddddddddd/4")); 156 "U/dddddddddddddddddddddddddddddddd/4"));
154 // Invalid object IDs should still be acknowledged. 157 // Invalid object IDs should still be acknowledged.
155 for (syncer::ObjectIdSet::const_iterator it = ids.begin(); it != ids.end(); 158 for (syncer::ObjectIdSet::const_iterator it = ids.begin(); it != ids.end();
156 ++it) { 159 ++it) {
157 EXPECT_CALL(service_, AcknowledgeInvalidation( 160 EXPECT_CALL(service_, AcknowledgeInvalidation(
158 *it, syncer::AckHandle::InvalidAckHandle())); 161 *it, syncer::AckHandle::InvalidAckHandle()));
159 } 162 }
160 handler_->OnIncomingInvalidation( 163 handler_->OnIncomingInvalidation(
161 ObjectIdSetToInvalidationMap(ids, "payload")); 164 ObjectIdSetToInvalidationMap(
165 ids,
166 syncer::Invalidation::kUnknownVersion,
167 "payload"));
162 } 168 }
163 169
164 } // namespace extensions 170 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698