Chromium Code Reviews

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

Issue 2838233002: Add PeerConnectionInterface::UpdateCallBitrate with call tests. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« 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 3269 matching lines...)
3280 std::unique_ptr<SessionDescriptionInterface> offer; 3280 std::unique_ptr<SessionDescriptionInterface> offer;
3281 ASSERT_TRUE(DoCreateOffer(&offer, nullptr)); 3281 ASSERT_TRUE(DoCreateOffer(&offer, nullptr));
3282 EXPECT_TRUE(DoSetRemoteDescription(offer.release())); 3282 EXPECT_TRUE(DoSetRemoteDescription(offer.release()));
3283 3283
3284 // Create and set answer as well. 3284 // Create and set answer as well.
3285 std::unique_ptr<SessionDescriptionInterface> answer; 3285 std::unique_ptr<SessionDescriptionInterface> answer;
3286 ASSERT_TRUE(DoCreateAnswer(&answer, nullptr)); 3286 ASSERT_TRUE(DoCreateAnswer(&answer, nullptr));
3287 EXPECT_TRUE(DoSetLocalDescription(answer.release())); 3287 EXPECT_TRUE(DoSetLocalDescription(answer.release()));
3288 } 3288 }
3289 3289
3290 TEST_F(PeerConnectionInterfaceTest, SetBitrateWithoutMinSucceeds) {
3291 CreatePeerConnection();
3292 PeerConnectionInterface::BitrateParameters bitrate;
3293 bitrate.current_bitrate_bps = rtc::Optional<int>(100000);
3294 EXPECT_TRUE(pc_->SetBitrate(bitrate).ok());
3295 }
3296
3297 TEST_F(PeerConnectionInterfaceTest, SetBitrateNegativeMinFails) {
3298 CreatePeerConnection();
3299 PeerConnectionInterface::BitrateParameters bitrate;
3300 bitrate.min_bitrate_bps = rtc::Optional<int>(-1);
3301 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3302 }
3303
3304 TEST_F(PeerConnectionInterfaceTest, SetBitrateCurrentLtMinFails) {
Taylor_Brandstetter 2017/04/26 15:46:11 nit: I'd spell out "LessThan".
Zach Stein 2017/05/04 22:32:44 Done.
3305 CreatePeerConnection();
3306 PeerConnectionInterface::BitrateParameters bitrate;
3307 bitrate.min_bitrate_bps = rtc::Optional<int>(5);
3308 bitrate.current_bitrate_bps = rtc::Optional<int>(3);
3309 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3310 }
3311
3312 TEST_F(PeerConnectionInterfaceTest, SetBitrateCurrentNegativeFails) {
3313 CreatePeerConnection();
3314 PeerConnectionInterface::BitrateParameters bitrate;
3315 bitrate.current_bitrate_bps = rtc::Optional<int>(-1);
3316 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3317 }
3318
3319 TEST_F(PeerConnectionInterfaceTest, SetBitrateMaxLtCurrentFails) {
3320 CreatePeerConnection();
3321 PeerConnectionInterface::BitrateParameters bitrate;
3322 bitrate.current_bitrate_bps = rtc::Optional<int>(10);
3323 bitrate.max_bitrate_bps = rtc::Optional<int>(8);
3324 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3325 }
3326
3327 TEST_F(PeerConnectionInterfaceTest, SetBitrateMaxLtMinFails) {
3328 CreatePeerConnection();
3329 PeerConnectionInterface::BitrateParameters bitrate;
3330 bitrate.min_bitrate_bps = rtc::Optional<int>(10);
3331 bitrate.max_bitrate_bps = rtc::Optional<int>(8);
3332 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3333 }
3334
3335 TEST_F(PeerConnectionInterfaceTest, SetBitrateMaxNegativeFails) {
3336 CreatePeerConnection();
3337 PeerConnectionInterface::BitrateParameters bitrate;
3338 bitrate.max_bitrate_bps = rtc::Optional<int>(-1);
3339 EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
3340 }
3341
3342 // TODO(zstein): Test PeerConnectionInterface::SetBitrate's interaction with
3343 // Call::SetBitrateConfig
3344
3290 class PeerConnectionMediaConfigTest : public testing::Test { 3345 class PeerConnectionMediaConfigTest : public testing::Test {
3291 protected: 3346 protected:
3292 void SetUp() override { 3347 void SetUp() override {
3293 pcf_ = new rtc::RefCountedObject<PeerConnectionFactoryForTest>(); 3348 pcf_ = new rtc::RefCountedObject<PeerConnectionFactoryForTest>();
3294 pcf_->Initialize(); 3349 pcf_->Initialize();
3295 } 3350 }
3296 const cricket::MediaConfig& TestCreatePeerConnection( 3351 const cricket::MediaConfig& TestCreatePeerConnection(
3297 const PeerConnectionInterface::RTCConfiguration& config, 3352 const PeerConnectionInterface::RTCConfiguration& config,
3298 const MediaConstraintsInterface *constraints) { 3353 const MediaConstraintsInterface *constraints) {
3299 pcf_->create_media_controller_called_ = false; 3354 pcf_->create_media_controller_called_ = false;
(...skipping 274 matching lines...)
3574 EXPECT_NE(a, f); 3629 EXPECT_NE(a, f);
3575 3630
3576 PeerConnectionInterface::RTCConfiguration g; 3631 PeerConnectionInterface::RTCConfiguration g;
3577 g.disable_ipv6 = true; 3632 g.disable_ipv6 = true;
3578 EXPECT_NE(a, g); 3633 EXPECT_NE(a, g);
3579 3634
3580 PeerConnectionInterface::RTCConfiguration h( 3635 PeerConnectionInterface::RTCConfiguration h(
3581 PeerConnectionInterface::RTCConfigurationType::kAggressive); 3636 PeerConnectionInterface::RTCConfigurationType::kAggressive);
3582 EXPECT_NE(a, h); 3637 EXPECT_NE(a, h);
3583 } 3638 }
OLDNEW
« webrtc/pc/peerconnection.cc ('K') | « webrtc/pc/peerconnection.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine