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 2372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2383 EXPECT_FALSE(options.has_video()); | 2383 EXPECT_FALSE(options.has_video()); |
2384 EXPECT_TRUE(options.bundle_enabled); | 2384 EXPECT_TRUE(options.bundle_enabled); |
2385 } | 2385 } |
2386 | 2386 |
2387 // Test that a correct MediaSessionOptions is created for an offer if | 2387 // Test that a correct MediaSessionOptions is created for an offer if |
2388 // the default OfferOptions are used. | 2388 // the default OfferOptions are used. |
2389 TEST(CreateSessionOptionsTest, GetDefaultMediaSessionOptionsForOffer) { | 2389 TEST(CreateSessionOptionsTest, GetDefaultMediaSessionOptionsForOffer) { |
2390 RTCOfferAnswerOptions rtc_options; | 2390 RTCOfferAnswerOptions rtc_options; |
2391 | 2391 |
2392 cricket::MediaSessionOptions options; | 2392 cricket::MediaSessionOptions options; |
| 2393 options.transport_options["audio"] = cricket::TransportOptions(); |
| 2394 options.transport_options["video"] = cricket::TransportOptions(); |
2393 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); | 2395 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); |
2394 EXPECT_TRUE(options.has_audio()); | 2396 EXPECT_TRUE(options.has_audio()); |
2395 EXPECT_FALSE(options.has_video()); | 2397 EXPECT_FALSE(options.has_video()); |
2396 EXPECT_TRUE(options.bundle_enabled); | 2398 EXPECT_TRUE(options.bundle_enabled); |
2397 EXPECT_TRUE(options.vad_enabled); | 2399 EXPECT_TRUE(options.vad_enabled); |
2398 EXPECT_FALSE(options.audio_transport_options.ice_restart); | 2400 EXPECT_FALSE(options.transport_options["audio"].ice_restart); |
2399 EXPECT_FALSE(options.video_transport_options.ice_restart); | 2401 EXPECT_FALSE(options.transport_options["video"].ice_restart); |
2400 EXPECT_FALSE(options.data_transport_options.ice_restart); | |
2401 } | 2402 } |
2402 | 2403 |
2403 // Test that a correct MediaSessionOptions is created for an offer if | 2404 // Test that a correct MediaSessionOptions is created for an offer if |
2404 // OfferToReceiveVideo is set. | 2405 // OfferToReceiveVideo is set. |
2405 TEST(CreateSessionOptionsTest, GetMediaSessionOptionsForOfferWithVideo) { | 2406 TEST(CreateSessionOptionsTest, GetMediaSessionOptionsForOfferWithVideo) { |
2406 RTCOfferAnswerOptions rtc_options; | 2407 RTCOfferAnswerOptions rtc_options; |
2407 rtc_options.offer_to_receive_audio = 0; | 2408 rtc_options.offer_to_receive_audio = 0; |
2408 rtc_options.offer_to_receive_video = 1; | 2409 rtc_options.offer_to_receive_video = 1; |
2409 | 2410 |
2410 cricket::MediaSessionOptions options; | 2411 cricket::MediaSessionOptions options; |
(...skipping 20 matching lines...) Expand all Loading... |
2431 } | 2432 } |
2432 | 2433 |
2433 // Test that a correct MediaSessionOptions is created to restart ice if | 2434 // Test that a correct MediaSessionOptions is created to restart ice if |
2434 // IceRestart is set. It also tests that subsequent MediaSessionOptions don't | 2435 // IceRestart is set. It also tests that subsequent MediaSessionOptions don't |
2435 // have |audio_transport_options.ice_restart| etc. set. | 2436 // have |audio_transport_options.ice_restart| etc. set. |
2436 TEST(CreateSessionOptionsTest, GetMediaSessionOptionsForOfferWithIceRestart) { | 2437 TEST(CreateSessionOptionsTest, GetMediaSessionOptionsForOfferWithIceRestart) { |
2437 RTCOfferAnswerOptions rtc_options; | 2438 RTCOfferAnswerOptions rtc_options; |
2438 rtc_options.ice_restart = true; | 2439 rtc_options.ice_restart = true; |
2439 | 2440 |
2440 cricket::MediaSessionOptions options; | 2441 cricket::MediaSessionOptions options; |
| 2442 options.transport_options["audio"] = cricket::TransportOptions(); |
| 2443 options.transport_options["video"] = cricket::TransportOptions(); |
2441 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); | 2444 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); |
2442 EXPECT_TRUE(options.audio_transport_options.ice_restart); | 2445 EXPECT_TRUE(options.transport_options["audio"].ice_restart); |
2443 EXPECT_TRUE(options.video_transport_options.ice_restart); | 2446 EXPECT_TRUE(options.transport_options["video"].ice_restart); |
2444 EXPECT_TRUE(options.data_transport_options.ice_restart); | |
2445 | 2447 |
2446 rtc_options = RTCOfferAnswerOptions(); | 2448 rtc_options = RTCOfferAnswerOptions(); |
2447 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); | 2449 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); |
2448 EXPECT_FALSE(options.audio_transport_options.ice_restart); | 2450 EXPECT_FALSE(options.transport_options["audio"].ice_restart); |
2449 EXPECT_FALSE(options.video_transport_options.ice_restart); | 2451 EXPECT_FALSE(options.transport_options["video"].ice_restart); |
2450 EXPECT_FALSE(options.data_transport_options.ice_restart); | |
2451 } | 2452 } |
2452 | 2453 |
2453 // Test that the MediaConstraints in an answer don't affect if audio and video | 2454 // Test that the MediaConstraints in an answer don't affect if audio and video |
2454 // is offered in an offer but that if kOfferToReceiveAudio or | 2455 // is offered in an offer but that if kOfferToReceiveAudio or |
2455 // kOfferToReceiveVideo constraints are true in an offer, the media type will be | 2456 // kOfferToReceiveVideo constraints are true in an offer, the media type will be |
2456 // included in subsequent answers. | 2457 // included in subsequent answers. |
2457 TEST(CreateSessionOptionsTest, MediaConstraintsInAnswer) { | 2458 TEST(CreateSessionOptionsTest, MediaConstraintsInAnswer) { |
2458 FakeConstraints answer_c; | 2459 FakeConstraints answer_c; |
2459 answer_c.SetMandatoryReceiveAudio(true); | 2460 answer_c.SetMandatoryReceiveAudio(true); |
2460 answer_c.SetMandatoryReceiveVideo(true); | 2461 answer_c.SetMandatoryReceiveVideo(true); |
(...skipping 28 matching lines...) Expand all Loading... |
2489 FakeConstraints updated_answer_c; | 2490 FakeConstraints updated_answer_c; |
2490 answer_c.SetMandatoryReceiveAudio(false); | 2491 answer_c.SetMandatoryReceiveAudio(false); |
2491 answer_c.SetMandatoryReceiveVideo(false); | 2492 answer_c.SetMandatoryReceiveVideo(false); |
2492 | 2493 |
2493 cricket::MediaSessionOptions updated_answer_options; | 2494 cricket::MediaSessionOptions updated_answer_options; |
2494 EXPECT_TRUE( | 2495 EXPECT_TRUE( |
2495 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); | 2496 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); |
2496 EXPECT_TRUE(updated_answer_options.has_audio()); | 2497 EXPECT_TRUE(updated_answer_options.has_audio()); |
2497 EXPECT_TRUE(updated_answer_options.has_video()); | 2498 EXPECT_TRUE(updated_answer_options.has_video()); |
2498 } | 2499 } |
OLD | NEW |