| Index: chromecast/media/cma/backend/alsa/post_processors/saturated_gain_unittest.cc
|
| diff --git a/chromecast/media/cma/backend/alsa/post_processors/saturated_gain_unittest.cc b/chromecast/media/cma/backend/alsa/post_processors/saturated_gain_unittest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..5fc630ff345df3b1d25ffdf99e73db4503351401
|
| --- /dev/null
|
| +++ b/chromecast/media/cma/backend/alsa/post_processors/saturated_gain_unittest.cc
|
| @@ -0,0 +1,53 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include <string>
|
| +#include <vector>
|
| +
|
| +#include "base/memory/ptr_util.h"
|
| +#include "base/strings/stringprintf.h"
|
| +#include "chromecast/media/cma/backend/alsa/post_processors/post_processor_unittest.h"
|
| +#include "chromecast/media/cma/backend/alsa/post_processors/saturated_gain.h"
|
| +
|
| +namespace chromecast {
|
| +namespace media {
|
| +namespace post_processor_test {
|
| +
|
| +namespace {
|
| +
|
| +const char* kConfigTemplate =
|
| + R"config({"gain_db": %f})config";
|
| +
|
| +std::string MakeConfigString(float gain_db) {
|
| + return base::StringPrintf(kConfigTemplate, gain_db);
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| +// Default tests from post_processor_test
|
| +TEST_P(PostProcessorTest, TestDelay) {
|
| + std::string config = MakeConfigString(0.0);
|
| + auto pp =
|
| + base::WrapUnique(AudioPostProcessorShlib_Create(config, kNumChannels));
|
| + TestDelay(pp.get(), sample_rate_);
|
| +}
|
| +
|
| +TEST_P(PostProcessorTest, TestRinging) {
|
| + std::string config = MakeConfigString(0.0);
|
| + auto pp =
|
| + base::WrapUnique(AudioPostProcessorShlib_Create(config, kNumChannels));
|
| + TestRingingTime(pp.get(), sample_rate_);
|
| +}
|
| +
|
| +// Also tests clipping (by attempting to set gain way too high).
|
| +TEST_P(PostProcessorTest, TestPassthrough) {
|
| + std::string config = MakeConfigString(100.0);
|
| + auto pp =
|
| + base::WrapUnique(AudioPostProcessorShlib_Create(config, kNumChannels));
|
| + TestPassthrough(pp.get(), sample_rate_);
|
| +}
|
| +
|
| +} // namespace post_processor_test
|
| +} // namespace media
|
| +} // namespace chromecast
|
|
|