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

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

Issue 2838233002: Add PeerConnectionInterface::UpdateCallBitrate with call tests. (Closed)
Patch Set: Update PC test - this is okay now that we clamp. 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 TEST_F(PeerConnectionInterfaceTest, SetBitrateCurrentLessThanSdpMin) {
Taylor Brandstetter 2017/05/11 04:16:15 Can you leave a comment above this test explaining
Zach Stein 2017/05/11 21:43:09 I'm not sure this test actually belongs here as is
Taylor Brandstetter 2017/05/11 23:14:08 I'm fine with relying on the Call tests. But if yo
3353 CreatePeerConnection();
3354 PeerConnectionInterface::BitrateParameters bitrate;
3355 bitrate.current_bitrate_bps = rtc::Optional<int>(1);
3356 EXPECT_TRUE(pc_->SetBitrate(bitrate).ok());
3357 }
3358
3300 class PeerConnectionMediaConfigTest : public testing::Test { 3359 class PeerConnectionMediaConfigTest : public testing::Test {
3301 protected: 3360 protected:
3302 void SetUp() override { 3361 void SetUp() override {
3303 pcf_ = new rtc::RefCountedObject<PeerConnectionFactoryForTest>(); 3362 pcf_ = new rtc::RefCountedObject<PeerConnectionFactoryForTest>();
3304 pcf_->Initialize(); 3363 pcf_->Initialize();
3305 } 3364 }
3306 const cricket::MediaConfig TestCreatePeerConnection( 3365 const cricket::MediaConfig TestCreatePeerConnection(
3307 const PeerConnectionInterface::RTCConfiguration& config, 3366 const PeerConnectionInterface::RTCConfiguration& config,
3308 const MediaConstraintsInterface *constraints) { 3367 const MediaConstraintsInterface *constraints) {
3309 3368
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
3582 EXPECT_NE(a, f); 3641 EXPECT_NE(a, f);
3583 3642
3584 PeerConnectionInterface::RTCConfiguration g; 3643 PeerConnectionInterface::RTCConfiguration g;
3585 g.disable_ipv6 = true; 3644 g.disable_ipv6 = true;
3586 EXPECT_NE(a, g); 3645 EXPECT_NE(a, g);
3587 3646
3588 PeerConnectionInterface::RTCConfiguration h( 3647 PeerConnectionInterface::RTCConfiguration h(
3589 PeerConnectionInterface::RTCConfigurationType::kAggressive); 3648 PeerConnectionInterface::RTCConfigurationType::kAggressive);
3590 EXPECT_NE(a, h); 3649 EXPECT_NE(a, h);
3591 } 3650 }
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