OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 return mock_audio_manager_.get(); | 103 return mock_audio_manager_.get(); |
104 } | 104 } |
105 | 105 |
106 MessageLoopForUI* message_loop() { | 106 MessageLoopForUI* message_loop() { |
107 return &message_loop_; | 107 return &message_loop_; |
108 } | 108 } |
109 | 109 |
110 // Convenience method which ensures that we are not running on the build | 110 // Convenience method which ensures that we are not running on the build |
111 // bots and that at least one valid input and output device can be found. | 111 // bots and that at least one valid input and output device can be found. |
112 bool CanRunAudioTests() { | 112 bool CanRunAudioTests() { |
113 scoped_ptr<base::Environment> env(base::Environment::Create()); | 113 bool input = audio_manager()->HasAudioInputDevices(); |
114 if (env->HasVar("CHROME_HEADLESS")) | 114 bool output = audio_manager()->HasAudioOutputDevices(); |
115 return false; | 115 LOG_IF(WARNING, !input) << "No input device detected."; |
116 return (audio_manager()->HasAudioInputDevices() && | 116 LOG_IF(WARNING, !output) << "No output device detected."; |
117 audio_manager()->HasAudioOutputDevices()); | 117 return input && output; |
118 } | 118 } |
119 | 119 |
120 private: | 120 private: |
121 MessageLoopForUI message_loop_; | 121 MessageLoopForUI message_loop_; |
122 scoped_refptr<MockAudioManager> mock_audio_manager_; | 122 scoped_refptr<MockAudioManager> mock_audio_manager_; |
123 | 123 |
124 DISALLOW_COPY_AND_ASSIGN(AudioLowLatencyInputOutputTest); | 124 DISALLOW_COPY_AND_ASSIGN(AudioLowLatencyInputOutputTest); |
125 }; | 125 }; |
126 | 126 |
127 } // namespace | 127 } // namespace |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 aos->Stop(); | 450 aos->Stop(); |
451 ais->Stop(); | 451 ais->Stop(); |
452 | 452 |
453 // All Close() operations that run on the mocked audio thread, | 453 // All Close() operations that run on the mocked audio thread, |
454 // should be synchronous and not post additional close tasks to | 454 // should be synchronous and not post additional close tasks to |
455 // mocked the audio thread. Hence, there is no need to call | 455 // mocked the audio thread. Hence, there is no need to call |
456 // message_loop()->RunAllPending() after the Close() methods. | 456 // message_loop()->RunAllPending() after the Close() methods. |
457 aos->Close(); | 457 aos->Close(); |
458 ais->Close(); | 458 ais->Close(); |
459 } | 459 } |
OLD | NEW |