blob: 6981f6d5108603f621848101832391f35ca4e583 [file] [log] [blame]
peahcf02cf12017-04-05 14:18:07 -07001/*
2 * Copyright (c) 2017 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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#include "modules/audio_processing/aec3/render_buffer.h"
peahcf02cf12017-04-05 14:18:07 -070012
13#include <algorithm>
14#include <functional>
15#include <vector>
16
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020017#include "test/gtest.h"
peahcf02cf12017-04-05 14:18:07 -070018
19namespace webrtc {
20
21#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
22
Per Åhgren8ba58612017-12-01 23:01:44 +010023// Verifies the check for non-null fft buffer.
24TEST(RenderBuffer, NullExternalFftBuffer) {
Sam Zackrissonf3f61592019-09-05 11:30:49 +020025 BlockBuffer block_buffer(10, 3, 1, kBlockSize);
Sam Zackrisson98872dc2019-10-18 08:20:09 +020026 SpectrumBuffer spectrum_buffer(10, 1);
Per Åhgrenec22e3f2017-12-20 15:20:37 +010027 EXPECT_DEATH(RenderBuffer(&block_buffer, &spectrum_buffer, nullptr), "");
peahcf02cf12017-04-05 14:18:07 -070028}
29
Per Åhgren8ba58612017-12-01 23:01:44 +010030// Verifies the check for non-null spectrum buffer.
31TEST(RenderBuffer, NullExternalSpectrumBuffer) {
Sam Zackrissoncfb94972019-09-05 15:03:07 +020032 FftBuffer fft_buffer(10, 1);
Sam Zackrissonf3f61592019-09-05 11:30:49 +020033 BlockBuffer block_buffer(10, 3, 1, kBlockSize);
Per Åhgrenec22e3f2017-12-20 15:20:37 +010034 EXPECT_DEATH(RenderBuffer(&block_buffer, nullptr, &fft_buffer), "");
peahcf02cf12017-04-05 14:18:07 -070035}
36
Per Åhgren8ba58612017-12-01 23:01:44 +010037// Verifies the check for non-null block buffer.
38TEST(RenderBuffer, NullExternalBlockBuffer) {
Sam Zackrissoncfb94972019-09-05 15:03:07 +020039 FftBuffer fft_buffer(10, 1);
Sam Zackrisson98872dc2019-10-18 08:20:09 +020040 SpectrumBuffer spectrum_buffer(10, 1);
Per Åhgrenec22e3f2017-12-20 15:20:37 +010041 EXPECT_DEATH(RenderBuffer(nullptr, &spectrum_buffer, &fft_buffer), "");
peahcf02cf12017-04-05 14:18:07 -070042}
43
44#endif
45
46} // namespace webrtc