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

Side by Side Diff: webrtc/pc/peerconnectioninterface_unittest.cc

Issue 2888303005: Add PeerConnectionInterface::UpdateCallBitrate. (Closed)
Patch Set: Implement SetBitrate in PeerConnectionInterface to avoid breaking chromium mock. Created 3 years, 6 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
« webrtc/pc/peerconnection.cc ('K') | « webrtc/pc/peerconnection.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
3304 class PeerConnectionMediaConfigTest : public testing::Test { 3367 class PeerConnectionMediaConfigTest : public testing::Test {
3305 protected: 3368 protected:
3306 void SetUp() override { 3369 void SetUp() override {
3307 pcf_ = new rtc::RefCountedObject<PeerConnectionFactoryForTest>(); 3370 pcf_ = new rtc::RefCountedObject<PeerConnectionFactoryForTest>();
3308 pcf_->Initialize(); 3371 pcf_->Initialize();
3309 } 3372 }
3310 const cricket::MediaConfig TestCreatePeerConnection( 3373 const cricket::MediaConfig TestCreatePeerConnection(
3311 const PeerConnectionInterface::RTCConfiguration& config, 3374 const PeerConnectionInterface::RTCConfiguration& config,
3312 const MediaConstraintsInterface *constraints) { 3375 const MediaConstraintsInterface *constraints) {
3313 3376
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
3586 EXPECT_NE(a, f); 3649 EXPECT_NE(a, f);
3587 3650
3588 PeerConnectionInterface::RTCConfiguration g; 3651 PeerConnectionInterface::RTCConfiguration g;
3589 g.disable_ipv6 = true; 3652 g.disable_ipv6 = true;
3590 EXPECT_NE(a, g); 3653 EXPECT_NE(a, g);
3591 3654
3592 PeerConnectionInterface::RTCConfiguration h( 3655 PeerConnectionInterface::RTCConfiguration h(
3593 PeerConnectionInterface::RTCConfigurationType::kAggressive); 3656 PeerConnectionInterface::RTCConfigurationType::kAggressive);
3594 EXPECT_NE(a, h); 3657 EXPECT_NE(a, h);
3595 } 3658 }
OLDNEW
« webrtc/pc/peerconnection.cc ('K') | « webrtc/pc/peerconnection.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698