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
3// found in the LICENSE file.
4
5#include "jingle/notifier/listener/send_ping_task.h"
6
7#include "base/base64.h"
8#include "base/memory/scoped_ptr.h"
9#include "jingle/notifier/listener/xml_element_util.h"
10#include "talk/xmpp/jid.h"
11#include "testing/gtest/include/gtest/gtest.h"
12
13namespace buzz {
14class XmlElement;
15}
16
17namespace notifier {
18
19class SendPingTaskTest : public testing::Test {
20 public:
21  SendPingTaskTest() {}
22
23 private:
24  DISALLOW_COPY_AND_ASSIGN(SendPingTaskTest);
25};
26
27TEST_F(SendPingTaskTest, MakePingStanza) {
28  std::string task_id = "42";
29
30  scoped_ptr<buzz::XmlElement> message(SendPingTask::MakePingStanza(task_id));
31
32  std::string expected_xml_string("<cli:iq type=\"get\" id=\"");
33  expected_xml_string += task_id;
34  expected_xml_string +=
35      "\" xmlns:cli=\"jabber:client\">"
36      "<ping:ping xmlns:ping=\"urn:xmpp:ping\"/></cli:iq>";
37
38  EXPECT_EQ(expected_xml_string, XmlElementToString(*message));
39}
40
41}  // namespace notifier
42