Revert 8237 "Cleanup and prepare for bundling."

libjingle_peerconnection_objc_test consistently failing on Mac64 Debug.

> Cleanup and prepare for bundling.
> 
> - Add a GetOptions function. Needed for eventual bundle testing to
>   confirm that channel options are preserved.
> - Simplify unit tests and cleanup unused code.
> 
> BUG=1574
> R=pthatcher@webrtc.org, tommi@webrtc.org
> 
> Review URL: https://webrtc-codereview.appspot.com/39699004

TBR=pthatcher@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/34959004

Cr-Commit-Position: refs/heads/master@{#8241}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8241 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
bjornv@webrtc.org 2015-02-04 10:22:14 +00:00
parent dc096f2c7e
commit c5f697135e
16 changed files with 133 additions and 189 deletions

View File

@ -323,16 +323,28 @@ bool PeerConnection::Initialize(
PortAllocatorFactoryInterface* allocator_factory, PortAllocatorFactoryInterface* allocator_factory,
DTLSIdentityServiceInterface* dtls_identity_service, DTLSIdentityServiceInterface* dtls_identity_service,
PeerConnectionObserver* observer) { PeerConnectionObserver* observer) {
ASSERT(observer != NULL);
if (!observer)
return false;
observer_ = observer;
std::vector<PortAllocatorFactoryInterface::StunConfiguration> stun_config; std::vector<PortAllocatorFactoryInterface::StunConfiguration> stun_config;
std::vector<PortAllocatorFactoryInterface::TurnConfiguration> turn_config; std::vector<PortAllocatorFactoryInterface::TurnConfiguration> turn_config;
if (!ParseIceServers(configuration.servers, &stun_config, &turn_config)) { if (!ParseIceServers(configuration.servers, &stun_config, &turn_config)) {
return false; return false;
} }
return DoInitialize(configuration.type, stun_config, turn_config, constraints,
allocator_factory, dtls_identity_service, observer);
}
bool PeerConnection::DoInitialize(
IceTransportsType type,
const StunConfigurations& stun_config,
const TurnConfigurations& turn_config,
const MediaConstraintsInterface* constraints,
webrtc::PortAllocatorFactoryInterface* allocator_factory,
DTLSIdentityServiceInterface* dtls_identity_service,
PeerConnectionObserver* observer) {
ASSERT(observer != NULL);
if (!observer)
return false;
observer_ = observer;
port_allocator_.reset( port_allocator_.reset(
allocator_factory->CreatePortAllocator(stun_config, turn_config)); allocator_factory->CreatePortAllocator(stun_config, turn_config));
@ -372,9 +384,7 @@ bool PeerConnection::Initialize(
// Initialize the WebRtcSession. It creates transport channels etc. // Initialize the WebRtcSession. It creates transport channels etc.
if (!session_->Initialize(factory_->options(), constraints, if (!session_->Initialize(factory_->options(), constraints,
dtls_identity_service, dtls_identity_service, type))
configuration.type,
configuration.bundle_policy))
return false; return false;
// Register PeerConnection as receiver of local ice candidates. // Register PeerConnection as receiver of local ice candidates.

View File

@ -506,13 +506,13 @@ class PeerConnectionFactoryInterface : public rtc::RefCountInterface {
// http://dev.w3.org/2011/webrtc/editor/webrtc.html // http://dev.w3.org/2011/webrtc/editor/webrtc.html
inline rtc::scoped_refptr<PeerConnectionInterface> inline rtc::scoped_refptr<PeerConnectionInterface>
CreatePeerConnection( CreatePeerConnection(
const PeerConnectionInterface::IceServers& servers, const PeerConnectionInterface::IceServers& configuration,
const MediaConstraintsInterface* constraints, const MediaConstraintsInterface* constraints,
PortAllocatorFactoryInterface* allocator_factory, PortAllocatorFactoryInterface* allocator_factory,
DTLSIdentityServiceInterface* dtls_identity_service, DTLSIdentityServiceInterface* dtls_identity_service,
PeerConnectionObserver* observer) { PeerConnectionObserver* observer) {
PeerConnectionInterface::RTCConfiguration rtc_config; PeerConnectionInterface::RTCConfiguration rtc_config;
rtc_config.servers = servers; rtc_config.servers = configuration;
return CreatePeerConnection(rtc_config, constraints, allocator_factory, return CreatePeerConnection(rtc_config, constraints, allocator_factory,
dtls_identity_service, observer); dtls_identity_service, observer);
} }

View File

@ -466,12 +466,11 @@ class IceRestartAnswerLatch {
bool ice_restart_; bool ice_restart_;
}; };
WebRtcSession::WebRtcSession( WebRtcSession::WebRtcSession(cricket::ChannelManager* channel_manager,
cricket::ChannelManager* channel_manager, rtc::Thread* signaling_thread,
rtc::Thread* signaling_thread, rtc::Thread* worker_thread,
rtc::Thread* worker_thread, cricket::PortAllocator* port_allocator,
cricket::PortAllocator* port_allocator, MediaStreamSignaling* mediastream_signaling)
MediaStreamSignaling* mediastream_signaling)
: cricket::BaseSession(signaling_thread, : cricket::BaseSession(signaling_thread,
worker_thread, worker_thread,
port_allocator, port_allocator,
@ -517,10 +516,7 @@ bool WebRtcSession::Initialize(
const PeerConnectionFactoryInterface::Options& options, const PeerConnectionFactoryInterface::Options& options,
const MediaConstraintsInterface* constraints, const MediaConstraintsInterface* constraints,
DTLSIdentityServiceInterface* dtls_identity_service, DTLSIdentityServiceInterface* dtls_identity_service,
PeerConnectionInterface::IceTransportsType ice_transport_type, PeerConnectionInterface::IceTransportsType ice_transport) {
PeerConnectionInterface::BundlePolicy bundle_policy) {
bundle_policy_ = bundle_policy;
// TODO(perkj): Take |constraints| into consideration. Return false if not all // TODO(perkj): Take |constraints| into consideration. Return false if not all
// mandatory constraints can be fulfilled. Note that |constraints| // mandatory constraints can be fulfilled. Note that |constraints|
// can be null. // can be null.
@ -663,7 +659,7 @@ bool WebRtcSession::Initialize(
webrtc_session_desc_factory_->SetSdesPolicy(cricket::SEC_DISABLED); webrtc_session_desc_factory_->SetSdesPolicy(cricket::SEC_DISABLED);
} }
port_allocator()->set_candidate_filter( port_allocator()->set_candidate_filter(
ConvertIceTransportTypeToCandidateFilter(ice_transport_type)); ConvertIceTransportTypeToCandidateFilter(ice_transport));
return true; return true;
} }

View File

@ -118,8 +118,7 @@ class WebRtcSession : public cricket::BaseSession,
bool Initialize(const PeerConnectionFactoryInterface::Options& options, bool Initialize(const PeerConnectionFactoryInterface::Options& options,
const MediaConstraintsInterface* constraints, const MediaConstraintsInterface* constraints,
DTLSIdentityServiceInterface* dtls_identity_service, DTLSIdentityServiceInterface* dtls_identity_service,
PeerConnectionInterface::IceTransportsType ice_transport_type, PeerConnectionInterface::IceTransportsType ice_transport);
PeerConnectionInterface::BundlePolicy bundle_policy);
// Deletes the voice, video and data channel and changes the session state // Deletes the voice, video and data channel and changes the session state
// to STATE_RECEIVEDTERMINATE. // to STATE_RECEIVEDTERMINATE.
void Terminate(); void Terminate();
@ -373,9 +372,6 @@ class WebRtcSession : public cricket::BaseSession,
cricket::VideoOptions video_options_; cricket::VideoOptions video_options_;
MetricsObserverInterface* metrics_observer_; MetricsObserverInterface* metrics_observer_;
// Declares the bundle policy for the WebRTCSession.
PeerConnectionInterface::BundlePolicy bundle_policy_;
DISALLOW_COPY_AND_ASSIGN(WebRtcSession); DISALLOW_COPY_AND_ASSIGN(WebRtcSession);
}; };
} // namespace webrtc } // namespace webrtc

View File

@ -342,7 +342,8 @@ class WebRtcSessionTest : public testing::Test {
stun_server_(cricket::TestStunServer::Create(Thread::Current(), stun_server_(cricket::TestStunServer::Create(Thread::Current(),
stun_socket_addr_)), stun_socket_addr_)),
turn_server_(Thread::Current(), kTurnUdpIntAddr, kTurnUdpExtAddr), turn_server_(Thread::Current(), kTurnUdpIntAddr, kTurnUdpExtAddr),
mediastream_signaling_(channel_manager_.get()) { mediastream_signaling_(channel_manager_.get()),
ice_type_(PeerConnectionInterface::kAll) {
tdesc_factory_->set_protocol(cricket::ICEPROTO_HYBRID); tdesc_factory_->set_protocol(cricket::ICEPROTO_HYBRID);
cricket::ServerAddresses stun_servers; cricket::ServerAddresses stun_servers;
@ -364,10 +365,11 @@ class WebRtcSessionTest : public testing::Test {
network_manager_.AddInterface(addr); network_manager_.AddInterface(addr);
} }
void Init( void SetIceTransportType(PeerConnectionInterface::IceTransportsType type) {
DTLSIdentityServiceInterface* identity_service, ice_type_ = type;
PeerConnectionInterface::IceTransportsType ice_transport_type, }
PeerConnectionInterface::BundlePolicy bundle_policy) {
void Init(DTLSIdentityServiceInterface* identity_service) {
ASSERT_TRUE(session_.get() == NULL); ASSERT_TRUE(session_.get() == NULL);
session_.reset(new WebRtcSessionForTest( session_.reset(new WebRtcSessionForTest(
channel_manager_.get(), rtc::Thread::Current(), channel_manager_.get(), rtc::Thread::Current(),
@ -381,35 +383,10 @@ class WebRtcSessionTest : public testing::Test {
observer_.ice_gathering_state_); observer_.ice_gathering_state_);
EXPECT_TRUE(session_->Initialize(options_, constraints_.get(), EXPECT_TRUE(session_->Initialize(options_, constraints_.get(),
identity_service, ice_transport_type, identity_service, ice_type_));
bundle_policy));
session_->set_metrics_observer(&metrics_observer_); session_->set_metrics_observer(&metrics_observer_);
} }
void Init() {
Init(NULL, PeerConnectionInterface::kAll,
PeerConnectionInterface::kBundlePolicyBalanced);
}
void InitWithIceTransport(
PeerConnectionInterface::IceTransportsType ice_transport_type) {
Init(NULL, ice_transport_type,
PeerConnectionInterface::kBundlePolicyBalanced);
}
void InitWithBundlePolicy(
PeerConnectionInterface::BundlePolicy bundle_policy) {
Init(NULL, PeerConnectionInterface::kAll, bundle_policy);
}
void InitWithDtls(bool identity_request_should_fail = false) {
FakeIdentityService* identity_service = new FakeIdentityService();
identity_service->set_should_fail(identity_request_should_fail);
Init(identity_service,
PeerConnectionInterface::kAll,
PeerConnectionInterface::kBundlePolicyBalanced);
}
void InitWithDtmfCodec() { void InitWithDtmfCodec() {
// Add kTelephoneEventCodec for dtmf test. // Add kTelephoneEventCodec for dtmf test.
const cricket::AudioCodec kTelephoneEventCodec( const cricket::AudioCodec kTelephoneEventCodec(
@ -418,7 +395,13 @@ class WebRtcSessionTest : public testing::Test {
codecs.push_back(kTelephoneEventCodec); codecs.push_back(kTelephoneEventCodec);
media_engine_->SetAudioCodecs(codecs); media_engine_->SetAudioCodecs(codecs);
desc_factory_->set_audio_codecs(codecs); desc_factory_->set_audio_codecs(codecs);
Init(); Init(NULL);
}
void InitWithDtls(bool identity_request_should_fail = false) {
FakeIdentityService* identity_service = new FakeIdentityService();
identity_service->set_should_fail(identity_request_should_fail);
Init(identity_service);
} }
// Creates a local offer and applies it. Starts ice. // Creates a local offer and applies it. Starts ice.
@ -589,7 +572,7 @@ class WebRtcSessionTest : public testing::Test {
webrtc::MediaConstraintsInterface::kNumUnsignalledRecvStreams, webrtc::MediaConstraintsInterface::kNumUnsignalledRecvStreams,
value_set); value_set);
session_.reset(); session_.reset();
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
SessionDescriptionInterface* offer = CreateOffer(); SessionDescriptionInterface* offer = CreateOffer();
@ -908,7 +891,7 @@ class WebRtcSessionTest : public testing::Test {
void TestSessionCandidatesWithBundleRtcpMux(bool bundle, bool rtcp_mux) { void TestSessionCandidatesWithBundleRtcpMux(bool bundle, bool rtcp_mux) {
AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
PeerConnectionInterface::RTCOfferAnswerOptions options; PeerConnectionInterface::RTCOfferAnswerOptions options;
@ -960,7 +943,7 @@ class WebRtcSessionTest : public testing::Test {
if (can) { if (can) {
InitWithDtmfCodec(); InitWithDtmfCodec();
} else { } else {
Init(); Init(NULL);
} }
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
CreateAndSetRemoteOfferAndLocalAnswer(); CreateAndSetRemoteOfferAndLocalAnswer();
@ -1067,7 +1050,7 @@ class WebRtcSessionTest : public testing::Test {
void TestLoopbackCall(const LoopbackNetworkConfiguration& config) { void TestLoopbackCall(const LoopbackNetworkConfiguration& config) {
LoopbackNetworkManager loopback_network_manager(this, config); LoopbackNetworkManager loopback_network_manager(this, config);
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
SessionDescriptionInterface* offer = CreateOffer(); SessionDescriptionInterface* offer = CreateOffer();
@ -1257,6 +1240,7 @@ class WebRtcSessionTest : public testing::Test {
MockIceObserver observer_; MockIceObserver observer_;
cricket::FakeVideoMediaChannel* video_channel_; cricket::FakeVideoMediaChannel* video_channel_;
cricket::FakeVoiceMediaChannel* voice_channel_; cricket::FakeVoiceMediaChannel* voice_channel_;
PeerConnectionInterface::IceTransportsType ice_type_;
FakeMetricsObserver metrics_observer_; FakeMetricsObserver metrics_observer_;
}; };
@ -1267,7 +1251,7 @@ TEST_F(WebRtcSessionTest, TestInitializeWithDtls) {
} }
TEST_F(WebRtcSessionTest, TestInitializeWithoutDtls) { TEST_F(WebRtcSessionTest, TestInitializeWithoutDtls) {
Init(); Init(NULL);
// SDES is required if DTLS is off. // SDES is required if DTLS is off.
EXPECT_EQ(cricket::SEC_REQUIRED, session_->SdesPolicy()); EXPECT_EQ(cricket::SEC_REQUIRED, session_->SdesPolicy());
} }
@ -1289,7 +1273,7 @@ TEST_F(WebRtcSessionTest, TestSessionCandidatesWithBundleRtcpMux) {
TEST_F(WebRtcSessionTest, TestMultihomeCandidates) { TEST_F(WebRtcSessionTest, TestMultihomeCandidates) {
AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
AddInterface(rtc::SocketAddress(kClientAddrHost2, kClientAddrPort)); AddInterface(rtc::SocketAddress(kClientAddrHost2, kClientAddrPort));
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
InitiateCall(); InitiateCall();
EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout);
@ -1304,7 +1288,7 @@ TEST_F(WebRtcSessionTest, TestStunError) {
rtc::FP_UDP, rtc::FP_UDP,
rtc::FD_ANY, rtc::FD_ANY,
rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
InitiateCall(); InitiateCall();
// Since kClientAddrHost1 is blocked, not expecting stun candidates for it. // Since kClientAddrHost1 is blocked, not expecting stun candidates for it.
@ -1316,7 +1300,8 @@ TEST_F(WebRtcSessionTest, TestStunError) {
// Test session delivers no candidates gathered when constraint set to "none". // Test session delivers no candidates gathered when constraint set to "none".
TEST_F(WebRtcSessionTest, TestIceTransportsNone) { TEST_F(WebRtcSessionTest, TestIceTransportsNone) {
AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
InitWithIceTransport(PeerConnectionInterface::kNone); SetIceTransportType(PeerConnectionInterface::kNone);
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
InitiateCall(); InitiateCall();
EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout);
@ -1329,7 +1314,8 @@ TEST_F(WebRtcSessionTest, TestIceTransportsNone) {
TEST_F(WebRtcSessionTest, TestIceTransportsRelay) { TEST_F(WebRtcSessionTest, TestIceTransportsRelay) {
AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
ConfigureAllocatorWithTurn(); ConfigureAllocatorWithTurn();
InitWithIceTransport(PeerConnectionInterface::kRelay); SetIceTransportType(PeerConnectionInterface::kRelay);
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
InitiateCall(); InitiateCall();
EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout);
@ -1348,7 +1334,8 @@ TEST_F(WebRtcSessionTest, TestIceTransportsRelay) {
// Test session delivers all candidates gathered when constaint set to "all". // Test session delivers all candidates gathered when constaint set to "all".
TEST_F(WebRtcSessionTest, TestIceTransportsAll) { TEST_F(WebRtcSessionTest, TestIceTransportsAll) {
AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
InitWithIceTransport(PeerConnectionInterface::kAll); SetIceTransportType(PeerConnectionInterface::kAll);
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
InitiateCall(); InitiateCall();
EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout);
@ -1358,7 +1345,7 @@ TEST_F(WebRtcSessionTest, TestIceTransportsAll) {
} }
TEST_F(WebRtcSessionTest, SetSdpFailedOnInvalidSdp) { TEST_F(WebRtcSessionTest, SetSdpFailedOnInvalidSdp) {
Init(); Init(NULL);
SessionDescriptionInterface* offer = NULL; SessionDescriptionInterface* offer = NULL;
// Since |offer| is NULL, there's no way to tell if it's an offer or answer. // Since |offer| is NULL, there's no way to tell if it's an offer or answer.
std::string unknown_action; std::string unknown_action;
@ -1369,7 +1356,7 @@ TEST_F(WebRtcSessionTest, SetSdpFailedOnInvalidSdp) {
// Test creating offers and receive answers and make sure the // Test creating offers and receive answers and make sure the
// media engine creates the expected send and receive streams. // media engine creates the expected send and receive streams.
TEST_F(WebRtcSessionTest, TestCreateSdesOfferReceiveSdesAnswer) { TEST_F(WebRtcSessionTest, TestCreateSdesOfferReceiveSdesAnswer) {
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
SessionDescriptionInterface* offer = CreateOffer(); SessionDescriptionInterface* offer = CreateOffer();
const std::string session_id_orig = offer->session_id(); const std::string session_id_orig = offer->session_id();
@ -1423,7 +1410,7 @@ TEST_F(WebRtcSessionTest, TestCreateSdesOfferReceiveSdesAnswer) {
// Test receiving offers and creating answers and make sure the // Test receiving offers and creating answers and make sure the
// media engine creates the expected send and receive streams. // media engine creates the expected send and receive streams.
TEST_F(WebRtcSessionTest, TestReceiveSdesOfferCreateSdesAnswer) { TEST_F(WebRtcSessionTest, TestReceiveSdesOfferCreateSdesAnswer) {
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream2(); mediastream_signaling_.SendAudioVideoStream2();
SessionDescriptionInterface* offer = CreateOffer(); SessionDescriptionInterface* offer = CreateOffer();
VerifyCryptoParams(offer->description()); VerifyCryptoParams(offer->description());
@ -1479,7 +1466,7 @@ TEST_F(WebRtcSessionTest, TestReceiveSdesOfferCreateSdesAnswer) {
} }
TEST_F(WebRtcSessionTest, SetLocalSdpFailedOnCreateChannel) { TEST_F(WebRtcSessionTest, SetLocalSdpFailedOnCreateChannel) {
Init(); Init(NULL);
media_engine_->set_fail_create_channel(true); media_engine_->set_fail_create_channel(true);
SessionDescriptionInterface* offer = CreateOffer(); SessionDescriptionInterface* offer = CreateOffer();
@ -1525,7 +1512,7 @@ TEST_F(WebRtcSessionTest, SetLocalSdpFailedOnCreateChannel) {
// Test that we return a failure when applying a remote/local offer that doesn't // Test that we return a failure when applying a remote/local offer that doesn't
// have cryptos enabled when DTLS is off. // have cryptos enabled when DTLS is off.
TEST_F(WebRtcSessionTest, TestSetNonSdesOfferWhenSdesOn) { TEST_F(WebRtcSessionTest, TestSetNonSdesOfferWhenSdesOn) {
Init(); Init(NULL);
cricket::MediaSessionOptions options; cricket::MediaSessionOptions options;
options.recv_video = true; options.recv_video = true;
JsepSessionDescription* offer = CreateRemoteOffer( JsepSessionDescription* offer = CreateRemoteOffer(
@ -1543,7 +1530,7 @@ TEST_F(WebRtcSessionTest, TestSetNonSdesOfferWhenSdesOn) {
// Test that we return a failure when applying a local answer that doesn't have // Test that we return a failure when applying a local answer that doesn't have
// cryptos enabled when DTLS is off. // cryptos enabled when DTLS is off.
TEST_F(WebRtcSessionTest, TestSetLocalNonSdesAnswerWhenSdesOn) { TEST_F(WebRtcSessionTest, TestSetLocalNonSdesAnswerWhenSdesOn) {
Init(); Init(NULL);
SessionDescriptionInterface* offer = NULL; SessionDescriptionInterface* offer = NULL;
SessionDescriptionInterface* answer = NULL; SessionDescriptionInterface* answer = NULL;
CreateCryptoOfferAndNonCryptoAnswer(&offer, &answer); CreateCryptoOfferAndNonCryptoAnswer(&offer, &answer);
@ -1556,7 +1543,7 @@ TEST_F(WebRtcSessionTest, TestSetLocalNonSdesAnswerWhenSdesOn) {
// Test we will return fail when apply an remote answer that doesn't have // Test we will return fail when apply an remote answer that doesn't have
// crypto enabled when DTLS is off. // crypto enabled when DTLS is off.
TEST_F(WebRtcSessionTest, TestSetRemoteNonSdesAnswerWhenSdesOn) { TEST_F(WebRtcSessionTest, TestSetRemoteNonSdesAnswerWhenSdesOn) {
Init(); Init(NULL);
SessionDescriptionInterface* offer = NULL; SessionDescriptionInterface* offer = NULL;
SessionDescriptionInterface* answer = NULL; SessionDescriptionInterface* answer = NULL;
CreateCryptoOfferAndNonCryptoAnswer(&offer, &answer); CreateCryptoOfferAndNonCryptoAnswer(&offer, &answer);
@ -1741,7 +1728,7 @@ TEST_F(WebRtcSessionTest, TestCreateAnswerReceiveOfferWithoutEncryption) {
} }
TEST_F(WebRtcSessionTest, TestSetLocalOfferTwice) { TEST_F(WebRtcSessionTest, TestSetLocalOfferTwice) {
Init(); Init(NULL);
mediastream_signaling_.SendNothing(); mediastream_signaling_.SendNothing();
// SetLocalDescription take ownership of offer. // SetLocalDescription take ownership of offer.
SessionDescriptionInterface* offer = CreateOffer(); SessionDescriptionInterface* offer = CreateOffer();
@ -1753,7 +1740,7 @@ TEST_F(WebRtcSessionTest, TestSetLocalOfferTwice) {
} }
TEST_F(WebRtcSessionTest, TestSetRemoteOfferTwice) { TEST_F(WebRtcSessionTest, TestSetRemoteOfferTwice) {
Init(); Init(NULL);
mediastream_signaling_.SendNothing(); mediastream_signaling_.SendNothing();
// SetLocalDescription take ownership of offer. // SetLocalDescription take ownership of offer.
SessionDescriptionInterface* offer = CreateOffer(); SessionDescriptionInterface* offer = CreateOffer();
@ -1764,7 +1751,7 @@ TEST_F(WebRtcSessionTest, TestSetRemoteOfferTwice) {
} }
TEST_F(WebRtcSessionTest, TestSetLocalAndRemoteOffer) { TEST_F(WebRtcSessionTest, TestSetLocalAndRemoteOffer) {
Init(); Init(NULL);
mediastream_signaling_.SendNothing(); mediastream_signaling_.SendNothing();
SessionDescriptionInterface* offer = CreateOffer(); SessionDescriptionInterface* offer = CreateOffer();
SetLocalDescriptionWithoutError(offer); SetLocalDescriptionWithoutError(offer);
@ -1774,7 +1761,7 @@ TEST_F(WebRtcSessionTest, TestSetLocalAndRemoteOffer) {
} }
TEST_F(WebRtcSessionTest, TestSetRemoteAndLocalOffer) { TEST_F(WebRtcSessionTest, TestSetRemoteAndLocalOffer) {
Init(); Init(NULL);
mediastream_signaling_.SendNothing(); mediastream_signaling_.SendNothing();
SessionDescriptionInterface* offer = CreateOffer(); SessionDescriptionInterface* offer = CreateOffer();
SetRemoteDescriptionWithoutError(offer); SetRemoteDescriptionWithoutError(offer);
@ -1784,7 +1771,7 @@ TEST_F(WebRtcSessionTest, TestSetRemoteAndLocalOffer) {
} }
TEST_F(WebRtcSessionTest, TestSetLocalPrAnswer) { TEST_F(WebRtcSessionTest, TestSetLocalPrAnswer) {
Init(); Init(NULL);
mediastream_signaling_.SendNothing(); mediastream_signaling_.SendNothing();
SessionDescriptionInterface* offer = CreateRemoteOffer(); SessionDescriptionInterface* offer = CreateRemoteOffer();
SetRemoteDescriptionExpectState(offer, BaseSession::STATE_RECEIVEDINITIATE); SetRemoteDescriptionExpectState(offer, BaseSession::STATE_RECEIVEDINITIATE);
@ -1807,7 +1794,7 @@ TEST_F(WebRtcSessionTest, TestSetLocalPrAnswer) {
} }
TEST_F(WebRtcSessionTest, TestSetRemotePrAnswer) { TEST_F(WebRtcSessionTest, TestSetRemotePrAnswer) {
Init(); Init(NULL);
mediastream_signaling_.SendNothing(); mediastream_signaling_.SendNothing();
SessionDescriptionInterface* offer = CreateOffer(); SessionDescriptionInterface* offer = CreateOffer();
SetLocalDescriptionExpectState(offer, BaseSession::STATE_SENTINITIATE); SetLocalDescriptionExpectState(offer, BaseSession::STATE_SENTINITIATE);
@ -1834,7 +1821,7 @@ TEST_F(WebRtcSessionTest, TestSetRemotePrAnswer) {
} }
TEST_F(WebRtcSessionTest, TestSetLocalAnswerWithoutOffer) { TEST_F(WebRtcSessionTest, TestSetLocalAnswerWithoutOffer) {
Init(); Init(NULL);
mediastream_signaling_.SendNothing(); mediastream_signaling_.SendNothing();
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
@ -1845,7 +1832,7 @@ TEST_F(WebRtcSessionTest, TestSetLocalAnswerWithoutOffer) {
} }
TEST_F(WebRtcSessionTest, TestSetRemoteAnswerWithoutOffer) { TEST_F(WebRtcSessionTest, TestSetRemoteAnswerWithoutOffer) {
Init(); Init(NULL);
mediastream_signaling_.SendNothing(); mediastream_signaling_.SendNothing();
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
@ -1856,7 +1843,7 @@ TEST_F(WebRtcSessionTest, TestSetRemoteAnswerWithoutOffer) {
} }
TEST_F(WebRtcSessionTest, TestAddRemoteCandidate) { TEST_F(WebRtcSessionTest, TestAddRemoteCandidate) {
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
cricket::Candidate candidate; cricket::Candidate candidate;
@ -1905,7 +1892,7 @@ TEST_F(WebRtcSessionTest, TestAddRemoteCandidate) {
// Test that a remote candidate is added to the remote session description and // Test that a remote candidate is added to the remote session description and
// that it is retained if the remote session description is changed. // that it is retained if the remote session description is changed.
TEST_F(WebRtcSessionTest, TestRemoteCandidatesAddedToSessionDescription) { TEST_F(WebRtcSessionTest, TestRemoteCandidatesAddedToSessionDescription) {
Init(); Init(NULL);
cricket::Candidate candidate1; cricket::Candidate candidate1;
candidate1.set_component(1); candidate1.set_component(1);
JsepIceCandidate ice_candidate1(kMediaContentName0, kMediaContentIndex0, JsepIceCandidate ice_candidate1(kMediaContentName0, kMediaContentIndex0,
@ -1958,7 +1945,7 @@ TEST_F(WebRtcSessionTest, TestRemoteCandidatesAddedToSessionDescription) {
// that they are retained if the local session description is changed. // that they are retained if the local session description is changed.
TEST_F(WebRtcSessionTest, TestLocalCandidatesAddedToSessionDescription) { TEST_F(WebRtcSessionTest, TestLocalCandidatesAddedToSessionDescription) {
AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
CreateAndSetRemoteOfferAndLocalAnswer(); CreateAndSetRemoteOfferAndLocalAnswer();
@ -1993,7 +1980,7 @@ TEST_F(WebRtcSessionTest, TestLocalCandidatesAddedToSessionDescription) {
// Test that we can set a remote session description with remote candidates. // Test that we can set a remote session description with remote candidates.
TEST_F(WebRtcSessionTest, TestSetRemoteSessionDescriptionWithCandidates) { TEST_F(WebRtcSessionTest, TestSetRemoteSessionDescriptionWithCandidates) {
Init(); Init(NULL);
cricket::Candidate candidate1; cricket::Candidate candidate1;
candidate1.set_component(1); candidate1.set_component(1);
@ -2022,7 +2009,7 @@ TEST_F(WebRtcSessionTest, TestSetRemoteSessionDescriptionWithCandidates) {
// been gathered. // been gathered.
TEST_F(WebRtcSessionTest, TestSetLocalAndRemoteDescriptionWithCandidates) { TEST_F(WebRtcSessionTest, TestSetLocalAndRemoteDescriptionWithCandidates) {
AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
// Ice is started but candidates are not provided until SetLocalDescription // Ice is started but candidates are not provided until SetLocalDescription
// is called. // is called.
@ -2055,7 +2042,7 @@ TEST_F(WebRtcSessionTest, TestSetLocalAndRemoteDescriptionWithCandidates) {
// Verifies TransportProxy and media channels are created with content names // Verifies TransportProxy and media channels are created with content names
// present in the SessionDescription. // present in the SessionDescription.
TEST_F(WebRtcSessionTest, TestChannelCreationsWithContentNames) { TEST_F(WebRtcSessionTest, TestChannelCreationsWithContentNames) {
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
@ -2099,7 +2086,7 @@ TEST_F(WebRtcSessionTest, TestChannelCreationsWithContentNames) {
// Test that an offer contains the correct media content descriptions based on // Test that an offer contains the correct media content descriptions based on
// the send streams when no constraints have been set. // the send streams when no constraints have been set.
TEST_F(WebRtcSessionTest, CreateOfferWithoutConstraintsOrStreams) { TEST_F(WebRtcSessionTest, CreateOfferWithoutConstraintsOrStreams) {
Init(); Init(NULL);
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
ASSERT_TRUE(offer != NULL); ASSERT_TRUE(offer != NULL);
@ -2113,7 +2100,7 @@ TEST_F(WebRtcSessionTest, CreateOfferWithoutConstraintsOrStreams) {
// Test that an offer contains the correct media content descriptions based on // Test that an offer contains the correct media content descriptions based on
// the send streams when no constraints have been set. // the send streams when no constraints have been set.
TEST_F(WebRtcSessionTest, CreateOfferWithoutConstraints) { TEST_F(WebRtcSessionTest, CreateOfferWithoutConstraints) {
Init(); Init(NULL);
// Test Audio only offer. // Test Audio only offer.
mediastream_signaling_.UseOptionsAudioOnly(); mediastream_signaling_.UseOptionsAudioOnly();
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
@ -2136,7 +2123,7 @@ TEST_F(WebRtcSessionTest, CreateOfferWithoutConstraints) {
// Test that an offer contains no media content descriptions if // Test that an offer contains no media content descriptions if
// kOfferToReceiveVideo and kOfferToReceiveAudio constraints are set to false. // kOfferToReceiveVideo and kOfferToReceiveAudio constraints are set to false.
TEST_F(WebRtcSessionTest, CreateOfferWithConstraintsWithoutStreams) { TEST_F(WebRtcSessionTest, CreateOfferWithConstraintsWithoutStreams) {
Init(); Init(NULL);
PeerConnectionInterface::RTCOfferAnswerOptions options; PeerConnectionInterface::RTCOfferAnswerOptions options;
options.offer_to_receive_audio = 0; options.offer_to_receive_audio = 0;
options.offer_to_receive_video = 0; options.offer_to_receive_video = 0;
@ -2155,7 +2142,7 @@ TEST_F(WebRtcSessionTest, CreateOfferWithConstraintsWithoutStreams) {
// Test that an offer contains only audio media content descriptions if // Test that an offer contains only audio media content descriptions if
// kOfferToReceiveAudio constraints are set to true. // kOfferToReceiveAudio constraints are set to true.
TEST_F(WebRtcSessionTest, CreateAudioOnlyOfferWithConstraints) { TEST_F(WebRtcSessionTest, CreateAudioOnlyOfferWithConstraints) {
Init(); Init(NULL);
PeerConnectionInterface::RTCOfferAnswerOptions options; PeerConnectionInterface::RTCOfferAnswerOptions options;
options.offer_to_receive_audio = options.offer_to_receive_audio =
RTCOfferAnswerOptions::kOfferToReceiveMediaTrue; RTCOfferAnswerOptions::kOfferToReceiveMediaTrue;
@ -2173,7 +2160,7 @@ TEST_F(WebRtcSessionTest, CreateAudioOnlyOfferWithConstraints) {
// Test that an offer contains audio and video media content descriptions if // Test that an offer contains audio and video media content descriptions if
// kOfferToReceiveAudio and kOfferToReceiveVideo constraints are set to true. // kOfferToReceiveAudio and kOfferToReceiveVideo constraints are set to true.
TEST_F(WebRtcSessionTest, CreateOfferWithConstraints) { TEST_F(WebRtcSessionTest, CreateOfferWithConstraints) {
Init(); Init(NULL);
// Test Audio / Video offer. // Test Audio / Video offer.
PeerConnectionInterface::RTCOfferAnswerOptions options; PeerConnectionInterface::RTCOfferAnswerOptions options;
options.offer_to_receive_audio = options.offer_to_receive_audio =
@ -2206,7 +2193,7 @@ TEST_F(WebRtcSessionTest, CreateOfferWithConstraints) {
// Test that an answer can not be created if the last remote description is not // Test that an answer can not be created if the last remote description is not
// an offer. // an offer.
TEST_F(WebRtcSessionTest, CreateAnswerWithoutAnOffer) { TEST_F(WebRtcSessionTest, CreateAnswerWithoutAnOffer) {
Init(); Init(NULL);
SessionDescriptionInterface* offer = CreateOffer(); SessionDescriptionInterface* offer = CreateOffer();
SetLocalDescriptionWithoutError(offer); SetLocalDescriptionWithoutError(offer);
SessionDescriptionInterface* answer = CreateRemoteAnswer(offer); SessionDescriptionInterface* answer = CreateRemoteAnswer(offer);
@ -2217,7 +2204,7 @@ TEST_F(WebRtcSessionTest, CreateAnswerWithoutAnOffer) {
// Test that an answer contains the correct media content descriptions when no // Test that an answer contains the correct media content descriptions when no
// constraints have been set. // constraints have been set.
TEST_F(WebRtcSessionTest, CreateAnswerWithoutConstraintsOrStreams) { TEST_F(WebRtcSessionTest, CreateAnswerWithoutConstraintsOrStreams) {
Init(); Init(NULL);
// Create a remote offer with audio and video content. // Create a remote offer with audio and video content.
rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer()); rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
SetRemoteDescriptionWithoutError(offer.release()); SetRemoteDescriptionWithoutError(offer.release());
@ -2236,7 +2223,7 @@ TEST_F(WebRtcSessionTest, CreateAnswerWithoutConstraintsOrStreams) {
// Test that an answer contains the correct media content descriptions when no // Test that an answer contains the correct media content descriptions when no
// constraints have been set and the offer only contain audio. // constraints have been set and the offer only contain audio.
TEST_F(WebRtcSessionTest, CreateAudioAnswerWithoutConstraintsOrStreams) { TEST_F(WebRtcSessionTest, CreateAudioAnswerWithoutConstraintsOrStreams) {
Init(); Init(NULL);
// Create a remote offer with audio only. // Create a remote offer with audio only.
cricket::MediaSessionOptions options; cricket::MediaSessionOptions options;
@ -2259,7 +2246,7 @@ TEST_F(WebRtcSessionTest, CreateAudioAnswerWithoutConstraintsOrStreams) {
// Test that an answer contains the correct media content descriptions when no // Test that an answer contains the correct media content descriptions when no
// constraints have been set. // constraints have been set.
TEST_F(WebRtcSessionTest, CreateAnswerWithoutConstraints) { TEST_F(WebRtcSessionTest, CreateAnswerWithoutConstraints) {
Init(); Init(NULL);
// Create a remote offer with audio and video content. // Create a remote offer with audio and video content.
rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer()); rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
SetRemoteDescriptionWithoutError(offer.release()); SetRemoteDescriptionWithoutError(offer.release());
@ -2280,7 +2267,7 @@ TEST_F(WebRtcSessionTest, CreateAnswerWithoutConstraints) {
// Test that an answer contains the correct media content descriptions when // Test that an answer contains the correct media content descriptions when
// constraints have been set but no stream is sent. // constraints have been set but no stream is sent.
TEST_F(WebRtcSessionTest, CreateAnswerWithConstraintsWithoutStreams) { TEST_F(WebRtcSessionTest, CreateAnswerWithConstraintsWithoutStreams) {
Init(); Init(NULL);
// Create a remote offer with audio and video content. // Create a remote offer with audio and video content.
rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer()); rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
SetRemoteDescriptionWithoutError(offer.release()); SetRemoteDescriptionWithoutError(offer.release());
@ -2304,7 +2291,7 @@ TEST_F(WebRtcSessionTest, CreateAnswerWithConstraintsWithoutStreams) {
// Test that an answer contains the correct media content descriptions when // Test that an answer contains the correct media content descriptions when
// constraints have been set and streams are sent. // constraints have been set and streams are sent.
TEST_F(WebRtcSessionTest, CreateAnswerWithConstraints) { TEST_F(WebRtcSessionTest, CreateAnswerWithConstraints) {
Init(); Init(NULL);
// Create a remote offer with audio and video content. // Create a remote offer with audio and video content.
rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer()); rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
SetRemoteDescriptionWithoutError(offer.release()); SetRemoteDescriptionWithoutError(offer.release());
@ -2332,7 +2319,7 @@ TEST_F(WebRtcSessionTest, CreateAnswerWithConstraints) {
TEST_F(WebRtcSessionTest, CreateOfferWithoutCNCodecs) { TEST_F(WebRtcSessionTest, CreateOfferWithoutCNCodecs) {
AddCNCodecs(); AddCNCodecs();
Init(); Init(NULL);
PeerConnectionInterface::RTCOfferAnswerOptions options; PeerConnectionInterface::RTCOfferAnswerOptions options;
options.offer_to_receive_audio = options.offer_to_receive_audio =
RTCOfferAnswerOptions::kOfferToReceiveMediaTrue; RTCOfferAnswerOptions::kOfferToReceiveMediaTrue;
@ -2349,7 +2336,7 @@ TEST_F(WebRtcSessionTest, CreateOfferWithoutCNCodecs) {
TEST_F(WebRtcSessionTest, CreateAnswerWithoutCNCodecs) { TEST_F(WebRtcSessionTest, CreateAnswerWithoutCNCodecs) {
AddCNCodecs(); AddCNCodecs();
Init(); Init(NULL);
// Create a remote offer with audio and video content. // Create a remote offer with audio and video content.
rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer()); rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
SetRemoteDescriptionWithoutError(offer.release()); SetRemoteDescriptionWithoutError(offer.release());
@ -2367,7 +2354,7 @@ TEST_F(WebRtcSessionTest, CreateAnswerWithoutCNCodecs) {
// This test verifies the call setup when remote answer with audio only and // This test verifies the call setup when remote answer with audio only and
// later updates with video. // later updates with video.
TEST_F(WebRtcSessionTest, TestAVOfferWithAudioOnlyAnswer) { TEST_F(WebRtcSessionTest, TestAVOfferWithAudioOnlyAnswer) {
Init(); Init(NULL);
EXPECT_TRUE(media_engine_->GetVideoChannel(0) == NULL); EXPECT_TRUE(media_engine_->GetVideoChannel(0) == NULL);
EXPECT_TRUE(media_engine_->GetVoiceChannel(0) == NULL); EXPECT_TRUE(media_engine_->GetVoiceChannel(0) == NULL);
@ -2424,7 +2411,7 @@ TEST_F(WebRtcSessionTest, TestAVOfferWithAudioOnlyAnswer) {
// This test verifies the call setup when remote answer with video only and // This test verifies the call setup when remote answer with video only and
// later updates with audio. // later updates with audio.
TEST_F(WebRtcSessionTest, TestAVOfferWithVideoOnlyAnswer) { TEST_F(WebRtcSessionTest, TestAVOfferWithVideoOnlyAnswer) {
Init(); Init(NULL);
EXPECT_TRUE(media_engine_->GetVideoChannel(0) == NULL); EXPECT_TRUE(media_engine_->GetVideoChannel(0) == NULL);
EXPECT_TRUE(media_engine_->GetVoiceChannel(0) == NULL); EXPECT_TRUE(media_engine_->GetVoiceChannel(0) == NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
@ -2477,7 +2464,7 @@ TEST_F(WebRtcSessionTest, TestAVOfferWithVideoOnlyAnswer) {
} }
TEST_F(WebRtcSessionTest, VerifyCryptoParamsInSDP) { TEST_F(WebRtcSessionTest, VerifyCryptoParamsInSDP) {
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
VerifyCryptoParams(offer->description()); VerifyCryptoParams(offer->description());
@ -2488,26 +2475,26 @@ TEST_F(WebRtcSessionTest, VerifyCryptoParamsInSDP) {
TEST_F(WebRtcSessionTest, VerifyNoCryptoParamsInSDP) { TEST_F(WebRtcSessionTest, VerifyNoCryptoParamsInSDP) {
options_.disable_encryption = true; options_.disable_encryption = true;
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
VerifyNoCryptoParams(offer->description(), false); VerifyNoCryptoParams(offer->description(), false);
} }
TEST_F(WebRtcSessionTest, VerifyAnswerFromNonCryptoOffer) { TEST_F(WebRtcSessionTest, VerifyAnswerFromNonCryptoOffer) {
Init(); Init(NULL);
VerifyAnswerFromNonCryptoOffer(); VerifyAnswerFromNonCryptoOffer();
} }
TEST_F(WebRtcSessionTest, VerifyAnswerFromCryptoOffer) { TEST_F(WebRtcSessionTest, VerifyAnswerFromCryptoOffer) {
Init(); Init(NULL);
VerifyAnswerFromCryptoOffer(); VerifyAnswerFromCryptoOffer();
} }
// This test verifies that setLocalDescription fails if // This test verifies that setLocalDescription fails if
// no a=ice-ufrag and a=ice-pwd lines are present in the SDP. // no a=ice-ufrag and a=ice-pwd lines are present in the SDP.
TEST_F(WebRtcSessionTest, TestSetLocalDescriptionWithoutIce) { TEST_F(WebRtcSessionTest, TestSetLocalDescriptionWithoutIce) {
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
@ -2521,7 +2508,7 @@ TEST_F(WebRtcSessionTest, TestSetLocalDescriptionWithoutIce) {
// This test verifies that setRemoteDescription fails if // This test verifies that setRemoteDescription fails if
// no a=ice-ufrag and a=ice-pwd lines are present in the SDP. // no a=ice-ufrag and a=ice-pwd lines are present in the SDP.
TEST_F(WebRtcSessionTest, TestSetRemoteDescriptionWithoutIce) { TEST_F(WebRtcSessionTest, TestSetRemoteDescriptionWithoutIce) {
Init(); Init(NULL);
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer()); rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer());
std::string sdp; std::string sdp;
RemoveIceUfragPwdLines(offer.get(), &sdp); RemoveIceUfragPwdLines(offer.get(), &sdp);
@ -2533,7 +2520,7 @@ TEST_F(WebRtcSessionTest, TestSetRemoteDescriptionWithoutIce) {
// This test verifies that setLocalDescription fails if local offer has // This test verifies that setLocalDescription fails if local offer has
// too short ice ufrag and pwd strings. // too short ice ufrag and pwd strings.
TEST_F(WebRtcSessionTest, TestSetLocalDescriptionInvalidIceCredentials) { TEST_F(WebRtcSessionTest, TestSetLocalDescriptionInvalidIceCredentials) {
Init(); Init(NULL);
tdesc_factory_->set_protocol(cricket::ICEPROTO_RFC5245); tdesc_factory_->set_protocol(cricket::ICEPROTO_RFC5245);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
@ -2559,7 +2546,7 @@ TEST_F(WebRtcSessionTest, TestSetLocalDescriptionInvalidIceCredentials) {
// This test verifies that setRemoteDescription fails if remote offer has // This test verifies that setRemoteDescription fails if remote offer has
// too short ice ufrag and pwd strings. // too short ice ufrag and pwd strings.
TEST_F(WebRtcSessionTest, TestSetRemoteDescriptionInvalidIceCredentials) { TEST_F(WebRtcSessionTest, TestSetRemoteDescriptionInvalidIceCredentials) {
Init(); Init(NULL);
tdesc_factory_->set_protocol(cricket::ICEPROTO_RFC5245); tdesc_factory_->set_protocol(cricket::ICEPROTO_RFC5245);
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer()); rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer());
std::string sdp; std::string sdp;
@ -2583,7 +2570,7 @@ TEST_F(WebRtcSessionTest, VerifyBundleFlagInPA) {
// This test verifies BUNDLE flag in PortAllocator, if BUNDLE information in // This test verifies BUNDLE flag in PortAllocator, if BUNDLE information in
// local description is removed by the application, BUNDLE flag should be // local description is removed by the application, BUNDLE flag should be
// disabled in PortAllocator. By default BUNDLE is enabled in the WebRtc. // disabled in PortAllocator. By default BUNDLE is enabled in the WebRtc.
Init(); Init(NULL);
EXPECT_TRUE((cricket::PORTALLOCATOR_ENABLE_BUNDLE & EXPECT_TRUE((cricket::PORTALLOCATOR_ENABLE_BUNDLE &
allocator_->flags()) == cricket::PORTALLOCATOR_ENABLE_BUNDLE); allocator_->flags()) == cricket::PORTALLOCATOR_ENABLE_BUNDLE);
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
@ -2600,7 +2587,7 @@ TEST_F(WebRtcSessionTest, VerifyBundleFlagInPA) {
} }
TEST_F(WebRtcSessionTest, TestDisabledBundleInAnswer) { TEST_F(WebRtcSessionTest, TestDisabledBundleInAnswer) {
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
EXPECT_TRUE((cricket::PORTALLOCATOR_ENABLE_BUNDLE & EXPECT_TRUE((cricket::PORTALLOCATOR_ENABLE_BUNDLE &
allocator_->flags()) == cricket::PORTALLOCATOR_ENABLE_BUNDLE); allocator_->flags()) == cricket::PORTALLOCATOR_ENABLE_BUNDLE);
@ -2641,7 +2628,7 @@ TEST_F(WebRtcSessionTest, TestDisabledBundleInAnswer) {
// This test verifies that SetLocalDescription and SetRemoteDescription fails // This test verifies that SetLocalDescription and SetRemoteDescription fails
// if BUNDLE is enabled but rtcp-mux is disabled in m-lines. // if BUNDLE is enabled but rtcp-mux is disabled in m-lines.
TEST_F(WebRtcSessionTest, TestDisabledRtcpMuxWithBundleEnabled) { TEST_F(WebRtcSessionTest, TestDisabledRtcpMuxWithBundleEnabled) {
Init(); WebRtcSessionTest::Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
EXPECT_TRUE((cricket::PORTALLOCATOR_ENABLE_BUNDLE & EXPECT_TRUE((cricket::PORTALLOCATOR_ENABLE_BUNDLE &
allocator_->flags()) == cricket::PORTALLOCATOR_ENABLE_BUNDLE); allocator_->flags()) == cricket::PORTALLOCATOR_ENABLE_BUNDLE);
@ -2671,7 +2658,7 @@ TEST_F(WebRtcSessionTest, TestDisabledRtcpMuxWithBundleEnabled) {
} }
TEST_F(WebRtcSessionTest, SetAudioPlayout) { TEST_F(WebRtcSessionTest, SetAudioPlayout) {
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
CreateAndSetRemoteOfferAndLocalAnswer(); CreateAndSetRemoteOfferAndLocalAnswer();
cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0); cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0);
@ -2696,7 +2683,7 @@ TEST_F(WebRtcSessionTest, SetAudioPlayout) {
} }
TEST_F(WebRtcSessionTest, SetAudioSend) { TEST_F(WebRtcSessionTest, SetAudioSend) {
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
CreateAndSetRemoteOfferAndLocalAnswer(); CreateAndSetRemoteOfferAndLocalAnswer();
cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0); cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0);
@ -2726,7 +2713,7 @@ TEST_F(WebRtcSessionTest, SetAudioSend) {
} }
TEST_F(WebRtcSessionTest, AudioRendererForLocalStream) { TEST_F(WebRtcSessionTest, AudioRendererForLocalStream) {
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
CreateAndSetRemoteOfferAndLocalAnswer(); CreateAndSetRemoteOfferAndLocalAnswer();
cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0); cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0);
@ -2749,7 +2736,7 @@ TEST_F(WebRtcSessionTest, AudioRendererForLocalStream) {
} }
TEST_F(WebRtcSessionTest, SetVideoPlayout) { TEST_F(WebRtcSessionTest, SetVideoPlayout) {
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
CreateAndSetRemoteOfferAndLocalAnswer(); CreateAndSetRemoteOfferAndLocalAnswer();
cricket::FakeVideoMediaChannel* channel = media_engine_->GetVideoChannel(0); cricket::FakeVideoMediaChannel* channel = media_engine_->GetVideoChannel(0);
@ -2766,7 +2753,7 @@ TEST_F(WebRtcSessionTest, SetVideoPlayout) {
} }
TEST_F(WebRtcSessionTest, SetVideoSend) { TEST_F(WebRtcSessionTest, SetVideoSend) {
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
CreateAndSetRemoteOfferAndLocalAnswer(); CreateAndSetRemoteOfferAndLocalAnswer();
cricket::FakeVideoMediaChannel* channel = media_engine_->GetVideoChannel(0); cricket::FakeVideoMediaChannel* channel = media_engine_->GetVideoChannel(0);
@ -2791,7 +2778,7 @@ TEST_F(WebRtcSessionTest, CanInsertDtmf) {
TEST_F(WebRtcSessionTest, InsertDtmf) { TEST_F(WebRtcSessionTest, InsertDtmf) {
// Setup // Setup
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
CreateAndSetRemoteOfferAndLocalAnswer(); CreateAndSetRemoteOfferAndLocalAnswer();
FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0); FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0);
@ -2817,7 +2804,7 @@ TEST_F(WebRtcSessionTest, InsertDtmf) {
// This test verifies the |initiator| flag when session initiates the call. // This test verifies the |initiator| flag when session initiates the call.
TEST_F(WebRtcSessionTest, TestInitiatorFlagAsOriginator) { TEST_F(WebRtcSessionTest, TestInitiatorFlagAsOriginator) {
Init(); Init(NULL);
EXPECT_FALSE(session_->initiator()); EXPECT_FALSE(session_->initiator());
SessionDescriptionInterface* offer = CreateOffer(); SessionDescriptionInterface* offer = CreateOffer();
SessionDescriptionInterface* answer = CreateRemoteAnswer(offer); SessionDescriptionInterface* answer = CreateRemoteAnswer(offer);
@ -2829,7 +2816,7 @@ TEST_F(WebRtcSessionTest, TestInitiatorFlagAsOriginator) {
// This test verifies the |initiator| flag when session receives the call. // This test verifies the |initiator| flag when session receives the call.
TEST_F(WebRtcSessionTest, TestInitiatorFlagAsReceiver) { TEST_F(WebRtcSessionTest, TestInitiatorFlagAsReceiver) {
Init(); Init(NULL);
EXPECT_FALSE(session_->initiator()); EXPECT_FALSE(session_->initiator());
SessionDescriptionInterface* offer = CreateRemoteOffer(); SessionDescriptionInterface* offer = CreateRemoteOffer();
SetRemoteDescriptionWithoutError(offer); SetRemoteDescriptionWithoutError(offer);
@ -2843,7 +2830,7 @@ TEST_F(WebRtcSessionTest, TestInitiatorFlagAsReceiver) {
// This test verifies the ice protocol type at initiator of the call // This test verifies the ice protocol type at initiator of the call
// if |a=ice-options:google-ice| is present in answer. // if |a=ice-options:google-ice| is present in answer.
TEST_F(WebRtcSessionTest, TestInitiatorGIceInAnswer) { TEST_F(WebRtcSessionTest, TestInitiatorGIceInAnswer) {
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
SessionDescriptionInterface* offer = CreateOffer(); SessionDescriptionInterface* offer = CreateOffer();
rtc::scoped_ptr<SessionDescriptionInterface> answer( rtc::scoped_ptr<SessionDescriptionInterface> answer(
@ -2865,7 +2852,7 @@ TEST_F(WebRtcSessionTest, TestInitiatorGIceInAnswer) {
// This test verifies the ice protocol type at initiator of the call // This test verifies the ice protocol type at initiator of the call
// if ICE RFC5245 is supported in answer. // if ICE RFC5245 is supported in answer.
TEST_F(WebRtcSessionTest, TestInitiatorIceInAnswer) { TEST_F(WebRtcSessionTest, TestInitiatorIceInAnswer) {
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
SessionDescriptionInterface* offer = CreateOffer(); SessionDescriptionInterface* offer = CreateOffer();
SessionDescriptionInterface* answer = CreateRemoteAnswer(offer); SessionDescriptionInterface* answer = CreateRemoteAnswer(offer);
@ -2879,7 +2866,7 @@ TEST_F(WebRtcSessionTest, TestInitiatorIceInAnswer) {
// This test verifies the ice protocol type at receiver side of the call if // This test verifies the ice protocol type at receiver side of the call if
// receiver decides to use google-ice. // receiver decides to use google-ice.
TEST_F(WebRtcSessionTest, TestReceiverGIceInOffer) { TEST_F(WebRtcSessionTest, TestReceiverGIceInOffer) {
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
SessionDescriptionInterface* offer = CreateOffer(); SessionDescriptionInterface* offer = CreateOffer();
SetRemoteDescriptionWithoutError(offer); SetRemoteDescriptionWithoutError(offer);
@ -2901,7 +2888,7 @@ TEST_F(WebRtcSessionTest, TestReceiverGIceInOffer) {
// This test verifies the ice protocol type at receiver side of the call if // This test verifies the ice protocol type at receiver side of the call if
// receiver decides to use ice RFC 5245. // receiver decides to use ice RFC 5245.
TEST_F(WebRtcSessionTest, TestReceiverIceInOffer) { TEST_F(WebRtcSessionTest, TestReceiverIceInOffer) {
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
SessionDescriptionInterface* offer = CreateOffer(); SessionDescriptionInterface* offer = CreateOffer();
SetRemoteDescriptionWithoutError(offer); SetRemoteDescriptionWithoutError(offer);
@ -2914,7 +2901,7 @@ TEST_F(WebRtcSessionTest, TestReceiverIceInOffer) {
// This test verifies the session state when ICE RFC5245 in offer and // This test verifies the session state when ICE RFC5245 in offer and
// ICE google-ice in answer. // ICE google-ice in answer.
TEST_F(WebRtcSessionTest, TestIceOfferGIceOnlyAnswer) { TEST_F(WebRtcSessionTest, TestIceOfferGIceOnlyAnswer) {
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
@ -2946,7 +2933,7 @@ TEST_F(WebRtcSessionTest, TestIceOfferGIceOnlyAnswer) {
// Verifing local offer and remote answer have matching m-lines as per RFC 3264. // Verifing local offer and remote answer have matching m-lines as per RFC 3264.
TEST_F(WebRtcSessionTest, TestIncorrectMLinesInRemoteAnswer) { TEST_F(WebRtcSessionTest, TestIncorrectMLinesInRemoteAnswer) {
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
SessionDescriptionInterface* offer = CreateOffer(); SessionDescriptionInterface* offer = CreateOffer();
SetLocalDescriptionWithoutError(offer); SetLocalDescriptionWithoutError(offer);
@ -2994,7 +2981,7 @@ TEST_F(WebRtcSessionTest, TestIncorrectMLinesInRemoteAnswer) {
// Verifying remote offer and local answer have matching m-lines as per // Verifying remote offer and local answer have matching m-lines as per
// RFC 3264. // RFC 3264.
TEST_F(WebRtcSessionTest, TestIncorrectMLinesInLocalAnswer) { TEST_F(WebRtcSessionTest, TestIncorrectMLinesInLocalAnswer) {
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
SessionDescriptionInterface* offer = CreateRemoteOffer(); SessionDescriptionInterface* offer = CreateRemoteOffer();
SetRemoteDescriptionWithoutError(offer); SetRemoteDescriptionWithoutError(offer);
@ -3015,7 +3002,7 @@ TEST_F(WebRtcSessionTest, TestIncorrectMLinesInLocalAnswer) {
// This test verifies that WebRtcSession does not start candidate allocation // This test verifies that WebRtcSession does not start candidate allocation
// before SetLocalDescription is called. // before SetLocalDescription is called.
TEST_F(WebRtcSessionTest, TestIceStartAfterSetLocalDescriptionOnly) { TEST_F(WebRtcSessionTest, TestIceStartAfterSetLocalDescriptionOnly) {
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
SessionDescriptionInterface* offer = CreateRemoteOffer(); SessionDescriptionInterface* offer = CreateRemoteOffer();
cricket::Candidate candidate; cricket::Candidate candidate;
@ -3047,7 +3034,7 @@ TEST_F(WebRtcSessionTest, TestIceStartAfterSetLocalDescriptionOnly) {
// This test verifies that crypto parameter is updated in local session // This test verifies that crypto parameter is updated in local session
// description as per security policy set in MediaSessionDescriptionFactory. // description as per security policy set in MediaSessionDescriptionFactory.
TEST_F(WebRtcSessionTest, TestCryptoAfterSetLocalDescription) { TEST_F(WebRtcSessionTest, TestCryptoAfterSetLocalDescription) {
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
@ -3066,7 +3053,7 @@ TEST_F(WebRtcSessionTest, TestCryptoAfterSetLocalDescription) {
// This test verifies the crypto parameter when security is disabled. // This test verifies the crypto parameter when security is disabled.
TEST_F(WebRtcSessionTest, TestCryptoAfterSetLocalDescriptionWithDisabled) { TEST_F(WebRtcSessionTest, TestCryptoAfterSetLocalDescriptionWithDisabled) {
options_.disable_encryption = true; options_.disable_encryption = true;
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
@ -3085,7 +3072,7 @@ TEST_F(WebRtcSessionTest, TestCryptoAfterSetLocalDescriptionWithDisabled) {
// This test verifies that an answer contains new ufrag and password if an offer // This test verifies that an answer contains new ufrag and password if an offer
// with new ufrag and password is received. // with new ufrag and password is received.
TEST_F(WebRtcSessionTest, TestCreateAnswerWithNewUfragAndPassword) { TEST_F(WebRtcSessionTest, TestCreateAnswerWithNewUfragAndPassword) {
Init(); Init(NULL);
cricket::MediaSessionOptions options; cricket::MediaSessionOptions options;
options.recv_video = true; options.recv_video = true;
rtc::scoped_ptr<JsepSessionDescription> offer( rtc::scoped_ptr<JsepSessionDescription> offer(
@ -3116,7 +3103,7 @@ TEST_F(WebRtcSessionTest, TestCreateAnswerWithNewUfragAndPassword) {
// This test verifies that an answer contains old ufrag and password if an offer // This test verifies that an answer contains old ufrag and password if an offer
// with old ufrag and password is received. // with old ufrag and password is received.
TEST_F(WebRtcSessionTest, TestCreateAnswerWithOldUfragAndPassword) { TEST_F(WebRtcSessionTest, TestCreateAnswerWithOldUfragAndPassword) {
Init(); Init(NULL);
cricket::MediaSessionOptions options; cricket::MediaSessionOptions options;
options.recv_video = true; options.recv_video = true;
rtc::scoped_ptr<JsepSessionDescription> offer( rtc::scoped_ptr<JsepSessionDescription> offer(
@ -3145,7 +3132,7 @@ TEST_F(WebRtcSessionTest, TestCreateAnswerWithOldUfragAndPassword) {
} }
TEST_F(WebRtcSessionTest, TestSessionContentError) { TEST_F(WebRtcSessionTest, TestSessionContentError) {
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
SessionDescriptionInterface* offer = CreateOffer(); SessionDescriptionInterface* offer = CreateOffer();
const std::string session_id_orig = offer->session_id(); const std::string session_id_orig = offer->session_id();
@ -3197,7 +3184,7 @@ TEST_F(WebRtcSessionTest, TestIceStatesBundle) {
} }
TEST_F(WebRtcSessionTest, SetSdpFailedOnSessionError) { TEST_F(WebRtcSessionTest, SetSdpFailedOnSessionError) {
Init(); Init(NULL);
cricket::MediaSessionOptions options; cricket::MediaSessionOptions options;
options.recv_video = true; options.recv_video = true;
@ -3222,7 +3209,7 @@ TEST_F(WebRtcSessionTest, TestRtpDataChannel) {
constraints_.reset(new FakeConstraints()); constraints_.reset(new FakeConstraints());
constraints_->AddOptional( constraints_->AddOptional(
webrtc::MediaConstraintsInterface::kEnableRtpDataChannels, true); webrtc::MediaConstraintsInterface::kEnableRtpDataChannels, true);
Init(); Init(NULL);
SetLocalDescriptionWithDataChannel(); SetLocalDescriptionWithDataChannel();
EXPECT_EQ(cricket::DCT_RTP, data_engine_->last_channel_type()); EXPECT_EQ(cricket::DCT_RTP, data_engine_->last_channel_type());
@ -3452,7 +3439,7 @@ TEST_F(WebRtcSessionTest,
// offer has no SDES crypto but only DTLS fingerprint. // offer has no SDES crypto but only DTLS fingerprint.
TEST_F(WebRtcSessionTest, TestSetRemoteOfferFailIfDtlsDisabledAndNoCrypto) { TEST_F(WebRtcSessionTest, TestSetRemoteOfferFailIfDtlsDisabledAndNoCrypto) {
// Init without DTLS. // Init without DTLS.
Init(); Init(NULL);
// Create a remote offer with secured transport disabled. // Create a remote offer with secured transport disabled.
cricket::MediaSessionOptions options; cricket::MediaSessionOptions options;
JsepSessionDescription* offer(CreateRemoteOffer( JsepSessionDescription* offer(CreateRemoteOffer(
@ -3474,7 +3461,7 @@ TEST_F(WebRtcSessionTest, TestDscpConstraint) {
constraints_.reset(new FakeConstraints()); constraints_.reset(new FakeConstraints());
constraints_->AddOptional( constraints_->AddOptional(
webrtc::MediaConstraintsInterface::kEnableDscp, true); webrtc::MediaConstraintsInterface::kEnableDscp, true);
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
SessionDescriptionInterface* offer = CreateOffer(); SessionDescriptionInterface* offer = CreateOffer();
@ -3500,7 +3487,7 @@ TEST_F(WebRtcSessionTest, TestSuspendBelowMinBitrateConstraint) {
constraints_->AddOptional( constraints_->AddOptional(
webrtc::MediaConstraintsInterface::kEnableVideoSuspendBelowMinBitrate, webrtc::MediaConstraintsInterface::kEnableVideoSuspendBelowMinBitrate,
true); true);
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
SessionDescriptionInterface* offer = CreateOffer(); SessionDescriptionInterface* offer = CreateOffer();
@ -3529,7 +3516,7 @@ TEST_F(WebRtcSessionTest, TestCombinedAudioVideoBweConstraint) {
constraints_->AddOptional( constraints_->AddOptional(
webrtc::MediaConstraintsInterface::kCombinedAudioVideoBwe, webrtc::MediaConstraintsInterface::kCombinedAudioVideoBwe,
true); true);
Init(); Init(NULL);
mediastream_signaling_.SendAudioVideoStream1(); mediastream_signaling_.SendAudioVideoStream1();
SessionDescriptionInterface* offer = CreateOffer(); SessionDescriptionInterface* offer = CreateOffer();

View File

@ -126,9 +126,6 @@ class DtlsTransportChannelWrapper : public TransportChannelImpl {
virtual int SetOption(rtc::Socket::Option opt, int value) { virtual int SetOption(rtc::Socket::Option opt, int value) {
return channel_->SetOption(opt, value); return channel_->SetOption(opt, value);
} }
virtual bool GetOption(rtc::Socket::Option opt, int* value) {
return channel_->GetOption(opt, value);
}
virtual int GetError() { virtual int GetError() {
return channel_->GetError(); return channel_->GetError();
} }

View File

@ -198,9 +198,6 @@ class FakeTransportChannel : public TransportChannelImpl,
virtual int SetOption(rtc::Socket::Option opt, int value) { virtual int SetOption(rtc::Socket::Option opt, int value) {
return true; return true;
} }
virtual bool GetOption(rtc::Socket::Option opt, int* value) {
return true;
}
virtual int GetError() { virtual int GetError() {
return 0; return 0;
} }

View File

@ -817,7 +817,6 @@ void P2PTransportChannel::RememberRemoteCandidate(
// Set options on ourselves is simply setting options on all of our available // Set options on ourselves is simply setting options on all of our available
// port objects. // port objects.
int P2PTransportChannel::SetOption(rtc::Socket::Option opt, int value) { int P2PTransportChannel::SetOption(rtc::Socket::Option opt, int value) {
ASSERT(worker_thread_ == rtc::Thread::Current());
OptionMap::iterator it = options_.find(opt); OptionMap::iterator it = options_.find(opt);
if (it == options_.end()) { if (it == options_.end()) {
options_.insert(std::make_pair(opt, value)); options_.insert(std::make_pair(opt, value));
@ -839,17 +838,6 @@ int P2PTransportChannel::SetOption(rtc::Socket::Option opt, int value) {
return 0; return 0;
} }
bool P2PTransportChannel::GetOption(rtc::Socket::Option opt, int* value) {
ASSERT(worker_thread_ == rtc::Thread::Current());
const auto& found = options_.find(opt);
if (found == options_.end()) {
return false;
}
*value = found->second;
return true;
}
// Send data to the other side, using our best connection. // Send data to the other side, using our best connection.
int P2PTransportChannel::SendPacket(const char *data, size_t len, int P2PTransportChannel::SendPacket(const char *data, size_t len,
const rtc::PacketOptions& options, const rtc::PacketOptions& options,

View File

@ -79,7 +79,6 @@ class P2PTransportChannel : public TransportChannelImpl,
virtual int SendPacket(const char *data, size_t len, virtual int SendPacket(const char *data, size_t len,
const rtc::PacketOptions& options, int flags); const rtc::PacketOptions& options, int flags);
virtual int SetOption(rtc::Socket::Option opt, int value); virtual int SetOption(rtc::Socket::Option opt, int value);
virtual bool GetOption(rtc::Socket::Option opt, int* value);
virtual int GetError() { return error_; } virtual int GetError() { return error_; }
virtual bool GetStats(std::vector<ConnectionInfo>* stats); virtual bool GetStats(std::vector<ConnectionInfo>* stats);

View File

@ -72,10 +72,6 @@ int RawTransportChannel::SetOption(rtc::Socket::Option opt, int value) {
return port_->SetOption(opt, value); return port_->SetOption(opt, value);
} }
bool RawTransportChannel::GetOption(rtc::Socket::Option opt, int* value) {
return false;
}
int RawTransportChannel::GetError() { int RawTransportChannel::GetError() {
return (port_ != NULL) ? port_->GetError() : 0; return (port_ != NULL) ? port_->GetError() : 0;
} }

View File

@ -50,7 +50,6 @@ class RawTransportChannel : public TransportChannelImpl,
virtual int SendPacket(const char *data, size_t len, virtual int SendPacket(const char *data, size_t len,
const rtc::PacketOptions& options, int flags); const rtc::PacketOptions& options, int flags);
virtual int SetOption(rtc::Socket::Option opt, int value); virtual int SetOption(rtc::Socket::Option opt, int value);
virtual bool GetOption(rtc::Socket::Option opt, int* value);
virtual int GetError(); virtual int GetError();
// Implements TransportChannelImpl. // Implements TransportChannelImpl.

View File

@ -823,11 +823,8 @@ void BaseSession::OnTransportCandidatesAllocationDone(Transport* transport) {
bool BaseSession::IsCandidateAllocationDone() const { bool BaseSession::IsCandidateAllocationDone() const {
for (TransportMap::const_iterator iter = transports_.begin(); for (TransportMap::const_iterator iter = transports_.begin();
iter != transports_.end(); ++iter) { iter != transports_.end(); ++iter) {
if (!iter->second->candidates_allocated()) { if (!iter->second->candidates_allocated())
LOG(LS_INFO) << "Candidate allocation not done for "
<< iter->second->content_name();
return false; return false;
}
} }
return true; return true;
} }

View File

@ -427,8 +427,6 @@ class BaseSession : public sigslot::has_slots<>,
virtual void OnMessage(rtc::Message *pmsg); virtual void OnMessage(rtc::Message *pmsg);
protected: protected:
bool IsCandidateAllocationDone() const;
State state_; State state_;
Error error_; Error error_;
std::string error_desc_; std::string error_desc_;
@ -442,6 +440,7 @@ class BaseSession : public sigslot::has_slots<>,
const SessionDescription* sdesc, ContentAction action, const SessionDescription* sdesc, ContentAction action,
std::string* error_desc); std::string* error_desc);
bool IsCandidateAllocationDone() const;
void MaybeCandidateAllocationDone(); void MaybeCandidateAllocationDone();
// This method will delete the Transport and TransportChannelImpls and // This method will delete the Transport and TransportChannelImpls and

View File

@ -81,7 +81,6 @@ class TransportChannel : public sigslot::has_slots<> {
// Sets a socket option on this channel. Note that not all options are // Sets a socket option on this channel. Note that not all options are
// supported by all transport types. // supported by all transport types.
virtual int SetOption(rtc::Socket::Option opt, int value) = 0; virtual int SetOption(rtc::Socket::Option opt, int value) = 0;
virtual bool GetOption(rtc::Socket::Option opt, int* value) = 0;
// Returns the most recent error that occurred on this channel. // Returns the most recent error that occurred on this channel.
virtual int GetError() = 0; virtual int GetError() = 0;

View File

@ -104,21 +104,6 @@ int TransportChannelProxy::SetOption(rtc::Socket::Option opt, int value) {
return impl_->SetOption(opt, value); return impl_->SetOption(opt, value);
} }
bool TransportChannelProxy::GetOption(rtc::Socket::Option opt, int* value) {
ASSERT(rtc::Thread::Current() == worker_thread_);
if (impl_) {
return impl_->GetOption(opt, value);
}
for (const auto& pending : pending_options_) {
if (pending.first == opt) {
*value = pending.second;
return true;
}
}
return false;
}
int TransportChannelProxy::GetError() { int TransportChannelProxy::GetError() {
ASSERT(rtc::Thread::Current() == worker_thread_); ASSERT(rtc::Thread::Current() == worker_thread_);
if (!impl_) { if (!impl_) {

View File

@ -52,7 +52,6 @@ class TransportChannelProxy : public TransportChannel,
const rtc::PacketOptions& options, const rtc::PacketOptions& options,
int flags); int flags);
virtual int SetOption(rtc::Socket::Option opt, int value); virtual int SetOption(rtc::Socket::Option opt, int value);
virtual bool GetOption(rtc::Socket::Option opt, int* value);
virtual int GetError(); virtual int GetError();
virtual IceRole GetIceRole() const; virtual IceRole GetIceRole() const;
virtual bool GetStats(ConnectionInfos* infos); virtual bool GetStats(ConnectionInfos* infos);