OLD | NEW |
| (Empty) |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "base/basictypes.h" | |
6 #include "base/logging.h" | |
7 #include "base/memory/scoped_ptr.h" | |
8 #include "base/strings/string_piece.h" | |
9 #include "media/audio/sounds/test_data.h" | |
10 #include "media/audio/sounds/wav_audio_handler.h" | |
11 #include "media/base/audio_bus.h" | |
12 #include "testing/gtest/include/gtest/gtest.h" | |
13 | |
14 namespace media { | |
15 | |
16 TEST(WavAudioHandlerTest, SampleDataTest) { | |
17 WavAudioHandler handler(base::StringPiece(kTestAudioData, | |
18 arraysize(kTestAudioData))); | |
19 ASSERT_EQ(static_cast<uint16>(2), handler.num_channels()); | |
20 ASSERT_EQ(static_cast<uint16>(16), handler.bits_per_sample()); | |
21 ASSERT_EQ(static_cast<uint32>(48000), handler.sample_rate()); | |
22 ASSERT_EQ(static_cast<uint32>(96000), handler.byte_rate()); | |
23 | |
24 ASSERT_EQ(4, handler.size()); | |
25 scoped_ptr<AudioBus> bus = AudioBus::Create( | |
26 handler.num_channels(), | |
27 handler.size() / handler.num_channels()); | |
28 size_t bytes_written; | |
29 ASSERT_TRUE(handler.CopyTo(bus.get(), 0, &bytes_written)); | |
30 ASSERT_EQ(static_cast<size_t>(handler.size()), bytes_written); | |
31 } | |
32 | |
33 } // namespace media | |
OLD | NEW |