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

Unified Diff: jingle/notifier/listener/send_ping_task_unittest.cc

Issue 11232048: Adding XMPP ping functionality to CLoudPrint. XMPP ping and timeout is controlled thorugh Service S… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added missing files Created 8 years, 2 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: jingle/notifier/listener/send_ping_task_unittest.cc
diff --git a/jingle/notifier/listener/send_ping_task_unittest.cc b/jingle/notifier/listener/send_ping_task_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0e916aff4dae88f3382f8990f114714c9f8f2b32
--- /dev/null
+++ b/jingle/notifier/listener/send_ping_task_unittest.cc
@@ -0,0 +1,41 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "jingle/notifier/listener/send_ping_task.h"
+
+#include "base/base64.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/stringprintf.h"
+#include "jingle/notifier/listener/xml_element_util.h"
+#include "talk/xmpp/jid.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace buzz {
+class XmlElement;
+}
+
+namespace notifier {
+
+class SendPingTaskTest : public testing::Test {
+ public:
+ SendPingTaskTest() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SendPingTaskTest);
+};
+
+TEST_F(SendPingTaskTest, MakePingStanza) {
+ std::string task_id = "42";
+
+ scoped_ptr<buzz::XmlElement> message(SendPingTask::MakePingStanza(task_id));
+
+ std::string expected_xml_string =
+ base::StringPrintf(
+ "<cli:iq type=\"get\" id=\"%s\" xmlns:cli=\"jabber:client\">"
+ "<ping:ping xmlns:ping=\"urn:xmpp:ping\"/></cli:iq>",
+ task_id.c_str());
+ EXPECT_EQ(expected_xml_string, XmlElementToString(*message));
+}
+
+} // namespace notifier

Powered by Google App Engine
This is Rietveld 408576698