| 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();
|
|
|