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

Side by Side Diff: media/audio/audio_parameters_unittest.cc

Issue 1275783003: Add a virtual beamforming audio device on ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More constructors. Created 5 years, 3 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 unified diff | Download patch
OLDNEW
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) {
Henrik Grunell 2015/08/27 08:38:18 I suppose you'll add tests for the new ctors when
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 19
20 AudioParameters params; 20 AudioParameters params;
21 21
22 EXPECT_EQ(expected_format, params.format()); 22 EXPECT_EQ(expected_format, params.format());
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // Verify that a value is never less than itself. 201 // Verify that a value is never less than itself.
202 EXPECT_FALSE(values[i] < values[i]); 202 EXPECT_FALSE(values[i] < values[i]);
203 } 203 }
204 } 204 }
205 205
206 TEST(AudioParameters, Constructor_ValidChannelCounts) { 206 TEST(AudioParameters, Constructor_ValidChannelCounts) {
207 int expected_channels = 8; 207 int expected_channels = 8;
208 ChannelLayout expected_layout = CHANNEL_LAYOUT_5_1; 208 ChannelLayout expected_layout = CHANNEL_LAYOUT_5_1;
209 209
210 AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY, 210 AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
211 expected_layout, expected_channels, 44100, 16, 880, 211 expected_channels, expected_layout, 44100, 16, 880);
212 AudioParameters::NO_EFFECTS);
213 212
214 EXPECT_EQ(expected_channels, params.channels()); 213 EXPECT_EQ(expected_channels, params.channels());
215 EXPECT_EQ(expected_layout, params.channel_layout()); 214 EXPECT_EQ(expected_layout, params.channel_layout());
216 EXPECT_FALSE(params.IsValid()); 215 EXPECT_FALSE(params.IsValid());
217 216
218 expected_layout = CHANNEL_LAYOUT_DISCRETE; 217 expected_layout = CHANNEL_LAYOUT_DISCRETE;
219 params.Reset(AudioParameters::AUDIO_PCM_LOW_LATENCY, expected_layout, 218 params.Reset(AudioParameters::AUDIO_PCM_LOW_LATENCY, expected_layout,
220 expected_channels, 44100, 16, 880); 219 expected_channels, 44100, 16, 880);
221 220
222 EXPECT_EQ(expected_channels, params.channels()); 221 EXPECT_EQ(expected_channels, params.channels());
223 EXPECT_EQ(expected_layout, params.channel_layout()); 222 EXPECT_EQ(expected_layout, params.channel_layout());
224 EXPECT_TRUE(params.IsValid()); 223 EXPECT_TRUE(params.IsValid());
225 } 224 }
226 225
227 } // namespace media 226 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698