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

Side by Side Diff: remoting/host/heartbeat_sender_unittest.cc

Issue 9005034: Refactor SignalStrategy so that it can be reused for multiple connections. (Closed) Base URL: svn://svn.chromium.org/chrome/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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/heartbeat_sender.cc ('k') | remoting/host/host_status_observer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "remoting/host/heartbeat_sender.h" 5 #include "remoting/host/heartbeat_sender.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 TEST_F(HeartbeatSenderTest, DoSendStanza) { 57 TEST_F(HeartbeatSenderTest, DoSendStanza) {
58 SignalStrategy::Listener* listener; 58 SignalStrategy::Listener* listener;
59 EXPECT_CALL(signal_strategy_, AddListener(NotNull())) 59 EXPECT_CALL(signal_strategy_, AddListener(NotNull()))
60 .WillOnce(SaveArg<0>(&listener)); 60 .WillOnce(SaveArg<0>(&listener));
61 61
62 scoped_ptr<HeartbeatSender> heartbeat_sender( 62 scoped_ptr<HeartbeatSender> heartbeat_sender(
63 new HeartbeatSender(base::MessageLoopProxy::current(), config_)); 63 new HeartbeatSender(base::MessageLoopProxy::current(), config_));
64 ASSERT_TRUE(heartbeat_sender->Init()); 64 ASSERT_TRUE(heartbeat_sender->Init());
65 65
66 XmlElement* sent_iq = NULL; 66 XmlElement* sent_iq = NULL;
67 EXPECT_CALL(signal_strategy_, GetLocalJid())
68 .WillRepeatedly(Return(kTestJid));
67 EXPECT_CALL(signal_strategy_, GetNextId()) 69 EXPECT_CALL(signal_strategy_, GetNextId())
68 .WillOnce(Return(kStanzaId)); 70 .WillOnce(Return(kStanzaId));
69 EXPECT_CALL(signal_strategy_, SendStanza(NotNull())) 71 EXPECT_CALL(signal_strategy_, SendStanza(NotNull()))
70 .WillOnce(DoAll(SaveArg<0>(&sent_iq), Return(true))); 72 .WillOnce(DoAll(SaveArg<0>(&sent_iq), Return(true)));
71 73
72 heartbeat_sender->OnSignallingConnected(&signal_strategy_, kTestJid); 74 heartbeat_sender->OnSignallingConnected(&signal_strategy_);
73 message_loop_.RunAllPending(); 75 message_loop_.RunAllPending();
74 76
75 scoped_ptr<XmlElement> stanza(sent_iq); 77 scoped_ptr<XmlElement> stanza(sent_iq);
76 ASSERT_TRUE(stanza != NULL); 78 ASSERT_TRUE(stanza != NULL);
77 79
78 EXPECT_EQ(stanza->Attr(buzz::QName("", "to")), 80 EXPECT_EQ(stanza->Attr(buzz::QName("", "to")),
79 std::string(kChromotingBotJid)); 81 std::string(kChromotingBotJid));
80 EXPECT_EQ(stanza->Attr(buzz::QName("", "type")), "set"); 82 EXPECT_EQ(stanza->Attr(buzz::QName("", "type")), "set");
81 83
82 EXPECT_CALL(signal_strategy_, RemoveListener(listener)); 84 EXPECT_CALL(signal_strategy_, RemoveListener(listener));
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 143
142 scoped_ptr<HeartbeatSender> heartbeat_sender( 144 scoped_ptr<HeartbeatSender> heartbeat_sender(
143 new HeartbeatSender(base::MessageLoopProxy::current(), 145 new HeartbeatSender(base::MessageLoopProxy::current(),
144 config_)); 146 config_));
145 heartbeat_sender->ProcessResponse(response.get()); 147 heartbeat_sender->ProcessResponse(response.get());
146 148
147 EXPECT_EQ(kTestInterval * 1000, heartbeat_sender->interval_ms_); 149 EXPECT_EQ(kTestInterval * 1000, heartbeat_sender->interval_ms_);
148 } 150 }
149 151
150 } // namespace remoting 152 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/heartbeat_sender.cc ('k') | remoting/host/host_status_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698