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

Unified Diff: webrtc/common_audio/resampler/push_resampler_unittest.cc

Issue 2007563002: Adding a some checks and switching out a few assert for RTC_[D]CHECK. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Remove ExternalMixingResamplingToInvalidFrequenciesFails since voe_auto_test has multiple threads r… Created 4 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
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

Powered by Google App Engine
This is Rietveld 408576698