Implement test-echo extension message and reply.
TEST=Run the following command in the JS console once connected: remoting.clientSession.plugin.sendExtensionMessage('test-echo', <thing to be echoed>)
Review URL: https://chromiumcodereview.appspot.com/23491004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@220802 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc
index b001a39..45439f4 100644
--- a/remoting/host/client_session.cc
+++ b/remoting/host/client_session.cc
@@ -189,6 +189,16 @@
void ClientSession::DeliverClientMessage(
const protocol::ExtensionMessage& message) {
+ if (message.has_type()) {
+ if (message.type() == "test-echo") {
+ protocol::ExtensionMessage reply;
+ reply.set_type("test-echo-reply");
+ if (message.has_data())
+ reply.set_data(message.data().substr(0, 16));
+ connection_->client_stub()->DeliverHostMessage(reply);
+ return;
+ }
+ }
// No messages are currently supported.
LOG(INFO) << "Unexpected message received: "
<< message.type() << ": " << message.data();