| 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 1947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1958 SessionDescriptionInterface* answer = CreateAnswer(NULL); | 1958 SessionDescriptionInterface* answer = CreateAnswer(NULL); |
| 1959 ASSERT_TRUE(answer != NULL); | 1959 ASSERT_TRUE(answer != NULL); |
| 1960 VerifyFingerprintStatus(answer->description(), false); | 1960 VerifyFingerprintStatus(answer->description(), false); |
| 1961 // Check that we don't have an a=crypto line in the answer. | 1961 // Check that we don't have an a=crypto line in the answer. |
| 1962 VerifyNoCryptoParams(answer->description(), false); | 1962 VerifyNoCryptoParams(answer->description(), false); |
| 1963 | 1963 |
| 1964 // Now set the local description, which should work, even without a=crypto. | 1964 // Now set the local description, which should work, even without a=crypto. |
| 1965 SetLocalDescriptionWithoutError(answer); | 1965 SetLocalDescriptionWithoutError(answer); |
| 1966 } | 1966 } |
| 1967 | 1967 |
| 1968 // Test that we can create and set an answer correctly when different |
| 1969 // SSL roles have been negotiated for different transports. |
| 1970 // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=4525 |
| 1971 TEST_P(WebRtcSessionTest, TestCreateAnswerWithDifferentSslRoles) { |
| 1972 SendAudioVideoStream1(); |
| 1973 InitWithDtls(GetParam()); |
| 1974 SetFactoryDtlsSrtp(); |
| 1975 |
| 1976 SessionDescriptionInterface* offer = CreateOffer(); |
| 1977 SetLocalDescriptionWithoutError(offer); |
| 1978 |
| 1979 cricket::MediaSessionOptions options; |
| 1980 options.recv_video = true; |
| 1981 |
| 1982 SessionDescriptionInterface* answer = |
| 1983 CreateRemoteAnswer(offer, options, cricket::SEC_DISABLED); |
| 1984 TransportInfo* audio_transport_info = |
| 1985 answer->description()->GetTransportInfoByName("audio"); |
| 1986 audio_transport_info->description.connection_role = |
| 1987 cricket::CONNECTIONROLE_ACTIVE; |
| 1988 TransportInfo* video_transport_info = |
| 1989 answer->description()->GetTransportInfoByName("video"); |
| 1990 video_transport_info->description.connection_role = |
| 1991 cricket::CONNECTIONROLE_PASSIVE; |
| 1992 SetRemoteDescriptionWithoutError(answer); |
| 1993 |
| 1994 offer = CreateRemoteOfferWithVersion(options, cricket::SEC_DISABLED, |
| 1995 kSessionVersion, |
| 1996 session_->remote_description()); |
| 1997 SetRemoteDescriptionWithoutError(offer); |
| 1998 |
| 1999 answer = CreateAnswer(nullptr); |
| 2000 audio_transport_info = answer->description()->GetTransportInfoByName("audio"); |
| 2001 EXPECT_EQ(cricket::CONNECTIONROLE_PASSIVE, |
| 2002 audio_transport_info->description.connection_role); |
| 2003 video_transport_info = answer->description()->GetTransportInfoByName("video"); |
| 2004 EXPECT_EQ(cricket::CONNECTIONROLE_ACTIVE, |
| 2005 video_transport_info->description.connection_role); |
| 2006 SetLocalDescriptionWithoutError(answer); |
| 2007 } |
| 2008 |
| 1968 TEST_F(WebRtcSessionTest, TestSetLocalOfferTwice) { | 2009 TEST_F(WebRtcSessionTest, TestSetLocalOfferTwice) { |
| 1969 Init(); | 2010 Init(); |
| 1970 SendNothing(); | 2011 SendNothing(); |
| 1971 // SetLocalDescription take ownership of offer. | 2012 // SetLocalDescription take ownership of offer. |
| 1972 SessionDescriptionInterface* offer = CreateOffer(); | 2013 SessionDescriptionInterface* offer = CreateOffer(); |
| 1973 SetLocalDescriptionWithoutError(offer); | 2014 SetLocalDescriptionWithoutError(offer); |
| 1974 | 2015 |
| 1975 // SetLocalDescription take ownership of offer. | 2016 // SetLocalDescription take ownership of offer. |
| 1976 SessionDescriptionInterface* offer2 = CreateOffer(); | 2017 SessionDescriptionInterface* offer2 = CreateOffer(); |
| 1977 SetLocalDescriptionWithoutError(offer2); | 2018 SetLocalDescriptionWithoutError(offer2); |
| (...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3569 rtc::scoped_ptr<JsepSessionDescription> offer( | 3610 rtc::scoped_ptr<JsepSessionDescription> offer( |
| 3570 CreateRemoteOffer(options)); | 3611 CreateRemoteOffer(options)); |
| 3571 SetRemoteDescriptionWithoutError(offer.release()); | 3612 SetRemoteDescriptionWithoutError(offer.release()); |
| 3572 | 3613 |
| 3573 SendAudioVideoStream1(); | 3614 SendAudioVideoStream1(); |
| 3574 rtc::scoped_ptr<SessionDescriptionInterface> answer( | 3615 rtc::scoped_ptr<SessionDescriptionInterface> answer( |
| 3575 CreateAnswer(NULL)); | 3616 CreateAnswer(NULL)); |
| 3576 SetLocalDescriptionWithoutError(answer.release()); | 3617 SetLocalDescriptionWithoutError(answer.release()); |
| 3577 | 3618 |
| 3578 // Receive an offer with new ufrag and password. | 3619 // Receive an offer with new ufrag and password. |
| 3579 options.transport_options.ice_restart = true; | 3620 options.audio_transport_options.ice_restart = true; |
| 3621 options.video_transport_options.ice_restart = true; |
| 3622 options.data_transport_options.ice_restart = true; |
| 3580 rtc::scoped_ptr<JsepSessionDescription> updated_offer1( | 3623 rtc::scoped_ptr<JsepSessionDescription> updated_offer1( |
| 3581 CreateRemoteOffer(options, session_->remote_description())); | 3624 CreateRemoteOffer(options, session_->remote_description())); |
| 3582 SetRemoteDescriptionWithoutError(updated_offer1.release()); | 3625 SetRemoteDescriptionWithoutError(updated_offer1.release()); |
| 3583 | 3626 |
| 3584 rtc::scoped_ptr<SessionDescriptionInterface> updated_answer1( | 3627 rtc::scoped_ptr<SessionDescriptionInterface> updated_answer1( |
| 3585 CreateAnswer(NULL)); | 3628 CreateAnswer(NULL)); |
| 3586 | 3629 |
| 3587 CompareIceUfragAndPassword(updated_answer1->description(), | 3630 CompareIceUfragAndPassword(updated_answer1->description(), |
| 3588 session_->local_description()->description(), | 3631 session_->local_description()->description(), |
| 3589 false); | 3632 false); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 3600 rtc::scoped_ptr<JsepSessionDescription> offer( | 3643 rtc::scoped_ptr<JsepSessionDescription> offer( |
| 3601 CreateRemoteOffer(options)); | 3644 CreateRemoteOffer(options)); |
| 3602 SetRemoteDescriptionWithoutError(offer.release()); | 3645 SetRemoteDescriptionWithoutError(offer.release()); |
| 3603 | 3646 |
| 3604 SendAudioVideoStream1(); | 3647 SendAudioVideoStream1(); |
| 3605 rtc::scoped_ptr<SessionDescriptionInterface> answer( | 3648 rtc::scoped_ptr<SessionDescriptionInterface> answer( |
| 3606 CreateAnswer(NULL)); | 3649 CreateAnswer(NULL)); |
| 3607 SetLocalDescriptionWithoutError(answer.release()); | 3650 SetLocalDescriptionWithoutError(answer.release()); |
| 3608 | 3651 |
| 3609 // Receive an offer without changed ufrag or password. | 3652 // Receive an offer without changed ufrag or password. |
| 3610 options.transport_options.ice_restart = false; | 3653 options.audio_transport_options.ice_restart = false; |
| 3654 options.video_transport_options.ice_restart = false; |
| 3655 options.data_transport_options.ice_restart = false; |
| 3611 rtc::scoped_ptr<JsepSessionDescription> updated_offer2( | 3656 rtc::scoped_ptr<JsepSessionDescription> updated_offer2( |
| 3612 CreateRemoteOffer(options, session_->remote_description())); | 3657 CreateRemoteOffer(options, session_->remote_description())); |
| 3613 SetRemoteDescriptionWithoutError(updated_offer2.release()); | 3658 SetRemoteDescriptionWithoutError(updated_offer2.release()); |
| 3614 | 3659 |
| 3615 rtc::scoped_ptr<SessionDescriptionInterface> updated_answer2( | 3660 rtc::scoped_ptr<SessionDescriptionInterface> updated_answer2( |
| 3616 CreateAnswer(NULL)); | 3661 CreateAnswer(NULL)); |
| 3617 | 3662 |
| 3618 CompareIceUfragAndPassword(updated_answer2->description(), | 3663 CompareIceUfragAndPassword(updated_answer2->description(), |
| 3619 session_->local_description()->description(), | 3664 session_->local_description()->description(), |
| 3620 true); | 3665 true); |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4200 } | 4245 } |
| 4201 | 4246 |
| 4202 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test | 4247 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
| 4203 // currently fails because upon disconnection and reconnection OnIceComplete is | 4248 // currently fails because upon disconnection and reconnection OnIceComplete is |
| 4204 // called more than once without returning to IceGatheringGathering. | 4249 // called more than once without returning to IceGatheringGathering. |
| 4205 | 4250 |
| 4206 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, | 4251 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, |
| 4207 WebRtcSessionTest, | 4252 WebRtcSessionTest, |
| 4208 testing::Values(ALREADY_GENERATED, | 4253 testing::Values(ALREADY_GENERATED, |
| 4209 DTLS_IDENTITY_STORE)); | 4254 DTLS_IDENTITY_STORE)); |
| OLD | NEW |