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

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: Comments. Collapse! 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
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 namespace {
scherkus (not reviewing) 2013/01/31 02:33:33 nit: us media folks prefer static as opposed to an
DaleCurtis 2013/01/31 19:50:00 Done.
11
12 const int kOutputBufferSize = 2048;
13 const int kOutputSampleRate = 48000;
14 const int kInputSampleRate = 44100;
15 const ChannelLayout kInputChannelLayout = CHANNEL_LAYOUT_STEREO;
16
17 } // namespace
18
19 TEST(AudioHardwareConfig, Getters) {
20 AudioHardwareConfig fake_config(
21 kOutputBufferSize, kOutputSampleRate, kInputSampleRate,
22 kInputChannelLayout);
23
24 EXPECT_EQ(kOutputBufferSize, fake_config.GetOutputBufferSize());
25 EXPECT_EQ(kOutputSampleRate, fake_config.GetOutputSampleRate());
26 EXPECT_EQ(kInputSampleRate, fake_config.GetInputSampleRate());
27 EXPECT_EQ(kInputChannelLayout, fake_config.GetInputChannelLayout());
28 }
29
30 TEST(AudioHardwareConfig, Setters) {
31 AudioHardwareConfig fake_config(
32 kOutputBufferSize, kOutputSampleRate, kInputSampleRate,
33 kInputChannelLayout);
34
35 // Verify output parameters.
36 const int kNewOutputBufferSize = kOutputBufferSize * 2;
37 const int kNewOutputSampleRate = kOutputSampleRate * 2;
38 EXPECT_NE(kNewOutputBufferSize, fake_config.GetOutputBufferSize());
39 EXPECT_NE(kNewOutputSampleRate, fake_config.GetOutputSampleRate());
40 fake_config.UpdateOutputConfig(kNewOutputBufferSize, kNewOutputSampleRate);
41 EXPECT_EQ(kNewOutputBufferSize, fake_config.GetOutputBufferSize());
42 EXPECT_EQ(kNewOutputSampleRate, fake_config.GetOutputSampleRate());
43
44 // Verify input parameters.
45 const int kNewInputSampleRate = kInputSampleRate * 2;
46 const ChannelLayout kNewInputChannelLayout = CHANNEL_LAYOUT_MONO;
47 EXPECT_NE(kNewInputSampleRate, fake_config.GetInputSampleRate());
48 EXPECT_NE(kNewInputChannelLayout, fake_config.GetInputChannelLayout());
49 fake_config.UpdateInputConfig(kNewInputSampleRate, kNewInputChannelLayout);
50 EXPECT_EQ(kNewInputSampleRate, fake_config.GetInputSampleRate());
51 EXPECT_EQ(kNewInputChannelLayout, fake_config.GetInputChannelLayout());
52 }
53
54 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698