| 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 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2230 // the default OfferOptions are used. | 2230 // the default OfferOptions are used. |
| 2231 TEST(CreateSessionOptionsTest, GetDefaultMediaSessionOptionsForOffer) { | 2231 TEST(CreateSessionOptionsTest, GetDefaultMediaSessionOptionsForOffer) { |
| 2232 RTCOfferAnswerOptions rtc_options; | 2232 RTCOfferAnswerOptions rtc_options; |
| 2233 | 2233 |
| 2234 cricket::MediaSessionOptions options; | 2234 cricket::MediaSessionOptions options; |
| 2235 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); | 2235 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); |
| 2236 EXPECT_TRUE(options.has_audio()); | 2236 EXPECT_TRUE(options.has_audio()); |
| 2237 EXPECT_FALSE(options.has_video()); | 2237 EXPECT_FALSE(options.has_video()); |
| 2238 EXPECT_TRUE(options.bundle_enabled); | 2238 EXPECT_TRUE(options.bundle_enabled); |
| 2239 EXPECT_TRUE(options.vad_enabled); | 2239 EXPECT_TRUE(options.vad_enabled); |
| 2240 EXPECT_FALSE(options.transport_options.ice_restart); | 2240 EXPECT_FALSE(options.audio_ice_restart); |
| 2241 EXPECT_FALSE(options.video_ice_restart); |
| 2242 EXPECT_FALSE(options.data_ice_restart); |
| 2241 } | 2243 } |
| 2242 | 2244 |
| 2243 // Test that a correct MediaSessionOptions is created for an offer if | 2245 // Test that a correct MediaSessionOptions is created for an offer if |
| 2244 // OfferToReceiveVideo is set. | 2246 // OfferToReceiveVideo is set. |
| 2245 TEST(CreateSessionOptionsTest, GetMediaSessionOptionsForOfferWithVideo) { | 2247 TEST(CreateSessionOptionsTest, GetMediaSessionOptionsForOfferWithVideo) { |
| 2246 RTCOfferAnswerOptions rtc_options; | 2248 RTCOfferAnswerOptions rtc_options; |
| 2247 rtc_options.offer_to_receive_audio = 0; | 2249 rtc_options.offer_to_receive_audio = 0; |
| 2248 rtc_options.offer_to_receive_video = 1; | 2250 rtc_options.offer_to_receive_video = 1; |
| 2249 | 2251 |
| 2250 cricket::MediaSessionOptions options; | 2252 cricket::MediaSessionOptions options; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2272 | 2274 |
| 2273 // Test that a correct MediaSessionOptions is created to restart ice if | 2275 // Test that a correct MediaSessionOptions is created to restart ice if |
| 2274 // IceRestart is set. It also tests that subsequent MediaSessionOptions don't | 2276 // IceRestart is set. It also tests that subsequent MediaSessionOptions don't |
| 2275 // have |transport_options.ice_restart| set. | 2277 // have |transport_options.ice_restart| set. |
| 2276 TEST(CreateSessionOptionsTest, GetMediaSessionOptionsForOfferWithIceRestart) { | 2278 TEST(CreateSessionOptionsTest, GetMediaSessionOptionsForOfferWithIceRestart) { |
| 2277 RTCOfferAnswerOptions rtc_options; | 2279 RTCOfferAnswerOptions rtc_options; |
| 2278 rtc_options.ice_restart = true; | 2280 rtc_options.ice_restart = true; |
| 2279 | 2281 |
| 2280 cricket::MediaSessionOptions options; | 2282 cricket::MediaSessionOptions options; |
| 2281 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); | 2283 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); |
| 2282 EXPECT_TRUE(options.transport_options.ice_restart); | 2284 EXPECT_TRUE(options.audio_ice_restart); |
| 2285 EXPECT_TRUE(options.video_ice_restart); |
| 2286 EXPECT_TRUE(options.data_ice_restart); |
| 2283 | 2287 |
| 2284 rtc_options = RTCOfferAnswerOptions(); | 2288 rtc_options = RTCOfferAnswerOptions(); |
| 2285 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); | 2289 EXPECT_TRUE(ConvertRtcOptionsForOffer(rtc_options, &options)); |
| 2286 EXPECT_FALSE(options.transport_options.ice_restart); | 2290 EXPECT_FALSE(options.audio_ice_restart); |
| 2291 EXPECT_FALSE(options.video_ice_restart); |
| 2292 EXPECT_FALSE(options.data_ice_restart); |
| 2287 } | 2293 } |
| 2288 | 2294 |
| 2289 // Test that the MediaConstraints in an answer don't affect if audio and video | 2295 // Test that the MediaConstraints in an answer don't affect if audio and video |
| 2290 // is offered in an offer but that if kOfferToReceiveAudio or | 2296 // is offered in an offer but that if kOfferToReceiveAudio or |
| 2291 // kOfferToReceiveVideo constraints are true in an offer, the media type will be | 2297 // kOfferToReceiveVideo constraints are true in an offer, the media type will be |
| 2292 // included in subsequent answers. | 2298 // included in subsequent answers. |
| 2293 TEST(CreateSessionOptionsTest, MediaConstraintsInAnswer) { | 2299 TEST(CreateSessionOptionsTest, MediaConstraintsInAnswer) { |
| 2294 FakeConstraints answer_c; | 2300 FakeConstraints answer_c; |
| 2295 answer_c.SetMandatoryReceiveAudio(true); | 2301 answer_c.SetMandatoryReceiveAudio(true); |
| 2296 answer_c.SetMandatoryReceiveVideo(true); | 2302 answer_c.SetMandatoryReceiveVideo(true); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2325 FakeConstraints updated_answer_c; | 2331 FakeConstraints updated_answer_c; |
| 2326 answer_c.SetMandatoryReceiveAudio(false); | 2332 answer_c.SetMandatoryReceiveAudio(false); |
| 2327 answer_c.SetMandatoryReceiveVideo(false); | 2333 answer_c.SetMandatoryReceiveVideo(false); |
| 2328 | 2334 |
| 2329 cricket::MediaSessionOptions updated_answer_options; | 2335 cricket::MediaSessionOptions updated_answer_options; |
| 2330 EXPECT_TRUE( | 2336 EXPECT_TRUE( |
| 2331 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); | 2337 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); |
| 2332 EXPECT_TRUE(updated_answer_options.has_audio()); | 2338 EXPECT_TRUE(updated_answer_options.has_audio()); |
| 2333 EXPECT_TRUE(updated_answer_options.has_video()); | 2339 EXPECT_TRUE(updated_answer_options.has_video()); |
| 2334 } | 2340 } |
| OLD | NEW |