peah | cf02cf1 | 2017-04-05 14:18:07 -0700 | [diff] [blame] | 1 | /* |
| 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 Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #include "modules/audio_processing/aec3/render_buffer.h" |
peah | cf02cf1 | 2017-04-05 14:18:07 -0700 | [diff] [blame] | 12 | |
| 13 | #include <algorithm> |
| 14 | #include <functional> |
| 15 | #include <vector> |
| 16 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 17 | #include "test/gtest.h" |
peah | cf02cf1 | 2017-04-05 14:18:07 -0700 | [diff] [blame] | 18 | |
| 19 | namespace webrtc { |
| 20 | |
| 21 | #if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) |
| 22 | |
Per Åhgren | 8ba5861 | 2017-12-01 23:01:44 +0100 | [diff] [blame] | 23 | // Verifies the check for non-null fft buffer. |
| 24 | TEST(RenderBuffer, NullExternalFftBuffer) { |
| 25 | MatrixBuffer block_buffer(10, 3, kBlockSize); |
| 26 | VectorBuffer spectrum_buffer(10, kFftLengthBy2Plus1); |
| 27 | EXPECT_DEATH(RenderBuffer(1, &block_buffer, &spectrum_buffer, nullptr), ""); |
peah | cf02cf1 | 2017-04-05 14:18:07 -0700 | [diff] [blame] | 28 | } |
| 29 | |
Per Åhgren | 8ba5861 | 2017-12-01 23:01:44 +0100 | [diff] [blame] | 30 | // Verifies the check for non-null spectrum buffer. |
| 31 | TEST(RenderBuffer, NullExternalSpectrumBuffer) { |
| 32 | FftBuffer fft_buffer(10); |
| 33 | MatrixBuffer block_buffer(10, 3, kBlockSize); |
| 34 | EXPECT_DEATH(RenderBuffer(1, &block_buffer, nullptr, &fft_buffer), ""); |
peah | cf02cf1 | 2017-04-05 14:18:07 -0700 | [diff] [blame] | 35 | } |
| 36 | |
Per Åhgren | 8ba5861 | 2017-12-01 23:01:44 +0100 | [diff] [blame] | 37 | // Verifies the check for non-null block buffer. |
| 38 | TEST(RenderBuffer, NullExternalBlockBuffer) { |
| 39 | FftBuffer fft_buffer(10); |
| 40 | VectorBuffer spectrum_buffer(10, kFftLengthBy2Plus1); |
| 41 | EXPECT_DEATH(RenderBuffer(1, nullptr, &spectrum_buffer, &fft_buffer), ""); |
peah | cf02cf1 | 2017-04-05 14:18:07 -0700 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | #endif |
| 45 | |
| 46 | } // namespace webrtc |