| 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 2243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2254 // the default OfferOptions are used. | 2254 // the default OfferOptions are used. |
| 2255 TEST(CreateSessionOptionsTest, GetDefaultMediaSessionOptionsForOffer) { | 2255 TEST(CreateSessionOptionsTest, GetDefaultMediaSessionOptionsForOffer) { |
| 2256 RTCOfferAnswerOptions rtc_options; | 2256 RTCOfferAnswerOptions rtc_options; |
| 2257 | 2257 |
| 2258 cricket::MediaSessionOptions options; | 2258 cricket::MediaSessionOptions options; |
| 2259 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); | 2259 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); |
| 2260 EXPECT_TRUE(options.has_audio()); | 2260 EXPECT_TRUE(options.has_audio()); |
| 2261 EXPECT_FALSE(options.has_video()); | 2261 EXPECT_FALSE(options.has_video()); |
| 2262 EXPECT_TRUE(options.bundle_enabled); | 2262 EXPECT_TRUE(options.bundle_enabled); |
| 2263 EXPECT_TRUE(options.vad_enabled); | 2263 EXPECT_TRUE(options.vad_enabled); |
| 2264 EXPECT_FALSE(options.transport_options.ice_restart); | 2264 EXPECT_FALSE(options.audio_transport_options.ice_restart); |
| 2265 EXPECT_FALSE(options.video_transport_options.ice_restart); |
| 2266 EXPECT_FALSE(options.data_transport_options.ice_restart); |
| 2265 } | 2267 } |
| 2266 | 2268 |
| 2267 // Test that a correct MediaSessionOptions is created for an offer if | 2269 // Test that a correct MediaSessionOptions is created for an offer if |
| 2268 // OfferToReceiveVideo is set. | 2270 // OfferToReceiveVideo is set. |
| 2269 TEST(CreateSessionOptionsTest, GetMediaSessionOptionsForOfferWithVideo) { | 2271 TEST(CreateSessionOptionsTest, GetMediaSessionOptionsForOfferWithVideo) { |
| 2270 RTCOfferAnswerOptions rtc_options; | 2272 RTCOfferAnswerOptions rtc_options; |
| 2271 rtc_options.offer_to_receive_audio = 0; | 2273 rtc_options.offer_to_receive_audio = 0; |
| 2272 rtc_options.offer_to_receive_video = 1; | 2274 rtc_options.offer_to_receive_video = 1; |
| 2273 | 2275 |
| 2274 cricket::MediaSessionOptions options; | 2276 cricket::MediaSessionOptions options; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2289 | 2291 |
| 2290 cricket::MediaSessionOptions options; | 2292 cricket::MediaSessionOptions options; |
| 2291 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); | 2293 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); |
| 2292 EXPECT_TRUE(options.has_audio()); | 2294 EXPECT_TRUE(options.has_audio()); |
| 2293 EXPECT_TRUE(options.has_video()); | 2295 EXPECT_TRUE(options.has_video()); |
| 2294 EXPECT_FALSE(options.bundle_enabled); | 2296 EXPECT_FALSE(options.bundle_enabled); |
| 2295 } | 2297 } |
| 2296 | 2298 |
| 2297 // Test that a correct MediaSessionOptions is created to restart ice if | 2299 // Test that a correct MediaSessionOptions is created to restart ice if |
| 2298 // IceRestart is set. It also tests that subsequent MediaSessionOptions don't | 2300 // IceRestart is set. It also tests that subsequent MediaSessionOptions don't |
| 2299 // have |transport_options.ice_restart| set. | 2301 // have |audio_transport_options.ice_restart| etc. set. |
| 2300 TEST(CreateSessionOptionsTest, GetMediaSessionOptionsForOfferWithIceRestart) { | 2302 TEST(CreateSessionOptionsTest, GetMediaSessionOptionsForOfferWithIceRestart) { |
| 2301 RTCOfferAnswerOptions rtc_options; | 2303 RTCOfferAnswerOptions rtc_options; |
| 2302 rtc_options.ice_restart = true; | 2304 rtc_options.ice_restart = true; |
| 2303 | 2305 |
| 2304 cricket::MediaSessionOptions options; | 2306 cricket::MediaSessionOptions options; |
| 2305 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); | 2307 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); |
| 2306 EXPECT_TRUE(options.transport_options.ice_restart); | 2308 EXPECT_TRUE(options.audio_transport_options.ice_restart); |
| 2309 EXPECT_TRUE(options.video_transport_options.ice_restart); |
| 2310 EXPECT_TRUE(options.data_transport_options.ice_restart); |
| 2307 | 2311 |
| 2308 rtc_options = RTCOfferAnswerOptions(); | 2312 rtc_options = RTCOfferAnswerOptions(); |
| 2309 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); | 2313 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); |
| 2310 EXPECT_FALSE(options.transport_options.ice_restart); | 2314 EXPECT_FALSE(options.audio_transport_options.ice_restart); |
| 2315 EXPECT_FALSE(options.video_transport_options.ice_restart); |
| 2316 EXPECT_FALSE(options.data_transport_options.ice_restart); |
| 2311 } | 2317 } |
| 2312 | 2318 |
| 2313 // Test that the MediaConstraints in an answer don't affect if audio and video | 2319 // Test that the MediaConstraints in an answer don't affect if audio and video |
| 2314 // is offered in an offer but that if kOfferToReceiveAudio or | 2320 // is offered in an offer but that if kOfferToReceiveAudio or |
| 2315 // kOfferToReceiveVideo constraints are true in an offer, the media type will be | 2321 // kOfferToReceiveVideo constraints are true in an offer, the media type will be |
| 2316 // included in subsequent answers. | 2322 // included in subsequent answers. |
| 2317 TEST(CreateSessionOptionsTest, MediaConstraintsInAnswer) { | 2323 TEST(CreateSessionOptionsTest, MediaConstraintsInAnswer) { |
| 2318 FakeConstraints answer_c; | 2324 FakeConstraints answer_c; |
| 2319 answer_c.SetMandatoryReceiveAudio(true); | 2325 answer_c.SetMandatoryReceiveAudio(true); |
| 2320 answer_c.SetMandatoryReceiveVideo(true); | 2326 answer_c.SetMandatoryReceiveVideo(true); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2349 FakeConstraints updated_answer_c; | 2355 FakeConstraints updated_answer_c; |
| 2350 answer_c.SetMandatoryReceiveAudio(false); | 2356 answer_c.SetMandatoryReceiveAudio(false); |
| 2351 answer_c.SetMandatoryReceiveVideo(false); | 2357 answer_c.SetMandatoryReceiveVideo(false); |
| 2352 | 2358 |
| 2353 cricket::MediaSessionOptions updated_answer_options; | 2359 cricket::MediaSessionOptions updated_answer_options; |
| 2354 EXPECT_TRUE( | 2360 EXPECT_TRUE( |
| 2355 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); | 2361 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); |
| 2356 EXPECT_TRUE(updated_answer_options.has_audio()); | 2362 EXPECT_TRUE(updated_answer_options.has_audio()); |
| 2357 EXPECT_TRUE(updated_answer_options.has_video()); | 2363 EXPECT_TRUE(updated_answer_options.has_video()); |
| 2358 } | 2364 } |
| OLD | NEW |