Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: media/audio/audio_input_unittest.cc

Issue 8879032: Removing MessageLoop::QuitTask() from media/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Really fixed. Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | media/audio/win/audio_low_latency_output_win_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 if (!CanRunAudioTests()) 174 if (!CanRunAudioTests())
175 return; 175 return;
176 MessageLoop message_loop(MessageLoop::TYPE_DEFAULT); 176 MessageLoop message_loop(MessageLoop::TYPE_DEFAULT);
177 AudioInputStream* ais = CreateTestAudioInputStream(); 177 AudioInputStream* ais = CreateTestAudioInputStream();
178 EXPECT_TRUE(ais->Open()); 178 EXPECT_TRUE(ais->Open());
179 179
180 TestInputCallback test_callback(kSamplesPerPacket * 4); 180 TestInputCallback test_callback(kSamplesPerPacket * 4);
181 ais->Start(&test_callback); 181 ais->Start(&test_callback);
182 // Verify at least 500ms worth of audio was recorded, after giving sufficient 182 // Verify at least 500ms worth of audio was recorded, after giving sufficient
183 // extra time. 183 // extra time.
184 message_loop.PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask(), 590); 184 message_loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), 590);
185 message_loop.Run(); 185 message_loop.Run();
186 EXPECT_GE(test_callback.callback_count(), 10); 186 EXPECT_GE(test_callback.callback_count(), 10);
187 EXPECT_FALSE(test_callback.had_error()); 187 EXPECT_FALSE(test_callback.had_error());
188 188
189 ais->Stop(); 189 ais->Stop();
190 ais->Close(); 190 ais->Close();
191 } 191 }
192 192
193 // Test a recording sequence with delays in the audio callback. 193 // Test a recording sequence with delays in the audio callback.
194 TEST(AudioInputTest, RecordWithSlowSink) { 194 TEST(AudioInputTest, RecordWithSlowSink) {
195 if (!CanRunAudioTests()) 195 if (!CanRunAudioTests())
196 return; 196 return;
197 MessageLoop message_loop(MessageLoop::TYPE_DEFAULT); 197 MessageLoop message_loop(MessageLoop::TYPE_DEFAULT);
198 AudioInputStream* ais = CreateTestAudioInputStream(); 198 AudioInputStream* ais = CreateTestAudioInputStream();
199 EXPECT_TRUE(ais->Open()); 199 EXPECT_TRUE(ais->Open());
200 200
201 // We should normally get a callback every 50ms, and a 20ms delay inside each 201 // We should normally get a callback every 50ms, and a 20ms delay inside each
202 // callback should not change this sequence. 202 // callback should not change this sequence.
203 TestInputCallbackBlocking test_callback(kSamplesPerPacket * 4, 0, 20); 203 TestInputCallbackBlocking test_callback(kSamplesPerPacket * 4, 0, 20);
204 ais->Start(&test_callback); 204 ais->Start(&test_callback);
205 // Verify at least 500ms worth of audio was recorded, after giving sufficient 205 // Verify at least 500ms worth of audio was recorded, after giving sufficient
206 // extra time. 206 // extra time.
207 message_loop.PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask(), 590); 207 message_loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), 590);
208 message_loop.Run(); 208 message_loop.Run();
209 EXPECT_GE(test_callback.callback_count(), 10); 209 EXPECT_GE(test_callback.callback_count(), 10);
210 EXPECT_FALSE(test_callback.had_error()); 210 EXPECT_FALSE(test_callback.had_error());
211 211
212 ais->Stop(); 212 ais->Stop();
213 ais->Close(); 213 ais->Close();
214 } 214 }
OLDNEW
« no previous file with comments | « no previous file | media/audio/win/audio_low_latency_output_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698