Chromium Code Reviews| Index: webrtc/modules/audio_processing/aec3/block_processor_unittest.cc |
| diff --git a/webrtc/modules/audio_processing/aec3/block_processor_unittest.cc b/webrtc/modules/audio_processing/aec3/block_processor_unittest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9dc266fef56ce9b3f761e0b1c4f6a30af965443b |
| --- /dev/null |
| +++ b/webrtc/modules/audio_processing/aec3/block_processor_unittest.cc |
| @@ -0,0 +1,46 @@ |
| +/* |
| + * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| + * |
| + * Use of this source code is governed by a BSD-style license |
| + * that can be found in the LICENSE file in the root of the source |
| + * tree. An additional intellectual property rights grant can be found |
| + * in the file PATENTS. All contributing project authors may |
| + * be found in the AUTHORS file in the root of the source tree. |
| + */ |
| + |
| +#include <memory> |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "webrtc/modules/audio_processing/aec3/aec3_constants.h" |
| +#include "webrtc/modules/audio_processing/aec3/block_processor.h" |
|
hlundin-webrtc
2016/12/22 10:23:56
This goes at the top.
peah-webrtc
2016/12/22 16:40:03
Done.
|
| +#include "webrtc/test/gtest.h" |
| + |
| +namespace webrtc { |
| +namespace { |
| + |
| +// Verifies that the basic BlockProcessor functionality works and that the API |
| +// methods are callable. |
| +void RunBasicSetupAndApiCallTest(int sample_rate_hz, size_t num_bands) { |
| + std::unique_ptr<BlockProcessor> block_processor( |
| + BlockProcessor::Create(sample_rate_hz, num_bands)); |
| + std::vector<std::vector<float>> block(num_bands, |
| + std::vector<float>(kBlockSize, 0.f)); |
| + |
| + EXPECT_FALSE(block_processor->BufferRender(&block)); |
| + block_processor->ProcessCapture(false, false, &block); |
| + block_processor->ReportEchoLeakage(false); |
| +} |
| + |
| +} // namespace |
| + |
| +TEST(BlockProcessor, BasicSetupAndApiCalls) { |
| + for (auto rate : {8000, 16000, 32000, 48000}) { |
| + std::ostringstream ss; |
| + ss << "Sample rate: " << rate; |
| + SCOPED_TRACE(ss.str()); |
| + RunBasicSetupAndApiCallTest(rate, NumBandsForRate(rate)); |
| + } |
| +} |
| + |
| +} // namespace webrtc |