| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/host_change_notification_listener.h" | 5 #include "remoting/host/host_change_notification_listener.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 scoped_ptr<XmlElement> stanza(new XmlElement(buzz::QN_IQ)); | 71 scoped_ptr<XmlElement> stanza(new XmlElement(buzz::QN_IQ)); |
| 72 stanza->AddAttr(QName(std::string(), "type"), "set"); | 72 stanza->AddAttr(QName(std::string(), "type"), "set"); |
| 73 XmlElement* host_changed = | 73 XmlElement* host_changed = |
| 74 new XmlElement(QName(kChromotingXmlNamespace, "host-changed")); | 74 new XmlElement(QName(kChromotingXmlNamespace, "host-changed")); |
| 75 host_changed->AddAttr(QName(kChromotingXmlNamespace, "operation"), | 75 host_changed->AddAttr(QName(kChromotingXmlNamespace, "operation"), |
| 76 operation); | 76 operation); |
| 77 host_changed->AddAttr(QName(kChromotingXmlNamespace, "hostid"), hostId); | 77 host_changed->AddAttr(QName(kChromotingXmlNamespace, "hostid"), hostId); |
| 78 stanza->AddElement(host_changed); | 78 stanza->AddElement(host_changed); |
| 79 stanza->AddAttr(buzz::QN_FROM, botJid); | 79 stanza->AddAttr(buzz::QN_FROM, botJid); |
| 80 stanza->AddAttr(buzz::QN_TO, kTestJid); | 80 stanza->AddAttr(buzz::QN_TO, kTestJid); |
| 81 return stanza.Pass(); | 81 return stanza; |
| 82 } | 82 } |
| 83 | 83 |
| 84 MockListener mock_listener_; | 84 MockListener mock_listener_; |
| 85 MockSignalStrategy signal_strategy_; | 85 MockSignalStrategy signal_strategy_; |
| 86 std::set<SignalStrategy::Listener*> signal_strategy_listeners_; | 86 std::set<SignalStrategy::Listener*> signal_strategy_listeners_; |
| 87 scoped_ptr<HostChangeNotificationListener> host_change_notification_listener_; | 87 scoped_ptr<HostChangeNotificationListener> host_change_notification_listener_; |
| 88 base::MessageLoop message_loop_; | 88 base::MessageLoop message_loop_; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 TEST_F(HostChangeNotificationListenerTest, ReceiveValidNotification) { | 91 TEST_F(HostChangeNotificationListenerTest, ReceiveValidNotification) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 scoped_ptr<XmlElement> stanza = GetNotificationStanza( | 144 scoped_ptr<XmlElement> stanza = GetNotificationStanza( |
| 145 "update", kHostId, kTestBotJid); | 145 "update", kHostId, kTestBotJid); |
| 146 host_change_notification_listener_->OnSignalStrategyIncomingStanza( | 146 host_change_notification_listener_->OnSignalStrategyIncomingStanza( |
| 147 stanza.get()); | 147 stanza.get()); |
| 148 message_loop_.PostTask(FROM_HERE, | 148 message_loop_.PostTask(FROM_HERE, |
| 149 base::Bind(base::MessageLoop::QuitWhenIdleClosure())); | 149 base::Bind(base::MessageLoop::QuitWhenIdleClosure())); |
| 150 message_loop_.Run(); | 150 message_loop_.Run(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 } // namespace remoting | 153 } // namespace remoting |
| OLD | NEW |