summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/dispatcher.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi/proxy/dispatcher.cc')
-rw-r--r--ppapi/proxy/dispatcher.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/ppapi/proxy/dispatcher.cc b/ppapi/proxy/dispatcher.cc
index 0ae8e2e..f852c49 100644
--- a/ppapi/proxy/dispatcher.cc
+++ b/ppapi/proxy/dispatcher.cc
@@ -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 @@ Dispatcher::Dispatcher(base::ProcessHandle remote_process_handle,
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 @@ bool Dispatcher::InitWithChannel(MessageLoop* ipc_message_loop,
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 @@ const void* Dispatcher::GetProxiedInterface(const std::string& interface) {
}
bool Dispatcher::Send(IPC::Message* msg) {
+ if (test_sink_)
+ return test_sink_->Send(msg);
return channel_->Send(msg);
}