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

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

Issue 2793913008: Add PeerConnectionInterface::UpdateCallBitrate. (Closed)
Patch Set: Force update if current bitrate is set. Remove big lambda. Improve parameter validation. Created 3 years, 8 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 3268 matching lines...) Expand 10 before | Expand all | Expand 10 after
3279 std::unique_ptr<SessionDescriptionInterface> offer; 3279 std::unique_ptr<SessionDescriptionInterface> offer;
3280 ASSERT_TRUE(DoCreateOffer(&offer, nullptr)); 3280 ASSERT_TRUE(DoCreateOffer(&offer, nullptr));
3281 EXPECT_TRUE(DoSetRemoteDescription(offer.release())); 3281 EXPECT_TRUE(DoSetRemoteDescription(offer.release()));
3282 3282
3283 // Create and set answer as well. 3283 // Create and set answer as well.
3284 std::unique_ptr<SessionDescriptionInterface> answer; 3284 std::unique_ptr<SessionDescriptionInterface> answer;
3285 ASSERT_TRUE(DoCreateAnswer(&answer, nullptr)); 3285 ASSERT_TRUE(DoCreateAnswer(&answer, nullptr));
3286 EXPECT_TRUE(DoSetLocalDescription(answer.release())); 3286 EXPECT_TRUE(DoSetLocalDescription(answer.release()));
3287 } 3287 }
3288 3288
3289 TEST_F(PeerConnectionInterfaceTest, SetBitrateWithoutMinSucceeds) {
3290 CreatePeerConnection();
3291 PeerConnectionInterface::BitrateParameters bitrate;
3292 bitrate.current_bitrate_bps = rtc::Optional<int>(100000);
3293 EXPECT_TRUE(pc_->SetBitrate(bitrate).ok());
3294 }
3295
3296 TEST_F(PeerConnectionInterfaceTest, SetBitrateNegativeMinFails) {
3297 CreatePeerConnection();
3298 PeerConnectionInterface::BitrateParameters bitrate;
3299 bitrate.min_bitrate_bps = rtc::Optional<int>(-1);
3300 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3301 }
3302
3303 TEST_F(PeerConnectionInterfaceTest, SetBitrateCurrentLtMinFails) {
3304 CreatePeerConnection();
3305 PeerConnectionInterface::BitrateParameters bitrate;
3306 bitrate.min_bitrate_bps = rtc::Optional<int>(5);
3307 bitrate.current_bitrate_bps = rtc::Optional<int>(3);
3308 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3309 }
3310
3311 TEST_F(PeerConnectionInterfaceTest, SetBitrateCurrentNegativeFails) {
3312 CreatePeerConnection();
3313 PeerConnectionInterface::BitrateParameters bitrate;
3314 bitrate.current_bitrate_bps = rtc::Optional<int>(-1);
3315 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3316 }
3317
3318 TEST_F(PeerConnectionInterfaceTest, SetBitrateMaxLtCurrentFails) {
3319 CreatePeerConnection();
3320 PeerConnectionInterface::BitrateParameters bitrate;
3321 bitrate.current_bitrate_bps = rtc::Optional<int>(10);
3322 bitrate.max_bitrate_bps = rtc::Optional<int>(8);
3323 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3324 }
3325
3326 TEST_F(PeerConnectionInterfaceTest, SetBitrateMaxLtMinFails) {
3327 CreatePeerConnection();
3328 PeerConnectionInterface::BitrateParameters bitrate;
3329 bitrate.min_bitrate_bps = rtc::Optional<int>(10);
3330 bitrate.max_bitrate_bps = rtc::Optional<int>(8);
3331 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3332 }
3333
3334 TEST_F(PeerConnectionInterfaceTest, SetBitrateMaxNegativeFails) {
3335 CreatePeerConnection();
3336 PeerConnectionInterface::BitrateParameters bitrate;
3337 bitrate.max_bitrate_bps = rtc::Optional<int>(-1);
3338 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3339 }
3340
3341 // TODO(zstein): Test PeerConnectionInterface::SetBitrate's interaction with
3342 // Call::SetBitrateConfig
3343
3289 class PeerConnectionMediaConfigTest : public testing::Test { 3344 class PeerConnectionMediaConfigTest : public testing::Test {
3290 protected: 3345 protected:
3291 void SetUp() override { 3346 void SetUp() override {
3292 pcf_ = new rtc::RefCountedObject<PeerConnectionFactoryForTest>(); 3347 pcf_ = new rtc::RefCountedObject<PeerConnectionFactoryForTest>();
3293 pcf_->Initialize(); 3348 pcf_->Initialize();
3294 } 3349 }
3295 const cricket::MediaConfig& TestCreatePeerConnection( 3350 const cricket::MediaConfig& TestCreatePeerConnection(
3296 const PeerConnectionInterface::RTCConfiguration& config, 3351 const PeerConnectionInterface::RTCConfiguration& config,
3297 const MediaConstraintsInterface *constraints) { 3352 const MediaConstraintsInterface *constraints) {
3298 pcf_->create_media_controller_called_ = false; 3353 pcf_->create_media_controller_called_ = false;
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
3573 EXPECT_NE(a, f); 3628 EXPECT_NE(a, f);
3574 3629
3575 PeerConnectionInterface::RTCConfiguration g; 3630 PeerConnectionInterface::RTCConfiguration g;
3576 g.disable_ipv6 = true; 3631 g.disable_ipv6 = true;
3577 EXPECT_NE(a, g); 3632 EXPECT_NE(a, g);
3578 3633
3579 PeerConnectionInterface::RTCConfiguration h( 3634 PeerConnectionInterface::RTCConfiguration h(
3580 PeerConnectionInterface::RTCConfigurationType::kAggressive); 3635 PeerConnectionInterface::RTCConfigurationType::kAggressive);
3581 EXPECT_NE(a, h); 3636 EXPECT_NE(a, h);
3582 } 3637 }
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