Index: media/base/channel_mixer_unittest.cc |
diff --git a/media/base/channel_mixer_unittest.cc b/media/base/channel_mixer_unittest.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ce7db0a4870781c39a4c590946ab1356c0497292 |
--- /dev/null |
+++ b/media/base/channel_mixer_unittest.cc |
@@ -0,0 +1,32 @@ |
+// Copyright (c) 2012 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 "media/base/audio_bus.h" |
+#include "media/base/channel_mixer.h" |
+#include "testing/gtest/include/gtest/gtest.h" |
+ |
+namespace media { |
+ |
+// Test flush resets the internal state properly. |
+TEST(ChannelMixerTest, Construction) { |
+ static const int kFrames = 16; |
+ |
+ for (ChannelLayout input_layout = CHANNEL_LAYOUT_MONO; |
+ input_layout < CHANNEL_LAYOUT_MAX; input_layout++) { |
+ for (ChannelLayout output_layout = CHANNEL_LAYOUT_MONO; |
+ output_layout < CHANNEL_LAYOUT_STEREO_DOWNMIX; output_layout++) { |
+ ChannelMixer mixer(input_layout, output_layout); |
scherkus (not reviewing)
2012/10/18 01:30:39
should consider using SCOPED_TRACE() to document t
DaleCurtis
2012/10/18 05:22:04
Done.
|
+ scoped_ptr<AudioBus> input_bus = AudioBus::Create( |
+ ChannelLayoutToChannelCount(input_layout), kFrames); |
+ scoped_ptr<AudioBus> output_bus = AudioBus::Create( |
+ ChannelLayoutToChannelCount(output_layout), kFrames); |
+ for(int ch = 0; ch < input_bus->channels(); ++ch) |
+ std::fill(input_bus->channel(ch), input_bus->channel(ch) + kFrames, 1); |
+ |
+ mixer.Rematrix(input_bus.get(), output_bus.get()); |
scherkus (not reviewing)
2012/10/18 01:30:39
what exactly are we testing?
DaleCurtis
2012/10/18 01:56:44
Just that construction of all layouts is possible
scherkus (not reviewing)
2012/10/18 02:24:03
How about naming this "AllLayoutCombinations" inst
DaleCurtis
2012/10/18 05:22:04
Done.
|
+ } |
+ } |
+} |
+ |
+} // namespace media |