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. |
| 114 // See crbug.com/647659. |
112 virtual bool Send(IPC::Message* message) { | 115 virtual bool Send(IPC::Message* message) { |
113 CHECK(message); | 116 CHECK(message); |
114 | 117 |
115 // In this method we dispatch the messages to the according handlers as if | 118 // In this method we dispatch the messages to the according handlers as if |
116 // we are the renderer. | 119 // we are the renderer. |
117 bool handled = true; | 120 bool handled = true; |
118 IPC_BEGIN_MESSAGE_MAP(MockAudioRendererHost, *message) | 121 IPC_BEGIN_MESSAGE_MAP(MockAudioRendererHost, *message) |
119 IPC_MESSAGE_HANDLER(AudioMsg_NotifyDeviceAuthorized, | 122 IPC_MESSAGE_HANDLER(AudioMsg_NotifyDeviceAuthorized, |
120 OnNotifyDeviceAuthorized) | 123 OnNotifyDeviceAuthorized) |
121 IPC_MESSAGE_HANDLER(AudioMsg_NotifyStreamCreated, | 124 IPC_MESSAGE_HANDLER(AudioMsg_NotifyStreamCreated, |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 } | 445 } |
443 | 446 |
444 TEST_F(AudioRendererHostTest, CreateFailsForInvalidRenderFrame) { | 447 TEST_F(AudioRendererHostTest, CreateFailsForInvalidRenderFrame) { |
445 CreateWithInvalidRenderFrameId(); | 448 CreateWithInvalidRenderFrameId(); |
446 Close(); | 449 Close(); |
447 } | 450 } |
448 | 451 |
449 // TODO(hclam): Add tests for data conversation in low latency mode. | 452 // TODO(hclam): Add tests for data conversation in low latency mode. |
450 | 453 |
451 } // namespace content | 454 } // namespace content |
OLD | NEW |