blob: 9a5cb5defc79c94051b1ae2a9626d14bb1ea6ed9 [file] [log] [blame]
andrew@webrtc.org50b2efe2013-04-29 17:27:29 +00001/*
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
kwibergac9f8762016-09-30 22:29:43 -070011#include "webrtc/base/checks.h" // RTC_DCHECK_IS_ON
andrew@webrtc.org50b2efe2013-04-29 17:27:29 +000012#include "webrtc/common_audio/resampler/include/push_resampler.h"
kwibergac9f8762016-09-30 22:29:43 -070013#include "webrtc/test/gtest.h"
andrew@webrtc.org50b2efe2013-04-29 17:27:29 +000014
15// Quality testing of PushResampler is handled through output_mixer_unittest.cc.
16
17namespace webrtc {
18
Tommi0ad72ea2016-05-26 23:07:40 +020019// The below tests are temporarily disabled on WEBRTC_WIN due to problems
20// with clang debug builds.
Tommi90edc652016-05-26 23:48:16 +020021// 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.orgc1eb5602013-06-03 19:00:29 +000024TEST(PushResamplerTest, VerifiesInputParameters) {
andrew@webrtc.orgf5a33f12014-04-19 00:32:07 +000025 PushResampler<int16_t> resampler;
andrew@webrtc.orgc1eb5602013-06-03 19:00:29 +000026 EXPECT_EQ(0, resampler.InitializeIfNeeded(16000, 16000, 1));
27 EXPECT_EQ(0, resampler.InitializeIfNeeded(16000, 16000, 2));
andrew@webrtc.org50b2efe2013-04-29 17:27:29 +000028}
29
Tommi0ad72ea2016-05-26 23:07:40 +020030#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
Tommif9d2fe92016-05-26 22:21:31 +020031TEST(PushResamplerTest, VerifiesBadInputParameters1) {
32 PushResampler<int16_t> resampler;
33 EXPECT_DEATH(resampler.InitializeIfNeeded(-1, 16000, 1),
34 "src_sample_rate_hz");
35}
36
37TEST(PushResamplerTest, VerifiesBadInputParameters2) {
38 PushResampler<int16_t> resampler;
39 EXPECT_DEATH(resampler.InitializeIfNeeded(16000, -1, 1),
40 "dst_sample_rate_hz");
41}
42
43TEST(PushResamplerTest, VerifiesBadInputParameters3) {
44 PushResampler<int16_t> resampler;
45 EXPECT_DEATH(resampler.InitializeIfNeeded(16000, 16000, 0), "num_channels");
46}
47
48TEST(PushResamplerTest, VerifiesBadInputParameters4) {
49 PushResampler<int16_t> resampler;
50 EXPECT_DEATH(resampler.InitializeIfNeeded(16000, 16000, 3), "num_channels");
51}
52#endif
Tommi0ad72ea2016-05-26 23:07:40 +020053#endif
Tommif9d2fe92016-05-26 22:21:31 +020054
andrew@webrtc.org50b2efe2013-04-29 17:27:29 +000055} // namespace webrtc