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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/environment.h" | 6 #include "base/environment.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 class AudioInputTest : public testing::Test { | 47 class AudioInputTest : public testing::Test { |
48 public: | 48 public: |
49 AudioInputTest() : | 49 AudioInputTest() : |
50 message_loop_(base::MessageLoop::TYPE_UI), | 50 message_loop_(base::MessageLoop::TYPE_UI), |
51 audio_manager_(AudioManager::CreateForTesting()), | 51 audio_manager_(AudioManager::CreateForTesting()), |
52 audio_input_stream_(NULL) { | 52 audio_input_stream_(NULL) { |
53 // Wait for the AudioManager to finish any initialization on the audio loop. | 53 // Wait for the AudioManager to finish any initialization on the audio loop. |
54 base::RunLoop().RunUntilIdle(); | 54 base::RunLoop().RunUntilIdle(); |
55 } | 55 } |
56 | 56 |
57 virtual ~AudioInputTest() { | 57 ~AudioInputTest() override { base::RunLoop().RunUntilIdle(); } |
58 base::RunLoop().RunUntilIdle(); | |
59 } | |
60 | 58 |
61 protected: | 59 protected: |
62 AudioManager* audio_manager() { return audio_manager_.get(); } | 60 AudioManager* audio_manager() { return audio_manager_.get(); } |
63 | 61 |
64 bool CanRunAudioTests() { | 62 bool CanRunAudioTests() { |
65 bool has_input = audio_manager()->HasAudioInputDevices(); | 63 bool has_input = audio_manager()->HasAudioInputDevices(); |
66 LOG_IF(WARNING, !has_input) << "No input devices detected"; | 64 LOG_IF(WARNING, !has_input) << "No input devices detected"; |
67 return has_input; | 65 return has_input; |
68 } | 66 } |
69 | 67 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 base::MessageLoop::QuitClosure(), | 230 base::MessageLoop::QuitClosure(), |
233 base::TimeDelta::FromMilliseconds(500)); | 231 base::TimeDelta::FromMilliseconds(500)); |
234 message_loop_.Run(); | 232 message_loop_.Run(); |
235 EXPECT_GE(test_callback.callback_count(), 2); | 233 EXPECT_GE(test_callback.callback_count(), 2); |
236 EXPECT_FALSE(test_callback.had_error()); | 234 EXPECT_FALSE(test_callback.had_error()); |
237 | 235 |
238 StopAndCloseAudioInputStreamOnAudioThread(); | 236 StopAndCloseAudioInputStreamOnAudioThread(); |
239 } | 237 } |
240 | 238 |
241 } // namespace media | 239 } // namespace media |
OLD | NEW |