Index: webrtc/pc/peerconnectioninterface_unittest.cc |
diff --git a/webrtc/pc/peerconnectioninterface_unittest.cc b/webrtc/pc/peerconnectioninterface_unittest.cc |
index 8b8b49c7223fee5cf7f6998d7336156111fa8560..6b0e901d3b28968b4a4c7d106c814a2988142da2 100644 |
--- a/webrtc/pc/peerconnectioninterface_unittest.cc |
+++ b/webrtc/pc/peerconnectioninterface_unittest.cc |
@@ -3297,6 +3297,69 @@ TEST_F(PeerConnectionInterfaceTest, |
EXPECT_TRUE(DoSetLocalDescription(answer.release())); |
} |
+TEST_F(PeerConnectionInterfaceTest, SetBitrateWithoutMinSucceeds) { |
+ CreatePeerConnection(); |
+ PeerConnectionInterface::BitrateParameters bitrate; |
+ bitrate.current_bitrate_bps = rtc::Optional<int>(100000); |
+ EXPECT_TRUE(pc_->SetBitrate(bitrate).ok()); |
+} |
+ |
+TEST_F(PeerConnectionInterfaceTest, SetBitrateNegativeMinFails) { |
+ CreatePeerConnection(); |
+ PeerConnectionInterface::BitrateParameters bitrate; |
+ bitrate.min_bitrate_bps = rtc::Optional<int>(-1); |
+ EXPECT_FALSE(pc_->SetBitrate(bitrate).ok()); |
+} |
+ |
+TEST_F(PeerConnectionInterfaceTest, SetBitrateCurrentLessThanMinFails) { |
+ CreatePeerConnection(); |
+ PeerConnectionInterface::BitrateParameters bitrate; |
+ bitrate.min_bitrate_bps = rtc::Optional<int>(5); |
+ bitrate.current_bitrate_bps = rtc::Optional<int>(3); |
+ EXPECT_FALSE(pc_->SetBitrate(bitrate).ok()); |
+} |
+ |
+TEST_F(PeerConnectionInterfaceTest, SetBitrateCurrentNegativeFails) { |
+ CreatePeerConnection(); |
+ PeerConnectionInterface::BitrateParameters bitrate; |
+ bitrate.current_bitrate_bps = rtc::Optional<int>(-1); |
+ EXPECT_FALSE(pc_->SetBitrate(bitrate).ok()); |
+} |
+ |
+TEST_F(PeerConnectionInterfaceTest, SetBitrateMaxLessThanCurrentFails) { |
+ CreatePeerConnection(); |
+ PeerConnectionInterface::BitrateParameters bitrate; |
+ bitrate.current_bitrate_bps = rtc::Optional<int>(10); |
+ bitrate.max_bitrate_bps = rtc::Optional<int>(8); |
+ EXPECT_FALSE(pc_->SetBitrate(bitrate).ok()); |
+} |
+ |
+TEST_F(PeerConnectionInterfaceTest, SetBitrateMaxLessThanMinFails) { |
+ CreatePeerConnection(); |
+ PeerConnectionInterface::BitrateParameters bitrate; |
+ bitrate.min_bitrate_bps = rtc::Optional<int>(10); |
+ bitrate.max_bitrate_bps = rtc::Optional<int>(8); |
+ EXPECT_FALSE(pc_->SetBitrate(bitrate).ok()); |
+} |
+ |
+TEST_F(PeerConnectionInterfaceTest, SetBitrateMaxNegativeFails) { |
+ CreatePeerConnection(); |
+ PeerConnectionInterface::BitrateParameters bitrate; |
+ bitrate.max_bitrate_bps = rtc::Optional<int>(-1); |
+ EXPECT_FALSE(pc_->SetBitrate(bitrate).ok()); |
+} |
+ |
+// The current bitrate from Call's BitrateConfigMask is currently clamped by |
+// Call's BitrateConfig, which comes from the SDP or a default value. This test |
+// checks that a call to SetBitrate with a current bitrate that will be clamped |
+// succeeds. |
+TEST_F(PeerConnectionInterfaceTest, SetBitrateCurrentLessThanImplicitMin) { |
+ CreatePeerConnection(); |
+ PeerConnectionInterface::BitrateParameters bitrate; |
+ bitrate.current_bitrate_bps = rtc::Optional<int>(1); |
+ EXPECT_TRUE(pc_->SetBitrate(bitrate).ok()); |
+} |
+ |
class PeerConnectionMediaConfigTest : public testing::Test { |
protected: |
void SetUp() override { |