| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CONTENT_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_ | 5 #ifndef CONTENT_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_ |
| 6 #define CONTENT_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_ | 6 #define CONTENT_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/message_loop.h" |
| 17 #include "base/synchronization/waitable_event.h" |
| 16 #include "content/browser/renderer_host/media/mock_media_observer.h" | 18 #include "content/browser/renderer_host/media/mock_media_observer.h" |
| 17 #include "content/renderer/media/audio_renderer_impl.h" | |
| 18 #include "content/renderer/mock_content_renderer_client.h" | 19 #include "content/renderer/mock_content_renderer_client.h" |
| 19 #include "ipc/ipc_channel.h" | 20 #include "ipc/ipc_channel.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 21 #include "third_party/webrtc/common_types.h" | 22 #include "third_party/webrtc/common_types.h" |
| 22 | 23 |
| 24 class AudioInputRendererHost; |
| 23 class AudioRendererHost; | 25 class AudioRendererHost; |
| 24 class RenderThreadImpl; | 26 class RenderThreadImpl; |
| 25 class WebRTCMockRenderProcess; | 27 class WebRTCMockRenderProcess; |
| 26 | 28 |
| 27 namespace base { | 29 namespace base { |
| 28 namespace win { | 30 namespace win { |
| 29 class ScopedCOMInitializer; | 31 class ScopedCOMInitializer; |
| 30 } | 32 } |
| 31 } | 33 } |
| 32 | 34 |
| 33 namespace content { | 35 namespace content { |
| 34 class ContentRendererClient; | 36 class ContentRendererClient; |
| 35 class ResourceContext; | 37 class ResourceContext; |
| 36 class TestBrowserThread; | 38 class TestBrowserThread; |
| 37 } | 39 } |
| 38 | 40 |
| 41 namespace media_stream { |
| 42 class MediaStreamManager; |
| 43 } |
| 44 |
| 39 namespace net { | 45 namespace net { |
| 40 class URLRequestContext; | 46 class URLRequestContext; |
| 41 } | 47 } |
| 42 | 48 |
| 43 namespace webrtc { | 49 namespace webrtc { |
| 44 class VoENetwork; | 50 class VoENetwork; |
| 45 } | 51 } |
| 46 | 52 |
| 47 // Scoped class for WebRTC interfaces. Fetches the wrapped interface | 53 // Scoped class for WebRTC interfaces. Fetches the wrapped interface |
| 48 // in the constructor via WebRTC's GetInterface mechanism and then releases | 54 // in the constructor via WebRTC's GetInterface mechanism and then releases |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 169 |
| 164 std::string GetTestDataPath(const FilePath::StringType& file_name); | 170 std::string GetTestDataPath(const FilePath::StringType& file_name); |
| 165 | 171 |
| 166 scoped_ptr<ReplaceContentClientRenderer> saved_content_renderer_; | 172 scoped_ptr<ReplaceContentClientRenderer> saved_content_renderer_; |
| 167 MessageLoopForUI message_loop_; | 173 MessageLoopForUI message_loop_; |
| 168 content::MockContentRendererClient mock_content_renderer_client_; | 174 content::MockContentRendererClient mock_content_renderer_client_; |
| 169 RenderThreadImpl* render_thread_; // Owned by mock_process_. | 175 RenderThreadImpl* render_thread_; // Owned by mock_process_. |
| 170 scoped_ptr<WebRTCMockRenderProcess> mock_process_; | 176 scoped_ptr<WebRTCMockRenderProcess> mock_process_; |
| 171 base::WaitableEvent event_; | 177 base::WaitableEvent event_; |
| 172 scoped_ptr<MockMediaObserver> media_observer_; | 178 scoped_ptr<MockMediaObserver> media_observer_; |
| 179 scoped_ptr<media_stream::MediaStreamManager> media_stream_manager_; |
| 173 scoped_ptr<content::ResourceContext> resource_context_; | 180 scoped_ptr<content::ResourceContext> resource_context_; |
| 174 scoped_refptr<net::URLRequestContext> test_request_context_; | 181 scoped_refptr<net::URLRequestContext> test_request_context_; |
| 175 scoped_ptr<IPC::Channel> channel_; | 182 scoped_ptr<IPC::Channel> channel_; |
| 176 scoped_refptr<AudioRendererHost> audio_render_host_; | 183 scoped_refptr<AudioRendererHost> audio_render_host_; |
| 184 scoped_refptr<AudioInputRendererHost> audio_input_renderer_host_; |
| 185 |
| 177 AudioUtilInterface* audio_util_callback_; // Weak reference. | 186 AudioUtilInterface* audio_util_callback_; // Weak reference. |
| 178 | 187 |
| 179 // Initialized on the main test thread that we mark as the UI thread. | 188 // Initialized on the main test thread that we mark as the UI thread. |
| 180 scoped_ptr<content::TestBrowserThread> ui_thread_; | 189 scoped_ptr<content::TestBrowserThread> ui_thread_; |
| 181 // Initialized on our IO thread to satisfy BrowserThread::IO checks. | 190 // Initialized on our IO thread to satisfy BrowserThread::IO checks. |
| 182 scoped_ptr<content::TestBrowserThread> io_thread_; | 191 scoped_ptr<content::TestBrowserThread> io_thread_; |
| 183 // COM initialization on the IO thread for Windows. | 192 // COM initialization on the IO thread for Windows. |
| 184 scoped_ptr<base::win::ScopedCOMInitializer> initialize_com_; | 193 scoped_ptr<base::win::ScopedCOMInitializer> initialize_com_; |
| 185 }; | 194 }; |
| 186 | 195 |
| 187 // A very basic implementation of webrtc::Transport that acts as a transport | 196 // A very basic implementation of webrtc::Transport that acts as a transport |
| 188 // but just forwards all calls to a local webrtc::VoENetwork implementation. | 197 // but just forwards all calls to a local webrtc::VoENetwork implementation. |
| 189 // Ownership of the VoENetwork object lies outside the class. | 198 // Ownership of the VoENetwork object lies outside the class. |
| 190 class WebRTCTransportImpl : public webrtc::Transport { | 199 class WebRTCTransportImpl : public webrtc::Transport { |
| 191 public: | 200 public: |
| 192 explicit WebRTCTransportImpl(webrtc::VoENetwork* network); | 201 explicit WebRTCTransportImpl(webrtc::VoENetwork* network); |
| 193 virtual ~WebRTCTransportImpl(); | 202 virtual ~WebRTCTransportImpl(); |
| 194 | 203 |
| 195 virtual int SendPacket(int channel, const void* data, int len); | 204 virtual int SendPacket(int channel, const void* data, int len); |
| 196 virtual int SendRTCPPacket(int channel, const void* data, int len); | 205 virtual int SendRTCPPacket(int channel, const void* data, int len); |
| 197 | 206 |
| 198 private: | 207 private: |
| 199 webrtc::VoENetwork* network_; | 208 webrtc::VoENetwork* network_; |
| 200 }; | 209 }; |
| 201 | 210 |
| 202 #endif // CONTENT_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_ | 211 #endif // CONTENT_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_ |
| OLD | NEW |