Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Unified Diff: webrtc/pc/rtptransport_unittest.cc

Issue 2812243005: Move ready to send logic from BaseChannel to RtpTransport. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« webrtc/pc/rtptransport.h ('K') | « webrtc/pc/rtptransport.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« webrtc/pc/rtptransport.h ('K') | « webrtc/pc/rtptransport.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698