| Index: webrtc/api/peerconnectioninterface_unittest.cc
|
| diff --git a/webrtc/api/peerconnectioninterface_unittest.cc b/webrtc/api/peerconnectioninterface_unittest.cc
|
| index 1a8dd57f08a6565f883c8ba5e73d69996fa1d623..2594b6c10637996c3a554757a188da633d5b12cb 100644
|
| --- a/webrtc/api/peerconnectioninterface_unittest.cc
|
| +++ b/webrtc/api/peerconnectioninterface_unittest.cc
|
| @@ -934,6 +934,34 @@ class PeerConnectionInterfaceTest : public testing::Test {
|
| ASSERT_TRUE(stream->AddTrack(video_track));
|
| }
|
|
|
| + rtc::scoped_ptr<SessionDescriptionInterface> CreateOfferWithOneAudioStream() {
|
| + CreatePeerConnection();
|
| + AddVoiceStream(kStreamLabel1);
|
| + rtc::scoped_ptr<SessionDescriptionInterface> offer;
|
| + EXPECT_TRUE(DoCreateOffer(&offer, nullptr));
|
| + return offer;
|
| + }
|
| +
|
| + rtc::scoped_ptr<SessionDescriptionInterface>
|
| + CreateAnswerWithOneAudioStream() {
|
| + rtc::scoped_ptr<SessionDescriptionInterface> offer =
|
| + CreateOfferWithOneAudioStream();
|
| + EXPECT_TRUE(DoSetRemoteDescription(offer.release()));
|
| + rtc::scoped_ptr<SessionDescriptionInterface> answer;
|
| + EXPECT_TRUE(DoCreateAnswer(&answer, nullptr));
|
| + return answer;
|
| + }
|
| +
|
| + const std::string& GetFirstAudioStreamCname(
|
| + const SessionDescriptionInterface* desc) {
|
| + const cricket::ContentInfo* audio_content =
|
| + cricket::GetFirstAudioContent(desc->description());
|
| + const cricket::AudioContentDescription* audio_desc =
|
| + static_cast<const cricket::AudioContentDescription*>(
|
| + audio_content->description);
|
| + return audio_desc->streams()[0].cname;
|
| + }
|
| +
|
| cricket::FakePortAllocator* port_allocator_ = nullptr;
|
| scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory_;
|
| scoped_refptr<PeerConnectionInterface> pc_;
|
| @@ -941,6 +969,27 @@ class PeerConnectionInterfaceTest : public testing::Test {
|
| rtc::scoped_refptr<StreamCollection> reference_collection_;
|
| };
|
|
|
| +// Generate different CNAMEs when PeerConnections are created.
|
| +// The CNAMEs are expected to be generated randomly. It is possible
|
| +// that the test fails, though the possibility is very low.
|
| +TEST_F(PeerConnectionInterfaceTest, CnameGenerationInOffer) {
|
| + rtc::scoped_ptr<SessionDescriptionInterface> offer1 =
|
| + CreateOfferWithOneAudioStream();
|
| + rtc::scoped_ptr<SessionDescriptionInterface> offer2 =
|
| + CreateOfferWithOneAudioStream();
|
| + EXPECT_NE(GetFirstAudioStreamCname(offer1.get()),
|
| + GetFirstAudioStreamCname(offer2.get()));
|
| +}
|
| +
|
| +TEST_F(PeerConnectionInterfaceTest, CnameGenerationInAnswer) {
|
| + rtc::scoped_ptr<SessionDescriptionInterface> answer1 =
|
| + CreateAnswerWithOneAudioStream();
|
| + rtc::scoped_ptr<SessionDescriptionInterface> answer2 =
|
| + CreateAnswerWithOneAudioStream();
|
| + EXPECT_NE(GetFirstAudioStreamCname(answer1.get()),
|
| + GetFirstAudioStreamCname(answer2.get()));
|
| +}
|
| +
|
| TEST_F(PeerConnectionInterfaceTest,
|
| CreatePeerConnectionWithDifferentConfigurations) {
|
| CreatePeerConnectionWithDifferentConfigurations();
|
|
|