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

Side by Side Diff: content/renderer/media/renderer_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: Plumb. 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 "content/renderer/media/renderer_audio_hardware_config.h"
6 #include "testing/gtest/include/gtest/gtest.h"
7
8 namespace content {
9
10 namespace {
11
12 const int kOutputBufferSize = 2048;
13 const int kOutputSampleRate = 48000;
14 const int kInputSampleRate = 44100;
15 const media::ChannelLayout kInputChannelLayout = media::CHANNEL_LAYOUT_STEREO;
16
17 } // namespace
18
19 TEST(RendererAudioHardwareConfig, Getters) {
20 RendererAudioHardwareConfig 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(RendererAudioHardwareConfig, Setters) {
31 RendererAudioHardwareConfig 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 media::ChannelLayout kNewInputChannelLayout =
47 media::CHANNEL_LAYOUT_MONO;
48 EXPECT_NE(kNewInputSampleRate, fake_config.GetInputSampleRate());
49 EXPECT_NE(kNewInputChannelLayout, fake_config.GetInputChannelLayout());
50 fake_config.UpdateInputConfig(kNewInputSampleRate, kNewInputChannelLayout);
51 EXPECT_EQ(kNewInputSampleRate, fake_config.GetInputSampleRate());
52 EXPECT_EQ(kNewInputChannelLayout, fake_config.GetInputChannelLayout());
53 }
54
55 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698