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

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

Issue 2838233002: Add PeerConnectionInterface::UpdateCallBitrate with call tests. (Closed)
Patch Set: Style/test coverage feedback. No clamping yet. 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_unittest.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 3294 matching lines...) Expand 10 before | Expand all | Expand 10 after
3305 std::unique_ptr<SessionDescriptionInterface> offer; 3305 std::unique_ptr<SessionDescriptionInterface> offer;
3306 ASSERT_TRUE(DoCreateOffer(&offer, nullptr)); 3306 ASSERT_TRUE(DoCreateOffer(&offer, nullptr));
3307 EXPECT_TRUE(DoSetRemoteDescription(offer.release())); 3307 EXPECT_TRUE(DoSetRemoteDescription(offer.release()));
3308 3308
3309 // Create and set answer as well. 3309 // Create and set answer as well.
3310 std::unique_ptr<SessionDescriptionInterface> answer; 3310 std::unique_ptr<SessionDescriptionInterface> answer;
3311 ASSERT_TRUE(DoCreateAnswer(&answer, nullptr)); 3311 ASSERT_TRUE(DoCreateAnswer(&answer, nullptr));
3312 EXPECT_TRUE(DoSetLocalDescription(answer.release())); 3312 EXPECT_TRUE(DoSetLocalDescription(answer.release()));
3313 } 3313 }
3314 3314
3315 TEST_F(PeerConnectionInterfaceTest, SetBitrateWithoutMinSucceeds) {
3316 CreatePeerConnection();
3317 PeerConnectionInterface::BitrateParameters bitrate;
3318 bitrate.current_bitrate_bps = rtc::Optional<int>(100000);
3319 EXPECT_TRUE(pc_->SetBitrate(bitrate).ok());
3320 }
3321
3322 TEST_F(PeerConnectionInterfaceTest, SetBitrateNegativeMinFails) {
3323 CreatePeerConnection();
3324 PeerConnectionInterface::BitrateParameters bitrate;
3325 bitrate.min_bitrate_bps = rtc::Optional<int>(-1);
3326 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3327 }
3328
3329 TEST_F(PeerConnectionInterfaceTest, SetBitrateCurrentLessThanMinFails) {
3330 CreatePeerConnection();
3331 PeerConnectionInterface::BitrateParameters bitrate;
3332 bitrate.min_bitrate_bps = rtc::Optional<int>(5);
3333 bitrate.current_bitrate_bps = rtc::Optional<int>(3);
3334 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3335 }
3336
3337 TEST_F(PeerConnectionInterfaceTest, SetBitrateCurrentNegativeFails) {
3338 CreatePeerConnection();
3339 PeerConnectionInterface::BitrateParameters bitrate;
3340 bitrate.current_bitrate_bps = rtc::Optional<int>(-1);
3341 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3342 }
3343
3344 TEST_F(PeerConnectionInterfaceTest, SetBitrateMaxLessThanCurrentFails) {
3345 CreatePeerConnection();
3346 PeerConnectionInterface::BitrateParameters bitrate;
3347 bitrate.current_bitrate_bps = rtc::Optional<int>(10);
3348 bitrate.max_bitrate_bps = rtc::Optional<int>(8);
3349 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3350 }
3351
3352 TEST_F(PeerConnectionInterfaceTest, SetBitrateMaxLessThanMinFails) {
3353 CreatePeerConnection();
3354 PeerConnectionInterface::BitrateParameters bitrate;
3355 bitrate.min_bitrate_bps = rtc::Optional<int>(10);
3356 bitrate.max_bitrate_bps = rtc::Optional<int>(8);
3357 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3358 }
3359
3360 TEST_F(PeerConnectionInterfaceTest, SetBitrateMaxNegativeFails) {
3361 CreatePeerConnection();
3362 PeerConnectionInterface::BitrateParameters bitrate;
3363 bitrate.max_bitrate_bps = rtc::Optional<int>(-1);
3364 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3365 }
3366
3367 // TODO(zstein): Test PeerConnectionInterface::SetBitrate's interaction with
3368 // Call::SetBitrateConfig
3369
3370 TEST_F(PeerConnectionInterfaceTest, SetBitrateCurrentLessThanSdpMin) {
3371 CreatePeerConnection();
3372 PeerConnectionInterface::BitrateParameters bitrate;
3373 bitrate.current_bitrate_bps = rtc::Optional<int>(1);
3374 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3375 }
3376
3315 class PeerConnectionMediaConfigTest : public testing::Test { 3377 class PeerConnectionMediaConfigTest : public testing::Test {
3316 protected: 3378 protected:
3317 void SetUp() override { 3379 void SetUp() override {
3318 pcf_ = new rtc::RefCountedObject<PeerConnectionFactoryForTest>(); 3380 pcf_ = new rtc::RefCountedObject<PeerConnectionFactoryForTest>();
3319 pcf_->Initialize(); 3381 pcf_->Initialize();
3320 } 3382 }
3321 const cricket::MediaConfig& TestCreatePeerConnection( 3383 const cricket::MediaConfig& TestCreatePeerConnection(
3322 const PeerConnectionInterface::RTCConfiguration& config, 3384 const PeerConnectionInterface::RTCConfiguration& config,
3323 const MediaConstraintsInterface *constraints) { 3385 const MediaConstraintsInterface *constraints) {
3324 pcf_->create_media_controller_called_ = false; 3386 pcf_->create_media_controller_called_ = false;
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
3599 EXPECT_NE(a, f); 3661 EXPECT_NE(a, f);
3600 3662
3601 PeerConnectionInterface::RTCConfiguration g; 3663 PeerConnectionInterface::RTCConfiguration g;
3602 g.disable_ipv6 = true; 3664 g.disable_ipv6 = true;
3603 EXPECT_NE(a, g); 3665 EXPECT_NE(a, g);
3604 3666
3605 PeerConnectionInterface::RTCConfiguration h( 3667 PeerConnectionInterface::RTCConfiguration h(
3606 PeerConnectionInterface::RTCConfigurationType::kAggressive); 3668 PeerConnectionInterface::RTCConfigurationType::kAggressive);
3607 EXPECT_NE(a, h); 3669 EXPECT_NE(a, h);
3608 } 3670 }
OLDNEW
« webrtc/call/call_unittest.cc ('K') | « webrtc/pc/peerconnection.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698