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

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

Issue 2838233002: Add PeerConnectionInterface::UpdateCallBitrate with call tests. (Closed)
Patch Set: Only update start from SetBitrateConfig when it changes; some comments and logging. Created 3 years, 7 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/call/call.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 3279 matching lines...) Expand 10 before | Expand all | Expand 10 after
3290 std::unique_ptr<SessionDescriptionInterface> offer; 3290 std::unique_ptr<SessionDescriptionInterface> offer;
3291 ASSERT_TRUE(DoCreateOffer(&offer, nullptr)); 3291 ASSERT_TRUE(DoCreateOffer(&offer, nullptr));
3292 EXPECT_TRUE(DoSetRemoteDescription(offer.release())); 3292 EXPECT_TRUE(DoSetRemoteDescription(offer.release()));
3293 3293
3294 // Create and set answer as well. 3294 // Create and set answer as well.
3295 std::unique_ptr<SessionDescriptionInterface> answer; 3295 std::unique_ptr<SessionDescriptionInterface> answer;
3296 ASSERT_TRUE(DoCreateAnswer(&answer, nullptr)); 3296 ASSERT_TRUE(DoCreateAnswer(&answer, nullptr));
3297 EXPECT_TRUE(DoSetLocalDescription(answer.release())); 3297 EXPECT_TRUE(DoSetLocalDescription(answer.release()));
3298 } 3298 }
3299 3299
3300 TEST_F(PeerConnectionInterfaceTest, SetBitrateWithoutMinSucceeds) {
3301 CreatePeerConnection();
3302 PeerConnectionInterface::BitrateParameters bitrate;
3303 bitrate.current_bitrate_bps = rtc::Optional<int>(100000);
3304 EXPECT_TRUE(pc_->SetBitrate(bitrate).ok());
3305 }
3306
3307 TEST_F(PeerConnectionInterfaceTest, SetBitrateNegativeMinFails) {
3308 CreatePeerConnection();
3309 PeerConnectionInterface::BitrateParameters bitrate;
3310 bitrate.min_bitrate_bps = rtc::Optional<int>(-1);
3311 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3312 }
3313
3314 TEST_F(PeerConnectionInterfaceTest, SetBitrateCurrentLessThanMinFails) {
3315 CreatePeerConnection();
3316 PeerConnectionInterface::BitrateParameters bitrate;
3317 bitrate.min_bitrate_bps = rtc::Optional<int>(5);
3318 bitrate.current_bitrate_bps = rtc::Optional<int>(3);
3319 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3320 }
3321
3322 TEST_F(PeerConnectionInterfaceTest, SetBitrateCurrentNegativeFails) {
3323 CreatePeerConnection();
3324 PeerConnectionInterface::BitrateParameters bitrate;
3325 bitrate.current_bitrate_bps = rtc::Optional<int>(-1);
3326 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3327 }
3328
3329 TEST_F(PeerConnectionInterfaceTest, SetBitrateMaxLessThanCurrentFails) {
3330 CreatePeerConnection();
3331 PeerConnectionInterface::BitrateParameters bitrate;
3332 bitrate.current_bitrate_bps = rtc::Optional<int>(10);
3333 bitrate.max_bitrate_bps = rtc::Optional<int>(8);
3334 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3335 }
3336
3337 TEST_F(PeerConnectionInterfaceTest, SetBitrateMaxLessThanMinFails) {
3338 CreatePeerConnection();
3339 PeerConnectionInterface::BitrateParameters bitrate;
3340 bitrate.min_bitrate_bps = rtc::Optional<int>(10);
3341 bitrate.max_bitrate_bps = rtc::Optional<int>(8);
3342 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3343 }
3344
3345 TEST_F(PeerConnectionInterfaceTest, SetBitrateMaxNegativeFails) {
3346 CreatePeerConnection();
3347 PeerConnectionInterface::BitrateParameters bitrate;
3348 bitrate.max_bitrate_bps = rtc::Optional<int>(-1);
3349 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3350 }
3351
3352 // The current bitrate from Call's BitrateConfigMask is currently clamped by
3353 // Call's BitrateConfig, which comes from the SDP or a default value. This test
3354 // checks that a call to SetBitrate with a current bitrate that will be clamped
3355 // succeeds.
3356 TEST_F(PeerConnectionInterfaceTest, SetBitrateCurrentLessThanImplicitMin) {
3357 CreatePeerConnection();
3358 PeerConnectionInterface::BitrateParameters bitrate;
3359 bitrate.current_bitrate_bps = rtc::Optional<int>(1);
3360 EXPECT_TRUE(pc_->SetBitrate(bitrate).ok());
3361 }
3362
3300 class PeerConnectionMediaConfigTest : public testing::Test { 3363 class PeerConnectionMediaConfigTest : public testing::Test {
3301 protected: 3364 protected:
3302 void SetUp() override { 3365 void SetUp() override {
3303 pcf_ = new rtc::RefCountedObject<PeerConnectionFactoryForTest>(); 3366 pcf_ = new rtc::RefCountedObject<PeerConnectionFactoryForTest>();
3304 pcf_->Initialize(); 3367 pcf_->Initialize();
3305 } 3368 }
3306 const cricket::MediaConfig TestCreatePeerConnection( 3369 const cricket::MediaConfig TestCreatePeerConnection(
3307 const PeerConnectionInterface::RTCConfiguration& config, 3370 const PeerConnectionInterface::RTCConfiguration& config,
3308 const MediaConstraintsInterface *constraints) { 3371 const MediaConstraintsInterface *constraints) {
3309 3372
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
3582 EXPECT_NE(a, f); 3645 EXPECT_NE(a, f);
3583 3646
3584 PeerConnectionInterface::RTCConfiguration g; 3647 PeerConnectionInterface::RTCConfiguration g;
3585 g.disable_ipv6 = true; 3648 g.disable_ipv6 = true;
3586 EXPECT_NE(a, g); 3649 EXPECT_NE(a, g);
3587 3650
3588 PeerConnectionInterface::RTCConfiguration h( 3651 PeerConnectionInterface::RTCConfiguration h(
3589 PeerConnectionInterface::RTCConfigurationType::kAggressive); 3652 PeerConnectionInterface::RTCConfigurationType::kAggressive);
3590 EXPECT_NE(a, h); 3653 EXPECT_NE(a, h);
3591 } 3654 }
OLDNEW
« webrtc/call/call.cc ('K') | « webrtc/pc/peerconnection.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698