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

Side by Side Diff: media/audio/test_audio_input_controller_factory.cc

Issue 3148003: Allow unit tests to use a mock audio input controller. (Closed)
Patch Set: Address review comments from Jeremy and Alpha Created 10 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
« no previous file with comments | « media/audio/test_audio_input_controller_factory.h ('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) 2009 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/audio/test_audio_input_controller_factory.h"
6 #include "media/audio/audio_io.h"
7
8 namespace media {
9
10 TestAudioInputController::TestAudioInputController(
11 TestAudioInputControllerFactory* factory, EventHandler* event_handler)
12 : AudioInputController(event_handler),
13 factory_(factory),
14 event_handler_(event_handler) {
15 }
16
17 TestAudioInputController::~TestAudioInputController() {
18 // Inform the factory so that it allows creating new instances in future.
19 factory_->OnTestAudioInputControllerDestroyed(this);
20 }
21
22 TestAudioInputControllerFactory::TestAudioInputControllerFactory()
23 : controller_(NULL) {
24 }
25
26 AudioInputController* TestAudioInputControllerFactory::Create(
27 AudioInputController::EventHandler* event_handler,
28 AudioManager::Format format,
29 int channels,
30 int sample_rate,
31 int bits_per_sample,
32 int samples_per_packet) {
33 DCHECK(!controller_); // Only one test instance managed at a time.
34 controller_ = new TestAudioInputController(this, event_handler);
35 return controller_;
36 }
37
38 void TestAudioInputControllerFactory::OnTestAudioInputControllerDestroyed(
39 TestAudioInputController* controller) {
40 DCHECK(controller_ == controller);
41 controller_ = NULL;
42 }
43
44 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/test_audio_input_controller_factory.h ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698