diff --git a/runtime/main/extend/systemplugin/napi/index.js b/runtime/main/extend/systemplugin/napi/index.js index 498374d6..2b312cb2 100644 --- a/runtime/main/extend/systemplugin/napi/index.js +++ b/runtime/main/extend/systemplugin/napi/index.js @@ -35,6 +35,8 @@ import { mockWifi } from './wifi' import { mockUsb } from './usb' import { mockBundle } from './bundle' import { mockInnerBundle } from './innerBundleManager' +import { mockUri } from './uri' +import { mockXml } from './xml' export function mockRequireNapiFun() { global.requireNapi = function (...args) { @@ -113,6 +115,10 @@ export function mockRequireNapiFun() { return mockBundle(); case "bundle.innerBundleManager": return mockInnerBundle(); + case "uri": + return mockUri(); + case "xml": + return mockXml(); default: return global.requireNapiPreview(...args); } diff --git a/runtime/main/extend/systemplugin/napi/process.js b/runtime/main/extend/systemplugin/napi/process.js index e0ad70db..5652a8d3 100644 --- a/runtime/main/extend/systemplugin/napi/process.js +++ b/runtime/main/extend/systemplugin/napi/process.js @@ -43,15 +43,66 @@ export function mockProcess() { " may be different from that on a real device.") return paramMock.paramBooleanMock; }, - getEgid: '[PC preview] unknow getEgid', - getEuid: '[PC preview] unknow getEuid', - getGid: '[PC preview] unknow getGid', - getUid: '[PC preview] unknow getUid', - getGroups: '[PC preview] unknow getGroups', - getPid: '[PC preview] unknow getPid', - getPpid: '[PC preview] unknow getPpid', - + getStartRealtime: function(...args) { + console.warn("process.getStartRealtime interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + getPastCputime: function(...args) { + console.warn("process.getPastCputime interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + getAvailableCores: function(...args) { + console.warn("process.getAvailableCores interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramArrayMock; + }, + isIsolatedProcess: function(...args) { + console.warn("process.isIsolatedProcess interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + is64Bit: function(...args) { + console.warn("process.is64Bit interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isAppUid: function(...args) { + console.warn("process.isAppUid interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + getUidForName: function(...args) { + console.warn("process.getUidForName interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + getThreadPriority: function(...args) { + console.warn("process.getThreadPriority interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + getSystemConfig: function(...args) { + console.warn("process.getSystemConfig interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + getEnvironmentVar: function(...args) { + console.warn("process.getEnvironmentVar interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramStringMock; + }, + egid: '[PC preview] unknow egid', + euid: '[PC preview] unknow euid', + gid: '[PC preview] unknow gid', + uid: '[PC preview] unknow uid', + groups: '[PC preview] unknow groups', + pid: '[PC preview] unknow pid', + ppid: '[PC preview] unknow ppid', + tid: '[PC preview] unknow tid', } + const ChildProcessMock = { pid: '[PC preview] unknow pid', ppid: '[PC preview] unknow ppid', @@ -90,4 +141,4 @@ export function mockProcess() { } } return result; -} \ No newline at end of file +} diff --git a/runtime/main/extend/systemplugin/napi/uri.js b/runtime/main/extend/systemplugin/napi/uri.js new file mode 100644 index 00000000..3c5d2dfa --- /dev/null +++ b/runtime/main/extend/systemplugin/napi/uri.js @@ -0,0 +1,43 @@ +import { paramMock } from "../utils" + +export function mockUri() { + const result = { + URI: function(...args) { + console.warn("uri.URI interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return URIMock; + } + } + const URIMock = { + toString: function(...args) { + console.warn("URI.toString interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramStringMock; + }, + equals: function(...args) { + console.warn("URI.equals interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + checkIsAbsolute: function(...args) { + console.warn("URI.checkIsAbsolute interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + normalize: function(...args) { + console.warn("URI.normalize interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramObjectMock; + }, + scheme: '[PC preview] unknow scheme', + userinfo: '[PC preview] unknow userinfo', + host: '[PC preview] unknow host', + port: '[PC preview] unknow port', + path: '[PC preview] unknow path', + query: '[PC preview] unknow query', + fragment: '[PC preview] unknow fragment', + authority: '[PC preview] unknow authority', + ssp: '[PC preview] unknow ssp' + } + return result; +} diff --git a/runtime/main/extend/systemplugin/napi/util.js b/runtime/main/extend/systemplugin/napi/util.js index 22c40ca8..77481ba2 100644 --- a/runtime/main/extend/systemplugin/napi/util.js +++ b/runtime/main/extend/systemplugin/napi/util.js @@ -1,77 +1,538 @@ -import {paramMock} from '../utils'; +import { paramMock } from "../utils" export function mockUtil() { - const result = { - printf: function(...args) { - console.warn('util.printf interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - return paramMock.paramStringMock; - }, - getErrorString: function(...args) { - console.warn('util.getErrorString interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - return paramMock.paramStringMock; - }, - callbackWrapper: function(...args) { - console.warn('util.callbackWrapper interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - return function(...args) { - console.warn('util.callbackWrapper.return function interface mocked in the Previewer. How this interface' + - ' works on the Previewer may be different from that on a real device.'); - }; - }, - promiseWrapper: function(func) { - console.warn('util.promiseWrapper interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - if (typeof func === 'function') { - return function(...args) { - return new Promise((resolve, reject) => { - const callback = function(err, ...values) { - if (err) { - reject(err); - } else { - resolve(values); - } - }; - func.apply(null, [...args, callback]); - }); - }; - } - }, - TextDecoder: function(...args) { - console.warn('util.TextDecoder interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - return TextDecoderMock; - }, - TextEncoder: function(...args) { - console.warn('util.TextEncoder interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - return TextEncoderMock; + const result = { + printf: function (...args) { + console.warn("util.printf interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramStringMock; + }, + getErrorString: function (...args) { + console.warn("util.getErrorString interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramStringMock; + }, + callbackWrapper: function (...args) { + console.warn("util.callbackWrapper interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }, + promiseWrapper: function (...args) { + console.warn("util.promiseWrapper interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramObjectMock; + }, + TextDecoder: function (...args) { + console.warn("util.TextDecoder interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return TextDecoderMock; + }, + TextEncoder: function (...args) { + console.warn("util.TextEncoder interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return TextEncoderMock; + }, + RationalNumber: function (...args) { + console.warn("util.RationalNumber interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return RationalNumberMock; + }, + Lrubuffer: function (...args) { + console.warn("util.Lrubuffer interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return LrubufferMock; + }, + Scope: function (...args) { + console.warn("util.Scope interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return ScopeMock; + }, + Base64: function (...args) { + console.warn("util.Base64 interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return Base64Mock; + }, + Types: function(...args) { + console.warn("util.Types interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return TypesMock; + } } - }; - const TextDecoderMock = { - encoding: '[PC preview] unknow encoding', - fatal: '[PC preview] unknow fatal', - ignoreBOM: '[PC preview] unknow ignoreBOM', - decode: function(...args) { - console.warn('TextDecoder.decode interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - return paramMock.paramStringMock; + const TextDecoderMock = { + encoding: '[PC preview] unknow encoding', + fatal: '[PC preview] unknow fatal', + ignoreBOM: '[PC preview] unknow ignoreBOM', + decode: function (...args) { + console.warn("TextDecoder.decode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramStringMock; + } } - }; - const TextEncoderMock = { - encoding: '[PC preview] unknow encoding', - encode: function(...args) { - console.warn('TextEncoder.encode interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - const arr = new Uint8Array(); - return arr; - }, - encodeInto: function(...args) { - console.warn('TextEncoder.encodeInto interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - return paramMock.paramObjectMock; + const TextEncoderMock = { + encoding: '[PC preview] unknow encoding', + encode: function (...args) { + console.warn("TextEncoder.encode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const arr = new Uint8Array() + return arr; + }, + encodeInto: function (...args) { + console.warn("TextEncoder.encodeInto interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramObjectMock; + } } - }; - return result; -} + const RationalNumberMock = { + createRationalFromString: function (...args) { + console.warn("RationalNumber.createRationalFromString​ interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramObjectMock; + }, + compareTo: function (...args) { + console.warn("RationalNumber.compareTo​ interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + equals: function (...args) { + console.warn("RationalNumber.equals​ interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + valueOf: function (...args) { + console.warn("RationalNumber.valueOf interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + getCommonDivisor: function (...args) { + console.warn("RationalNumber.getCommonDivisor​ interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + getDenominator: function (...args) { + console.warn("RationalNumber.getDenominator​ interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + getNumerator: function (...args) { + console.warn("RationalNumber.getNumerator​ interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + isFinite: function (...args) { + console.warn("RationalNumber.isFinite​ interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isNaN: function (...args) { + console.warn("RationalNumber.isNaN​ interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isZero: function (...args) { + console.warn("RationalNumber.isZero​ interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + toString: function (...args) { + console.warn("RationalNumber.toString interface mocked in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramStringMock; + } + } + const LrubufferMock = { + length: '[PC preview] unknow length', + updateCapacity: function (...args) { + console.warn("Lrubuffer.updateCapacity interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + }, + toString: function (...args) { + console.warn("Lrubuffer.toString interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramStringMock; + }, + getCapacity: function (...args) { + console.warn("Lrubuffer.getCapacity interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + clear: function (...args) { + console.warn("Lrubuffer.clear interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + }, + getCreateCount: function (...args) { + console.warn("Lrubuffer.getCreateCount interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + getMissCount: function (...args) { + console.warn("Lrubuffer.getMissCount interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + getRemovalCount: function (...args) { + console.warn("Lrubuffer.getRemovalCount interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + getMatchCount: function (...args) { + console.warn("Lrubuffer.getMatchCount interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + getPutCount: function (...args) { + console.warn("Lrubuffer.getPutCount interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + isEmpty: function (...args) { + console.warn("Lrubuffer.isEmpty​ interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + get: function (...args) { + console.warn("Lrubuffer.get interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramObjectMock; + }, + put: function (...args) { + console.warn("Lrubuffer.put interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramObjectMock; + }, + values: function (...args) { + console.warn("Lrubuffer.values interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramObjectMock; + }, + keys: function (...args) { + console.warn("Lrubuffer.keys​ interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramObjectMock; + }, + remove: function (...args) { + console.warn("Lrubuffer.remove interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramObjectMock; + }, + afterRemoval: function (...args) { + console.warn("Lrubuffer.afterRemoval interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + }, + contains: function (...args) { + console.warn("Lrubuffer.contains​ interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + createDefault: function (...args) { + console.warn("Lrubuffer.createDefault​ interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramObjectMock; + }, + entries: function (...args) { + console.warn("Lrubuffer.entries interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramObjectMock; + }, + [Symbol.iterator]: function (...args) { + console.warn("Lrubuffer.[Symbol.iterator] interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramObjectMock; + } + } + const ScopeMock = { + toString: function (...args) { + console.warn("Scope.toString interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramStringMock; + }, + intersect: function (...args) { + console.warn("Scope.intersect interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramScopeMock; + }, + intersect: function (...args) { + console.warn("Scope.intersect interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramScopeMock; + }, + getUpper: function (...args) { + console.warn("Scope.getUpper interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramScopeTypeMock; + }, + getLower: function (...args) { + console.warn("Scope.getLower interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramScopeTypeMock; + }, + expand: function (...args) { + console.warn("Scope.expand interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramScopeMock; + }, + expand: function (...args) { + console.warn("Scope.expand interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramScopeMock; + }, + expand: function (...args) { + console.warn("Scope.expand interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramScopeMock; + }, + contains: function (...args) { + console.warn("Scope.contains interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + contains: function (...args) { + console.warn("Scope.contains interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + clamp: function (...args) { + console.warn("Scope.clamp interface mockecd in the Previewer. How this interface works on the Previewer" + + "may be different from that on a real device.") + return paramMock.paramScopeTypeMock; + } + } + const Base64Mock = { + encodeSync: function (...args) { + console.warn("Base64.encodeSync interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const arr = new Uint8Array() + return arr; + }, + encodeToStringSync: function (...args) { + console.warn("Base64.encodeToStringSync interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramStringMock; + }, + decodeSync: function (...args) { + console.warn("Base64.decodeSync interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const arr = new Uint8Array() + return arr; + }, + encode: function (...args) { + console.warn("Base64.encode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const arr = new Uint8Array() + return new Promise((resolve, reject) => { + resolve(arr); + }) + }, + encodeToString: function (...args) { + console.warn("Base64.encodeToString 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(paramMock.paramStringMock); + }) + }, + decode: function (...args) { + console.warn("Base64.decode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const arr = new Uint8Array() + return new Promise((resolve, reject) => { + resolve(arr); + }) + } + } + const TypesMock = { + isAnyArrayBuffer: function(...args) { + console.warn("Types.isAnyArrayBuffer interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isArrayBufferView: function(...args) { + console.warn("Types.isArrayBufferView interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isArgumentsObject: function(...args) { + console.warn("Types.isArgumentsObject interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isArrayBuffer: function(...args) { + console.warn("Types.isArrayBuffer interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isAsyncFunction: function(...args) { + console.warn("Types.isAsyncFunction interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isBigInt64Array: function(...args) { + console.warn("Types.isBigInt64Array interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isBigUint64Array: function(...args) { + console.warn("Types.isBigUint64Array interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isBooleanObject: function(...args) { + console.warn("Types.isBooleanObject interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isBoxedPrimitive: function(...args) { + console.warn("Types.isBoxedPrimitive interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isDataView: function(...args) { + console.warn("Types.isDataView interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isDate: function(...args) { + console.warn("Types.isDate interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isExternal: function(...args) { + console.warn("Types.isExternal interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isFloat32Array: function(...args) { + console.warn("Types.isFloat32Array interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isFloat64Array: function(...args) { + console.warn("Types.isFloat64Array interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isGeneratorFunction: function(...args) { + console.warn("Types.isGeneratorFunction interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isGeneratorObject: function(...args) { + console.warn("Types.isGeneratorObject interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isInt8Array: function(...args) { + console.warn("Types.isInt8Array interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isInt16Array: function(...args) { + console.warn("Types.isInt16Array interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isInt32Array: function(...args) { + console.warn("Types.isInt32Array interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isMap: function(...args) { + console.warn("Types.isMap interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isMapIterator: function(...args) { + console.warn("Types.isMapIterator interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isModuleNamespaceObject: function(...args) { + console.warn("Types.isModuleNamespaceObject interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isNativeError: function(...args) { + console.warn("Types.isNativeError interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isNumberObject: function(...args) { + console.warn("Types.isNumberObject interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isPromise: function(...args) { + console.warn("Types.isPromise interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isProxy: function(...args) { + console.warn("Types.isProxy interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isRegExp: function(...args) { + console.warn("Types.isRegExp interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isSet: function(...args) { + console.warn("Types.isSet interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isSetIterator: function(...args) { + console.warn("Types.isSetIterator interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isSharedArrayBuffer: function(...args) { + console.warn("Types.isSharedArrayBuffer interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isStringObject: function(...args) { + console.warn("Types.isStringObject interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isSymbolObject: function(...args) { + console.warn("Types.isSymbolObject interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isTypedArray: function(...args) { + console.warn("Types.isTypedArray interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isUint8Array: function(...args) { + console.warn("Types.isUint8Array interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isUint8ClampedArray: function(...args) { + console.warn("Types.isUint8ClampedArray interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isUint16Array: function(...args) { + console.warn("Types.isUint16Array interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isUint32Array: function(...args) { + console.warn("Types.isUint32Array interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isWeakMap: function(...args) { + console.warn("Types.isWeakMap interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isWeakSet: function(...args) { + console.warn("Types.isWeakSet interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + } + } + return result; +} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/xml.js b/runtime/main/extend/systemplugin/napi/xml.js new file mode 100644 index 00000000..74ebc513 --- /dev/null +++ b/runtime/main/extend/systemplugin/napi/xml.js @@ -0,0 +1,77 @@ +import { paramMock } from "../utils" + +export function mockXml() { + const result = { + XmlSerializer: function(...args) { + console.warn("xml.XmlSerializer interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return XmlSerializerMock; + }, + XmlPullParser: function(...args) { + console.warn("xml.XmlPullParser interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return XmlPullParserMock; + }, + ConvertXML: function(...args) { + console.warn("xml.ConvertXML interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return ConvertXMLMock; + } + } + const XmlSerializerMock = { + setAttributes: function(...args) { + console.warn("XmlSerializer.setAttributes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }, + addEmptyElement: function(...args) { + console.warn("XmlSerializer.addEmptyElement interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }, + setDeclaration: function(...args) { + console.warn("XmlSerializer.setDeclaration interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }, + startElement: function(...args) { + console.warn("XmlSerializer.startElement interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }, + endElement: function(...args) { + console.warn("XmlSerializer.endElement interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }, + setNamespace: function(...args) { + console.warn("XmlSerializer.setNamespace interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }, + setCommnet: function(...args) { + console.warn("XmlSerializer.setCommnet interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }, + setCData: function(...args) { + console.warn("XmlSerializer.setCData interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }, + setText: function(...args) { + console.warn("XmlSerializer.setText interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }, + setDocType: function(...args) { + console.warn("XmlSerializer.setDocType interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }, + } + const XmlPullParserMock = { + parse: function(...args) { + console.warn("XmlPullParser.parse interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }, + } + const ConvertXMLMock = { + convert: function(...args) { + console.warn("ConvertXML.convert interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramObjectMock; + }, + } + return result; +}