OLD | NEW |
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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 std::vector<std::string> codec_names; | 219 std::vector<std::string> codec_names; |
220 for (const auto& codec : codecs) { | 220 for (const auto& codec : codecs) { |
221 codec_names.push_back(codec.name); | 221 codec_names.push_back(codec.name); |
222 } | 222 } |
223 return codec_names; | 223 return codec_names; |
224 } | 224 } |
225 | 225 |
226 class MediaSessionDescriptionFactoryTest : public testing::Test { | 226 class MediaSessionDescriptionFactoryTest : public testing::Test { |
227 public: | 227 public: |
228 MediaSessionDescriptionFactoryTest() | 228 MediaSessionDescriptionFactoryTest() |
229 : f1_(&tdf1_), f2_(&tdf2_), id1_("id1"), id2_("id2") { | 229 : f1_(&tdf1_), |
| 230 f2_(&tdf2_) { |
230 f1_.set_audio_codecs(MAKE_VECTOR(kAudioCodecs1)); | 231 f1_.set_audio_codecs(MAKE_VECTOR(kAudioCodecs1)); |
231 f1_.set_video_codecs(MAKE_VECTOR(kVideoCodecs1)); | 232 f1_.set_video_codecs(MAKE_VECTOR(kVideoCodecs1)); |
232 f1_.set_data_codecs(MAKE_VECTOR(kDataCodecs1)); | 233 f1_.set_data_codecs(MAKE_VECTOR(kDataCodecs1)); |
233 f2_.set_audio_codecs(MAKE_VECTOR(kAudioCodecs2)); | 234 f2_.set_audio_codecs(MAKE_VECTOR(kAudioCodecs2)); |
234 f2_.set_video_codecs(MAKE_VECTOR(kVideoCodecs2)); | 235 f2_.set_video_codecs(MAKE_VECTOR(kVideoCodecs2)); |
235 f2_.set_data_codecs(MAKE_VECTOR(kDataCodecs2)); | 236 f2_.set_data_codecs(MAKE_VECTOR(kDataCodecs2)); |
236 tdf1_.set_identity(&id1_); | 237 tdf1_.set_certificate(rtc::RTCCertificate::Create( |
237 tdf2_.set_identity(&id2_); | 238 rtc::scoped_ptr<rtc::SSLIdentity>( |
| 239 new rtc::FakeSSLIdentity("id1")).Pass())); |
| 240 tdf2_.set_certificate(rtc::RTCCertificate::Create( |
| 241 rtc::scoped_ptr<rtc::SSLIdentity>( |
| 242 new rtc::FakeSSLIdentity("id2")).Pass())); |
238 } | 243 } |
239 | 244 |
240 // Create a video StreamParamsVec object with: | 245 // Create a video StreamParamsVec object with: |
241 // - one video stream with 3 simulcast streams and FEC, | 246 // - one video stream with 3 simulcast streams and FEC, |
242 StreamParamsVec CreateComplexVideoStreamParamsVec() { | 247 StreamParamsVec CreateComplexVideoStreamParamsVec() { |
243 SsrcGroup sim_group("SIM", MAKE_VECTOR(kSimSsrc)); | 248 SsrcGroup sim_group("SIM", MAKE_VECTOR(kSimSsrc)); |
244 SsrcGroup fec_group1("FEC", MAKE_VECTOR(kFec1Ssrc)); | 249 SsrcGroup fec_group1("FEC", MAKE_VECTOR(kFec1Ssrc)); |
245 SsrcGroup fec_group2("FEC", MAKE_VECTOR(kFec2Ssrc)); | 250 SsrcGroup fec_group2("FEC", MAKE_VECTOR(kFec2Ssrc)); |
246 SsrcGroup fec_group3("FEC", MAKE_VECTOR(kFec3Ssrc)); | 251 SsrcGroup fec_group3("FEC", MAKE_VECTOR(kFec3Ssrc)); |
247 | 252 |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 return false; | 468 return false; |
464 } | 469 } |
465 return true; | 470 return true; |
466 } | 471 } |
467 | 472 |
468 protected: | 473 protected: |
469 MediaSessionDescriptionFactory f1_; | 474 MediaSessionDescriptionFactory f1_; |
470 MediaSessionDescriptionFactory f2_; | 475 MediaSessionDescriptionFactory f2_; |
471 TransportDescriptionFactory tdf1_; | 476 TransportDescriptionFactory tdf1_; |
472 TransportDescriptionFactory tdf2_; | 477 TransportDescriptionFactory tdf2_; |
473 rtc::FakeSSLIdentity id1_; | |
474 rtc::FakeSSLIdentity id2_; | |
475 }; | 478 }; |
476 | 479 |
477 // Create a typical audio offer, and ensure it matches what we expect. | 480 // Create a typical audio offer, and ensure it matches what we expect. |
478 TEST_F(MediaSessionDescriptionFactoryTest, TestCreateAudioOffer) { | 481 TEST_F(MediaSessionDescriptionFactoryTest, TestCreateAudioOffer) { |
479 f1_.set_secure(SEC_ENABLED); | 482 f1_.set_secure(SEC_ENABLED); |
480 rtc::scoped_ptr<SessionDescription> offer( | 483 rtc::scoped_ptr<SessionDescription> offer( |
481 f1_.CreateOffer(MediaSessionOptions(), NULL)); | 484 f1_.CreateOffer(MediaSessionOptions(), NULL)); |
482 ASSERT_TRUE(offer.get() != NULL); | 485 ASSERT_TRUE(offer.get() != NULL); |
483 const ContentInfo* ac = offer->GetContentByName("audio"); | 486 const ContentInfo* ac = offer->GetContentByName("audio"); |
484 const ContentInfo* vc = offer->GetContentByName("video"); | 487 const ContentInfo* vc = offer->GetContentByName("video"); |
(...skipping 1818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2303 offer.reset(f1_.CreateOffer(options, NULL)); | 2306 offer.reset(f1_.CreateOffer(options, NULL)); |
2304 ASSERT_TRUE(offer.get() != NULL); | 2307 ASSERT_TRUE(offer.get() != NULL); |
2305 audio_content = offer->GetContentByName("audio"); | 2308 audio_content = offer->GetContentByName("audio"); |
2306 EXPECT_TRUE(VerifyNoCNCodecs(audio_content)); | 2309 EXPECT_TRUE(VerifyNoCNCodecs(audio_content)); |
2307 rtc::scoped_ptr<SessionDescription> answer( | 2310 rtc::scoped_ptr<SessionDescription> answer( |
2308 f1_.CreateAnswer(offer.get(), options, NULL)); | 2311 f1_.CreateAnswer(offer.get(), options, NULL)); |
2309 ASSERT_TRUE(answer.get() != NULL); | 2312 ASSERT_TRUE(answer.get() != NULL); |
2310 audio_content = answer->GetContentByName("audio"); | 2313 audio_content = answer->GetContentByName("audio"); |
2311 EXPECT_TRUE(VerifyNoCNCodecs(audio_content)); | 2314 EXPECT_TRUE(VerifyNoCNCodecs(audio_content)); |
2312 } | 2315 } |
OLD | NEW |