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

Side by Side Diff: content/renderer/media/audio_renderer_mixer_manager_unittest.cc

Issue 12387006: Pass more detailed audio hardware configuration information to the renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 9 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
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/logging.h" 5 #include "base/logging.h"
6 #include "base/memory/ref_counted.h" 6 #include "base/memory/ref_counted.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "content/renderer/media/audio_renderer_mixer_manager.h" 8 #include "content/renderer/media/audio_renderer_mixer_manager.h"
9 #include "media/audio/audio_parameters.h"
9 #include "media/base/audio_hardware_config.h" 10 #include "media/base/audio_hardware_config.h"
10 #include "media/base/audio_renderer_mixer.h" 11 #include "media/base/audio_renderer_mixer.h"
11 #include "media/base/audio_renderer_mixer_input.h" 12 #include "media/base/audio_renderer_mixer_input.h"
12 #include "media/base/fake_audio_render_callback.h" 13 #include "media/base/fake_audio_render_callback.h"
13 #include "media/base/mock_audio_renderer_sink.h" 14 #include "media/base/mock_audio_renderer_sink.h"
14 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 17
17 namespace content { 18 namespace content {
18 19
19 static const int kBitsPerChannel = 16; 20 static const int kBitsPerChannel = 16;
20 static const int kSampleRate = 48000; 21 static const int kSampleRate = 48000;
21 static const int kBufferSize = 8192; 22 static const int kBufferSize = 8192;
22 static const media::ChannelLayout kChannelLayout = media::CHANNEL_LAYOUT_STEREO; 23 static const media::ChannelLayout kChannelLayout = media::CHANNEL_LAYOUT_STEREO;
23 24
24 static const int kRenderViewId = 123; 25 static const int kRenderViewId = 123;
25 static const int kAnotherRenderViewId = 456; 26 static const int kAnotherRenderViewId = 456;
26 27
28 using media::AudioParameters;
29
27 class AudioRendererMixerManagerTest : public testing::Test { 30 class AudioRendererMixerManagerTest : public testing::Test {
28 public: 31 public:
29 AudioRendererMixerManagerTest() 32 AudioRendererMixerManagerTest()
30 : fake_config_(kBufferSize, kSampleRate, 0, media::CHANNEL_LAYOUT_NONE) { 33 : fake_config_(AudioParameters(), AudioParameters()) {
34 AudioParameters output_params(
35 media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
36 media::CHANNEL_LAYOUT_STEREO,
37 kSampleRate,
38 16,
39 kBufferSize);
40 fake_config_.UpdateOutputConfig(output_params);
41
31 manager_.reset(new AudioRendererMixerManager(&fake_config_)); 42 manager_.reset(new AudioRendererMixerManager(&fake_config_));
32 43
33 // We don't want to deal with instantiating a real AudioOutputDevice since 44 // We don't want to deal with instantiating a real AudioOutputDevice since
34 // it's not important to our testing, so we inject a mock. 45 // it's not important to our testing, so we inject a mock.
35 mock_sink_ = new media::MockAudioRendererSink(); 46 mock_sink_ = new media::MockAudioRendererSink();
36 manager_->SetAudioRendererSinkForTesting(mock_sink_); 47 manager_->SetAudioRendererSinkForTesting(mock_sink_);
37 } 48 }
38 49
39 media::AudioRendererMixer* GetMixer(int source_render_view_id, 50 media::AudioRendererMixer* GetMixer(int source_render_view_id,
40 const media::AudioParameters& params) { 51 const media::AudioParameters& params) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 EXPECT_EQ(mixer_count(), 2); 147 EXPECT_EQ(mixer_count(), 2);
137 148
138 // Destroying the inputs should destroy the mixers. 149 // Destroying the inputs should destroy the mixers.
139 input = NULL; 150 input = NULL;
140 EXPECT_EQ(mixer_count(), 1); 151 EXPECT_EQ(mixer_count(), 1);
141 another_input = NULL; 152 another_input = NULL;
142 EXPECT_EQ(mixer_count(), 0); 153 EXPECT_EQ(mixer_count(), 0);
143 } 154 }
144 155
145 } // namespace content 156 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698