summaryrefslogtreecommitdiffstats
path: root/remoting/host/heartbeat_sender_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'remoting/host/heartbeat_sender_unittest.cc')
-rw-r--r--remoting/host/heartbeat_sender_unittest.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/remoting/host/heartbeat_sender_unittest.cc b/remoting/host/heartbeat_sender_unittest.cc
index 8818c156..49933c2 100644
--- a/remoting/host/heartbeat_sender_unittest.cc
+++ b/remoting/host/heartbeat_sender_unittest.cc
@@ -27,6 +27,7 @@ using testing::DoAll;
using testing::Invoke;
using testing::NotNull;
using testing::Return;
+using testing::SaveArg;
namespace remoting {
@@ -50,7 +51,7 @@ class HeartbeatSenderTest : public testing::Test {
};
// Call Start() followed by Stop(), and makes sure an Iq stanza is
-// being send.
+// being sent.
TEST_F(HeartbeatSenderTest, DoSendStanza) {
// |iq_request| is freed by HeartbeatSender.
MockIqRequest* iq_request = new MockIqRequest();
@@ -66,12 +67,20 @@ TEST_F(HeartbeatSenderTest, DoSendStanza) {
EXPECT_CALL(signal_strategy_, CreateIqRequest())
.WillOnce(Return(iq_request));
- EXPECT_CALL(*iq_request, SendIq(buzz::STR_SET, kChromotingBotJid, NotNull()))
- .WillOnce(DoAll(DeleteArg<2>(), Return()));
+ XmlElement* sent_iq = NULL;
+ EXPECT_CALL(*iq_request, SendIq(NotNull()))
+ .WillOnce(SaveArg<0>(&sent_iq));
heartbeat_sender->OnSignallingConnected(&signal_strategy_, kTestJid);
message_loop_.RunAllPending();
+ scoped_ptr<XmlElement> stanza(sent_iq);
+ ASSERT_TRUE(stanza != NULL);
+
+ EXPECT_EQ(stanza->Attr(buzz::QName("", "to")),
+ std::string(kChromotingBotJid));
+ EXPECT_EQ(stanza->Attr(buzz::QName("", "type")), "set");
+
heartbeat_sender->OnSignallingDisconnected();
message_loop_.RunAllPending();
}