OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/register_support_host_request.h" | 5 #include "remoting/host/register_support_host_request.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 base::Bind(&MockCallback::OnResponse, | 83 base::Bind(&MockCallback::OnResponse, |
84 base::Unretained(&callback_)))); | 84 base::Unretained(&callback_)))); |
85 | 85 |
86 XmlElement* sent_iq = NULL; | 86 XmlElement* sent_iq = NULL; |
87 EXPECT_CALL(signal_strategy_, GetNextId()) | 87 EXPECT_CALL(signal_strategy_, GetNextId()) |
88 .WillOnce(Return(kStanzaId)); | 88 .WillOnce(Return(kStanzaId)); |
89 EXPECT_CALL(signal_strategy_, SendStanzaPtr(NotNull())) | 89 EXPECT_CALL(signal_strategy_, SendStanzaPtr(NotNull())) |
90 .WillOnce(DoAll(SaveArg<0>(&sent_iq), Return(true))); | 90 .WillOnce(DoAll(SaveArg<0>(&sent_iq), Return(true))); |
91 | 91 |
92 request->OnSignalStrategyStateChange(SignalStrategy::CONNECTED); | 92 request->OnSignalStrategyStateChange(SignalStrategy::CONNECTED); |
93 message_loop_.RunAllPending(); | 93 message_loop_.RunUntilIdle(); |
94 | 94 |
95 // Verify format of the query. | 95 // Verify format of the query. |
96 scoped_ptr<XmlElement> stanza(sent_iq); | 96 scoped_ptr<XmlElement> stanza(sent_iq); |
97 ASSERT_TRUE(stanza != NULL); | 97 ASSERT_TRUE(stanza != NULL); |
98 | 98 |
99 EXPECT_EQ(stanza->Attr(buzz::QName("", "to")), | 99 EXPECT_EQ(stanza->Attr(buzz::QName("", "to")), |
100 std::string(kChromotingBotJid)); | 100 std::string(kChromotingBotJid)); |
101 EXPECT_EQ(stanza->Attr(buzz::QName("", "type")), "set"); | 101 EXPECT_EQ(stanza->Attr(buzz::QName("", "type")), "set"); |
102 | 102 |
103 EXPECT_EQ(QName(kChromotingXmlNamespace, "register-support-host"), | 103 EXPECT_EQ(QName(kChromotingXmlNamespace, "register-support-host"), |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 int consumed = 0; | 148 int consumed = 0; |
149 ObserverListBase<SignalStrategy::Listener>::Iterator it( | 149 ObserverListBase<SignalStrategy::Listener>::Iterator it( |
150 signal_strategy_listeners_); | 150 signal_strategy_listeners_); |
151 SignalStrategy::Listener* listener; | 151 SignalStrategy::Listener* listener; |
152 while ((listener = it.GetNext()) != NULL) { | 152 while ((listener = it.GetNext()) != NULL) { |
153 if (listener->OnSignalStrategyIncomingStanza(response.get())) | 153 if (listener->OnSignalStrategyIncomingStanza(response.get())) |
154 consumed++; | 154 consumed++; |
155 } | 155 } |
156 EXPECT_EQ(1, consumed); | 156 EXPECT_EQ(1, consumed); |
157 | 157 |
158 message_loop_.RunAllPending(); | 158 message_loop_.RunUntilIdle(); |
159 } | 159 } |
160 | 160 |
161 } // namespace remoting | 161 } // namespace remoting |
OLD | NEW |