cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / media / audio / test_audio_input_controller_factory.cc
blobd146231a25d4ca4b91f55de9951c2c34ce30b7a5
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
3 // found in the LICENSE file.
5 #include "media/audio/test_audio_input_controller_factory.h"
6 #include "media/audio/audio_io.h"
8 namespace media {
10 TestAudioInputController::TestAudioInputController(
11 TestAudioInputControllerFactory* factory,
12 AudioManager* audio_manager,
13 const AudioParameters& audio_parameters,
14 EventHandler* event_handler,
15 SyncWriter* sync_writer,
16 UserInputMonitor* user_input_monitor)
17 : AudioInputController(event_handler, sync_writer, user_input_monitor),
18 audio_parameters_(audio_parameters),
19 factory_(factory),
20 event_handler_(event_handler) {
21 message_loop_ = audio_manager->GetMessageLoop();
24 TestAudioInputController::~TestAudioInputController() {
25 // Inform the factory so that it allows creating new instances in future.
26 factory_->OnTestAudioInputControllerDestroyed(this);
29 void TestAudioInputController::Record() {
30 if (factory_->delegate_)
31 factory_->delegate_->TestAudioControllerOpened(this);
34 void TestAudioInputController::Close(const base::Closure& closed_task) {
35 message_loop_->PostTask(FROM_HERE, closed_task);
36 if (factory_->delegate_)
37 factory_->delegate_->TestAudioControllerClosed(this);
40 TestAudioInputControllerFactory::TestAudioInputControllerFactory()
41 : controller_(NULL),
42 delegate_(NULL) {
45 TestAudioInputControllerFactory::~TestAudioInputControllerFactory() {
46 DCHECK(!controller_);
49 AudioInputController* TestAudioInputControllerFactory::Create(
50 AudioManager* audio_manager,
51 AudioInputController::EventHandler* event_handler,
52 AudioParameters params,
53 UserInputMonitor* user_input_monitor) {
54 DCHECK(!controller_); // Only one test instance managed at a time.
55 controller_ = new TestAudioInputController(
56 this, audio_manager, params, event_handler, NULL, user_input_monitor);
57 return controller_;
60 void TestAudioInputControllerFactory::SetDelegateForTests(
61 TestAudioInputControllerDelegate* delegate) {
62 delegate_ = delegate;
65 void TestAudioInputControllerFactory::OnTestAudioInputControllerDestroyed(
66 TestAudioInputController* controller) {
67 DCHECK_EQ(controller_, controller);
68 controller_ = NULL;
71 } // namespace media