OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 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 |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #include <string> |
| 12 |
| 13 #include "webrtc/pc/rtptransport.h" |
| 14 #include "webrtc/base/gunit.h" |
| 15 |
| 16 namespace webrtc { |
| 17 |
| 18 class RtpTransportTest : public testing::Test {}; |
| 19 |
| 20 TEST_F(RtpTransportTest, SetRtcpParametersCantDisableRtcpMux) { |
| 21 RtpTransport transport(false); |
| 22 RtcpParameters params; |
| 23 transport.SetRtcpParameters(params); |
| 24 params.mux = false; |
| 25 EXPECT_FALSE(transport.SetRtcpParameters(params).ok()); |
| 26 } |
| 27 |
| 28 TEST_F(RtpTransportTest, SetRtcpParametersEmptyCnameUsesExisting) { |
| 29 static const char kName[] = "name"; |
| 30 RtpTransport transport(false); |
| 31 RtcpParameters params_with_name; |
| 32 params_with_name.cname = kName; |
| 33 transport.SetRtcpParameters(params_with_name); |
| 34 EXPECT_EQ(transport.GetRtcpParameters().cname, kName); |
| 35 |
| 36 RtcpParameters params_without_name; |
| 37 transport.SetRtcpParameters(params_without_name); |
| 38 EXPECT_EQ(transport.GetRtcpParameters().cname, kName); |
| 39 } |
| 40 |
| 41 class SignalObserver : public sigslot::has_slots<> { |
| 42 public: |
| 43 void OnReadyToSend(bool ready) { ready_ = ready; } |
| 44 bool ready_ = false; |
| 45 }; |
| 46 |
| 47 TEST_F(RtpTransportTest, SetReadyToSend) { |
| 48 RtpTransport transport(false); |
| 49 SignalObserver observer; |
| 50 transport.SignalReadyToSend.connect(&observer, |
| 51 &SignalObserver::OnReadyToSend); |
| 52 |
| 53 transport.SetReadyToSend(true, true); // rtcp ready |
| 54 EXPECT_FALSE(observer.ready_); |
| 55 transport.SetReadyToSend(false, true); // rtp ready |
| 56 EXPECT_TRUE(observer.ready_); |
| 57 } |
| 58 |
| 59 } // namespace webrtc |
OLD | NEW |