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

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

Issue 10834033: Move AudioDevice and AudioInputDevice to media. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments and fixed a few lint issues Created 8 years, 4 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/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "content/renderer/media/audio_device_factory.h" 6 #include "content/renderer/media/audio_device_factory.h"
7 #include "content/renderer/media/audio_renderer_mixer_manager.h" 7 #include "content/renderer/media/audio_renderer_mixer_manager.h"
8 #include "media/base/audio_renderer_mixer.h" 8 #include "media/base/audio_renderer_mixer.h"
9 #include "media/base/audio_renderer_mixer_input.h" 9 #include "media/base/audio_renderer_mixer_input.h"
10 #include "media/base/fake_audio_render_callback.h" 10 #include "media/base/fake_audio_render_callback.h"
(...skipping 16 matching lines...) Expand all
27 virtual ~MockAudioRenderSinkFactory() {} 27 virtual ~MockAudioRenderSinkFactory() {}
28 28
29 protected: 29 protected:
30 virtual media::MockAudioRendererSink* CreateOutputDevice() OVERRIDE { 30 virtual media::MockAudioRendererSink* CreateOutputDevice() OVERRIDE {
31 media::MockAudioRendererSink* sink = new media::MockAudioRendererSink(); 31 media::MockAudioRendererSink* sink = new media::MockAudioRendererSink();
32 EXPECT_CALL(*sink, Start()); 32 EXPECT_CALL(*sink, Start());
33 EXPECT_CALL(*sink, Stop()); 33 EXPECT_CALL(*sink, Stop());
34 return sink; 34 return sink;
35 } 35 }
36 36
37 virtual AudioInputDevice* CreateInputDevice() OVERRIDE { 37 virtual media::AudioInputDevice* CreateInputDevice() OVERRIDE {
38 ADD_FAILURE(); 38 ADD_FAILURE();
39 return NULL; 39 return NULL;
40 } 40 }
41 41
42 DISALLOW_COPY_AND_ASSIGN(MockAudioRenderSinkFactory); 42 DISALLOW_COPY_AND_ASSIGN(MockAudioRenderSinkFactory);
43 }; 43 };
44 44
45 class AudioRendererMixerManagerTest : public testing::Test { 45 class AudioRendererMixerManagerTest : public testing::Test {
46 public: 46 public:
47 AudioRendererMixerManagerTest() { 47 AudioRendererMixerManagerTest() {
48 // We don't want to deal with instantiating a real AudioDevice since it's 48 // We don't want to deal with instantiating a real AudioOutputDevice since
49 // not important to our testing, so use a mock AudioDeviceFactory. 49 // it's not important to our testing, so use a mock AudioDeviceFactory.
50 mock_sink_factory_.reset(new MockAudioRenderSinkFactory()); 50 mock_sink_factory_.reset(new MockAudioRenderSinkFactory());
51 manager_.reset(new AudioRendererMixerManager(kSampleRate, kBufferSize)); 51 manager_.reset(new AudioRendererMixerManager(kSampleRate, kBufferSize));
52 } 52 }
53 53
54 media::AudioRendererMixer* GetMixer(const media::AudioParameters& params) { 54 media::AudioRendererMixer* GetMixer(const media::AudioParameters& params) {
55 return manager_->GetMixer(params); 55 return manager_->GetMixer(params);
56 } 56 }
57 57
58 void RemoveMixer(const media::AudioParameters& params) { 58 void RemoveMixer(const media::AudioParameters& params) {
59 return manager_->RemoveMixer(params); 59 return manager_->RemoveMixer(params);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 media::FakeAudioRenderCallback callback(0); 127 media::FakeAudioRenderCallback callback(0);
128 input->Initialize(params, &callback); 128 input->Initialize(params, &callback);
129 EXPECT_EQ(mixer_count(), 1); 129 EXPECT_EQ(mixer_count(), 1);
130 130
131 // Destroying the input should destroy the mixer. 131 // Destroying the input should destroy the mixer.
132 input = NULL; 132 input = NULL;
133 EXPECT_EQ(mixer_count(), 0); 133 EXPECT_EQ(mixer_count(), 0);
134 } 134 }
135 135
136 } // namespace content 136 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/audio_renderer_mixer_manager.h ('k') | content/renderer/media/render_audiosourceprovider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698