Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(547)

Unified Diff: media/base/audio_bus_unittest.cc

Issue 2845813004: Add unit test for AudioBus::CreateWrapper() (Closed)
Patch Set: Add unit test for AudioBus::CreateWrapper() Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/audio_bus.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/audio_bus_unittest.cc
diff --git a/media/base/audio_bus_unittest.cc b/media/base/audio_bus_unittest.cc
index 63dcb0cad0aaa85e0b47dc41c92df289a04d3828..1dfb4b90519172ecb8bc9ccc264b05da76cf8040 100644
--- a/media/base/audio_bus_unittest.cc
+++ b/media/base/audio_bus_unittest.cc
@@ -132,6 +132,23 @@ TEST_F(AudioBusTest, CreateUsingAudioParameters) {
VerifyReadWriteAndAlignment(bus.get());
}
+// Verify an AudioBus created via CreateWrapper(...) works as advertised.
+TEST_F(AudioBusTest, CreateWrapper) {
+ data_.reserve(kChannels);
+ for (int i = 0; i < kChannels; ++i) {
+ data_.push_back(static_cast<float*>(base::AlignedAlloc(
+ sizeof(*data_[i]) * kFrameCount, AudioBus::kChannelAlignment)));
+ }
+
+ std::unique_ptr<AudioBus> bus = AudioBus::CreateWrapper(kChannels);
+ bus->set_frames(kFrameCount);
+ for (int i = 0; i < bus->channels(); ++i)
+ bus->SetChannelData(i, data_[i]);
+
+ VerifyChannelAndFrameCount(bus.get());
+ VerifyReadWriteAndAlignment(bus.get());
+}
+
// Verify an AudioBus created via wrapping a vector works as advertised.
TEST_F(AudioBusTest, WrapVector) {
data_.reserve(kChannels);
« no previous file with comments | « media/base/audio_bus.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698