| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/environment.h" | 8 #include "base/environment.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 class AudioInputTest : public testing::Test { | 52 class AudioInputTest : public testing::Test { |
| 53 public: | 53 public: |
| 54 AudioInputTest() : | 54 AudioInputTest() : |
| 55 message_loop_(base::MessageLoop::TYPE_UI), | 55 message_loop_(base::MessageLoop::TYPE_UI), |
| 56 audio_manager_(AudioManager::CreateForTesting()), | 56 audio_manager_(AudioManager::CreateForTesting()), |
| 57 audio_input_stream_(NULL) { | 57 audio_input_stream_(NULL) { |
| 58 // Wait for the AudioManager to finish any initialization on the audio loop. | 58 // Wait for the AudioManager to finish any initialization on the audio loop. |
| 59 base::RunLoop().RunUntilIdle(); | 59 base::RunLoop().RunUntilIdle(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 ~AudioInputTest() override { base::RunLoop().RunUntilIdle(); } | 62 ~AudioInputTest() override { |
| 63 AudioManager::Destroy(audio_manager_.release()); |
| 64 base::RunLoop().RunUntilIdle(); |
| 65 } |
| 63 | 66 |
| 64 protected: | 67 protected: |
| 65 bool InputDevicesAvailable() { | 68 bool InputDevicesAvailable() { |
| 66 return audio_manager_->HasAudioInputDevices(); | 69 return audio_manager_->HasAudioInputDevices(); |
| 67 } | 70 } |
| 68 | 71 |
| 69 void MakeAudioInputStreamOnAudioThread() { | 72 void MakeAudioInputStreamOnAudioThread() { |
| 70 RunOnAudioThread( | 73 RunOnAudioThread( |
| 71 base::Bind(&AudioInputTest::MakeAudioInputStream, | 74 base::Bind(&AudioInputTest::MakeAudioInputStream, |
| 72 base::Unretained(this))); | 75 base::Unretained(this))); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 base::MessageLoop::QuitWhenIdleClosure(), | 229 base::MessageLoop::QuitWhenIdleClosure(), |
| 227 base::TimeDelta::FromMilliseconds(500)); | 230 base::TimeDelta::FromMilliseconds(500)); |
| 228 message_loop_.Run(); | 231 message_loop_.Run(); |
| 229 EXPECT_GE(test_callback.callback_count(), 2); | 232 EXPECT_GE(test_callback.callback_count(), 2); |
| 230 EXPECT_FALSE(test_callback.had_error()); | 233 EXPECT_FALSE(test_callback.had_error()); |
| 231 | 234 |
| 232 StopAndCloseAudioInputStreamOnAudioThread(); | 235 StopAndCloseAudioInputStreamOnAudioThread(); |
| 233 } | 236 } |
| 234 | 237 |
| 235 } // namespace media | 238 } // namespace media |
| OLD | NEW |