OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 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 2471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2482 EXPECT_FALSE(options.has_video()); | 2482 EXPECT_FALSE(options.has_video()); |
2483 EXPECT_TRUE(options.bundle_enabled); | 2483 EXPECT_TRUE(options.bundle_enabled); |
2484 } | 2484 } |
2485 | 2485 |
2486 // Test that a correct MediaSessionOptions is created for an offer if | 2486 // Test that a correct MediaSessionOptions is created for an offer if |
2487 // the default OfferOptions are used. | 2487 // the default OfferOptions are used. |
2488 TEST(CreateSessionOptionsTest, GetDefaultMediaSessionOptionsForOffer) { | 2488 TEST(CreateSessionOptionsTest, GetDefaultMediaSessionOptionsForOffer) { |
2489 RTCOfferAnswerOptions rtc_options; | 2489 RTCOfferAnswerOptions rtc_options; |
2490 | 2490 |
2491 cricket::MediaSessionOptions options; | 2491 cricket::MediaSessionOptions options; |
| 2492 options.transport_options["audio"] = cricket::TransportOptions(); |
| 2493 options.transport_options["video"] = cricket::TransportOptions(); |
2492 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); | 2494 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); |
2493 EXPECT_TRUE(options.has_audio()); | 2495 EXPECT_TRUE(options.has_audio()); |
2494 EXPECT_FALSE(options.has_video()); | 2496 EXPECT_FALSE(options.has_video()); |
2495 EXPECT_TRUE(options.bundle_enabled); | 2497 EXPECT_TRUE(options.bundle_enabled); |
2496 EXPECT_TRUE(options.vad_enabled); | 2498 EXPECT_TRUE(options.vad_enabled); |
2497 EXPECT_FALSE(options.audio_transport_options.ice_restart); | 2499 EXPECT_FALSE(options.transport_options["audio"].ice_restart); |
2498 EXPECT_FALSE(options.video_transport_options.ice_restart); | 2500 EXPECT_FALSE(options.transport_options["video"].ice_restart); |
2499 EXPECT_FALSE(options.data_transport_options.ice_restart); | |
2500 } | 2501 } |
2501 | 2502 |
2502 // Test that a correct MediaSessionOptions is created for an offer if | 2503 // Test that a correct MediaSessionOptions is created for an offer if |
2503 // OfferToReceiveVideo is set. | 2504 // OfferToReceiveVideo is set. |
2504 TEST(CreateSessionOptionsTest, GetMediaSessionOptionsForOfferWithVideo) { | 2505 TEST(CreateSessionOptionsTest, GetMediaSessionOptionsForOfferWithVideo) { |
2505 RTCOfferAnswerOptions rtc_options; | 2506 RTCOfferAnswerOptions rtc_options; |
2506 rtc_options.offer_to_receive_audio = 0; | 2507 rtc_options.offer_to_receive_audio = 0; |
2507 rtc_options.offer_to_receive_video = 1; | 2508 rtc_options.offer_to_receive_video = 1; |
2508 | 2509 |
2509 cricket::MediaSessionOptions options; | 2510 cricket::MediaSessionOptions options; |
(...skipping 20 matching lines...) Expand all Loading... |
2530 } | 2531 } |
2531 | 2532 |
2532 // Test that a correct MediaSessionOptions is created to restart ice if | 2533 // Test that a correct MediaSessionOptions is created to restart ice if |
2533 // IceRestart is set. It also tests that subsequent MediaSessionOptions don't | 2534 // IceRestart is set. It also tests that subsequent MediaSessionOptions don't |
2534 // have |audio_transport_options.ice_restart| etc. set. | 2535 // have |audio_transport_options.ice_restart| etc. set. |
2535 TEST(CreateSessionOptionsTest, GetMediaSessionOptionsForOfferWithIceRestart) { | 2536 TEST(CreateSessionOptionsTest, GetMediaSessionOptionsForOfferWithIceRestart) { |
2536 RTCOfferAnswerOptions rtc_options; | 2537 RTCOfferAnswerOptions rtc_options; |
2537 rtc_options.ice_restart = true; | 2538 rtc_options.ice_restart = true; |
2538 | 2539 |
2539 cricket::MediaSessionOptions options; | 2540 cricket::MediaSessionOptions options; |
| 2541 options.transport_options["audio"] = cricket::TransportOptions(); |
| 2542 options.transport_options["video"] = cricket::TransportOptions(); |
2540 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); | 2543 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); |
2541 EXPECT_TRUE(options.audio_transport_options.ice_restart); | 2544 EXPECT_TRUE(options.transport_options["audio"].ice_restart); |
2542 EXPECT_TRUE(options.video_transport_options.ice_restart); | 2545 EXPECT_TRUE(options.transport_options["video"].ice_restart); |
2543 EXPECT_TRUE(options.data_transport_options.ice_restart); | |
2544 | 2546 |
2545 rtc_options = RTCOfferAnswerOptions(); | 2547 rtc_options = RTCOfferAnswerOptions(); |
2546 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); | 2548 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); |
2547 EXPECT_FALSE(options.audio_transport_options.ice_restart); | 2549 EXPECT_FALSE(options.transport_options["audio"].ice_restart); |
2548 EXPECT_FALSE(options.video_transport_options.ice_restart); | 2550 EXPECT_FALSE(options.transport_options["video"].ice_restart); |
2549 EXPECT_FALSE(options.data_transport_options.ice_restart); | |
2550 } | 2551 } |
2551 | 2552 |
2552 // Test that the MediaConstraints in an answer don't affect if audio and video | 2553 // Test that the MediaConstraints in an answer don't affect if audio and video |
2553 // is offered in an offer but that if kOfferToReceiveAudio or | 2554 // is offered in an offer but that if kOfferToReceiveAudio or |
2554 // kOfferToReceiveVideo constraints are true in an offer, the media type will be | 2555 // kOfferToReceiveVideo constraints are true in an offer, the media type will be |
2555 // included in subsequent answers. | 2556 // included in subsequent answers. |
2556 TEST(CreateSessionOptionsTest, MediaConstraintsInAnswer) { | 2557 TEST(CreateSessionOptionsTest, MediaConstraintsInAnswer) { |
2557 FakeConstraints answer_c; | 2558 FakeConstraints answer_c; |
2558 answer_c.SetMandatoryReceiveAudio(true); | 2559 answer_c.SetMandatoryReceiveAudio(true); |
2559 answer_c.SetMandatoryReceiveVideo(true); | 2560 answer_c.SetMandatoryReceiveVideo(true); |
(...skipping 28 matching lines...) Expand all Loading... |
2588 FakeConstraints updated_answer_c; | 2589 FakeConstraints updated_answer_c; |
2589 answer_c.SetMandatoryReceiveAudio(false); | 2590 answer_c.SetMandatoryReceiveAudio(false); |
2590 answer_c.SetMandatoryReceiveVideo(false); | 2591 answer_c.SetMandatoryReceiveVideo(false); |
2591 | 2592 |
2592 cricket::MediaSessionOptions updated_answer_options; | 2593 cricket::MediaSessionOptions updated_answer_options; |
2593 EXPECT_TRUE( | 2594 EXPECT_TRUE( |
2594 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); | 2595 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); |
2595 EXPECT_TRUE(updated_answer_options.has_audio()); | 2596 EXPECT_TRUE(updated_answer_options.has_audio()); |
2596 EXPECT_TRUE(updated_answer_options.has_video()); | 2597 EXPECT_TRUE(updated_answer_options.has_video()); |
2597 } | 2598 } |
OLD | NEW |