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

Side by Side Diff: media/base/audio_hardware_config_unittest.cc

Issue 11880009: Introduce AudioHardwareConfig for renderer side audio device info. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Style nits. Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « media/base/audio_hardware_config.cc ('k') | media/media.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 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 "media/base/audio_hardware_config.h"
6 #include "testing/gtest/include/gtest/gtest.h"
7
8 namespace media {
9
10 static const int kOutputBufferSize = 2048;
11 static const int kOutputSampleRate = 48000;
12 static const int kInputSampleRate = 44100;
13 static const ChannelLayout kInputChannelLayout = CHANNEL_LAYOUT_STEREO;
14
15 TEST(AudioHardwareConfig, Getters) {
16 AudioHardwareConfig fake_config(
17 kOutputBufferSize, kOutputSampleRate, kInputSampleRate,
18 kInputChannelLayout);
19
20 EXPECT_EQ(kOutputBufferSize, fake_config.GetOutputBufferSize());
21 EXPECT_EQ(kOutputSampleRate, fake_config.GetOutputSampleRate());
22 EXPECT_EQ(kInputSampleRate, fake_config.GetInputSampleRate());
23 EXPECT_EQ(kInputChannelLayout, fake_config.GetInputChannelLayout());
24 }
25
26 TEST(AudioHardwareConfig, Setters) {
27 AudioHardwareConfig fake_config(
28 kOutputBufferSize, kOutputSampleRate, kInputSampleRate,
29 kInputChannelLayout);
30
31 // Verify output parameters.
32 const int kNewOutputBufferSize = kOutputBufferSize * 2;
33 const int kNewOutputSampleRate = kOutputSampleRate * 2;
34 EXPECT_NE(kNewOutputBufferSize, fake_config.GetOutputBufferSize());
35 EXPECT_NE(kNewOutputSampleRate, fake_config.GetOutputSampleRate());
36 fake_config.UpdateOutputConfig(kNewOutputBufferSize, kNewOutputSampleRate);
37 EXPECT_EQ(kNewOutputBufferSize, fake_config.GetOutputBufferSize());
38 EXPECT_EQ(kNewOutputSampleRate, fake_config.GetOutputSampleRate());
39
40 // Verify input parameters.
41 const int kNewInputSampleRate = kInputSampleRate * 2;
42 const ChannelLayout kNewInputChannelLayout = CHANNEL_LAYOUT_MONO;
43 EXPECT_NE(kNewInputSampleRate, fake_config.GetInputSampleRate());
44 EXPECT_NE(kNewInputChannelLayout, fake_config.GetInputChannelLayout());
45 fake_config.UpdateInputConfig(kNewInputSampleRate, kNewInputChannelLayout);
46 EXPECT_EQ(kNewInputSampleRate, fake_config.GetInputSampleRate());
47 EXPECT_EQ(kNewInputChannelLayout, fake_config.GetInputChannelLayout());
48 }
49
50 } // namespace content
OLDNEW
« no previous file with comments | « media/base/audio_hardware_config.cc ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698