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

Unified Diff: media/audio/sounds/audio_stream_handler_unittest.cc

Issue 115693004: Added volume adjust sound behind the flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed creation of AudioParameters. Created 7 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 side-by-side diff with in-line comments
Download patch
Index: media/audio/sounds/audio_stream_handler_unittest.cc
diff --git a/media/audio/sounds/audio_stream_handler_unittest.cc b/media/audio/sounds/audio_stream_handler_unittest.cc
index 50bc301c38abed23f5a72eadcd39e2764a4802c4..d6f2c2a325ba86b363b744573d24a2e599cfb561 100644
--- a/media/audio/sounds/audio_stream_handler_unittest.cc
+++ b/media/audio/sounds/audio_stream_handler_unittest.cc
@@ -49,6 +49,10 @@ class AudioStreamHandlerTest : public testing::Test {
AudioStreamHandler::SetAudioSourceForTesting(source);
}
+ void AllowReplayOnceForTesting() {
+ audio_stream_handler_->AllowReplayOnceForTesting();
+ }
+
private:
scoped_ptr<AudioManager> audio_manager_;
scoped_ptr<AudioStreamHandler> audio_stream_handler_;
@@ -74,34 +78,24 @@ TEST_F(AudioStreamHandlerTest, Play) {
ASSERT_EQ(4, observer.cursor());
}
-TEST_F(AudioStreamHandlerTest, Rewind) {
+TEST_F(AudioStreamHandlerTest, Replay) {
base::RunLoop run_loop;
TestObserver observer(run_loop.QuitClosure());
- SineWaveAudioSource source(CHANNEL_LAYOUT_STEREO, 200.0, 8000);
-
SetObserverForTesting(&observer);
- SetAudioSourceForTesting(&source);
ASSERT_TRUE(audio_stream_handler()->IsInitialized());
+ AllowReplayOnceForTesting();
+ ASSERT_TRUE(audio_stream_handler()->Play());
ASSERT_TRUE(audio_stream_handler()->Play());
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- base::Bind(base::IgnoreResult(&AudioStreamHandler::Play),
- base::Unretained(audio_stream_handler())),
- base::TimeDelta::FromSeconds(3));
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- base::Bind(&AudioStreamHandler::Stop,
- base::Unretained(audio_stream_handler())),
- base::TimeDelta::FromSeconds(6));
run_loop.Run();
SetObserverForTesting(NULL);
SetAudioSourceForTesting(NULL);
- ASSERT_EQ(2, observer.num_play_requests());
+ ASSERT_EQ(1, observer.num_play_requests());
+ ASSERT_EQ(1, observer.num_replays());
ASSERT_EQ(1, observer.num_stop_requests());
}

Powered by Google App Engine
This is Rietveld 408576698