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

Unified Diff: media/audio/audio_output_proxy_unittest.cc

Issue 8680009: Call close_timer_.Reset() from StopStreamTask. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/audio/audio_output_dispatcher.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_output_proxy_unittest.cc
===================================================================
--- media/audio/audio_output_proxy_unittest.cc (revision 111157)
+++ media/audio/audio_output_proxy_unittest.cc (working copy)
@@ -85,10 +85,15 @@
AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR,
CHANNEL_LAYOUT_STEREO, 44100, 16, 1024);
dispatcher_ = new AudioOutputDispatcher(&manager_, params, close_delay_ms);
+
+ // Necessary to know how long the dispatcher will wait before posting
+ // StopStreamTask.
+ pause_delay_milliseconds_ = dispatcher_->pause_delay_milliseconds_;
}
MessageLoop message_loop_;
scoped_refptr<AudioOutputDispatcher> dispatcher_;
+ int64 pause_delay_milliseconds_;
MockAudioManager manager_;
MockAudioSourceCallback callback_;
};
@@ -187,9 +192,12 @@
proxy->Start(&callback_);
proxy->Stop();
- // Simulate a delay.
+ // Wait for StreamStopped() to post StopStreamTask().
+ base::PlatformThread::Sleep(pause_delay_milliseconds_ * 2);
message_loop_.RunAllPending();
- base::PlatformThread::Sleep(kTestCloseDelayMs * 10);
+
+ // Wait for the close timer to fire.
+ base::PlatformThread::Sleep(kTestCloseDelayMs * 2);
message_loop_.RunAllPending();
// Verify expectation before calling Close().
@@ -336,7 +344,7 @@
EXPECT_TRUE(proxy->Open());
// Simulate a delay.
- base::PlatformThread::Sleep(kTestCloseDelayMs);
+ base::PlatformThread::Sleep(kTestCloseDelayMs * 2);
message_loop_.RunAllPending();
// Verify expectation before calling Close().
« no previous file with comments | « media/audio/audio_output_dispatcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698