Index: ppapi/proxy/dispatcher.cc |
=================================================================== |
--- ppapi/proxy/dispatcher.cc (revision 72840) |
+++ ppapi/proxy/dispatcher.cc (working copy) |
@@ -12,6 +12,7 @@ |
#include "base/logging.h" |
#include "ipc/ipc_message.h" |
#include "ipc/ipc_sync_channel.h" |
+#include "ipc/ipc_test_sink.h" |
#include "ppapi/c/dev/ppb_buffer_dev.h" |
#include "ppapi/c/dev/ppb_char_set_dev.h" |
#include "ppapi/c/dev/ppb_cursor_control_dev.h" |
@@ -65,6 +66,7 @@ |
GetInterfaceFunc local_get_interface) |
: pp_module_(0), |
remote_process_handle_(remote_process_handle), |
+ test_sink_(NULL), |
disallow_trusted_interfaces_(false), // TODO(brettw) make this settable. |
local_get_interface_(local_get_interface), |
declared_supported_remote_interfaces_(false), |
@@ -87,6 +89,11 @@ |
return true; |
} |
+void Dispatcher::InitWithTestSink(IPC::TestSink* test_sink) { |
+ DCHECK(!test_sink_); |
+ test_sink_ = test_sink; |
+} |
+ |
bool Dispatcher::OnMessageReceived(const IPC::Message& msg) { |
// Control messages. |
if (msg.routing_id() == MSG_ROUTING_CONTROL) { |
@@ -157,6 +164,8 @@ |
} |
bool Dispatcher::Send(IPC::Message* msg) { |
+ if (test_sink_) |
+ return test_sink_->Send(msg); |
return channel_->Send(msg); |
} |