| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 3283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3294 std::unique_ptr<SessionDescriptionInterface> offer; | 3294 std::unique_ptr<SessionDescriptionInterface> offer; |
| 3295 ASSERT_TRUE(DoCreateOffer(&offer, nullptr)); | 3295 ASSERT_TRUE(DoCreateOffer(&offer, nullptr)); |
| 3296 EXPECT_TRUE(DoSetRemoteDescription(offer.release())); | 3296 EXPECT_TRUE(DoSetRemoteDescription(offer.release())); |
| 3297 | 3297 |
| 3298 // Create and set answer as well. | 3298 // Create and set answer as well. |
| 3299 std::unique_ptr<SessionDescriptionInterface> answer; | 3299 std::unique_ptr<SessionDescriptionInterface> answer; |
| 3300 ASSERT_TRUE(DoCreateAnswer(&answer, nullptr)); | 3300 ASSERT_TRUE(DoCreateAnswer(&answer, nullptr)); |
| 3301 EXPECT_TRUE(DoSetLocalDescription(answer.release())); | 3301 EXPECT_TRUE(DoSetLocalDescription(answer.release())); |
| 3302 } | 3302 } |
| 3303 | 3303 |
| 3304 TEST_F(PeerConnectionInterfaceTest, SetBitrateWithoutMinSucceeds) { | |
| 3305 CreatePeerConnection(); | |
| 3306 PeerConnectionInterface::BitrateParameters bitrate; | |
| 3307 bitrate.current_bitrate_bps = rtc::Optional<int>(100000); | |
| 3308 EXPECT_TRUE(pc_->SetBitrate(bitrate).ok()); | |
| 3309 } | |
| 3310 | |
| 3311 TEST_F(PeerConnectionInterfaceTest, SetBitrateNegativeMinFails) { | |
| 3312 CreatePeerConnection(); | |
| 3313 PeerConnectionInterface::BitrateParameters bitrate; | |
| 3314 bitrate.min_bitrate_bps = rtc::Optional<int>(-1); | |
| 3315 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok()); | |
| 3316 } | |
| 3317 | |
| 3318 TEST_F(PeerConnectionInterfaceTest, SetBitrateCurrentLessThanMinFails) { | |
| 3319 CreatePeerConnection(); | |
| 3320 PeerConnectionInterface::BitrateParameters bitrate; | |
| 3321 bitrate.min_bitrate_bps = rtc::Optional<int>(5); | |
| 3322 bitrate.current_bitrate_bps = rtc::Optional<int>(3); | |
| 3323 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok()); | |
| 3324 } | |
| 3325 | |
| 3326 TEST_F(PeerConnectionInterfaceTest, SetBitrateCurrentNegativeFails) { | |
| 3327 CreatePeerConnection(); | |
| 3328 PeerConnectionInterface::BitrateParameters bitrate; | |
| 3329 bitrate.current_bitrate_bps = rtc::Optional<int>(-1); | |
| 3330 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok()); | |
| 3331 } | |
| 3332 | |
| 3333 TEST_F(PeerConnectionInterfaceTest, SetBitrateMaxLessThanCurrentFails) { | |
| 3334 CreatePeerConnection(); | |
| 3335 PeerConnectionInterface::BitrateParameters bitrate; | |
| 3336 bitrate.current_bitrate_bps = rtc::Optional<int>(10); | |
| 3337 bitrate.max_bitrate_bps = rtc::Optional<int>(8); | |
| 3338 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok()); | |
| 3339 } | |
| 3340 | |
| 3341 TEST_F(PeerConnectionInterfaceTest, SetBitrateMaxLessThanMinFails) { | |
| 3342 CreatePeerConnection(); | |
| 3343 PeerConnectionInterface::BitrateParameters bitrate; | |
| 3344 bitrate.min_bitrate_bps = rtc::Optional<int>(10); | |
| 3345 bitrate.max_bitrate_bps = rtc::Optional<int>(8); | |
| 3346 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok()); | |
| 3347 } | |
| 3348 | |
| 3349 TEST_F(PeerConnectionInterfaceTest, SetBitrateMaxNegativeFails) { | |
| 3350 CreatePeerConnection(); | |
| 3351 PeerConnectionInterface::BitrateParameters bitrate; | |
| 3352 bitrate.max_bitrate_bps = rtc::Optional<int>(-1); | |
| 3353 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok()); | |
| 3354 } | |
| 3355 | |
| 3356 // The current bitrate from Call's BitrateConfigMask is currently clamped by | |
| 3357 // Call's BitrateConfig, which comes from the SDP or a default value. This test | |
| 3358 // checks that a call to SetBitrate with a current bitrate that will be clamped | |
| 3359 // succeeds. | |
| 3360 TEST_F(PeerConnectionInterfaceTest, SetBitrateCurrentLessThanImplicitMin) { | |
| 3361 CreatePeerConnection(); | |
| 3362 PeerConnectionInterface::BitrateParameters bitrate; | |
| 3363 bitrate.current_bitrate_bps = rtc::Optional<int>(1); | |
| 3364 EXPECT_TRUE(pc_->SetBitrate(bitrate).ok()); | |
| 3365 } | |
| 3366 | |
| 3367 class PeerConnectionMediaConfigTest : public testing::Test { | 3304 class PeerConnectionMediaConfigTest : public testing::Test { |
| 3368 protected: | 3305 protected: |
| 3369 void SetUp() override { | 3306 void SetUp() override { |
| 3370 pcf_ = new rtc::RefCountedObject<PeerConnectionFactoryForTest>(); | 3307 pcf_ = new rtc::RefCountedObject<PeerConnectionFactoryForTest>(); |
| 3371 pcf_->Initialize(); | 3308 pcf_->Initialize(); |
| 3372 } | 3309 } |
| 3373 const cricket::MediaConfig TestCreatePeerConnection( | 3310 const cricket::MediaConfig TestCreatePeerConnection( |
| 3374 const PeerConnectionInterface::RTCConfiguration& config, | 3311 const PeerConnectionInterface::RTCConfiguration& config, |
| 3375 const MediaConstraintsInterface *constraints) { | 3312 const MediaConstraintsInterface *constraints) { |
| 3376 | 3313 |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3649 EXPECT_NE(a, f); | 3586 EXPECT_NE(a, f); |
| 3650 | 3587 |
| 3651 PeerConnectionInterface::RTCConfiguration g; | 3588 PeerConnectionInterface::RTCConfiguration g; |
| 3652 g.disable_ipv6 = true; | 3589 g.disable_ipv6 = true; |
| 3653 EXPECT_NE(a, g); | 3590 EXPECT_NE(a, g); |
| 3654 | 3591 |
| 3655 PeerConnectionInterface::RTCConfiguration h( | 3592 PeerConnectionInterface::RTCConfiguration h( |
| 3656 PeerConnectionInterface::RTCConfigurationType::kAggressive); | 3593 PeerConnectionInterface::RTCConfigurationType::kAggressive); |
| 3657 EXPECT_NE(a, h); | 3594 EXPECT_NE(a, h); |
| 3658 } | 3595 } |
| OLD | NEW |