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

Side by Side Diff: webrtc/ortc/ortcfactory_unittest.cc

Issue 2714813004: Create the SrtpTransportInterface. (Closed)
Patch Set: Use rtc::Optional for SRTP send and receive keys. Created 3 years, 9 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/ortc/ortcfactory_integrationtest.cc ('k') | webrtc/ortc/ortcrtpreceiver_unittest.cc » ('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
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 nullptr, nullptr); 75 nullptr, nullptr);
76 EXPECT_TRUE(result.ok()); 76 EXPECT_TRUE(result.ok());
77 result.MoveValue().reset(); 77 result.MoveValue().reset();
78 // With non-muxed RTCP. 78 // With non-muxed RTCP.
79 rtcp_parameters.mux = false; 79 rtcp_parameters.mux = false;
80 result = 80 result =
81 ortc_factory_->CreateRtpTransport(rtcp_parameters, &rtp, &rtcp, nullptr); 81 ortc_factory_->CreateRtpTransport(rtcp_parameters, &rtp, &rtcp, nullptr);
82 EXPECT_TRUE(result.ok()); 82 EXPECT_TRUE(result.ok());
83 } 83 }
84 84
85 // Simple test for the successful cases of CreateSrtpTransport.
86 TEST_F(OrtcFactoryTest, CreateSrtpTransport) {
87 rtc::FakePacketTransport rtp("rtp");
88 rtc::FakePacketTransport rtcp("rtcp");
89 // With muxed RTCP.
90 RtcpParameters rtcp_parameters;
91 rtcp_parameters.mux = true;
92 auto result = ortc_factory_->CreateSrtpTransport(rtcp_parameters, &rtp,
93 nullptr, nullptr);
94 EXPECT_TRUE(result.ok());
95 result.MoveValue().reset();
96 // With non-muxed RTCP.
97 rtcp_parameters.mux = false;
98 result =
99 ortc_factory_->CreateSrtpTransport(rtcp_parameters, &rtp, &rtcp, nullptr);
100 EXPECT_TRUE(result.ok());
101 }
102
85 // If no CNAME is provided, one should be generated and returned by 103 // If no CNAME is provided, one should be generated and returned by
86 // GetRtpParameters. 104 // GetRtpParameters.
87 TEST_F(OrtcFactoryTest, CreateRtpTransportGeneratesCname) { 105 TEST_F(OrtcFactoryTest, CreateRtpTransportGeneratesCname) {
88 rtc::FakePacketTransport rtp("rtp"); 106 rtc::FakePacketTransport rtp("rtp");
89 RtcpParameters rtcp_parameters; 107 RtcpParameters rtcp_parameters;
90 rtcp_parameters.mux = true; 108 rtcp_parameters.mux = true;
91 auto result = ortc_factory_->CreateRtpTransport(rtcp_parameters, &rtp, 109 auto result = ortc_factory_->CreateRtpTransport(rtcp_parameters, &rtp,
92 nullptr, nullptr); 110 nullptr, nullptr);
93 ASSERT_TRUE(result.ok()); 111 ASSERT_TRUE(result.ok());
94 EXPECT_FALSE(result.value()->GetRtcpParameters().cname.empty()); 112 EXPECT_FALSE(result.value()->GetRtcpParameters().cname.empty());
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 TEST_F(OrtcFactoryTest, CreateSendersOrReceieversWithNullTransport) { 249 TEST_F(OrtcFactoryTest, CreateSendersOrReceieversWithNullTransport) {
232 auto sender_result = 250 auto sender_result =
233 ortc_factory_->CreateRtpSender(cricket::MEDIA_TYPE_AUDIO, nullptr); 251 ortc_factory_->CreateRtpSender(cricket::MEDIA_TYPE_AUDIO, nullptr);
234 EXPECT_EQ(RTCErrorType::INVALID_PARAMETER, sender_result.error().type()); 252 EXPECT_EQ(RTCErrorType::INVALID_PARAMETER, sender_result.error().type());
235 auto receiver_result = 253 auto receiver_result =
236 ortc_factory_->CreateRtpReceiver(cricket::MEDIA_TYPE_AUDIO, nullptr); 254 ortc_factory_->CreateRtpReceiver(cricket::MEDIA_TYPE_AUDIO, nullptr);
237 EXPECT_EQ(RTCErrorType::INVALID_PARAMETER, receiver_result.error().type()); 255 EXPECT_EQ(RTCErrorType::INVALID_PARAMETER, receiver_result.error().type());
238 } 256 }
239 257
240 } // namespace webrtc 258 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/ortc/ortcfactory_integrationtest.cc ('k') | webrtc/ortc/ortcrtpreceiver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698