Index: webrtc/modules/audio_coding/neteq/expand_unittest.cc |
diff --git a/webrtc/modules/audio_coding/neteq/expand_unittest.cc b/webrtc/modules/audio_coding/neteq/expand_unittest.cc |
index 1441704102dd41d8179d3ffc8d05a568fc1d43a3..3b0efb63d3a59af2cd55c08cf25b9eed702a9992 100644 |
--- a/webrtc/modules/audio_coding/neteq/expand_unittest.cc |
+++ b/webrtc/modules/audio_coding/neteq/expand_unittest.cc |
@@ -169,6 +169,38 @@ TEST_F(ExpandTest, CheckOutageStatsAfterReset) { |
statistics_.last_outage_duration_ms()); |
} |
+namespace { |
+// Runs expand until Muted() returns true. Times out after 1000 calls. |
+void ExpandUntilMuted(size_t num_channels, Expand* expand) { |
+ EXPECT_FALSE(expand->Muted()) << "Instance is muted from the start"; |
+ AudioMultiVector output(num_channels); |
+ int num_calls = 0; |
+ while (!expand->Muted()) { |
+ ASSERT_LT(num_calls++, 1000) << "Test timed out"; |
+ EXPECT_EQ(0, expand->Process(&output)); |
+ } |
+} |
+} // namespace |
+ |
+// Verifies that Muted() returns true after a long expand period. Also verifies |
+// that Muted() is reset to false after calling Reset(), |
+// SetParametersForMergeAfterExpand() and SetParametersForNormalAfterExpand(). |
+TEST_F(ExpandTest, Muted) { |
+ EXPECT_FALSE(expand_.Muted()); // Should start unmuted. |
minyue-webrtc
2016/05/10 11:43:12
not needed, since checked in 175 also.
hlundin-webrtc
2016/05/10 11:52:39
Done.
|
+ ExpandUntilMuted(num_channels_, &expand_); |
+ expand_.Reset(); |
+ EXPECT_FALSE(expand_.Muted()); // Should be back to unmuted. |
+ |
+ ExpandUntilMuted(num_channels_, &expand_); |
+ expand_.SetParametersForMergeAfterExpand(); |
+ EXPECT_FALSE(expand_.Muted()); // Should be back to unmuted. |
+ |
+ expand_.Reset(); // Must reset in order to start a new expand period. |
+ ExpandUntilMuted(num_channels_, &expand_); |
+ expand_.SetParametersForNormalAfterExpand(); |
+ EXPECT_FALSE(expand_.Muted()); // Should be back to unmuted. |
+} |
+ |
// TODO(hlundin): Write more tests. |
} // namespace webrtc |