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

Unified Diff: webrtc/pc/peerconnectioninterface_unittest.cc

Issue 2888303005: Add PeerConnectionInterface::UpdateCallBitrate. (Closed)
Patch Set: Implement SetBitrate in PeerConnectionInterface to avoid breaking chromium mock. 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 side-by-side diff with in-line comments
Download patch
« webrtc/pc/peerconnection.cc ('K') | « webrtc/pc/peerconnection.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/peerconnectioninterface_unittest.cc
diff --git a/webrtc/pc/peerconnectioninterface_unittest.cc b/webrtc/pc/peerconnectioninterface_unittest.cc
index d0e42621cffdeab915e6e4e9fbef0821dcd5b749..f8d9ef60208e0b81786012dc6e734f8547d7d5ab 100644
--- a/webrtc/pc/peerconnectioninterface_unittest.cc
+++ b/webrtc/pc/peerconnectioninterface_unittest.cc
@@ -3301,6 +3301,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 {
« webrtc/pc/peerconnection.cc ('K') | « webrtc/pc/peerconnection.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698