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

Side by Side Diff: talk/session/media/mediasession_unittest.cc

Issue 1529673002: Fixing bug where "mid" wasn't preserved across re-offers. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years 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 | « talk/session/media/mediasession.cc ('k') | 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 * libjingle 2 * libjingle
3 * Copyright 2004 Google Inc. 3 * Copyright 2004 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 using cricket::StreamParams; 62 using cricket::StreamParams;
63 using cricket::StreamParamsVec; 63 using cricket::StreamParamsVec;
64 using cricket::TransportDescription; 64 using cricket::TransportDescription;
65 using cricket::TransportDescriptionFactory; 65 using cricket::TransportDescriptionFactory;
66 using cricket::TransportInfo; 66 using cricket::TransportInfo;
67 using cricket::ContentInfo; 67 using cricket::ContentInfo;
68 using cricket::CryptoParamsVec; 68 using cricket::CryptoParamsVec;
69 using cricket::AudioContentDescription; 69 using cricket::AudioContentDescription;
70 using cricket::VideoContentDescription; 70 using cricket::VideoContentDescription;
71 using cricket::DataContentDescription; 71 using cricket::DataContentDescription;
72 using cricket::GetFirstAudioContent;
73 using cricket::GetFirstVideoContent;
74 using cricket::GetFirstDataContent;
72 using cricket::GetFirstAudioContentDescription; 75 using cricket::GetFirstAudioContentDescription;
73 using cricket::GetFirstVideoContentDescription; 76 using cricket::GetFirstVideoContentDescription;
74 using cricket::GetFirstDataContentDescription; 77 using cricket::GetFirstDataContentDescription;
75 using cricket::kAutoBandwidth; 78 using cricket::kAutoBandwidth;
76 using cricket::AudioCodec; 79 using cricket::AudioCodec;
77 using cricket::VideoCodec; 80 using cricket::VideoCodec;
78 using cricket::DataCodec; 81 using cricket::DataCodec;
79 using cricket::NS_JINGLE_RTP; 82 using cricket::NS_JINGLE_RTP;
80 using cricket::MEDIA_TYPE_AUDIO; 83 using cricket::MEDIA_TYPE_AUDIO;
81 using cricket::MEDIA_TYPE_VIDEO; 84 using cricket::MEDIA_TYPE_VIDEO;
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 EXPECT_TRUE(NULL != acd); 603 EXPECT_TRUE(NULL != acd);
601 EXPECT_TRUE(NULL != dcd); 604 EXPECT_TRUE(NULL != dcd);
602 605
603 ASSERT_CRYPTO(acd, 1U, CS_AES_CM_128_HMAC_SHA1_80); 606 ASSERT_CRYPTO(acd, 1U, CS_AES_CM_128_HMAC_SHA1_80);
604 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), acd->protocol()); 607 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), acd->protocol());
605 ASSERT_CRYPTO(vcd, 1U, CS_AES_CM_128_HMAC_SHA1_80); 608 ASSERT_CRYPTO(vcd, 1U, CS_AES_CM_128_HMAC_SHA1_80);
606 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), vcd->protocol()); 609 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), vcd->protocol());
607 ASSERT_CRYPTO(dcd, 1U, CS_AES_CM_128_HMAC_SHA1_80); 610 ASSERT_CRYPTO(dcd, 1U, CS_AES_CM_128_HMAC_SHA1_80);
608 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), dcd->protocol()); 611 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), dcd->protocol());
609 } 612 }
613
610 // Create a RTP data offer, and ensure it matches what we expect. 614 // Create a RTP data offer, and ensure it matches what we expect.
611 TEST_F(MediaSessionDescriptionFactoryTest, TestCreateRtpDataOffer) { 615 TEST_F(MediaSessionDescriptionFactoryTest, TestCreateRtpDataOffer) {
612 MediaSessionOptions opts; 616 MediaSessionOptions opts;
613 opts.data_channel_type = cricket::DCT_RTP; 617 opts.data_channel_type = cricket::DCT_RTP;
614 f1_.set_secure(SEC_ENABLED); 618 f1_.set_secure(SEC_ENABLED);
615 rtc::scoped_ptr<SessionDescription> 619 rtc::scoped_ptr<SessionDescription>
616 offer(f1_.CreateOffer(opts, NULL)); 620 offer(f1_.CreateOffer(opts, NULL));
617 ASSERT_TRUE(offer.get() != NULL); 621 ASSERT_TRUE(offer.get() != NULL);
618 const ContentInfo* ac = offer->GetContentByName("audio"); 622 const ContentInfo* ac = offer->GetContentByName("audio");
619 const ContentInfo* dc = offer->GetContentByName("data"); 623 const ContentInfo* dc = offer->GetContentByName("data");
(...skipping 1686 matching lines...) Expand 10 before | Expand all | Expand 10 after
2306 offer.reset(f1_.CreateOffer(options, NULL)); 2310 offer.reset(f1_.CreateOffer(options, NULL));
2307 ASSERT_TRUE(offer.get() != NULL); 2311 ASSERT_TRUE(offer.get() != NULL);
2308 audio_content = offer->GetContentByName("audio"); 2312 audio_content = offer->GetContentByName("audio");
2309 EXPECT_TRUE(VerifyNoCNCodecs(audio_content)); 2313 EXPECT_TRUE(VerifyNoCNCodecs(audio_content));
2310 rtc::scoped_ptr<SessionDescription> answer( 2314 rtc::scoped_ptr<SessionDescription> answer(
2311 f1_.CreateAnswer(offer.get(), options, NULL)); 2315 f1_.CreateAnswer(offer.get(), options, NULL));
2312 ASSERT_TRUE(answer.get() != NULL); 2316 ASSERT_TRUE(answer.get() != NULL);
2313 audio_content = answer->GetContentByName("audio"); 2317 audio_content = answer->GetContentByName("audio");
2314 EXPECT_TRUE(VerifyNoCNCodecs(audio_content)); 2318 EXPECT_TRUE(VerifyNoCNCodecs(audio_content));
2315 } 2319 }
2320
2321 // Test that the content name ("mid" in SDP) is unchanged when creating a
2322 // new offer.
2323 TEST_F(MediaSessionDescriptionFactoryTest,
2324 TestContentNameNotChangedInSubsequentOffers) {
2325 MediaSessionOptions opts;
2326 opts.recv_audio = true;
2327 opts.recv_video = true;
2328 opts.data_channel_type = cricket::DCT_SCTP;
2329 // Create offer and modify the default content names.
2330 rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, nullptr));
2331 for (ContentInfo& content : offer->contents()) {
2332 content.name.append("_modified");
2333 }
2334
2335 rtc::scoped_ptr<SessionDescription> updated_offer(
2336 f1_.CreateOffer(opts, offer.get()));
2337 const ContentInfo* audio_content = GetFirstAudioContent(updated_offer.get());
2338 const ContentInfo* video_content = GetFirstVideoContent(updated_offer.get());
2339 const ContentInfo* data_content = GetFirstDataContent(updated_offer.get());
2340 ASSERT_TRUE(audio_content != nullptr);
2341 ASSERT_TRUE(video_content != nullptr);
2342 ASSERT_TRUE(data_content != nullptr);
2343 EXPECT_EQ("audio_modified", audio_content->name);
2344 EXPECT_EQ("video_modified", video_content->name);
2345 EXPECT_EQ("data_modified", data_content->name);
2346 }
OLDNEW
« no previous file with comments | « talk/session/media/mediasession.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698