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 "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 Loading... | |
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 Loading... | |
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 |
OLD | NEW |