| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 2296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2307 // the default OfferOptions are used. | 2307 // the default OfferOptions are used. |
| 2308 TEST(CreateSessionOptionsTest, GetDefaultMediaSessionOptionsForOffer) { | 2308 TEST(CreateSessionOptionsTest, GetDefaultMediaSessionOptionsForOffer) { |
| 2309 RTCOfferAnswerOptions rtc_options; | 2309 RTCOfferAnswerOptions rtc_options; |
| 2310 | 2310 |
| 2311 cricket::MediaSessionOptions options; | 2311 cricket::MediaSessionOptions options; |
| 2312 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); | 2312 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); |
| 2313 EXPECT_TRUE(options.has_audio()); | 2313 EXPECT_TRUE(options.has_audio()); |
| 2314 EXPECT_FALSE(options.has_video()); | 2314 EXPECT_FALSE(options.has_video()); |
| 2315 EXPECT_TRUE(options.bundle_enabled); | 2315 EXPECT_TRUE(options.bundle_enabled); |
| 2316 EXPECT_TRUE(options.vad_enabled); | 2316 EXPECT_TRUE(options.vad_enabled); |
| 2317 EXPECT_FALSE(options.transport_options.ice_restart); | 2317 EXPECT_FALSE(options.audio_transport_options.ice_restart); |
| 2318 EXPECT_FALSE(options.video_transport_options.ice_restart); |
| 2319 EXPECT_FALSE(options.data_transport_options.ice_restart); |
| 2318 } | 2320 } |
| 2319 | 2321 |
| 2320 // Test that a correct MediaSessionOptions is created for an offer if | 2322 // Test that a correct MediaSessionOptions is created for an offer if |
| 2321 // OfferToReceiveVideo is set. | 2323 // OfferToReceiveVideo is set. |
| 2322 TEST(CreateSessionOptionsTest, GetMediaSessionOptionsForOfferWithVideo) { | 2324 TEST(CreateSessionOptionsTest, GetMediaSessionOptionsForOfferWithVideo) { |
| 2323 RTCOfferAnswerOptions rtc_options; | 2325 RTCOfferAnswerOptions rtc_options; |
| 2324 rtc_options.offer_to_receive_audio = 0; | 2326 rtc_options.offer_to_receive_audio = 0; |
| 2325 rtc_options.offer_to_receive_video = 1; | 2327 rtc_options.offer_to_receive_video = 1; |
| 2326 | 2328 |
| 2327 cricket::MediaSessionOptions options; | 2329 cricket::MediaSessionOptions options; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2342 | 2344 |
| 2343 cricket::MediaSessionOptions options; | 2345 cricket::MediaSessionOptions options; |
| 2344 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); | 2346 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); |
| 2345 EXPECT_TRUE(options.has_audio()); | 2347 EXPECT_TRUE(options.has_audio()); |
| 2346 EXPECT_TRUE(options.has_video()); | 2348 EXPECT_TRUE(options.has_video()); |
| 2347 EXPECT_FALSE(options.bundle_enabled); | 2349 EXPECT_FALSE(options.bundle_enabled); |
| 2348 } | 2350 } |
| 2349 | 2351 |
| 2350 // Test that a correct MediaSessionOptions is created to restart ice if | 2352 // Test that a correct MediaSessionOptions is created to restart ice if |
| 2351 // IceRestart is set. It also tests that subsequent MediaSessionOptions don't | 2353 // IceRestart is set. It also tests that subsequent MediaSessionOptions don't |
| 2352 // have |transport_options.ice_restart| set. | 2354 // have |audio_transport_options.ice_restart| etc. set. |
| 2353 TEST(CreateSessionOptionsTest, GetMediaSessionOptionsForOfferWithIceRestart) { | 2355 TEST(CreateSessionOptionsTest, GetMediaSessionOptionsForOfferWithIceRestart) { |
| 2354 RTCOfferAnswerOptions rtc_options; | 2356 RTCOfferAnswerOptions rtc_options; |
| 2355 rtc_options.ice_restart = true; | 2357 rtc_options.ice_restart = true; |
| 2356 | 2358 |
| 2357 cricket::MediaSessionOptions options; | 2359 cricket::MediaSessionOptions options; |
| 2358 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); | 2360 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); |
| 2359 EXPECT_TRUE(options.transport_options.ice_restart); | 2361 EXPECT_TRUE(options.audio_transport_options.ice_restart); |
| 2362 EXPECT_TRUE(options.video_transport_options.ice_restart); |
| 2363 EXPECT_TRUE(options.data_transport_options.ice_restart); |
| 2360 | 2364 |
| 2361 rtc_options = RTCOfferAnswerOptions(); | 2365 rtc_options = RTCOfferAnswerOptions(); |
| 2362 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); | 2366 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); |
| 2363 EXPECT_FALSE(options.transport_options.ice_restart); | 2367 EXPECT_FALSE(options.audio_transport_options.ice_restart); |
| 2368 EXPECT_FALSE(options.video_transport_options.ice_restart); |
| 2369 EXPECT_FALSE(options.data_transport_options.ice_restart); |
| 2364 } | 2370 } |
| 2365 | 2371 |
| 2366 // Test that the MediaConstraints in an answer don't affect if audio and video | 2372 // Test that the MediaConstraints in an answer don't affect if audio and video |
| 2367 // is offered in an offer but that if kOfferToReceiveAudio or | 2373 // is offered in an offer but that if kOfferToReceiveAudio or |
| 2368 // kOfferToReceiveVideo constraints are true in an offer, the media type will be | 2374 // kOfferToReceiveVideo constraints are true in an offer, the media type will be |
| 2369 // included in subsequent answers. | 2375 // included in subsequent answers. |
| 2370 TEST(CreateSessionOptionsTest, MediaConstraintsInAnswer) { | 2376 TEST(CreateSessionOptionsTest, MediaConstraintsInAnswer) { |
| 2371 FakeConstraints answer_c; | 2377 FakeConstraints answer_c; |
| 2372 answer_c.SetMandatoryReceiveAudio(true); | 2378 answer_c.SetMandatoryReceiveAudio(true); |
| 2373 answer_c.SetMandatoryReceiveVideo(true); | 2379 answer_c.SetMandatoryReceiveVideo(true); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2402 FakeConstraints updated_answer_c; | 2408 FakeConstraints updated_answer_c; |
| 2403 answer_c.SetMandatoryReceiveAudio(false); | 2409 answer_c.SetMandatoryReceiveAudio(false); |
| 2404 answer_c.SetMandatoryReceiveVideo(false); | 2410 answer_c.SetMandatoryReceiveVideo(false); |
| 2405 | 2411 |
| 2406 cricket::MediaSessionOptions updated_answer_options; | 2412 cricket::MediaSessionOptions updated_answer_options; |
| 2407 EXPECT_TRUE( | 2413 EXPECT_TRUE( |
| 2408 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); | 2414 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); |
| 2409 EXPECT_TRUE(updated_answer_options.has_audio()); | 2415 EXPECT_TRUE(updated_answer_options.has_audio()); |
| 2410 EXPECT_TRUE(updated_answer_options.has_video()); | 2416 EXPECT_TRUE(updated_answer_options.has_video()); |
| 2411 } | 2417 } |
| OLD | NEW |