andrew@webrtc.org | 50b2efe | 2013-04-29 17:27:29 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
kwiberg | ac9f876 | 2016-09-30 22:29:43 -0700 | [diff] [blame] | 11 | #include "webrtc/base/checks.h" // RTC_DCHECK_IS_ON |
andrew@webrtc.org | 50b2efe | 2013-04-29 17:27:29 +0000 | [diff] [blame] | 12 | #include "webrtc/common_audio/resampler/include/push_resampler.h" |
kwiberg | ac9f876 | 2016-09-30 22:29:43 -0700 | [diff] [blame] | 13 | #include "webrtc/test/gtest.h" |
andrew@webrtc.org | 50b2efe | 2013-04-29 17:27:29 +0000 | [diff] [blame] | 14 | |
| 15 | // Quality testing of PushResampler is handled through output_mixer_unittest.cc. |
| 16 | |
| 17 | namespace webrtc { |
| 18 | |
Tommi | 0ad72ea | 2016-05-26 23:07:40 +0200 | [diff] [blame] | 19 | // The below tests are temporarily disabled on WEBRTC_WIN due to problems |
| 20 | // with clang debug builds. |
Tommi | 90edc65 | 2016-05-26 23:48:16 +0200 | [diff] [blame] | 21 | // TODO(tommi): Re-enable when we've figured out what the problem is. |
| 22 | // http://crbug.com/615050 |
| 23 | #if !defined(WEBRTC_WIN) && defined(__clang__) && !defined(NDEBUG) |
andrew@webrtc.org | c1eb560 | 2013-06-03 19:00:29 +0000 | [diff] [blame] | 24 | TEST(PushResamplerTest, VerifiesInputParameters) { |
andrew@webrtc.org | f5a33f1 | 2014-04-19 00:32:07 +0000 | [diff] [blame] | 25 | PushResampler<int16_t> resampler; |
andrew@webrtc.org | c1eb560 | 2013-06-03 19:00:29 +0000 | [diff] [blame] | 26 | EXPECT_EQ(0, resampler.InitializeIfNeeded(16000, 16000, 1)); |
| 27 | EXPECT_EQ(0, resampler.InitializeIfNeeded(16000, 16000, 2)); |
andrew@webrtc.org | 50b2efe | 2013-04-29 17:27:29 +0000 | [diff] [blame] | 28 | } |
| 29 | |
Tommi | 0ad72ea | 2016-05-26 23:07:40 +0200 | [diff] [blame] | 30 | #if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) |
Tommi | f9d2fe9 | 2016-05-26 22:21:31 +0200 | [diff] [blame] | 31 | TEST(PushResamplerTest, VerifiesBadInputParameters1) { |
| 32 | PushResampler<int16_t> resampler; |
| 33 | EXPECT_DEATH(resampler.InitializeIfNeeded(-1, 16000, 1), |
| 34 | "src_sample_rate_hz"); |
| 35 | } |
| 36 | |
| 37 | TEST(PushResamplerTest, VerifiesBadInputParameters2) { |
| 38 | PushResampler<int16_t> resampler; |
| 39 | EXPECT_DEATH(resampler.InitializeIfNeeded(16000, -1, 1), |
| 40 | "dst_sample_rate_hz"); |
| 41 | } |
| 42 | |
| 43 | TEST(PushResamplerTest, VerifiesBadInputParameters3) { |
| 44 | PushResampler<int16_t> resampler; |
| 45 | EXPECT_DEATH(resampler.InitializeIfNeeded(16000, 16000, 0), "num_channels"); |
| 46 | } |
| 47 | |
| 48 | TEST(PushResamplerTest, VerifiesBadInputParameters4) { |
| 49 | PushResampler<int16_t> resampler; |
| 50 | EXPECT_DEATH(resampler.InitializeIfNeeded(16000, 16000, 3), "num_channels"); |
| 51 | } |
| 52 | #endif |
Tommi | 0ad72ea | 2016-05-26 23:07:40 +0200 | [diff] [blame] | 53 | #endif |
Tommi | f9d2fe9 | 2016-05-26 22:21:31 +0200 | [diff] [blame] | 54 | |
andrew@webrtc.org | 50b2efe | 2013-04-29 17:27:29 +0000 | [diff] [blame] | 55 | } // namespace webrtc |