Use rtc::PacketTransportInterface in WebrtcSession unit test.

Using rtc::PacketTransportInterface instead of cricket::TransportChannel
is a preparation for refactoring channel.cc.

BUG=webrtc:6676

Review-Url: https://codereview.webrtc.org/2483093003
Cr-Commit-Position: refs/heads/master@{#14989}
This commit is contained in:
johan 2016-11-08 14:14:08 -08:00 committed by Commit bot
parent bc38b4d450
commit 669d69bd15

View File

@ -40,6 +40,7 @@
#include "webrtc/media/base/fakevideorenderer.h"
#include "webrtc/media/base/mediachannel.h"
#include "webrtc/media/engine/fakewebrtccall.h"
#include "webrtc/p2p/base/packettransportinterface.h"
#include "webrtc/p2p/base/stunserver.h"
#include "webrtc/p2p/base/teststunserver.h"
#include "webrtc/p2p/base/testturnserver.h"
@ -232,39 +233,41 @@ class WebRtcSessionForTest : public webrtc::WebRtcSession {
// Note that these methods are only safe to use if the signaling thread
// is the same as the worker thread
cricket::TransportChannel* voice_rtp_transport_channel() {
rtc::PacketTransportInterface* voice_rtp_transport_channel() {
return rtp_transport_channel(voice_channel());
}
cricket::TransportChannel* voice_rtcp_transport_channel() {
rtc::PacketTransportInterface* voice_rtcp_transport_channel() {
return rtcp_transport_channel(voice_channel());
}
cricket::TransportChannel* video_rtp_transport_channel() {
rtc::PacketTransportInterface* video_rtp_transport_channel() {
return rtp_transport_channel(video_channel());
}
cricket::TransportChannel* video_rtcp_transport_channel() {
rtc::PacketTransportInterface* video_rtcp_transport_channel() {
return rtcp_transport_channel(video_channel());
}
cricket::TransportChannel* data_rtp_transport_channel() {
rtc::PacketTransportInterface* data_rtp_transport_channel() {
return rtp_transport_channel(data_channel());
}
cricket::TransportChannel* data_rtcp_transport_channel() {
rtc::PacketTransportInterface* data_rtcp_transport_channel() {
return rtcp_transport_channel(data_channel());
}
private:
cricket::TransportChannel* rtp_transport_channel(cricket::BaseChannel* ch) {
rtc::PacketTransportInterface* rtp_transport_channel(
cricket::BaseChannel* ch) {
if (!ch) {
return nullptr;
}
return ch->transport_channel();
}
cricket::TransportChannel* rtcp_transport_channel(cricket::BaseChannel* ch) {
rtc::PacketTransportInterface* rtcp_transport_channel(
cricket::BaseChannel* ch) {
if (!ch) {
return nullptr;
}
@ -2425,14 +2428,18 @@ TEST_F(WebRtcSessionTest, TestChannelCreationsWithContentNames) {
SessionDescriptionInterface* answer = CreateAnswer();
SetLocalDescriptionWithoutError(answer);
cricket::TransportChannel* voice_transport_channel =
rtc::PacketTransportInterface* voice_transport_channel =
session_->voice_rtp_transport_channel();
EXPECT_TRUE(voice_transport_channel != NULL);
EXPECT_EQ(voice_transport_channel->transport_name(), "audio_content_name");
cricket::TransportChannel* video_transport_channel =
EXPECT_EQ(voice_transport_channel->debug_name(),
"audio_content_name " +
std::to_string(cricket::ICE_CANDIDATE_COMPONENT_RTP));
rtc::PacketTransportInterface* video_transport_channel =
session_->video_rtp_transport_channel();
ASSERT_TRUE(video_transport_channel != NULL);
EXPECT_EQ(video_transport_channel->transport_name(), "video_content_name");
EXPECT_EQ(video_transport_channel->debug_name(),
"video_content_name " +
std::to_string(cricket::ICE_CANDIDATE_COMPONENT_RTP));
EXPECT_TRUE((video_channel_ = media_engine_->GetVideoChannel(0)) != NULL);
EXPECT_TRUE((voice_channel_ = media_engine_->GetVoiceChannel(0)) != NULL);
}