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

Unified Diff: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_testing.cc

Issue 8920005: Add TestingInstance::EvalScript method which posts a message that the test page can eval(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years 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
Index: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_testing.cc
===================================================================
--- ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_testing.cc (revision 114053)
+++ ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_testing.cc (working copy)
@@ -97,6 +97,51 @@
return PP_FALSE;
}
+void SimulateInputEvent(PP_Instance instance, PP_Resource input_event) {
+ DebugPrintf("PPB_Testing::SimulateInputEvent: instance=%"NACL_PRId32", "
+ "input_event=%"NACL_PRId32"\n",
+ instance, input_event);
+
+ NaClSrpcError srpc_result =
+ PpbTestingRpcClient::PPB_Testing_SimulateInputEvent(GetMainSrpcChannel(),
+ instance,
+ input_event);
+ DebugPrintf("PPB_Testing::SimulateInputEvent: %s\n",
+ NaClSrpcErrorString(srpc_result));
+}
+
+PP_Var ExecuteScript(PP_Instance instance, PP_Var script, PP_Var* exception) {
+ DebugPrintf("PPB_Testing::ExecuteScript: instance=%"NACL_PRId32", "
+ "script=%"NACL_PRId32", exception=%"NACL_PRId32"\n",
+ script, exception);
+
+ nacl_abi_size_t script_size = kMaxVarSize;
+ nacl::scoped_array<char> script_bytes(Serialize(&script, 1, &script_size));
+ nacl_abi_size_t exception_size = kMaxVarSize;
+ nacl::scoped_array<char> exception_bytes(new char[kMaxVarSize]);
+ nacl_abi_size_t result_size = kMaxVarSize;
+ nacl::scoped_array<char> result_bytes(new char[kMaxVarSize]);
+
+ NaClSrpcError srpc_result =
+ PpbTestingRpcClient::PPB_Testing_ExecuteScript(
+ GetMainSrpcChannel(),
+ instance,
+ script_size, script_bytes.get(),
+ &exception_size, exception_bytes.get(),
+ &result_size, result_bytes.get());
+
+ DebugPrintf("PPB_Testing::ExecuteScript: %s\n",
+ NaClSrpcErrorString(srpc_result));
+
+ PP_Var result = PP_MakeUndefined();
+ if (srpc_result == NACL_SRPC_RESULT_OK) {
+ (void) DeserializeTo(result_bytes.get(), result_size, 1, &result);
+ (void) DeserializeTo(exception_bytes.get(), exception_size, 1, exception);
+ }
+
+ return result;
+}
+
} // namespace
const PPB_Testing_Dev* PluginTesting::GetInterface() {
@@ -105,7 +150,9 @@
RunMessageLoop,
QuitMessageLoop,
GetLiveObjectsForInstance,
- IsOutOfProcess
+ IsOutOfProcess,
+ SimulateInputEvent,
+ ExecuteScript
};
return &testing_interface;
}

Powered by Google App Engine
This is Rietveld 408576698