OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
| 11 #include <memory> |
11 #include <string> | 12 #include <string> |
12 | 13 |
13 #include "webrtc/libjingle/xmllite/qname.h" | 14 #include "webrtc/libjingle/xmllite/qname.h" |
14 #include "webrtc/libjingle/xmllite/xmlelement.h" | 15 #include "webrtc/libjingle/xmllite/xmlelement.h" |
15 #include "webrtc/libjingle/xmpp/constants.h" | 16 #include "webrtc/libjingle/xmpp/constants.h" |
16 #include "webrtc/libjingle/xmpp/fakexmppclient.h" | 17 #include "webrtc/libjingle/xmpp/fakexmppclient.h" |
17 #include "webrtc/libjingle/xmpp/hangoutpubsubclient.h" | 18 #include "webrtc/libjingle/xmpp/hangoutpubsubclient.h" |
18 #include "webrtc/libjingle/xmpp/jid.h" | 19 #include "webrtc/libjingle/xmpp/jid.h" |
19 #include "webrtc/base/faketaskrunner.h" | 20 #include "webrtc/base/faketaskrunner.h" |
20 #include "webrtc/base/gunit.h" | 21 #include "webrtc/base/gunit.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 client->SignalRemoteMuteResult.connect( | 222 client->SignalRemoteMuteResult.connect( |
222 listener.get(), &TestHangoutPubSubListener::OnRemoteMuteResult); | 223 listener.get(), &TestHangoutPubSubListener::OnRemoteMuteResult); |
223 client->SignalRemoteMuteError.connect( | 224 client->SignalRemoteMuteError.connect( |
224 listener.get(), &TestHangoutPubSubListener::OnRemoteMuteError); | 225 listener.get(), &TestHangoutPubSubListener::OnRemoteMuteError); |
225 client->SignalMediaBlockResult.connect( | 226 client->SignalMediaBlockResult.connect( |
226 listener.get(), &TestHangoutPubSubListener::OnMediaBlockResult); | 227 listener.get(), &TestHangoutPubSubListener::OnMediaBlockResult); |
227 client->SignalMediaBlockError.connect( | 228 client->SignalMediaBlockError.connect( |
228 listener.get(), &TestHangoutPubSubListener::OnMediaBlockError); | 229 listener.get(), &TestHangoutPubSubListener::OnMediaBlockError); |
229 } | 230 } |
230 | 231 |
231 rtc::scoped_ptr<rtc::FakeTaskRunner> runner; | 232 std::unique_ptr<rtc::FakeTaskRunner> runner; |
232 // xmpp_client deleted by deleting runner. | 233 // xmpp_client deleted by deleting runner. |
233 buzz::FakeXmppClient* xmpp_client; | 234 buzz::FakeXmppClient* xmpp_client; |
234 rtc::scoped_ptr<buzz::HangoutPubSubClient> client; | 235 std::unique_ptr<buzz::HangoutPubSubClient> client; |
235 rtc::scoped_ptr<TestHangoutPubSubListener> listener; | 236 std::unique_ptr<TestHangoutPubSubListener> listener; |
236 buzz::Jid pubsubjid; | 237 buzz::Jid pubsubjid; |
237 std::string nick; | 238 std::string nick; |
238 }; | 239 }; |
239 | 240 |
240 TEST_F(HangoutPubSubClientTest, TestRequest) { | 241 TEST_F(HangoutPubSubClientTest, TestRequest) { |
241 ASSERT_EQ(0U, xmpp_client->sent_stanzas().size()); | 242 ASSERT_EQ(0U, xmpp_client->sent_stanzas().size()); |
242 | 243 |
243 client->RequestAll(); | 244 client->RequestAll(); |
244 std::string expected_presenter_request = | 245 std::string expected_presenter_request = |
245 "<cli:iq type=\"get\" to=\"room@domain.com\" id=\"0\" " | 246 "<cli:iq type=\"get\" to=\"room@domain.com\" id=\"0\" " |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 TEST_F(HangoutPubSubClientTest, TestMediaBlockError) { | 745 TEST_F(HangoutPubSubClientTest, TestMediaBlockError) { |
745 std::string result_iq = | 746 std::string result_iq = |
746 "<iq xmlns='jabber:client' id='0' type='error' from='room@domain.com'/>"; | 747 "<iq xmlns='jabber:client' id='0' type='error' from='room@domain.com'/>"; |
747 | 748 |
748 client->BlockMedia("joe"); | 749 client->BlockMedia("joe"); |
749 xmpp_client->HandleStanza(buzz::XmlElement::ForStr(result_iq)); | 750 xmpp_client->HandleStanza(buzz::XmlElement::ForStr(result_iq)); |
750 EXPECT_EQ(1, listener->remote_mute_error_count); | 751 EXPECT_EQ(1, listener->remote_mute_error_count); |
751 EXPECT_EQ("joe", listener->media_blockee_nick); | 752 EXPECT_EQ("joe", listener->media_blockee_nick); |
752 EXPECT_EQ("0", listener->error_task_id); | 753 EXPECT_EQ("0", listener->error_task_id); |
753 } | 754 } |
OLD | NEW |