From 1e7334935fbb00eb74763e74b0c181023af552d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=B3=8A=E8=BF=9Cyg?= Date: Thu, 28 Jul 2022 01:52:25 +0000 Subject: [PATCH] add api mock for new api of rpc Signed-off-by: boyuan zhang --- .../main/extend/systemplugin/napi/ohos_rpc.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/runtime/main/extend/systemplugin/napi/ohos_rpc.js b/runtime/main/extend/systemplugin/napi/ohos_rpc.js index 62d500f5..c2e1bc07 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_rpc.js +++ b/runtime/main/extend/systemplugin/napi/ohos_rpc.js @@ -508,6 +508,13 @@ export const RemoteObjectClass = class RemoteObject { }) } }; + this.sendRequestAsync = function (...args) { + console.warn("RemoteObject.sendRequestAsync interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return new Promise((resolve, reject) => { + resolve(SendRequestResultMock) + }) + }; this.getCallingPid = function () { console.warn("RemoteObject.getCallingPid interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") @@ -580,6 +587,13 @@ export const RemoteProxyClass = class RemoteProxy { }) } }; + this.sendRequestAsync = function (...args) { + console.warn("RemoteProxy.sendRequestAsync mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return new Promise((resolve, reject) => { + resolve(SendRequestResultMock) + }) + }; this.PING_TRANSACTION = ('_'.charCodeAt(0) << 24) | ('P'.charCodeAt(0) << 16) | ('N'.charCodeAt(0) << 8) | 'G'.charCodeAt(0); this.DUMP_TRANSACTION = ('_'.charCodeAt(0) << 24) | ('D'.charCodeAt(0) << 16) | @@ -608,6 +622,13 @@ export const IRemoteObjectMock = { }) } }, + sendRequestAsync: function (...args) { + console.warn("IRemoteObject.sendRequestAsync interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return new Promise((resolve, reject) => { + resolve(SendRequestResultMock) + }) + }, addDeathRecipient: function (...args) { console.warn("IRemoteObject.addDeathRecipient interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") -- Gitee