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

Unified Diff: content/test/webrtc_audio_device_test.cc

Issue 24514003: Make BrowserMessageFilter not derive from IPC::ChannelProxy::MessageFilter. This allows us to hide … (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 7 years, 3 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
« no previous file with comments | « content/test/webrtc_audio_device_test.h ('k') | ipc/ipc_channel_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/webrtc_audio_device_test.cc
===================================================================
--- content/test/webrtc_audio_device_test.cc (revision 225900)
+++ content/test/webrtc_audio_device_test.cc (working copy)
@@ -77,6 +77,61 @@
DISALLOW_COPY_AND_ASSIGN(WebRTCMockRenderProcess);
};
+class TestAudioRendererHost : public AudioRendererHost {
+ public:
+ TestAudioRendererHost(
+ int render_process_id,
+ media::AudioManager* audio_manager,
+ AudioMirroringManager* mirroring_manager,
+ MediaInternals* media_internals,
+ MediaStreamManager* media_stream_manager,
+ IPC::Channel* channel)
+ : AudioRendererHost(render_process_id, audio_manager, mirroring_manager,
+ media_internals, media_stream_manager),
+ channel_(channel) {}
+ virtual bool Send(IPC::Message* message) OVERRIDE {
+ if (channel_)
+ return channel_->Send(message);
+ return false;
+ }
+ void ResetChannel() {
+ channel_ = NULL;
+ }
+
+ protected:
+ virtual ~TestAudioRendererHost() {}
+
+ private:
+ IPC::Channel* channel_;
+};
+
+class TestAudioInputRendererHost : public AudioInputRendererHost {
+ public:
+ TestAudioInputRendererHost(
+ media::AudioManager* audio_manager,
+ MediaStreamManager* media_stream_manager,
+ AudioMirroringManager* audio_mirroring_manager,
+ media::UserInputMonitor* user_input_monitor,
+ IPC::Channel* channel)
+ : AudioInputRendererHost(audio_manager, media_stream_manager,
+ audio_mirroring_manager, user_input_monitor),
+ channel_(channel) {}
+ virtual bool Send(IPC::Message* message) OVERRIDE {
+ if (channel_)
+ return channel_->Send(message);
+ return false;
+ }
+ void ResetChannel() {
+ channel_ = NULL;
+ }
+
+ protected:
+ virtual ~TestAudioInputRendererHost() {}
+
+ private:
+ IPC::Channel* channel_;
+};
+
// Utility scoped class to replace the global content client's renderer for the
// duration of the test.
class ReplaceContentClientRenderer {
@@ -258,24 +313,23 @@
void MAYBE_WebRTCAudioDeviceTest::CreateChannel(const char* name) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ channel_.reset(new IPC::Channel(name, IPC::Channel::MODE_SERVER, this));
+ ASSERT_TRUE(channel_->Connect());
+
static const int kRenderProcessId = 1;
- audio_render_host_ = new AudioRendererHost(
+ audio_render_host_ = new TestAudioRendererHost(
kRenderProcessId, audio_manager_.get(), mirroring_manager_.get(),
- media_internals_.get(), media_stream_manager_.get());
- audio_render_host_->OnChannelConnected(base::GetCurrentProcId());
+ media_internals_.get(), media_stream_manager_.get(), channel_.get());
+ audio_render_host_->set_peer_pid_for_testing(base::GetCurrentProcId());
audio_input_renderer_host_ =
- new AudioInputRendererHost(audio_manager_.get(),
- media_stream_manager_.get(),
- mirroring_manager_.get(),
- NULL);
- audio_input_renderer_host_->OnChannelConnected(base::GetCurrentProcId());
-
- channel_.reset(new IPC::Channel(name, IPC::Channel::MODE_SERVER, this));
- ASSERT_TRUE(channel_->Connect());
-
- audio_render_host_->OnFilterAdded(channel_.get());
- audio_input_renderer_host_->OnFilterAdded(channel_.get());
+ new TestAudioInputRendererHost(audio_manager_.get(),
+ media_stream_manager_.get(),
+ mirroring_manager_.get(),
+ NULL,
+ channel_.get());
+ audio_input_renderer_host_->set_peer_pid_for_testing(
+ base::GetCurrentProcId());
}
void MAYBE_WebRTCAudioDeviceTest::DestroyChannel() {
@@ -284,6 +338,8 @@
audio_render_host_->OnFilterRemoved();
audio_input_renderer_host_->OnChannelClosing();
audio_input_renderer_host_->OnFilterRemoved();
+ audio_render_host_->ResetChannel();
+ audio_input_renderer_host_->ResetChannel();
channel_.reset();
audio_render_host_ = NULL;
audio_input_renderer_host_ = NULL;
« no previous file with comments | « content/test/webrtc_audio_device_test.h ('k') | ipc/ipc_channel_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698