| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/strings/string_number_conversions.h" | 6 #include "base/strings/string_number_conversions.h" |
| 7 #include "media/audio/audio_parameters.h" | 7 #include "media/audio/audio_parameters.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace media { | 10 namespace media { |
| 11 | 11 |
| 12 TEST(AudioParameters, Constructor_Default) { | 12 TEST(AudioParameters, Constructor_Default) { |
| 13 AudioParameters::Format expected_format = AudioParameters::AUDIO_PCM_LINEAR; | 13 AudioParameters::Format expected_format = AudioParameters::AUDIO_PCM_LINEAR; |
| 14 int expected_bits = 0; | 14 int expected_bits = 0; |
| 15 int expected_channels = 0; | 15 int expected_channels = 0; |
| 16 ChannelLayout expected_channel_layout = CHANNEL_LAYOUT_NONE; | 16 ChannelLayout expected_channel_layout = CHANNEL_LAYOUT_NONE; |
| 17 int expected_rate = 0; | 17 int expected_rate = 0; |
| 18 int expected_samples = 0; | 18 int expected_samples = 0; |
| 19 AudioParameters::PlatformEffectsMask expected_effects = |
| 20 AudioParameters::NO_EFFECTS; |
| 21 std::vector<Point> expected_mic_positions; |
| 19 | 22 |
| 20 AudioParameters params; | 23 AudioParameters params; |
| 21 | 24 |
| 22 EXPECT_EQ(expected_format, params.format()); | 25 EXPECT_EQ(expected_format, params.format()); |
| 23 EXPECT_EQ(expected_bits, params.bits_per_sample()); | 26 EXPECT_EQ(expected_bits, params.bits_per_sample()); |
| 24 EXPECT_EQ(expected_channels, params.channels()); | 27 EXPECT_EQ(expected_channels, params.channels()); |
| 25 EXPECT_EQ(expected_channel_layout, params.channel_layout()); | 28 EXPECT_EQ(expected_channel_layout, params.channel_layout()); |
| 26 EXPECT_EQ(expected_rate, params.sample_rate()); | 29 EXPECT_EQ(expected_rate, params.sample_rate()); |
| 27 EXPECT_EQ(expected_samples, params.frames_per_buffer()); | 30 EXPECT_EQ(expected_samples, params.frames_per_buffer()); |
| 31 EXPECT_EQ(expected_effects, params.effects()); |
| 32 EXPECT_EQ(expected_mic_positions, params.mic_positions()); |
| 28 } | 33 } |
| 29 | 34 |
| 30 TEST(AudioParameters, Constructor_ParameterValues) { | 35 TEST(AudioParameters, Constructor_ParameterValues) { |
| 31 AudioParameters::Format expected_format = | 36 AudioParameters::Format expected_format = |
| 32 AudioParameters::AUDIO_PCM_LOW_LATENCY; | 37 AudioParameters::AUDIO_PCM_LOW_LATENCY; |
| 33 int expected_bits = 16; | 38 int expected_bits = 16; |
| 34 int expected_channels = 6; | 39 int expected_channels = 6; |
| 35 ChannelLayout expected_channel_layout = CHANNEL_LAYOUT_5_1; | 40 ChannelLayout expected_channel_layout = CHANNEL_LAYOUT_5_1; |
| 36 int expected_rate = 44100; | 41 int expected_rate = 44100; |
| 37 int expected_samples = 880; | 42 int expected_samples = 880; |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 214 |
| 210 AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY, | 215 AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY, |
| 211 expected_layout, 44100, 16, 880); | 216 expected_layout, 44100, 16, 880); |
| 212 params.set_channels_for_discrete(expected_channels); | 217 params.set_channels_for_discrete(expected_channels); |
| 213 EXPECT_EQ(expected_channels, params.channels()); | 218 EXPECT_EQ(expected_channels, params.channels()); |
| 214 EXPECT_EQ(expected_layout, params.channel_layout()); | 219 EXPECT_EQ(expected_layout, params.channel_layout()); |
| 215 EXPECT_TRUE(params.IsValid()); | 220 EXPECT_TRUE(params.IsValid()); |
| 216 } | 221 } |
| 217 | 222 |
| 218 } // namespace media | 223 } // namespace media |
| OLD | NEW |