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

Unified Diff: media/base/audio_renderer_mixer_input_unittest.cc

Issue 2359883002: Make ARMI::SwitchOutputDevice work after Stop is called. (Closed)
Patch Set: Update unit test Created 4 years, 3 months 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/base/audio_renderer_mixer_input.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/audio_renderer_mixer_input_unittest.cc
diff --git a/media/base/audio_renderer_mixer_input_unittest.cc b/media/base/audio_renderer_mixer_input_unittest.cc
index 534a69e3508167329fdc8ab201b2b570eccd2dea..ba7b074b02ccc200a438eb2cce852473e0f31e7c 100644
--- a/media/base/audio_renderer_mixer_input_unittest.cc
+++ b/media/base/audio_renderer_mixer_input_unittest.cc
@@ -260,36 +260,35 @@ TEST_F(AudioRendererMixerInputTest, SwitchOutputDeviceToUnauthorizedDevice) {
mixer_input_->Stop();
}
-// Test that calling SwitchOutputDevice() before Start() is resolved after
-// a call to Start().
+// Test that calling SwitchOutputDevice() before Start() succeeds.
TEST_F(AudioRendererMixerInputTest, SwitchOutputDeviceBeforeStart) {
base::RunLoop run_loop;
+ EXPECT_CALL(*this, SwitchCallbackCalled(OUTPUT_DEVICE_STATUS_OK));
mixer_input_->SwitchOutputDevice(
kDefaultDeviceId, url::Origin(),
base::Bind(&AudioRendererMixerInputTest::SwitchCallback,
base::Unretained(this), &run_loop));
- EXPECT_CALL(*this, SwitchCallbackCalled(OUTPUT_DEVICE_STATUS_OK));
mixer_input_->Start();
run_loop.Run();
mixer_input_->Stop();
}
-// Test that calling SwitchOutputDevice() without ever calling Start() fails
-// cleanly after calling Stop().
+// Test that calling SwitchOutputDevice() succeeds even if Start() is never
+// called.
TEST_F(AudioRendererMixerInputTest, SwitchOutputDeviceWithoutStart) {
base::RunLoop run_loop;
+ EXPECT_CALL(*this, SwitchCallbackCalled(OUTPUT_DEVICE_STATUS_OK));
mixer_input_->SwitchOutputDevice(
kDefaultDeviceId, url::Origin(),
base::Bind(&AudioRendererMixerInputTest::SwitchCallback,
base::Unretained(this), &run_loop));
- EXPECT_CALL(*this, SwitchCallbackCalled(OUTPUT_DEVICE_STATUS_ERROR_INTERNAL));
mixer_input_->Stop();
run_loop.Run();
}
// Test creation with an invalid device. OnRenderError() should be called.
-// Play() and Pause() should not cause crashes, even if they have no effect.
-// SwitchOutputDevice() should fail.
+// Play(), Pause() and SwitchOutputDevice() should not cause crashes, even if
+// they have no effect.
TEST_F(AudioRendererMixerInputTest, CreateWithInvalidDevice) {
// |mixer_input_| was initialized during construction.
mixer_input_->Stop();
@@ -301,7 +300,7 @@ TEST_F(AudioRendererMixerInputTest, CreateWithInvalidDevice) {
mixer_input_->Play();
mixer_input_->Pause();
base::RunLoop run_loop;
- EXPECT_CALL(*this, SwitchCallbackCalled(OUTPUT_DEVICE_STATUS_ERROR_INTERNAL));
+ EXPECT_CALL(*this, SwitchCallbackCalled(testing::_));
mixer_input_->SwitchOutputDevice(
kDefaultDeviceId, url::Origin(),
base::Bind(&AudioRendererMixerInputTest::SwitchCallback,
@@ -310,4 +309,22 @@ TEST_F(AudioRendererMixerInputTest, CreateWithInvalidDevice) {
run_loop.Run();
}
+// Test that calling SwitchOutputDevice() works after calling Stop(), and that
+// restarting works after the call to SwitchOutputDevice().
+TEST_F(AudioRendererMixerInputTest, SwitchOutputDeviceAfterStopBeforeRestart) {
+ mixer_input_->Start();
+ mixer_input_->Stop();
+
+ base::RunLoop run_loop;
+ EXPECT_CALL(*this, SwitchCallbackCalled(OUTPUT_DEVICE_STATUS_OK));
+ mixer_input_->SwitchOutputDevice(
+ kDefaultDeviceId, url::Origin(),
+ base::Bind(&AudioRendererMixerInputTest::SwitchCallback,
+ base::Unretained(this), &run_loop));
+ run_loop.Run();
+
+ mixer_input_->Start();
+ mixer_input_->Stop();
+}
+
} // namespace media
« no previous file with comments | « media/base/audio_renderer_mixer_input.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698