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 "content/browser/renderer_host/media/audio_renderer_host.h" | 5 #include "content/browser/renderer_host/media/audio_renderer_host.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 kSalt); | 250 kSalt); |
251 | 251 |
252 // Simulate IPC channel connected. | 252 // Simulate IPC channel connected. |
253 host_->set_peer_process_for_testing(base::Process::Current()); | 253 host_->set_peer_process_for_testing(base::Process::Current()); |
254 } | 254 } |
255 | 255 |
256 ~AudioRendererHostTest() override { | 256 ~AudioRendererHostTest() override { |
257 // Simulate closing the IPC channel and give the audio thread time to close | 257 // Simulate closing the IPC channel and give the audio thread time to close |
258 // the underlying streams. | 258 // the underlying streams. |
259 host_->OnChannelClosing(); | 259 host_->OnChannelClosing(); |
| 260 audio_manager_->GetTaskRunner()->PostTask( |
| 261 FROM_HERE, base::Bind(&media::AudioManager::Shutdown, |
| 262 base::Unretained(audio_manager_.get()))); |
260 SyncWithAudioThread(); | 263 SyncWithAudioThread(); |
261 // To correctly clean up the audio manager, we first put it in a | |
262 // ScopedAudioManagerPtr. It will immediately destruct, cleaning up the | |
263 // audio manager correctly. | |
264 media::ScopedAudioManagerPtr(audio_manager_.release()); | |
265 | 264 |
266 // Release the reference to the mock object. The object will be destructed | 265 // Release the reference to the mock object. The object will be destructed |
267 // on message_loop_. | 266 // on message_loop_. |
268 host_ = nullptr; | 267 host_ = nullptr; |
269 } | 268 } |
270 | 269 |
271 protected: | 270 protected: |
272 void OverrideDevicePermissions(bool has_permissions) { | 271 void OverrideDevicePermissions(bool has_permissions) { |
273 host_->OverrideDevicePermissionsForTesting(has_permissions); | 272 host_->OverrideDevicePermissionsForTesting(has_permissions); |
274 } | 273 } |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 } | 622 } |
624 | 623 |
625 TEST_F(AudioRendererHostTest, CreateFailsForInvalidRenderFrame) { | 624 TEST_F(AudioRendererHostTest, CreateFailsForInvalidRenderFrame) { |
626 CreateWithInvalidRenderFrameId(); | 625 CreateWithInvalidRenderFrameId(); |
627 Close(); | 626 Close(); |
628 } | 627 } |
629 | 628 |
630 // TODO(hclam): Add tests for data conversation in low latency mode. | 629 // TODO(hclam): Add tests for data conversation in low latency mode. |
631 | 630 |
632 } // namespace content | 631 } // namespace content |
OLD | NEW |