Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/renderer_host/media/audio_renderer_host.h" | 5 #include "content/browser/renderer_host/media/audio_renderer_host.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 | 102 |
| 103 private: | 103 private: |
| 104 virtual ~MockAudioRendererHost() { | 104 virtual ~MockAudioRendererHost() { |
| 105 // Make sure all audio streams have been deleted. | 105 // Make sure all audio streams have been deleted. |
| 106 EXPECT_TRUE(audio_entries_.empty()); | 106 EXPECT_TRUE(audio_entries_.empty()); |
| 107 } | 107 } |
| 108 | 108 |
| 109 // This method is used to dispatch IPC messages to the renderer. We intercept | 109 // This method is used to dispatch IPC messages to the renderer. We intercept |
| 110 // these messages here and dispatch to our mock methods to verify the | 110 // these messages here and dispatch to our mock methods to verify the |
| 111 // conversation between this object and the renderer. | 111 // conversation between this object and the renderer. |
| 112 // Note: this means that file descriptors won't be duplicated, | |
| 113 // leading to double-close errors from SyncSocket. | |
|
o1ka
2016/09/16 10:51:59
Can you file a bug and refer it here?
Max Morin
2016/09/16 12:46:15
Done.
| |
| 112 virtual bool Send(IPC::Message* message) { | 114 virtual bool Send(IPC::Message* message) { |
| 113 CHECK(message); | 115 CHECK(message); |
| 114 | 116 |
| 115 // In this method we dispatch the messages to the according handlers as if | 117 // In this method we dispatch the messages to the according handlers as if |
| 116 // we are the renderer. | 118 // we are the renderer. |
| 117 bool handled = true; | 119 bool handled = true; |
| 118 IPC_BEGIN_MESSAGE_MAP(MockAudioRendererHost, *message) | 120 IPC_BEGIN_MESSAGE_MAP(MockAudioRendererHost, *message) |
| 119 IPC_MESSAGE_HANDLER(AudioMsg_NotifyDeviceAuthorized, | 121 IPC_MESSAGE_HANDLER(AudioMsg_NotifyDeviceAuthorized, |
| 120 OnNotifyDeviceAuthorized) | 122 OnNotifyDeviceAuthorized) |
| 121 IPC_MESSAGE_HANDLER(AudioMsg_NotifyStreamCreated, | 123 IPC_MESSAGE_HANDLER(AudioMsg_NotifyStreamCreated, |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 442 } | 444 } |
| 443 | 445 |
| 444 TEST_F(AudioRendererHostTest, CreateFailsForInvalidRenderFrame) { | 446 TEST_F(AudioRendererHostTest, CreateFailsForInvalidRenderFrame) { |
| 445 CreateWithInvalidRenderFrameId(); | 447 CreateWithInvalidRenderFrameId(); |
| 446 Close(); | 448 Close(); |
| 447 } | 449 } |
| 448 | 450 |
| 449 // TODO(hclam): Add tests for data conversation in low latency mode. | 451 // TODO(hclam): Add tests for data conversation in low latency mode. |
| 450 | 452 |
| 451 } // namespace content | 453 } // namespace content |
| OLD | NEW |