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/bind.h" | 6 #include "base/bind.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
9 #include "base/test/test_timeouts.h" | 9 #include "base/test/test_timeouts.h" |
10 #include "media/audio/audio_input_controller.h" | 10 #include "media/audio/audio_input_controller.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // Record and wait until ten OnData() callbacks are received. | 138 // Record and wait until ten OnData() callbacks are received. |
139 message_loop_.Run(); | 139 message_loop_.Run(); |
140 | 140 |
141 // Close the AudioInputController synchronously. | 141 // Close the AudioInputController synchronously. |
142 CloseAudioController(controller.get()); | 142 CloseAudioController(controller.get()); |
143 } | 143 } |
144 | 144 |
145 // Test that the AudioInputController reports an error when the input stream | 145 // Test that the AudioInputController reports an error when the input stream |
146 // stops. This can happen when the underlying audio layer stops feeding data as | 146 // stops. This can happen when the underlying audio layer stops feeding data as |
147 // a result of a removed microphone device. | 147 // a result of a removed microphone device. |
148 TEST_F(AudioInputControllerTest, RecordAndError) { | 148 #if defined(OS_MACOSX) |
| 149 // Disabled on Mac due to crbug.com/357501. |
| 150 // TODO(tommi): Remove the test when the timer workaround has been removed. |
| 151 #define MAYBE_RecordAndError DISABLED_RecordAndError |
| 152 #else |
| 153 #define MAYBE_RecordAndError RecordAndError |
| 154 #endif |
| 155 TEST_F(AudioInputControllerTest, MAYBE_RecordAndError) { |
149 MockAudioInputControllerEventHandler event_handler; | 156 MockAudioInputControllerEventHandler event_handler; |
150 int count = 0; | 157 int count = 0; |
151 | 158 |
152 // OnCreated() will be called once. | 159 // OnCreated() will be called once. |
153 EXPECT_CALL(event_handler, OnCreated(NotNull())) | 160 EXPECT_CALL(event_handler, OnCreated(NotNull())) |
154 .Times(Exactly(1)); | 161 .Times(Exactly(1)); |
155 | 162 |
156 // OnRecording() will be called only once. | 163 // OnRecording() will be called only once. |
157 EXPECT_CALL(event_handler, OnRecording(NotNull())) | 164 EXPECT_CALL(event_handler, OnRecording(NotNull())) |
158 .Times(Exactly(1)); | 165 .Times(Exactly(1)); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 controller->Record(); | 257 controller->Record(); |
251 | 258 |
252 controller->Close(base::MessageLoop::QuitClosure()); | 259 controller->Close(base::MessageLoop::QuitClosure()); |
253 base::MessageLoop::current()->Run(); | 260 base::MessageLoop::current()->Run(); |
254 | 261 |
255 controller->Close(base::MessageLoop::QuitClosure()); | 262 controller->Close(base::MessageLoop::QuitClosure()); |
256 base::MessageLoop::current()->Run(); | 263 base::MessageLoop::current()->Run(); |
257 } | 264 } |
258 | 265 |
259 } // namespace media | 266 } // namespace media |
OLD | NEW |