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

Side by Side Diff: webrtc/pc/rtptransport_unittest.cc

Issue 2981513002: Wire up RTP keep-alive in ortc api. (Closed)
Patch Set: deps, again Created 3 years, 4 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 unified diff | Download patch
« no previous file with comments | « webrtc/pc/rtptransport.cc ('k') | webrtc/pc/srtptransport.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2017 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 <string> 11 #include <string>
12 12
13 #include "webrtc/p2p/base/fakepackettransport.h" 13 #include "webrtc/p2p/base/fakepackettransport.h"
14 #include "webrtc/pc/rtptransport.h" 14 #include "webrtc/pc/rtptransport.h"
15 #include "webrtc/pc/rtptransporttestutil.h" 15 #include "webrtc/pc/rtptransporttestutil.h"
16 #include "webrtc/rtc_base/gunit.h" 16 #include "webrtc/rtc_base/gunit.h"
17 17
18 namespace webrtc { 18 namespace webrtc {
19 19
20 constexpr bool kMuxDisabled = false; 20 constexpr bool kMuxDisabled = false;
21 constexpr bool kMuxEnabled = true; 21 constexpr bool kMuxEnabled = true;
22 22
23 TEST(RtpTransportTest, SetRtcpParametersCantDisableRtcpMux) { 23 TEST(RtpTransportTest, SetRtcpParametersCantDisableRtcpMux) {
24 RtpTransport transport(kMuxDisabled); 24 RtpTransport transport(kMuxDisabled);
25 RtcpParameters params; 25 RtpTransportParameters params;
26 transport.SetRtcpParameters(params); 26 transport.SetParameters(params);
27 params.mux = false; 27 params.rtcp.mux = false;
28 EXPECT_FALSE(transport.SetRtcpParameters(params).ok()); 28 EXPECT_FALSE(transport.SetParameters(params).ok());
29 } 29 }
30 30
31 TEST(RtpTransportTest, SetRtcpParametersEmptyCnameUsesExisting) { 31 TEST(RtpTransportTest, SetRtcpParametersEmptyCnameUsesExisting) {
32 static const char kName[] = "name"; 32 static const char kName[] = "name";
33 RtpTransport transport(kMuxDisabled); 33 RtpTransport transport(kMuxDisabled);
34 RtcpParameters params_with_name; 34 RtpTransportParameters params_with_name;
35 params_with_name.cname = kName; 35 params_with_name.rtcp.cname = kName;
36 transport.SetRtcpParameters(params_with_name); 36 transport.SetParameters(params_with_name);
37 EXPECT_EQ(transport.GetRtcpParameters().cname, kName); 37 EXPECT_EQ(transport.GetParameters().rtcp.cname, kName);
38 38
39 RtcpParameters params_without_name; 39 RtpTransportParameters params_without_name;
40 transport.SetRtcpParameters(params_without_name); 40 transport.SetParameters(params_without_name);
41 EXPECT_EQ(transport.GetRtcpParameters().cname, kName); 41 EXPECT_EQ(transport.GetParameters().rtcp.cname, kName);
42 }
43
44 TEST(RtpTransportTest, SetRtpTransportKeepAliveNotSupported) {
45 // Tests that we warn users that keep-alive isn't supported yet.
46 // TODO(sprang): Wire up keep-alive and remove this test.
47 RtpTransport transport(kMuxDisabled);
48 RtpTransportParameters params;
49 params.keepalive.timeout_interval_ms = 1;
50 auto result = transport.SetParameters(params);
51 EXPECT_FALSE(result.ok());
52 EXPECT_EQ(RTCErrorType::INVALID_MODIFICATION, result.type());
42 } 53 }
43 54
44 class SignalObserver : public sigslot::has_slots<> { 55 class SignalObserver : public sigslot::has_slots<> {
45 public: 56 public:
46 explicit SignalObserver(RtpTransport* transport) { 57 explicit SignalObserver(RtpTransport* transport) {
47 transport->SignalReadyToSend.connect(this, &SignalObserver::OnReadyToSend); 58 transport->SignalReadyToSend.connect(this, &SignalObserver::OnReadyToSend);
48 } 59 }
49 bool ready() const { return ready_; } 60 bool ready() const { return ready_; }
50 void OnReadyToSend(bool ready) { ready_ = ready; } 61 void OnReadyToSend(bool ready) { ready_ = ready; }
51 62
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 216
206 const rtc::PacketOptions options; 217 const rtc::PacketOptions options;
207 const int flags = 0; 218 const int flags = 0;
208 rtc::Buffer rtp_data(kRtpData, kRtpLen); 219 rtc::Buffer rtp_data(kRtpData, kRtpLen);
209 fake_rtp.SendPacket(rtp_data.data<char>(), kRtpLen, options, flags); 220 fake_rtp.SendPacket(rtp_data.data<char>(), kRtpLen, options, flags);
210 EXPECT_EQ(0, observer.rtp_count()); 221 EXPECT_EQ(0, observer.rtp_count());
211 EXPECT_EQ(0, observer.rtcp_count()); 222 EXPECT_EQ(0, observer.rtcp_count());
212 } 223 }
213 224
214 } // namespace webrtc 225 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/pc/rtptransport.cc ('k') | webrtc/pc/srtptransport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698