Index: webrtc/common_audio/resampler/push_resampler_unittest.cc |
diff --git a/webrtc/common_audio/resampler/push_resampler_unittest.cc b/webrtc/common_audio/resampler/push_resampler_unittest.cc |
index 4449f4c633109afe24a61770268b9ed25e737b08..58880cc1b74a6cd479d748d94c278a93a5951eae 100644 |
--- a/webrtc/common_audio/resampler/push_resampler_unittest.cc |
+++ b/webrtc/common_audio/resampler/push_resampler_unittest.cc |
@@ -9,6 +9,7 @@ |
*/ |
#include "testing/gtest/include/gtest/gtest.h" |
+#include "webrtc/base/checks.h" // force defintion of RTC_DCHECK_IS_ON |
#include "webrtc/common_audio/resampler/include/push_resampler.h" |
// Quality testing of PushResampler is handled through output_mixer_unittest.cc. |
@@ -17,12 +18,32 @@ namespace webrtc { |
TEST(PushResamplerTest, VerifiesInputParameters) { |
PushResampler<int16_t> resampler; |
- EXPECT_EQ(-1, resampler.InitializeIfNeeded(-1, 16000, 1)); |
- EXPECT_EQ(-1, resampler.InitializeIfNeeded(16000, -1, 1)); |
- EXPECT_EQ(-1, resampler.InitializeIfNeeded(16000, 16000, 0)); |
- EXPECT_EQ(-1, resampler.InitializeIfNeeded(16000, 16000, 3)); |
EXPECT_EQ(0, resampler.InitializeIfNeeded(16000, 16000, 1)); |
EXPECT_EQ(0, resampler.InitializeIfNeeded(16000, 16000, 2)); |
} |
+#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) |
+TEST(PushResamplerTest, VerifiesBadInputParameters1) { |
+ PushResampler<int16_t> resampler; |
+ EXPECT_DEATH(resampler.InitializeIfNeeded(-1, 16000, 1), |
+ "src_sample_rate_hz"); |
+} |
+ |
+TEST(PushResamplerTest, VerifiesBadInputParameters2) { |
+ PushResampler<int16_t> resampler; |
+ EXPECT_DEATH(resampler.InitializeIfNeeded(16000, -1, 1), |
+ "dst_sample_rate_hz"); |
+} |
+ |
+TEST(PushResamplerTest, VerifiesBadInputParameters3) { |
+ PushResampler<int16_t> resampler; |
+ EXPECT_DEATH(resampler.InitializeIfNeeded(16000, 16000, 0), "num_channels"); |
+} |
+ |
+TEST(PushResamplerTest, VerifiesBadInputParameters4) { |
+ PushResampler<int16_t> resampler; |
+ EXPECT_DEATH(resampler.InitializeIfNeeded(16000, 16000, 3), "num_channels"); |
+} |
+#endif |
+ |
} // namespace webrtc |