Chromium Code Reviews| Index: webrtc/video/send_statistics_proxy_unittest.cc | 
| diff --git a/webrtc/video/send_statistics_proxy_unittest.cc b/webrtc/video/send_statistics_proxy_unittest.cc | 
| index 593c93b8e1aa859150ceacc39408a20e5c1a64e2..de9530a3f8f2dd420568b730fbc6ab9e46d54c05 100644 | 
| --- a/webrtc/video/send_statistics_proxy_unittest.cc | 
| +++ b/webrtc/video/send_statistics_proxy_unittest.cc | 
| @@ -65,6 +65,8 @@ class SendStatisticsProxyTest : public ::testing::Test { | 
| EXPECT_EQ(one.input_frame_rate, other.input_frame_rate); | 
| EXPECT_EQ(one.encode_frame_rate, other.encode_frame_rate); | 
| EXPECT_EQ(one.media_bitrate_bps, other.media_bitrate_bps); | 
| + EXPECT_EQ(one.preferred_media_bitrate_bps, | 
| + other.preferred_media_bitrate_bps); | 
| EXPECT_EQ(one.suspended, other.suspended); | 
| EXPECT_EQ(one.substreams.size(), other.substreams.size()); | 
| @@ -288,6 +290,18 @@ TEST_F(SendStatisticsProxyTest, OnEncodedFrameTimeMeasured) { | 
| EXPECT_EQ(metrics.encode_usage_percent, stats.encode_usage_percent); | 
| } | 
| +TEST_F(SendStatisticsProxyTest, OnEncoderReconfiguredChangePreferredBitrate) { | 
| + VideoSendStream::Stats stats = statistics_proxy_->GetStats(); | 
| + EXPECT_EQ(0, stats.preferred_media_bitrate_bps); | 
| + | 
| + VideoEncoderConfig config; | 
| + int preferred_media_bitrate_bps = 50; | 
| 
 
sprang_webrtc
2016/09/27 10:55:07
Maybe have this as named constant at the top, and
 
perkj_webrtc
2016/09/27 11:33:12
Done.
 
 | 
| + | 
| + statistics_proxy_->OnEncoderReconfigured(config, preferred_media_bitrate_bps); | 
| + stats = statistics_proxy_->GetStats(); | 
| + EXPECT_EQ(preferred_media_bitrate_bps, stats.preferred_media_bitrate_bps); | 
| +} | 
| + | 
| TEST_F(SendStatisticsProxyTest, SwitchContentTypeUpdatesHistograms) { | 
| const int kWidth = 640; | 
| const int kHeight = 480; | 
| @@ -295,13 +309,15 @@ TEST_F(SendStatisticsProxyTest, SwitchContentTypeUpdatesHistograms) { | 
| for (int i = 0; i < kMinRequiredSamples; ++i) | 
| statistics_proxy_->OnIncomingFrame(kWidth, kHeight); | 
| - // No switch, stats not should be updated. | 
| - statistics_proxy_->SetContentType( | 
| - VideoEncoderConfig::ContentType::kRealtimeVideo); | 
| + // No switch, stats should not be updated. | 
| + VideoEncoderConfig config; | 
| + config.content_type = VideoEncoderConfig::ContentType::kRealtimeVideo; | 
| + statistics_proxy_->OnEncoderReconfigured(config, 50); | 
| EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.InputWidthInPixels")); | 
| // Switch to screenshare, real-time stats should be updated. | 
| - statistics_proxy_->SetContentType(VideoEncoderConfig::ContentType::kScreen); | 
| + config.content_type = VideoEncoderConfig::ContentType::kScreen; | 
| + statistics_proxy_->OnEncoderReconfigured(config, 50); | 
| EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InputWidthInPixels")); | 
| } | 
| @@ -538,7 +554,9 @@ TEST_F(SendStatisticsProxyTest, ResetsRtcpCountersOnContentChange) { | 
| proxy->RtcpPacketTypesCounterUpdated(kSecondSsrc, counters); | 
| // Changing content type causes histograms to be reported. | 
| - statistics_proxy_->SetContentType(VideoEncoderConfig::ContentType::kScreen); | 
| + VideoEncoderConfig config; | 
| + config.content_type = VideoEncoderConfig::ContentType::kScreen; | 
| + statistics_proxy_->OnEncoderReconfigured(config, 50); | 
| EXPECT_EQ(1, | 
| metrics::NumSamples("WebRTC.Video.NackPacketsReceivedPerMinute")); | 
| @@ -633,7 +651,9 @@ TEST_F(SendStatisticsProxyTest, ResetsRtpCountersOnContentChange) { | 
| proxy->DataCountersUpdated(rtx_counters, kSecondRtxSsrc); | 
| // Changing content type causes histograms to be reported. | 
| - statistics_proxy_->SetContentType(VideoEncoderConfig::ContentType::kScreen); | 
| + VideoEncoderConfig config; | 
| + config.content_type = VideoEncoderConfig::ContentType::kScreen; | 
| + statistics_proxy_->OnEncoderReconfigured(config, 50); | 
| EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.BitrateSentInKbps")); | 
| EXPECT_EQ(1, |