| OLD | NEW |
| 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/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/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 scoped_ptr<RegisterSupportHostRequest> request( | 70 scoped_ptr<RegisterSupportHostRequest> request( |
| 71 new RegisterSupportHostRequest()); | 71 new RegisterSupportHostRequest()); |
| 72 ASSERT_TRUE(request->Init( | 72 ASSERT_TRUE(request->Init( |
| 73 config_, base::Bind(&MockCallback::OnResponse, | 73 config_, base::Bind(&MockCallback::OnResponse, |
| 74 base::Unretained(&callback_)))); | 74 base::Unretained(&callback_)))); |
| 75 | 75 |
| 76 XmlElement* sent_iq = NULL; | 76 XmlElement* sent_iq = NULL; |
| 77 EXPECT_CALL(signal_strategy_, GetNextId()) | 77 EXPECT_CALL(signal_strategy_, GetNextId()) |
| 78 .WillOnce(Return(kStanzaId)); | 78 .WillOnce(Return(kStanzaId)); |
| 79 EXPECT_CALL(signal_strategy_, GetLocalJid()) |
| 80 .WillRepeatedly(Return(kTestJid)); |
| 79 EXPECT_CALL(signal_strategy_, SendStanza(NotNull())) | 81 EXPECT_CALL(signal_strategy_, SendStanza(NotNull())) |
| 80 .WillOnce(DoAll(SaveArg<0>(&sent_iq), Return(true))); | 82 .WillOnce(DoAll(SaveArg<0>(&sent_iq), Return(true))); |
| 81 | 83 |
| 82 request->OnSignallingConnected(&signal_strategy_, kTestJid); | 84 request->OnSignallingConnected(&signal_strategy_); |
| 83 message_loop_.RunAllPending(); | 85 message_loop_.RunAllPending(); |
| 84 | 86 |
| 85 // Verify format of the query. | 87 // Verify format of the query. |
| 86 scoped_ptr<XmlElement> stanza(sent_iq); | 88 scoped_ptr<XmlElement> stanza(sent_iq); |
| 87 ASSERT_TRUE(stanza != NULL); | 89 ASSERT_TRUE(stanza != NULL); |
| 88 | 90 |
| 89 EXPECT_EQ(stanza->Attr(buzz::QName("", "to")), | 91 EXPECT_EQ(stanza->Attr(buzz::QName("", "to")), |
| 90 std::string(kChromotingBotJid)); | 92 std::string(kChromotingBotJid)); |
| 91 EXPECT_EQ(stanza->Attr(buzz::QName("", "type")), "set"); | 93 EXPECT_EQ(stanza->Attr(buzz::QName("", "type")), "set"); |
| 92 | 94 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 XmlElement* support_id = new XmlElement( | 129 XmlElement* support_id = new XmlElement( |
| 128 QName(kChromotingXmlNamespace, "support-id")); | 130 QName(kChromotingXmlNamespace, "support-id")); |
| 129 support_id->AddText(kSupportId); | 131 support_id->AddText(kSupportId); |
| 130 result->AddElement(support_id); | 132 result->AddElement(support_id); |
| 131 | 133 |
| 132 XmlElement* support_id_lifetime = new XmlElement( | 134 XmlElement* support_id_lifetime = new XmlElement( |
| 133 QName(kChromotingXmlNamespace, "support-id-lifetime")); | 135 QName(kChromotingXmlNamespace, "support-id-lifetime")); |
| 134 support_id_lifetime->AddText(kSupportIdLifetime); | 136 support_id_lifetime->AddText(kSupportIdLifetime); |
| 135 result->AddElement(support_id_lifetime); | 137 result->AddElement(support_id_lifetime); |
| 136 | 138 |
| 137 EXPECT_TRUE(listener->OnIncomingStanza(response.get())); | 139 EXPECT_TRUE(listener->OnSignalStrategyIncomingStanza(response.get())); |
| 138 message_loop_.RunAllPending(); | 140 message_loop_.RunAllPending(); |
| 139 | 141 |
| 140 EXPECT_CALL(signal_strategy_, RemoveListener(listener)); | 142 EXPECT_CALL(signal_strategy_, RemoveListener(listener)); |
| 141 } | 143 } |
| 142 | 144 |
| 143 } // namespace remoting | 145 } // namespace remoting |
| OLD | NEW |