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

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: 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 91220198ef7702291800603071c584174711663d..af6bfcd5f10030c04a596ca7829464973a40c43a 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::AudioOutputIPCDelegate::State 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::AudioOutputIPCDelegate::kPlaying, 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();

Powered by Google App Engine
This is Rietveld 408576698