Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: talk/app/webrtc/webrtcsession_unittest.cc

Issue 1516993002: Properly handle different transports having different SSL roles. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing merge conflicts. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after
1950 SessionDescriptionInterface* answer = CreateAnswer(NULL); 1950 SessionDescriptionInterface* answer = CreateAnswer(NULL);
1951 ASSERT_TRUE(answer != NULL); 1951 ASSERT_TRUE(answer != NULL);
1952 VerifyFingerprintStatus(answer->description(), false); 1952 VerifyFingerprintStatus(answer->description(), false);
1953 // Check that we don't have an a=crypto line in the answer. 1953 // Check that we don't have an a=crypto line in the answer.
1954 VerifyNoCryptoParams(answer->description(), false); 1954 VerifyNoCryptoParams(answer->description(), false);
1955 1955
1956 // Now set the local description, which should work, even without a=crypto. 1956 // Now set the local description, which should work, even without a=crypto.
1957 SetLocalDescriptionWithoutError(answer); 1957 SetLocalDescriptionWithoutError(answer);
1958 } 1958 }
1959 1959
1960 // Test that we can create and set an answer correctly when different
1961 // SSL roles have been negotiated for different transports.
1962 // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=4525
1963 TEST_P(WebRtcSessionTest, TestCreateAnswerWithDifferentSslRoles) {
1964 SendAudioVideoStream1();
1965 InitWithDtls(GetParam());
1966 SetFactoryDtlsSrtp();
1967
1968 SessionDescriptionInterface* offer = CreateOffer();
1969 SetLocalDescriptionWithoutError(offer);
1970
1971 cricket::MediaSessionOptions options;
1972 options.recv_video = true;
1973
1974 // First, negotiate different SSL roles.
1975 SessionDescriptionInterface* answer =
1976 CreateRemoteAnswer(offer, options, cricket::SEC_DISABLED);
1977 TransportInfo* audio_transport_info =
1978 answer->description()->GetTransportInfoByName("audio");
1979 audio_transport_info->description.connection_role =
1980 cricket::CONNECTIONROLE_ACTIVE;
1981 TransportInfo* video_transport_info =
1982 answer->description()->GetTransportInfoByName("video");
1983 video_transport_info->description.connection_role =
1984 cricket::CONNECTIONROLE_PASSIVE;
1985 SetRemoteDescriptionWithoutError(answer);
1986
1987 // Now create an offer in the reverse direction, and ensure the initial
1988 // offerer responds with an answer with correct SSL roles.
1989 offer = CreateRemoteOfferWithVersion(options, cricket::SEC_DISABLED,
1990 kSessionVersion,
1991 session_->remote_description());
1992 SetRemoteDescriptionWithoutError(offer);
1993
1994 answer = CreateAnswer(nullptr);
1995 audio_transport_info = answer->description()->GetTransportInfoByName("audio");
1996 EXPECT_EQ(cricket::CONNECTIONROLE_PASSIVE,
1997 audio_transport_info->description.connection_role);
1998 video_transport_info = answer->description()->GetTransportInfoByName("video");
1999 EXPECT_EQ(cricket::CONNECTIONROLE_ACTIVE,
2000 video_transport_info->description.connection_role);
2001 SetLocalDescriptionWithoutError(answer);
2002
2003 // Lastly, start BUNDLE-ing on "audio", expecting that the "passive" role of
2004 // audio is transferred over to video in the answer that completes the BUNDLE
2005 // negotiation.
2006 options.bundle_enabled = true;
2007 offer = CreateRemoteOfferWithVersion(options, cricket::SEC_DISABLED,
2008 kSessionVersion,
2009 session_->remote_description());
2010 SetRemoteDescriptionWithoutError(offer);
2011 answer = CreateAnswer(nullptr);
2012 audio_transport_info = answer->description()->GetTransportInfoByName("audio");
2013 EXPECT_EQ(cricket::CONNECTIONROLE_PASSIVE,
2014 audio_transport_info->description.connection_role);
2015 video_transport_info = answer->description()->GetTransportInfoByName("video");
2016 EXPECT_EQ(cricket::CONNECTIONROLE_PASSIVE,
2017 video_transport_info->description.connection_role);
2018 SetLocalDescriptionWithoutError(answer);
2019 }
2020
1960 TEST_F(WebRtcSessionTest, TestSetLocalOfferTwice) { 2021 TEST_F(WebRtcSessionTest, TestSetLocalOfferTwice) {
1961 Init(); 2022 Init();
1962 SendNothing(); 2023 SendNothing();
1963 // SetLocalDescription take ownership of offer. 2024 // SetLocalDescription take ownership of offer.
1964 SessionDescriptionInterface* offer = CreateOffer(); 2025 SessionDescriptionInterface* offer = CreateOffer();
1965 SetLocalDescriptionWithoutError(offer); 2026 SetLocalDescriptionWithoutError(offer);
1966 2027
1967 // SetLocalDescription take ownership of offer. 2028 // SetLocalDescription take ownership of offer.
1968 SessionDescriptionInterface* offer2 = CreateOffer(); 2029 SessionDescriptionInterface* offer2 = CreateOffer();
1969 SetLocalDescriptionWithoutError(offer2); 2030 SetLocalDescriptionWithoutError(offer2);
(...skipping 1648 matching lines...) Expand 10 before | Expand all | Expand 10 after
3618 rtc::scoped_ptr<JsepSessionDescription> offer( 3679 rtc::scoped_ptr<JsepSessionDescription> offer(
3619 CreateRemoteOffer(options)); 3680 CreateRemoteOffer(options));
3620 SetRemoteDescriptionWithoutError(offer.release()); 3681 SetRemoteDescriptionWithoutError(offer.release());
3621 3682
3622 SendAudioVideoStream1(); 3683 SendAudioVideoStream1();
3623 rtc::scoped_ptr<SessionDescriptionInterface> answer( 3684 rtc::scoped_ptr<SessionDescriptionInterface> answer(
3624 CreateAnswer(NULL)); 3685 CreateAnswer(NULL));
3625 SetLocalDescriptionWithoutError(answer.release()); 3686 SetLocalDescriptionWithoutError(answer.release());
3626 3687
3627 // Receive an offer with new ufrag and password. 3688 // Receive an offer with new ufrag and password.
3628 options.transport_options.ice_restart = true; 3689 options.audio_transport_options.ice_restart = true;
3690 options.video_transport_options.ice_restart = true;
3691 options.data_transport_options.ice_restart = true;
3629 rtc::scoped_ptr<JsepSessionDescription> updated_offer1( 3692 rtc::scoped_ptr<JsepSessionDescription> updated_offer1(
3630 CreateRemoteOffer(options, session_->remote_description())); 3693 CreateRemoteOffer(options, session_->remote_description()));
3631 SetRemoteDescriptionWithoutError(updated_offer1.release()); 3694 SetRemoteDescriptionWithoutError(updated_offer1.release());
3632 3695
3633 rtc::scoped_ptr<SessionDescriptionInterface> updated_answer1( 3696 rtc::scoped_ptr<SessionDescriptionInterface> updated_answer1(
3634 CreateAnswer(NULL)); 3697 CreateAnswer(NULL));
3635 3698
3636 CompareIceUfragAndPassword(updated_answer1->description(), 3699 CompareIceUfragAndPassword(updated_answer1->description(),
3637 session_->local_description()->description(), 3700 session_->local_description()->description(),
3638 false); 3701 false);
(...skipping 10 matching lines...) Expand all
3649 rtc::scoped_ptr<JsepSessionDescription> offer( 3712 rtc::scoped_ptr<JsepSessionDescription> offer(
3650 CreateRemoteOffer(options)); 3713 CreateRemoteOffer(options));
3651 SetRemoteDescriptionWithoutError(offer.release()); 3714 SetRemoteDescriptionWithoutError(offer.release());
3652 3715
3653 SendAudioVideoStream1(); 3716 SendAudioVideoStream1();
3654 rtc::scoped_ptr<SessionDescriptionInterface> answer( 3717 rtc::scoped_ptr<SessionDescriptionInterface> answer(
3655 CreateAnswer(NULL)); 3718 CreateAnswer(NULL));
3656 SetLocalDescriptionWithoutError(answer.release()); 3719 SetLocalDescriptionWithoutError(answer.release());
3657 3720
3658 // Receive an offer without changed ufrag or password. 3721 // Receive an offer without changed ufrag or password.
3659 options.transport_options.ice_restart = false; 3722 options.audio_transport_options.ice_restart = false;
3723 options.video_transport_options.ice_restart = false;
3724 options.data_transport_options.ice_restart = false;
3660 rtc::scoped_ptr<JsepSessionDescription> updated_offer2( 3725 rtc::scoped_ptr<JsepSessionDescription> updated_offer2(
3661 CreateRemoteOffer(options, session_->remote_description())); 3726 CreateRemoteOffer(options, session_->remote_description()));
3662 SetRemoteDescriptionWithoutError(updated_offer2.release()); 3727 SetRemoteDescriptionWithoutError(updated_offer2.release());
3663 3728
3664 rtc::scoped_ptr<SessionDescriptionInterface> updated_answer2( 3729 rtc::scoped_ptr<SessionDescriptionInterface> updated_answer2(
3665 CreateAnswer(NULL)); 3730 CreateAnswer(NULL));
3666 3731
3667 CompareIceUfragAndPassword(updated_answer2->description(), 3732 CompareIceUfragAndPassword(updated_answer2->description(),
3668 session_->local_description()->description(), 3733 session_->local_description()->description(),
3669 true); 3734 true);
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
4249 } 4314 }
4250 4315
4251 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test 4316 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test
4252 // currently fails because upon disconnection and reconnection OnIceComplete is 4317 // currently fails because upon disconnection and reconnection OnIceComplete is
4253 // called more than once without returning to IceGatheringGathering. 4318 // called more than once without returning to IceGatheringGathering.
4254 4319
4255 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, 4320 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests,
4256 WebRtcSessionTest, 4321 WebRtcSessionTest,
4257 testing::Values(ALREADY_GENERATED, 4322 testing::Values(ALREADY_GENERATED,
4258 DTLS_IDENTITY_STORE)); 4323 DTLS_IDENTITY_STORE));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698