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

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

Issue 1304973005: Refactor AudioParameters member setting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More cross-platform. 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 {
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 EXPECT_EQ(i < j, values[i] < values[j]); 198 EXPECT_EQ(i < j, values[i] < values[j]);
199 } 199 }
200 200
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_DISCRETE;
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_layout, 44100, 16, 880);
212 AudioParameters::NO_EFFECTS); 212 params.set_channels_for_discrete(expected_channels);
213
214 EXPECT_EQ(expected_channels, params.channels());
215 EXPECT_EQ(expected_layout, params.channel_layout());
216 EXPECT_FALSE(params.IsValid());
217
218 expected_layout = CHANNEL_LAYOUT_DISCRETE;
219 params.Reset(AudioParameters::AUDIO_PCM_LOW_LATENCY, expected_layout,
220 expected_channels, 44100, 16, 880);
221
222 EXPECT_EQ(expected_channels, params.channels()); 213 EXPECT_EQ(expected_channels, params.channels());
223 EXPECT_EQ(expected_layout, params.channel_layout()); 214 EXPECT_EQ(expected_layout, params.channel_layout());
224 EXPECT_TRUE(params.IsValid()); 215 EXPECT_TRUE(params.IsValid());
225 } 216 }
226 217
227 } // namespace media 218 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698