OLD | NEW |
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 "media/audio/mock_audio_manager.h" | 5 #include "media/audio/mock_audio_manager.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "media/base/audio_parameters.h" | 10 #include "media/base/audio_parameters.h" |
11 | 11 |
12 namespace media { | 12 namespace media { |
13 | 13 |
14 void MockAudioManager::Deleter::operator()( | |
15 const MockAudioManager* instance) const { | |
16 CHECK(instance); | |
17 if (instance->GetTaskRunner()->BelongsToCurrentThread()) { | |
18 delete instance; | |
19 return; | |
20 } | |
21 // AudioManager must be destroyed on the audio thread. | |
22 if (!instance->GetTaskRunner()->DeleteSoon(FROM_HERE, instance)) { | |
23 LOG(WARNING) << "Failed to delete AudioManager instance."; | |
24 } | |
25 } | |
26 | |
27 MockAudioManager::MockAudioManager( | 14 MockAudioManager::MockAudioManager( |
28 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 15 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
29 : AudioManager(task_runner, task_runner) {} | 16 : AudioManager(task_runner, task_runner) {} |
30 | 17 |
31 MockAudioManager::~MockAudioManager() { | 18 MockAudioManager::~MockAudioManager() { |
32 } | 19 } |
33 | 20 |
| 21 void MockAudioManager::Shutdown() {} |
| 22 |
34 bool MockAudioManager::HasAudioOutputDevices() { | 23 bool MockAudioManager::HasAudioOutputDevices() { |
35 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); | 24 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); |
36 return has_output_devices_; | 25 return has_output_devices_; |
37 } | 26 } |
38 | 27 |
39 bool MockAudioManager::HasAudioInputDevices() { | 28 bool MockAudioManager::HasAudioInputDevices() { |
40 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); | 29 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); |
41 return has_input_devices_; | 30 return has_input_devices_; |
42 } | 31 } |
43 | 32 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 GetDeviceDescriptionsCallback callback) { | 150 GetDeviceDescriptionsCallback callback) { |
162 get_input_device_descriptions_cb_ = std::move(callback); | 151 get_input_device_descriptions_cb_ = std::move(callback); |
163 } | 152 } |
164 | 153 |
165 void MockAudioManager::SetOutputDeviceDescriptionsCallback( | 154 void MockAudioManager::SetOutputDeviceDescriptionsCallback( |
166 GetDeviceDescriptionsCallback callback) { | 155 GetDeviceDescriptionsCallback callback) { |
167 get_output_device_descriptions_cb_ = std::move(callback); | 156 get_output_device_descriptions_cb_ = std::move(callback); |
168 } | 157 } |
169 | 158 |
170 } // namespace media. | 159 } // namespace media. |
OLD | NEW |