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/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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 // This test is failing on ARM linux: http://crbug.com/238490 | 154 // This test is failing on ARM linux: http://crbug.com/238490 |
155 #define MAYBE_Record DISABLED_Record | 155 #define MAYBE_Record DISABLED_Record |
156 #else | 156 #else |
157 #define MAYBE_Record Record | 157 #define MAYBE_Record Record |
158 #endif | 158 #endif |
159 // Test a normal recording sequence using an AudioInputStream. | 159 // Test a normal recording sequence using an AudioInputStream. |
160 TEST(AudioInputTest, MAYBE_Record) { | 160 TEST(AudioInputTest, MAYBE_Record) { |
161 scoped_ptr<AudioManager> audio_man(AudioManager::CreateForTesting()); | 161 scoped_ptr<AudioManager> audio_man(AudioManager::CreateForTesting()); |
162 if (!CanRunAudioTests(audio_man.get())) | 162 if (!CanRunAudioTests(audio_man.get())) |
163 return; | 163 return; |
164 base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); | 164 base::MessageLoop message_loop; |
165 AudioInputStream* ais = CreateTestAudioInputStream(audio_man.get()); | 165 AudioInputStream* ais = CreateTestAudioInputStream(audio_man.get()); |
166 EXPECT_TRUE(ais->Open()); | 166 EXPECT_TRUE(ais->Open()); |
167 | 167 |
168 TestInputCallback test_callback(kSamplesPerPacket * 4); | 168 TestInputCallback test_callback(kSamplesPerPacket * 4); |
169 ais->Start(&test_callback); | 169 ais->Start(&test_callback); |
170 // Verify at least 500ms worth of audio was recorded, after giving sufficient | 170 // Verify at least 500ms worth of audio was recorded, after giving sufficient |
171 // extra time. | 171 // extra time. |
172 message_loop.PostDelayedTask( | 172 message_loop.PostDelayedTask( |
173 FROM_HERE, | 173 FROM_HERE, |
174 base::MessageLoop::QuitClosure(), | 174 base::MessageLoop::QuitClosure(), |
175 base::TimeDelta::FromMilliseconds(690)); | 175 base::TimeDelta::FromMilliseconds(690)); |
176 message_loop.Run(); | 176 message_loop.Run(); |
177 EXPECT_GE(test_callback.callback_count(), 1); | 177 EXPECT_GE(test_callback.callback_count(), 1); |
178 EXPECT_FALSE(test_callback.had_error()); | 178 EXPECT_FALSE(test_callback.had_error()); |
179 | 179 |
180 ais->Stop(); | 180 ais->Stop(); |
181 ais->Close(); | 181 ais->Close(); |
182 } | 182 } |
183 | 183 |
184 } // namespace media | 184 } // namespace media |
OLD | NEW |