| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_output_delegate.h" | 5 #include "content/browser/renderer_host/media/audio_output_delegate.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 // This test uses real UI, IO and audio threads. | 106 // This test uses real UI, IO and audio threads. |
| 107 // AudioOutputDelegate mainly interacts with the IO and audio threads, | 107 // AudioOutputDelegate mainly interacts with the IO and audio threads, |
| 108 // but interacts with UI for bad messages, so using these threads should | 108 // but interacts with UI for bad messages, so using these threads should |
| 109 // approximate the real conditions of AudioOutputDelegate well. | 109 // approximate the real conditions of AudioOutputDelegate well. |
| 110 thread_bundle_ = base::MakeUnique<TestBrowserThreadBundle>( | 110 thread_bundle_ = base::MakeUnique<TestBrowserThreadBundle>( |
| 111 TestBrowserThreadBundle::Options::REAL_IO_THREAD); | 111 TestBrowserThreadBundle::Options::REAL_IO_THREAD); |
| 112 audio_thread_ = base::MakeUnique<AudioDeviceThread>(); | 112 audio_thread_ = base::MakeUnique<AudioDeviceThread>(); |
| 113 | 113 |
| 114 audio_manager_.reset(new media::FakeAudioManager( | 114 audio_manager_.reset(new media::FakeAudioManager( |
| 115 audio_thread_->GetTaskRunner(), audio_thread_->worker_task_runner(), | 115 audio_thread_->task_runner(), audio_thread_->worker_task_runner(), |
| 116 &log_factory_)); | 116 &log_factory_)); |
| 117 media_stream_manager_ = | 117 media_stream_manager_ = |
| 118 base::MakeUnique<MediaStreamManager>(audio_manager_.get()); | 118 base::MakeUnique<MediaStreamManager>(audio_manager_.get()); |
| 119 } | 119 } |
| 120 | 120 |
| 121 // Test bodies are here, so that we can run them on the IO thread. | 121 // Test bodies are here, so that we can run them on the IO thread. |
| 122 void CreateTest(base::Closure done) { | 122 void CreateTest(base::Closure done) { |
| 123 EXPECT_CALL(media_observer_, | 123 EXPECT_CALL(media_observer_, |
| 124 OnCreatingAudioStream(kRenderProcessId, kRenderFrameId)); | 124 OnCreatingAudioStream(kRenderProcessId, kRenderFrameId)); |
| 125 EXPECT_CALL(event_handler_, | 125 EXPECT_CALL(event_handler_, |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 TEST_F(AudioOutputDelegateTest, ErrorAndDestroy) { | 580 TEST_F(AudioOutputDelegateTest, ErrorAndDestroy) { |
| 581 base::RunLoop l; | 581 base::RunLoop l; |
| 582 BrowserThread::PostTask( | 582 BrowserThread::PostTask( |
| 583 BrowserThread::IO, FROM_HERE, | 583 BrowserThread::IO, FROM_HERE, |
| 584 base::Bind(&AudioOutputDelegateTest::PlayAndDestroyTest, | 584 base::Bind(&AudioOutputDelegateTest::PlayAndDestroyTest, |
| 585 base::Unretained(this), l.QuitClosure())); | 585 base::Unretained(this), l.QuitClosure())); |
| 586 l.Run(); | 586 l.Run(); |
| 587 } | 587 } |
| 588 | 588 |
| 589 } // namespace content | 589 } // namespace content |
| OLD | NEW |