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

Unified Diff: chrome/browser/sync/notifier/cache_invalidation_packet_handler_unittest.cc

Issue 9190029: use push messaging in cache invalidation xmpp channel (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/notifier/cache_invalidation_packet_handler_unittest.cc
===================================================================
--- chrome/browser/sync/notifier/cache_invalidation_packet_handler_unittest.cc (revision 117278)
+++ chrome/browser/sync/notifier/cache_invalidation_packet_handler_unittest.cc (working copy)
@@ -8,8 +8,10 @@
#include "base/memory/weak_ptr.h"
#include "base/message_loop.h"
#include "google/cacheinvalidation/callback.h"
+#include "google/cacheinvalidation/v2/client_gateway.pb.h"
#include "google/cacheinvalidation/v2/system-resources.h"
#include "jingle/notifier/base/fake_base_task.h"
+#include "jingle/notifier/listener/notification_defines.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "talk/base/task.h"
@@ -32,6 +34,12 @@
class CacheInvalidationPacketHandlerTest : public testing::Test {
public:
virtual ~CacheInvalidationPacketHandlerTest() {}
+
+ void InitNotification(
akalin 2012/01/12 23:06:44 seems cleaner to just have InitNotification return
ghc 2012/01/13 01:23:07 Done.
+ const std::string& data, notifier::Notification* notification) {
+ notification->channel = "tango_raw";
+ notification->data = data;
+ }
};
TEST_F(CacheInvalidationPacketHandlerTest, Basic) {
@@ -46,6 +54,10 @@
&callback, &MockMessageCallback::StoreMessage);
const char kInboundMessage[] = "non-bogus";
+ ipc::invalidation::ClientGatewayMessage envelope;
+ envelope.set_network_message(kInboundMessage);
+ std::string serialized;
+ envelope.SerializeToString(&serialized);
{
CacheInvalidationPacketHandler handler(fake_base_task.AsWeakPtr());
handler.SetMessageReceiver(mock_message_callback);
@@ -54,11 +66,11 @@
message_loop.RunAllPending();
{
- handler.HandleInboundPacket("bogus");
- std::string inbound_message_encoded;
- EXPECT_TRUE(
- base::Base64Encode(kInboundMessage, &inbound_message_encoded));
- handler.HandleInboundPacket(inbound_message_encoded);
+ notifier::Notification notification;
+ InitNotification("bogus", &notification);
+ handler.OnNotificationReceived(notification);
+ InitNotification(serialized, &notification);
+ handler.OnNotificationReceived(notification);
}
// Take care of any tasks posted by HandleOutboundPacket().

Powered by Google App Engine
This is Rietveld 408576698