| Index: ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_testing_rpc_server.cc
|
| ===================================================================
|
| --- ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_testing_rpc_server.cc (revision 114053)
|
| +++ ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_testing_rpc_server.cc (working copy)
|
| @@ -17,7 +17,9 @@
|
| #include "srpcgen/ppb_rpc.h"
|
|
|
| using ppapi_proxy::DebugPrintf;
|
| +using ppapi_proxy::DeserializeTo;
|
| using ppapi_proxy::PPBTestingInterface;
|
| +using ppapi_proxy::SerializeTo;
|
|
|
| void PpbTestingRpcServer::PPB_Testing_ReadImageData(
|
| NaClSrpcRpc* rpc,
|
| @@ -90,4 +92,50 @@
|
| rpc->result = NACL_SRPC_RESULT_OK;
|
| }
|
|
|
| +void PpbTestingRpcServer::PPB_Testing_SimulateInputEvent(
|
| + NaClSrpcRpc* rpc,
|
| + NaClSrpcClosure* done,
|
| + PP_Instance instance,
|
| + PP_Resource input_event) {
|
| + NaClSrpcClosureRunner runner(done);
|
| + rpc->result = NACL_SRPC_RESULT_APP_ERROR;
|
|
|
| + PPBTestingInterface()->SimulateInputEvent(instance, input_event);
|
| +
|
| + DebugPrintf("PPB_Testing::SimulateInputEvent: instance=%"NACL_PRIu32"\n",
|
| + instance);
|
| + rpc->result = NACL_SRPC_RESULT_OK;
|
| +}
|
| +
|
| +void PpbTestingRpcServer::PPB_Testing_ExecuteScript(
|
| + NaClSrpcRpc* rpc,
|
| + NaClSrpcClosure* done,
|
| + PP_Instance instance,
|
| + nacl_abi_size_t script_size, char* script_bytes,
|
| + nacl_abi_size_t* result_size, char* result_bytes,
|
| + nacl_abi_size_t* exception_size, char* exception_bytes) {
|
| + NaClSrpcClosureRunner runner(done);
|
| + rpc->result = NACL_SRPC_RESULT_APP_ERROR;
|
| +
|
| + PP_Var script;
|
| + if (!DeserializeTo(script_bytes, script_size, 1, &script))
|
| + return;
|
| +
|
| + PP_Var exception = PP_MakeUndefined();
|
| + PP_Var result =
|
| + PPBTestingInterface()->ExecuteScript(instance, script, &exception);
|
| +
|
| + // The proxy can't serialize anything more complex than a string.
|
| + if (result.type > PP_VARTYPE_STRING)
|
| + result = PP_MakeUndefined();
|
| + if (exception.type > PP_VARTYPE_STRING)
|
| + exception = PP_MakeUndefined();
|
| +
|
| + if (!SerializeTo(&result, result_bytes, result_size))
|
| + return;
|
| + if (!SerializeTo(&exception, exception_bytes, exception_size))
|
| + return;
|
| +
|
| + rpc->result = NACL_SRPC_RESULT_OK;
|
| +}
|
| +
|
|
|