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 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 scoped_ptr<JsepSessionDescription> offer( | 757 scoped_ptr<JsepSessionDescription> offer( |
758 CreateRemoteOffer(options, cricket::SEC_REQUIRED)); | 758 CreateRemoteOffer(options, cricket::SEC_REQUIRED)); |
759 ASSERT_TRUE(offer.get() != NULL); | 759 ASSERT_TRUE(offer.get() != NULL); |
760 VerifyCryptoParams(offer->description()); | 760 VerifyCryptoParams(offer->description()); |
761 SetRemoteDescriptionWithoutError(offer.release()); | 761 SetRemoteDescriptionWithoutError(offer.release()); |
762 scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer(NULL)); | 762 scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer(NULL)); |
763 ASSERT_TRUE(answer.get() != NULL); | 763 ASSERT_TRUE(answer.get() != NULL); |
764 VerifyCryptoParams(answer->description()); | 764 VerifyCryptoParams(answer->description()); |
765 } | 765 } |
766 | 766 |
767 void SetAndVerifyNumUnsignalledRecvStreams( | |
768 int value_set, int value_expected) { | |
769 constraints_.reset(new FakeConstraints()); | |
770 constraints_->AddOptional( | |
771 webrtc::MediaConstraintsInterface::kNumUnsignalledRecvStreams, | |
772 value_set); | |
773 session_.reset(); | |
774 Init(); | |
775 SendAudioVideoStream1(); | |
776 SessionDescriptionInterface* offer = CreateOffer(); | |
777 | |
778 SetLocalDescriptionWithoutError(offer); | |
779 | |
780 video_channel_ = media_engine_->GetVideoChannel(0); | |
781 | |
782 ASSERT_TRUE(video_channel_ != NULL); | |
783 const cricket::VideoOptions& video_options = video_channel_->options(); | |
784 EXPECT_EQ(value_expected, | |
785 video_options.unsignalled_recv_stream_limit.value_or(-1)); | |
786 } | |
787 | |
788 void CompareIceUfragAndPassword(const cricket::SessionDescription* desc1, | 767 void CompareIceUfragAndPassword(const cricket::SessionDescription* desc1, |
789 const cricket::SessionDescription* desc2, | 768 const cricket::SessionDescription* desc2, |
790 bool expect_equal) { | 769 bool expect_equal) { |
791 if (desc1->contents().size() != desc2->contents().size()) { | 770 if (desc1->contents().size() != desc2->contents().size()) { |
792 EXPECT_FALSE(expect_equal); | 771 EXPECT_FALSE(expect_equal); |
793 return; | 772 return; |
794 } | 773 } |
795 | 774 |
796 const cricket::ContentInfos& contents = desc1->contents(); | 775 const cricket::ContentInfos& contents = desc1->contents(); |
797 cricket::ContentInfos::const_iterator it = contents.begin(); | 776 cricket::ContentInfos::const_iterator it = contents.begin(); |
(...skipping 3329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4127 | 4106 |
4128 SetLocalDescriptionWithoutError(offer); | 4107 SetLocalDescriptionWithoutError(offer); |
4129 | 4108 |
4130 video_channel_ = media_engine_->GetVideoChannel(0); | 4109 video_channel_ = media_engine_->GetVideoChannel(0); |
4131 | 4110 |
4132 ASSERT_TRUE(video_channel_ != NULL); | 4111 ASSERT_TRUE(video_channel_ != NULL); |
4133 const cricket::VideoOptions& video_options = video_channel_->options(); | 4112 const cricket::VideoOptions& video_options = video_channel_->options(); |
4134 EXPECT_EQ(rtc::Optional<bool>(true), video_options.suspend_below_min_bitrate); | 4113 EXPECT_EQ(rtc::Optional<bool>(true), video_options.suspend_below_min_bitrate); |
4135 } | 4114 } |
4136 | 4115 |
4137 TEST_F(WebRtcSessionTest, TestNumUnsignalledRecvStreamsConstraint) { | |
4138 // Number of unsignalled receiving streams should be between 0 and | |
4139 // kMaxUnsignalledRecvStreams. | |
4140 SetAndVerifyNumUnsignalledRecvStreams(10, 10); | |
4141 SetAndVerifyNumUnsignalledRecvStreams(kMaxUnsignalledRecvStreams + 1, | |
4142 kMaxUnsignalledRecvStreams); | |
4143 SetAndVerifyNumUnsignalledRecvStreams(-1, 0); | |
4144 } | |
4145 | |
4146 TEST_F(WebRtcSessionTest, TestCombinedAudioVideoBweConstraint) { | 4116 TEST_F(WebRtcSessionTest, TestCombinedAudioVideoBweConstraint) { |
4147 constraints_.reset(new FakeConstraints()); | 4117 constraints_.reset(new FakeConstraints()); |
4148 constraints_->AddOptional( | 4118 constraints_->AddOptional( |
4149 webrtc::MediaConstraintsInterface::kCombinedAudioVideoBwe, | 4119 webrtc::MediaConstraintsInterface::kCombinedAudioVideoBwe, |
4150 true); | 4120 true); |
4151 Init(); | 4121 Init(); |
4152 SendAudioVideoStream1(); | 4122 SendAudioVideoStream1(); |
4153 SessionDescriptionInterface* offer = CreateOffer(); | 4123 SessionDescriptionInterface* offer = CreateOffer(); |
4154 | 4124 |
4155 SetLocalDescriptionWithoutError(offer); | 4125 SetLocalDescriptionWithoutError(offer); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4333 } | 4303 } |
4334 | 4304 |
4335 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test | 4305 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
4336 // currently fails because upon disconnection and reconnection OnIceComplete is | 4306 // currently fails because upon disconnection and reconnection OnIceComplete is |
4337 // called more than once without returning to IceGatheringGathering. | 4307 // called more than once without returning to IceGatheringGathering. |
4338 | 4308 |
4339 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, | 4309 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, |
4340 WebRtcSessionTest, | 4310 WebRtcSessionTest, |
4341 testing::Values(ALREADY_GENERATED, | 4311 testing::Values(ALREADY_GENERATED, |
4342 DTLS_IDENTITY_STORE)); | 4312 DTLS_IDENTITY_STORE)); |
OLD | NEW |