| Index: webrtc/pc/rtptransport_unittest.cc
|
| diff --git a/webrtc/pc/rtptransport_unittest.cc b/webrtc/pc/rtptransport_unittest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a3b930cf5b6f2b69078cc9c995e32ce21e393dd2
|
| --- /dev/null
|
| +++ b/webrtc/pc/rtptransport_unittest.cc
|
| @@ -0,0 +1,59 @@
|
| +/*
|
| + * Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
| + *
|
| + * Use of this source code is governed by a BSD-style license
|
| + * that can be found in the LICENSE file in the root of the source
|
| + * tree. An additional intellectual property rights grant can be found
|
| + * in the file PATENTS. All contributing project authors may
|
| + * be found in the AUTHORS file in the root of the source tree.
|
| + */
|
| +
|
| +#include <string>
|
| +
|
| +#include "webrtc/pc/rtptransport.h"
|
| +#include "webrtc/base/gunit.h"
|
| +
|
| +namespace webrtc {
|
| +
|
| +class RtpTransportTest : public testing::Test {};
|
| +
|
| +TEST_F(RtpTransportTest, SetRtcpParametersCantDisableRtcpMux) {
|
| + RtpTransport transport(false);
|
| + RtcpParameters params;
|
| + transport.SetRtcpParameters(params);
|
| + params.mux = false;
|
| + EXPECT_FALSE(transport.SetRtcpParameters(params).ok());
|
| +}
|
| +
|
| +TEST_F(RtpTransportTest, SetRtcpParametersEmptyCnameUsesExisting) {
|
| + static const char kName[] = "name";
|
| + RtpTransport transport(false);
|
| + RtcpParameters params_with_name;
|
| + params_with_name.cname = kName;
|
| + transport.SetRtcpParameters(params_with_name);
|
| + EXPECT_EQ(transport.GetRtcpParameters().cname, kName);
|
| +
|
| + RtcpParameters params_without_name;
|
| + transport.SetRtcpParameters(params_without_name);
|
| + EXPECT_EQ(transport.GetRtcpParameters().cname, kName);
|
| +}
|
| +
|
| +class SignalObserver : public sigslot::has_slots<> {
|
| + public:
|
| + void OnReadyToSend(bool ready) { ready_ = ready; }
|
| + bool ready_ = false;
|
| +};
|
| +
|
| +TEST_F(RtpTransportTest, SetReadyToSend) {
|
| + RtpTransport transport(false);
|
| + SignalObserver observer;
|
| + transport.SignalReadyToSend.connect(&observer,
|
| + &SignalObserver::OnReadyToSend);
|
| +
|
| + transport.SetReadyToSend(true, true); // rtcp ready
|
| + EXPECT_FALSE(observer.ready_);
|
| + transport.SetReadyToSend(false, true); // rtp ready
|
| + EXPECT_TRUE(observer.ready_);
|
| +}
|
| +
|
| +} // namespace webrtc
|
|
|