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.h" | 8 #include "base/message_loop.h" |
9 #include "base/threading/platform_thread.h" | 9 #include "base/threading/platform_thread.h" |
10 #include "media/audio/audio_io.h" | 10 #include "media/audio/audio_io.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 if (!CanRunAudioTests(audio_man.get())) | 152 if (!CanRunAudioTests(audio_man.get())) |
153 return; | 153 return; |
154 MessageLoop message_loop(MessageLoop::TYPE_DEFAULT); | 154 MessageLoop message_loop(MessageLoop::TYPE_DEFAULT); |
155 AudioInputStream* ais = CreateTestAudioInputStream(audio_man.get()); | 155 AudioInputStream* ais = CreateTestAudioInputStream(audio_man.get()); |
156 EXPECT_TRUE(ais->Open()); | 156 EXPECT_TRUE(ais->Open()); |
157 | 157 |
158 TestInputCallback test_callback(kSamplesPerPacket * 4); | 158 TestInputCallback test_callback(kSamplesPerPacket * 4); |
159 ais->Start(&test_callback); | 159 ais->Start(&test_callback); |
160 // Verify at least 500ms worth of audio was recorded, after giving sufficient | 160 // Verify at least 500ms worth of audio was recorded, after giving sufficient |
161 // extra time. | 161 // extra time. |
162 message_loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), 590); | 162 message_loop.PostDelayedTask( |
| 163 FROM_HERE, |
| 164 MessageLoop::QuitClosure(), |
| 165 base::TimeDelta::FromMilliseconds(590)); |
163 message_loop.Run(); | 166 message_loop.Run(); |
164 EXPECT_GE(test_callback.callback_count(), 10); | 167 EXPECT_GE(test_callback.callback_count(), 10); |
165 EXPECT_FALSE(test_callback.had_error()); | 168 EXPECT_FALSE(test_callback.had_error()); |
166 | 169 |
167 ais->Stop(); | 170 ais->Stop(); |
168 ais->Close(); | 171 ais->Close(); |
169 } | 172 } |
OLD | NEW |