OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 // This test that the audio and video media direction is set to | 403 // This test that the audio and video media direction is set to |
404 // |expected_direction_in_answer| in an answer if the offer direction is set | 404 // |expected_direction_in_answer| in an answer if the offer direction is set |
405 // to |direction_in_offer|. | 405 // to |direction_in_offer|. |
406 void TestMediaDirectionInAnswer( | 406 void TestMediaDirectionInAnswer( |
407 cricket::MediaContentDirection direction_in_offer, | 407 cricket::MediaContentDirection direction_in_offer, |
408 cricket::MediaContentDirection expected_direction_in_answer) { | 408 cricket::MediaContentDirection expected_direction_in_answer) { |
409 MediaSessionOptions opts; | 409 MediaSessionOptions opts; |
410 opts.recv_video = true; | 410 opts.recv_video = true; |
411 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); | 411 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); |
412 ASSERT_TRUE(offer.get() != NULL); | 412 ASSERT_TRUE(offer.get() != NULL); |
413 ContentInfo* ac_offer= offer->GetContentByName("audio"); | 413 ContentInfo* ac_offer = offer->GetContentByName("audio"); |
414 ASSERT_TRUE(ac_offer != NULL); | 414 ASSERT_TRUE(ac_offer != NULL); |
415 AudioContentDescription* acd_offer = | 415 AudioContentDescription* acd_offer = |
416 static_cast<AudioContentDescription*>(ac_offer->description); | 416 static_cast<AudioContentDescription*>(ac_offer->description); |
417 acd_offer->set_direction(direction_in_offer); | 417 acd_offer->set_direction(direction_in_offer); |
418 ContentInfo* vc_offer= offer->GetContentByName("video"); | 418 ContentInfo* vc_offer = offer->GetContentByName("video"); |
419 ASSERT_TRUE(vc_offer != NULL); | 419 ASSERT_TRUE(vc_offer != NULL); |
420 VideoContentDescription* vcd_offer = | 420 VideoContentDescription* vcd_offer = |
421 static_cast<VideoContentDescription*>(vc_offer->description); | 421 static_cast<VideoContentDescription*>(vc_offer->description); |
422 vcd_offer->set_direction(direction_in_offer); | 422 vcd_offer->set_direction(direction_in_offer); |
423 | 423 |
424 std::unique_ptr<SessionDescription> answer( | 424 std::unique_ptr<SessionDescription> answer( |
425 f2_.CreateAnswer(offer.get(), opts, NULL)); | 425 f2_.CreateAnswer(offer.get(), opts, NULL)); |
426 const AudioContentDescription* acd_answer = | 426 const AudioContentDescription* acd_answer = |
427 GetFirstAudioContentDescription(answer.get()); | 427 GetFirstAudioContentDescription(answer.get()); |
428 EXPECT_EQ(expected_direction_in_answer, acd_answer->direction()); | 428 EXPECT_EQ(expected_direction_in_answer, acd_answer->direction()); |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 | 882 |
883 // Test that a data content with an unknown protocol is rejected in an answer. | 883 // Test that a data content with an unknown protocol is rejected in an answer. |
884 TEST_F(MediaSessionDescriptionFactoryTest, | 884 TEST_F(MediaSessionDescriptionFactoryTest, |
885 CreateDataAnswerToOfferWithUnknownProtocol) { | 885 CreateDataAnswerToOfferWithUnknownProtocol) { |
886 MediaSessionOptions opts; | 886 MediaSessionOptions opts; |
887 opts.data_channel_type = cricket::DCT_RTP; | 887 opts.data_channel_type = cricket::DCT_RTP; |
888 opts.recv_audio = false; | 888 opts.recv_audio = false; |
889 f1_.set_secure(SEC_ENABLED); | 889 f1_.set_secure(SEC_ENABLED); |
890 f2_.set_secure(SEC_ENABLED); | 890 f2_.set_secure(SEC_ENABLED); |
891 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); | 891 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); |
892 ContentInfo* dc_offer= offer->GetContentByName("data"); | 892 ContentInfo* dc_offer = offer->GetContentByName("data"); |
893 ASSERT_TRUE(dc_offer != NULL); | 893 ASSERT_TRUE(dc_offer != NULL); |
894 DataContentDescription* dcd_offer = | 894 DataContentDescription* dcd_offer = |
895 static_cast<DataContentDescription*>(dc_offer->description); | 895 static_cast<DataContentDescription*>(dc_offer->description); |
896 ASSERT_TRUE(dcd_offer != NULL); | 896 ASSERT_TRUE(dcd_offer != NULL); |
897 std::string protocol = "a weird unknown protocol"; | 897 std::string protocol = "a weird unknown protocol"; |
898 dcd_offer->set_protocol(protocol); | 898 dcd_offer->set_protocol(protocol); |
899 | 899 |
900 std::unique_ptr<SessionDescription> answer( | 900 std::unique_ptr<SessionDescription> answer( |
901 f2_.CreateAnswer(offer.get(), opts, NULL)); | 901 f2_.CreateAnswer(offer.get(), opts, NULL)); |
902 | 902 |
(...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2372 const ContentInfo* audio_content = GetFirstAudioContent(updated_offer.get()); | 2372 const ContentInfo* audio_content = GetFirstAudioContent(updated_offer.get()); |
2373 const ContentInfo* video_content = GetFirstVideoContent(updated_offer.get()); | 2373 const ContentInfo* video_content = GetFirstVideoContent(updated_offer.get()); |
2374 const ContentInfo* data_content = GetFirstDataContent(updated_offer.get()); | 2374 const ContentInfo* data_content = GetFirstDataContent(updated_offer.get()); |
2375 ASSERT_TRUE(audio_content != nullptr); | 2375 ASSERT_TRUE(audio_content != nullptr); |
2376 ASSERT_TRUE(video_content != nullptr); | 2376 ASSERT_TRUE(video_content != nullptr); |
2377 ASSERT_TRUE(data_content != nullptr); | 2377 ASSERT_TRUE(data_content != nullptr); |
2378 EXPECT_EQ("audio_modified", audio_content->name); | 2378 EXPECT_EQ("audio_modified", audio_content->name); |
2379 EXPECT_EQ("video_modified", video_content->name); | 2379 EXPECT_EQ("video_modified", video_content->name); |
2380 EXPECT_EQ("data_modified", data_content->name); | 2380 EXPECT_EQ("data_modified", data_content->name); |
2381 } | 2381 } |
OLD | NEW |