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

Side by Side Diff: webrtc/api/webrtcsession_unittest.cc

Issue 2483093003: Use rtc::PacketTransportInterface in WebrtcSession unit test. (Closed)
Patch Set: Fix unit test. Created 4 years, 1 month 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 | « no previous file | no next file » | 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 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 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 22 matching lines...) Expand all
33 #include "webrtc/base/sslidentity.h" 33 #include "webrtc/base/sslidentity.h"
34 #include "webrtc/base/sslstreamadapter.h" 34 #include "webrtc/base/sslstreamadapter.h"
35 #include "webrtc/base/stringutils.h" 35 #include "webrtc/base/stringutils.h"
36 #include "webrtc/base/thread.h" 36 #include "webrtc/base/thread.h"
37 #include "webrtc/base/virtualsocketserver.h" 37 #include "webrtc/base/virtualsocketserver.h"
38 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" 38 #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
39 #include "webrtc/media/base/fakemediaengine.h" 39 #include "webrtc/media/base/fakemediaengine.h"
40 #include "webrtc/media/base/fakevideorenderer.h" 40 #include "webrtc/media/base/fakevideorenderer.h"
41 #include "webrtc/media/base/mediachannel.h" 41 #include "webrtc/media/base/mediachannel.h"
42 #include "webrtc/media/engine/fakewebrtccall.h" 42 #include "webrtc/media/engine/fakewebrtccall.h"
43 #include "webrtc/p2p/base/packettransportinterface.h"
43 #include "webrtc/p2p/base/stunserver.h" 44 #include "webrtc/p2p/base/stunserver.h"
44 #include "webrtc/p2p/base/teststunserver.h" 45 #include "webrtc/p2p/base/teststunserver.h"
45 #include "webrtc/p2p/base/testturnserver.h" 46 #include "webrtc/p2p/base/testturnserver.h"
46 #include "webrtc/p2p/base/transportchannel.h" 47 #include "webrtc/p2p/base/transportchannel.h"
47 #include "webrtc/p2p/client/basicportallocator.h" 48 #include "webrtc/p2p/client/basicportallocator.h"
48 #include "webrtc/pc/channelmanager.h" 49 #include "webrtc/pc/channelmanager.h"
49 #include "webrtc/pc/mediasession.h" 50 #include "webrtc/pc/mediasession.h"
50 51
51 #define MAYBE_SKIP_TEST(feature) \ 52 #define MAYBE_SKIP_TEST(feature) \
52 if (!(feature())) { \ 53 if (!(feature())) { \
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 worker_thread, 226 worker_thread,
226 signaling_thread, 227 signaling_thread,
227 port_allocator, 228 port_allocator,
228 std::move(transport_controller)) { 229 std::move(transport_controller)) {
229 RegisterIceObserver(ice_observer); 230 RegisterIceObserver(ice_observer);
230 } 231 }
231 virtual ~WebRtcSessionForTest() {} 232 virtual ~WebRtcSessionForTest() {}
232 233
233 // Note that these methods are only safe to use if the signaling thread 234 // Note that these methods are only safe to use if the signaling thread
234 // is the same as the worker thread 235 // is the same as the worker thread
235 cricket::TransportChannel* voice_rtp_transport_channel() { 236 rtc::PacketTransportInterface* voice_rtp_transport_channel() {
236 return rtp_transport_channel(voice_channel()); 237 return rtp_transport_channel(voice_channel());
237 } 238 }
238 239
239 cricket::TransportChannel* voice_rtcp_transport_channel() { 240 rtc::PacketTransportInterface* voice_rtcp_transport_channel() {
240 return rtcp_transport_channel(voice_channel()); 241 return rtcp_transport_channel(voice_channel());
241 } 242 }
242 243
243 cricket::TransportChannel* video_rtp_transport_channel() { 244 rtc::PacketTransportInterface* video_rtp_transport_channel() {
244 return rtp_transport_channel(video_channel()); 245 return rtp_transport_channel(video_channel());
245 } 246 }
246 247
247 cricket::TransportChannel* video_rtcp_transport_channel() { 248 rtc::PacketTransportInterface* video_rtcp_transport_channel() {
248 return rtcp_transport_channel(video_channel()); 249 return rtcp_transport_channel(video_channel());
249 } 250 }
250 251
251 cricket::TransportChannel* data_rtp_transport_channel() { 252 rtc::PacketTransportInterface* data_rtp_transport_channel() {
252 return rtp_transport_channel(data_channel()); 253 return rtp_transport_channel(data_channel());
253 } 254 }
254 255
255 cricket::TransportChannel* data_rtcp_transport_channel() { 256 rtc::PacketTransportInterface* data_rtcp_transport_channel() {
256 return rtcp_transport_channel(data_channel()); 257 return rtcp_transport_channel(data_channel());
257 } 258 }
258 259
259 private: 260 private:
260 cricket::TransportChannel* rtp_transport_channel(cricket::BaseChannel* ch) { 261 rtc::PacketTransportInterface* rtp_transport_channel(
262 cricket::BaseChannel* ch) {
261 if (!ch) { 263 if (!ch) {
262 return nullptr; 264 return nullptr;
263 } 265 }
264 return ch->transport_channel(); 266 return ch->transport_channel();
265 } 267 }
266 268
267 cricket::TransportChannel* rtcp_transport_channel(cricket::BaseChannel* ch) { 269 rtc::PacketTransportInterface* rtcp_transport_channel(
270 cricket::BaseChannel* ch) {
268 if (!ch) { 271 if (!ch) {
269 return nullptr; 272 return nullptr;
270 } 273 }
271 return ch->rtcp_transport_channel(); 274 return ch->rtcp_transport_channel();
272 } 275 }
273 }; 276 };
274 277
275 class WebRtcSessionCreateSDPObserverForTest 278 class WebRtcSessionCreateSDPObserverForTest
276 : public rtc::RefCountedObject<CreateSessionDescriptionObserver> { 279 : public rtc::RefCountedObject<CreateSessionDescriptionObserver> {
277 public: 280 public:
(...skipping 2140 matching lines...) Expand 10 before | Expand all | Expand 10 after
2418 &sdp); 2421 &sdp);
2419 2422
2420 SessionDescriptionInterface* modified_offer = 2423 SessionDescriptionInterface* modified_offer =
2421 CreateSessionDescription(JsepSessionDescription::kOffer, sdp, NULL); 2424 CreateSessionDescription(JsepSessionDescription::kOffer, sdp, NULL);
2422 2425
2423 SetRemoteDescriptionWithoutError(modified_offer); 2426 SetRemoteDescriptionWithoutError(modified_offer);
2424 2427
2425 SessionDescriptionInterface* answer = CreateAnswer(); 2428 SessionDescriptionInterface* answer = CreateAnswer();
2426 SetLocalDescriptionWithoutError(answer); 2429 SetLocalDescriptionWithoutError(answer);
2427 2430
2428 cricket::TransportChannel* voice_transport_channel = 2431 rtc::PacketTransportInterface* voice_transport_channel =
2429 session_->voice_rtp_transport_channel(); 2432 session_->voice_rtp_transport_channel();
2430 EXPECT_TRUE(voice_transport_channel != NULL); 2433 EXPECT_TRUE(voice_transport_channel != NULL);
2431 EXPECT_EQ(voice_transport_channel->transport_name(), "audio_content_name"); 2434 EXPECT_EQ(voice_transport_channel->debug_name(),
2432 cricket::TransportChannel* video_transport_channel = 2435 "audio_content_name " +
2436 std::to_string(cricket::ICE_CANDIDATE_COMPONENT_RTP));
2437 rtc::PacketTransportInterface* video_transport_channel =
2433 session_->video_rtp_transport_channel(); 2438 session_->video_rtp_transport_channel();
2434 ASSERT_TRUE(video_transport_channel != NULL); 2439 ASSERT_TRUE(video_transport_channel != NULL);
2435 EXPECT_EQ(video_transport_channel->transport_name(), "video_content_name"); 2440 EXPECT_EQ(video_transport_channel->debug_name(),
2441 "video_content_name " +
2442 std::to_string(cricket::ICE_CANDIDATE_COMPONENT_RTP));
2436 EXPECT_TRUE((video_channel_ = media_engine_->GetVideoChannel(0)) != NULL); 2443 EXPECT_TRUE((video_channel_ = media_engine_->GetVideoChannel(0)) != NULL);
2437 EXPECT_TRUE((voice_channel_ = media_engine_->GetVoiceChannel(0)) != NULL); 2444 EXPECT_TRUE((voice_channel_ = media_engine_->GetVoiceChannel(0)) != NULL);
2438 } 2445 }
2439 2446
2440 // Test that an offer contains the correct media content descriptions based on 2447 // Test that an offer contains the correct media content descriptions based on
2441 // the send streams when no constraints have been set. 2448 // the send streams when no constraints have been set.
2442 TEST_F(WebRtcSessionTest, CreateOfferWithoutConstraintsOrStreams) { 2449 TEST_F(WebRtcSessionTest, CreateOfferWithoutConstraintsOrStreams) {
2443 Init(); 2450 Init();
2444 std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer()); 2451 std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer());
2445 2452
(...skipping 1902 matching lines...) Expand 10 before | Expand all | Expand 10 after
4348 } 4355 }
4349 4356
4350 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test 4357 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test
4351 // currently fails because upon disconnection and reconnection OnIceComplete is 4358 // currently fails because upon disconnection and reconnection OnIceComplete is
4352 // called more than once without returning to IceGatheringGathering. 4359 // called more than once without returning to IceGatheringGathering.
4353 4360
4354 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, 4361 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests,
4355 WebRtcSessionTest, 4362 WebRtcSessionTest,
4356 testing::Values(ALREADY_GENERATED, 4363 testing::Values(ALREADY_GENERATED,
4357 DTLS_IDENTITY_STORE)); 4364 DTLS_IDENTITY_STORE));
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698