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

Unified Diff: content/renderer/media/audio_message_filter_unittest.cc

Issue 1184473002: Add support for the audio-output-device switching IPC mechanism to the renderer lower layers (media… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build dependencies for audio_unittests Created 5 years, 6 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
Index: content/renderer/media/audio_message_filter_unittest.cc
diff --git a/content/renderer/media/audio_message_filter_unittest.cc b/content/renderer/media/audio_message_filter_unittest.cc
index 267a547a6753ef1311c709e762c96c023e8bab15..65b3baa6a78b07f68d45eaf45309835bd27451ad 100644
--- a/content/renderer/media/audio_message_filter_unittest.cc
+++ b/content/renderer/media/audio_message_filter_unittest.cc
@@ -31,6 +31,12 @@ class MockAudioDelegate : public media::AudioOutputIPCDelegate {
length_ = length;
}
+ void OnOutputDeviceSwitched(int request_id,
+ media::SwitchOutputDeviceResult result) override {
+ output_device_switched_received_ = true;
+ switch_output_device_result_ = result;
+ }
+
void OnIPCClosed() override {}
void Reset() {
@@ -43,6 +49,10 @@ class MockAudioDelegate : public media::AudioOutputIPCDelegate {
volume_received_ = false;
volume_ = 0;
+
+ output_device_switched_received_ = false;
+ switch_output_device_result_ =
+ media::SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_SUPPORTED;
}
bool state_changed_received() { return state_changed_received_; }
@@ -52,6 +62,13 @@ class MockAudioDelegate : public media::AudioOutputIPCDelegate {
base::SharedMemoryHandle handle() { return handle_; }
uint32 length() { return length_; }
+ bool output_device_switched_received() {
+ return output_device_switched_received_;
+ }
+ media::SwitchOutputDeviceResult switch_output_device_result() {
+ return switch_output_device_result_;
+ }
+
private:
bool state_changed_received_;
media::AudioOutputIPCDelegateState state_;
@@ -63,6 +80,9 @@ class MockAudioDelegate : public media::AudioOutputIPCDelegate {
bool volume_received_;
double volume_;
+ bool output_device_switched_received_;
+ media::SwitchOutputDeviceResult switch_output_device_result_;
+
DISALLOW_COPY_AND_ASSIGN(MockAudioDelegate);
};
@@ -102,6 +122,14 @@ TEST(AudioMessageFilterTest, Basic) {
EXPECT_EQ(media::AUDIO_OUTPUT_IPC_DELEGATE_STATE_PLAYING, delegate.state());
delegate.Reset();
+ // AudioMsg_NotifyOutputDeviceSwitched
+ static const int kSwitchOutputRequestId = 1;
+ EXPECT_FALSE(delegate.output_device_switched_received());
+ filter->OnOutputDeviceSwitched(kStreamId, kSwitchOutputRequestId,
+ media::SWITCH_OUTPUT_DEVICE_RESULT_SUCCESS);
+ EXPECT_TRUE(delegate.output_device_switched_received());
+ EXPECT_EQ(media::SWITCH_OUTPUT_DEVICE_RESULT_SUCCESS,
+ delegate.switch_output_device_result());
message_loop.RunUntilIdle();
ipc->CloseStream();
« no previous file with comments | « content/renderer/media/audio_message_filter.cc ('k') | content/renderer/media/webrtc_audio_renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698