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

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

Issue 2689503002: Removing unnecessary parameters from CreateXChannel methods. (Closed)
Patch Set: Rebase onto master Created 3 years, 10 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/channelmanager.cc ('k') | webrtc/pc/rtpsenderreceiver_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 2008 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2008 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 <memory> 11 #include <memory>
12 12
13 #include "webrtc/base/gunit.h" 13 #include "webrtc/base/gunit.h"
14 #include "webrtc/base/logging.h" 14 #include "webrtc/base/logging.h"
15 #include "webrtc/base/thread.h" 15 #include "webrtc/base/thread.h"
16 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" 16 #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
17 #include "webrtc/media/base/fakemediaengine.h" 17 #include "webrtc/media/base/fakemediaengine.h"
18 #include "webrtc/media/base/fakevideocapturer.h" 18 #include "webrtc/media/base/fakevideocapturer.h"
19 #include "webrtc/media/base/testutils.h" 19 #include "webrtc/media/base/testutils.h"
20 #include "webrtc/media/engine/fakewebrtccall.h" 20 #include "webrtc/media/engine/fakewebrtccall.h"
21 #include "webrtc/p2p/base/faketransportcontroller.h" 21 #include "webrtc/p2p/base/faketransportcontroller.h"
22 #include "webrtc/pc/channelmanager.h" 22 #include "webrtc/pc/channelmanager.h"
23 #include "webrtc/pc/fakemediacontroller.h" 23 #include "webrtc/pc/fakemediacontroller.h"
24 24
25 namespace cricket { 25 namespace {
26 const bool kDefaultRtcpMuxRequired = true;
27 const bool kDefaultSrtpRequired = true; 26 const bool kDefaultSrtpRequired = true;
28 } 27 }
29 28
30 namespace cricket { 29 namespace cricket {
31 30
32 static const AudioCodec kAudioCodecs[] = { 31 static const AudioCodec kAudioCodecs[] = {
33 AudioCodec(97, "voice", 1, 2, 3), AudioCodec(111, "OPUS", 48000, 32000, 2), 32 AudioCodec(97, "voice", 1, 2, 3), AudioCodec(111, "OPUS", 48000, 32000, 2),
34 }; 33 };
35 34
36 static const VideoCodec kVideoCodecs[] = { 35 static const VideoCodec kVideoCodecs[] = {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 95 }
97 96
98 // Test that we can create and destroy a voice and video channel. 97 // Test that we can create and destroy a voice and video channel.
99 TEST_F(ChannelManagerTest, CreateDestroyChannels) { 98 TEST_F(ChannelManagerTest, CreateDestroyChannels) {
100 EXPECT_TRUE(cm_->Init()); 99 EXPECT_TRUE(cm_->Init());
101 cricket::DtlsTransportInternal* rtp_transport = 100 cricket::DtlsTransportInternal* rtp_transport =
102 transport_controller_->CreateDtlsTransport( 101 transport_controller_->CreateDtlsTransport(
103 cricket::CN_AUDIO, cricket::ICE_CANDIDATE_COMPONENT_RTP); 102 cricket::CN_AUDIO, cricket::ICE_CANDIDATE_COMPONENT_RTP);
104 cricket::VoiceChannel* voice_channel = cm_->CreateVoiceChannel( 103 cricket::VoiceChannel* voice_channel = cm_->CreateVoiceChannel(
105 &fake_mc_, rtp_transport, nullptr /*rtcp_transport*/, 104 &fake_mc_, rtp_transport, nullptr /*rtcp_transport*/,
106 rtc::Thread::Current(), cricket::CN_AUDIO, nullptr, 105 rtc::Thread::Current(), cricket::CN_AUDIO, kDefaultSrtpRequired,
107 kDefaultRtcpMuxRequired, kDefaultSrtpRequired, AudioOptions()); 106 AudioOptions());
108 EXPECT_TRUE(voice_channel != nullptr); 107 EXPECT_TRUE(voice_channel != nullptr);
109 cricket::VideoChannel* video_channel = cm_->CreateVideoChannel( 108 cricket::VideoChannel* video_channel = cm_->CreateVideoChannel(
110 &fake_mc_, rtp_transport, nullptr /*rtcp_transport*/, 109 &fake_mc_, rtp_transport, nullptr /*rtcp_transport*/,
111 rtc::Thread::Current(), cricket::CN_VIDEO, nullptr, 110 rtc::Thread::Current(), cricket::CN_VIDEO, kDefaultSrtpRequired,
112 kDefaultRtcpMuxRequired, kDefaultSrtpRequired, VideoOptions()); 111 VideoOptions());
113 EXPECT_TRUE(video_channel != nullptr); 112 EXPECT_TRUE(video_channel != nullptr);
114 cricket::RtpDataChannel* rtp_data_channel = cm_->CreateRtpDataChannel( 113 cricket::RtpDataChannel* rtp_data_channel = cm_->CreateRtpDataChannel(
115 &fake_mc_, rtp_transport, nullptr /*rtcp_transport*/, 114 &fake_mc_, rtp_transport, nullptr /*rtcp_transport*/,
116 rtc::Thread::Current(), cricket::CN_DATA, nullptr, 115 rtc::Thread::Current(), cricket::CN_DATA, kDefaultSrtpRequired);
117 kDefaultRtcpMuxRequired, kDefaultSrtpRequired);
118 EXPECT_TRUE(rtp_data_channel != nullptr); 116 EXPECT_TRUE(rtp_data_channel != nullptr);
119 cm_->DestroyVideoChannel(video_channel); 117 cm_->DestroyVideoChannel(video_channel);
120 cm_->DestroyVoiceChannel(voice_channel); 118 cm_->DestroyVoiceChannel(voice_channel);
121 cm_->DestroyRtpDataChannel(rtp_data_channel); 119 cm_->DestroyRtpDataChannel(rtp_data_channel);
122 cm_->Terminate(); 120 cm_->Terminate();
123 } 121 }
124 122
125 // Test that we can create and destroy a voice and video channel with a worker. 123 // Test that we can create and destroy a voice and video channel with a worker.
126 TEST_F(ChannelManagerTest, CreateDestroyChannelsOnThread) { 124 TEST_F(ChannelManagerTest, CreateDestroyChannelsOnThread) {
127 network_.Start(); 125 network_.Start();
128 worker_.Start(); 126 worker_.Start();
129 EXPECT_TRUE(cm_->set_worker_thread(&worker_)); 127 EXPECT_TRUE(cm_->set_worker_thread(&worker_));
130 EXPECT_TRUE(cm_->set_network_thread(&network_)); 128 EXPECT_TRUE(cm_->set_network_thread(&network_));
131 EXPECT_TRUE(cm_->Init()); 129 EXPECT_TRUE(cm_->Init());
132 transport_controller_.reset( 130 transport_controller_.reset(
133 new cricket::FakeTransportController(&network_, ICEROLE_CONTROLLING)); 131 new cricket::FakeTransportController(&network_, ICEROLE_CONTROLLING));
134 cricket::DtlsTransportInternal* rtp_transport = 132 cricket::DtlsTransportInternal* rtp_transport =
135 transport_controller_->CreateDtlsTransport( 133 transport_controller_->CreateDtlsTransport(
136 cricket::CN_AUDIO, cricket::ICE_CANDIDATE_COMPONENT_RTP); 134 cricket::CN_AUDIO, cricket::ICE_CANDIDATE_COMPONENT_RTP);
137 cricket::VoiceChannel* voice_channel = cm_->CreateVoiceChannel( 135 cricket::VoiceChannel* voice_channel = cm_->CreateVoiceChannel(
138 &fake_mc_, rtp_transport, nullptr /*rtcp_transport*/, 136 &fake_mc_, rtp_transport, nullptr /*rtcp_transport*/,
139 rtc::Thread::Current(), cricket::CN_AUDIO, nullptr, 137 rtc::Thread::Current(), cricket::CN_AUDIO, kDefaultSrtpRequired,
140 kDefaultRtcpMuxRequired, kDefaultSrtpRequired, AudioOptions()); 138 AudioOptions());
141 EXPECT_TRUE(voice_channel != nullptr); 139 EXPECT_TRUE(voice_channel != nullptr);
142 cricket::VideoChannel* video_channel = cm_->CreateVideoChannel( 140 cricket::VideoChannel* video_channel = cm_->CreateVideoChannel(
143 &fake_mc_, rtp_transport, nullptr /*rtcp_transport*/, 141 &fake_mc_, rtp_transport, nullptr /*rtcp_transport*/,
144 rtc::Thread::Current(), cricket::CN_VIDEO, nullptr, 142 rtc::Thread::Current(), cricket::CN_VIDEO, kDefaultSrtpRequired,
145 kDefaultRtcpMuxRequired, kDefaultSrtpRequired, VideoOptions()); 143 VideoOptions());
146 EXPECT_TRUE(video_channel != nullptr); 144 EXPECT_TRUE(video_channel != nullptr);
147 cricket::RtpDataChannel* rtp_data_channel = cm_->CreateRtpDataChannel( 145 cricket::RtpDataChannel* rtp_data_channel = cm_->CreateRtpDataChannel(
148 &fake_mc_, rtp_transport, nullptr /*rtcp_transport*/, 146 &fake_mc_, rtp_transport, nullptr /*rtcp_transport*/,
149 rtc::Thread::Current(), cricket::CN_DATA, nullptr, 147 rtc::Thread::Current(), cricket::CN_DATA, kDefaultSrtpRequired);
150 kDefaultRtcpMuxRequired, kDefaultSrtpRequired);
151 EXPECT_TRUE(rtp_data_channel != nullptr); 148 EXPECT_TRUE(rtp_data_channel != nullptr);
152 cm_->DestroyVideoChannel(video_channel); 149 cm_->DestroyVideoChannel(video_channel);
153 cm_->DestroyVoiceChannel(voice_channel); 150 cm_->DestroyVoiceChannel(voice_channel);
154 cm_->DestroyRtpDataChannel(rtp_data_channel); 151 cm_->DestroyRtpDataChannel(rtp_data_channel);
155 cm_->Terminate(); 152 cm_->Terminate();
156 } 153 }
157 154
158 TEST_F(ChannelManagerTest, SetVideoRtxEnabled) { 155 TEST_F(ChannelManagerTest, SetVideoRtxEnabled) {
159 std::vector<VideoCodec> codecs; 156 std::vector<VideoCodec> codecs;
160 const VideoCodec rtx_codec(96, "rtx"); 157 const VideoCodec rtx_codec(96, "rtx");
(...skipping 18 matching lines...) Expand all
179 EXPECT_FALSE(cm_->SetVideoRtxEnabled(false)); 176 EXPECT_FALSE(cm_->SetVideoRtxEnabled(false));
180 177
181 // Can set again after terminate. 178 // Can set again after terminate.
182 cm_->Terminate(); 179 cm_->Terminate();
183 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); 180 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true));
184 cm_->GetSupportedVideoCodecs(&codecs); 181 cm_->GetSupportedVideoCodecs(&codecs);
185 EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec)); 182 EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec));
186 } 183 }
187 184
188 } // namespace cricket 185 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/pc/channelmanager.cc ('k') | webrtc/pc/rtpsenderreceiver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698