diff --git a/BUILD.gn b/BUILD.gn index 3c122f0a..b79825a5 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -11,7 +11,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/ts2abc/ts2panda/ts2abc_config.gni") import("//build/ohos.gni") import("//foundation/ace/ace_engine/ace_config.gni") @@ -36,7 +35,7 @@ action("gen_snapshot") { js_framework = "//third_party/jsframework/runtime" is_mac = "false" - if (is_standard_system) { + if (is_standard_system || is_cross_platform_build) { node_modules = "//prebuilts/build-tools/common/js-framework/node_modules" if (use_mac) { nodejs_path = @@ -181,7 +180,7 @@ action("gen_snapshot") { ] } -if (!is_standard_system) { +if (!is_standard_system && !is_cross_platform_build) { import("$v8_root/gni/snapshot_toolchain.gni") v8_snapshot_bin_path = get_label_info(":v8_snapshot_bin", "target_out_dir") + @@ -287,22 +286,25 @@ ohos_static_library("jsf") { sources = [ jsfc_path ] } -ark_abc_path = - get_label_info(":ark_build", "target_out_dir") + "/strip.native.min.abc" +if (!is_cross_platform_build) { + import("//ark/ts2abc/ts2panda/ts2abc_config.gni") + ark_abc_path = + get_label_info(":ark_build", "target_out_dir") + "/strip.native.min.abc" -ts2abc_gen_abc("ark_jsf") { - extra_visibility = [ ":*" ] # Only targets in this file can depend on this - extra_dependencies = [ ":gen_snapshot" ] + ts2abc_gen_abc("ark_jsf") { + extra_visibility = [ ":*" ] # Only targets in this file can depend on this + extra_dependencies = [ ":gen_snapshot" ] - src_js = rebase_path(prebuilt_js_path) - dst_file = rebase_path(ark_abc_path) + src_js = rebase_path(prebuilt_js_path) + dst_file = rebase_path(ark_abc_path) - in_puts = [ prebuilt_js_path ] - out_puts = [ ark_abc_path ] -} - -ohos_prebuilt_etc("ark_build") { - deps = [ ":ark_jsf" ] - source = ark_abc_path - part_name = "ace_engine_standard" + in_puts = [ prebuilt_js_path ] + out_puts = [ ark_abc_path ] + } + + ohos_prebuilt_etc("ark_build") { + deps = [ ":ark_jsf" ] + source = ark_abc_path + part_name = "ace_engine_standard" + } } diff --git a/bundle.json b/bundle.json new file mode 100644 index 00000000..2874ece2 --- /dev/null +++ b/bundle.json @@ -0,0 +1,30 @@ +{ + "name": "@ohos/jsframework", + "description": "A framework for building performant mobile cross-platform UI.", + "version": "3.1", + "license": "Apache V2", + "publishAs": "code-segment", + "segment": { + "destPath": "third_party/jsframework" + }, + "dirs": {}, + "scripts": {}, + "component": { + "name": "thirdparty_jsframework", + "subsystem": "", + "syscap": [], + "features": [], + "adapted_system_type": [], + "rom": "", + "ram": "", + "deps": { + "components": [], + "third_party": [] + }, + "build": { + "sub_component": [], + "inner_kits": [], + "test": [] + } + } +} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/ability.js b/runtime/main/extend/systemplugin/ability.js index 76ed8bcf..6036f493 100644 --- a/runtime/main/extend/systemplugin/ability.js +++ b/runtime/main/extend/systemplugin/ability.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "./utils" import { windowMock } from "./window" @@ -1258,11 +1273,11 @@ export function mockAbilityContinuationRegisterManager() { console.warn("ability.ContinuationRegisterManager.on interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") const len = args.length - if(typeof args[len -1]==='function'){ - if(args[0] ==='deviceConnect'){ - args[len-1].call(this,ContinuationResultMock) - }else{ - args[len-1].call(this,paramMock.paramStringMock) + if (typeof args[len - 1] === 'function') { + if (args[0] === 'deviceConnect') { + args[len - 1].call(this, ContinuationResultMock) + } else { + args[len - 1].call(this, paramMock.paramStringMock) } } }, @@ -1270,11 +1285,11 @@ export function mockAbilityContinuationRegisterManager() { console.warn("ability.ContinuationRegisterManager.off interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") const len = args.length - if(typeof args[len -1]==='function'){ - if(args[0] ==='deviceConnect'){ - args[len-1].call(this,ContinuationResultMock) - }else{ - args[len-1].call(this,paramMock.paramStringMock) + if (typeof args[len - 1] === 'function') { + if (args[0] === 'deviceConnect') { + args[len - 1].call(this, ContinuationResultMock) + } else { + args[len - 1].call(this, paramMock.paramStringMock) } } }, diff --git a/runtime/main/extend/systemplugin/accessibility.js b/runtime/main/extend/systemplugin/accessibility.js index 0656ca76..0efba532 100644 --- a/runtime/main/extend/systemplugin/accessibility.js +++ b/runtime/main/extend/systemplugin/accessibility.js @@ -1,4 +1,19 @@ -import {paramMock} from './utils'; +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from './utils'; export function mockAccessibility() { const AbilitySubTypeMock = { @@ -131,7 +146,7 @@ export function mockAccessibility() { global.systemplugin.accessibility = { EventInfo: EventInfoClass, - isOpenAccessibility: function(...args) { + isOpenAccessibility: function (...args) { console.warn('accessibility.isOpenAccessibility interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -143,7 +158,7 @@ export function mockAccessibility() { }); } }, - isOpenTouchGuide: function(...args) { + isOpenTouchGuide: function (...args) { console.warn('accessibility.isOpenTouchGuide interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -155,13 +170,13 @@ export function mockAccessibility() { }); } }, - on: function(...args) { + on: function (...args) { console.warn('accessibility.on interface mocked in the Previewer. How this interface works on the Previewer may be' + ' different from that on a real device.'); const len = args.length; args[len - 1].call(this, paramMock.businessErrorMock, StateEventMock); }, - off: function(...args) { + off: function (...args) { console.warn('accessibility.off interface mocked in the Previewer. How this interface works on the Previewer may be' + ' different from that on a real device.'); const len = args.length; @@ -169,7 +184,7 @@ export function mockAccessibility() { args[len - 1].call(this, paramMock.businessErrorMock, StateEventMock); } }, - getAbilityLists: function(...args) { + getAbilityLists: function (...args) { console.warn('accessibility.getAbilityLists interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -181,7 +196,7 @@ export function mockAccessibility() { }); } }, - sendEvent: function(...args) { + sendEvent: function (...args) { console.warn('accessibility.sendEvent interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; diff --git a/runtime/main/extend/systemplugin/ai.js b/runtime/main/extend/systemplugin/ai.js index f89ad022..2d83c285 100644 --- a/runtime/main/extend/systemplugin/ai.js +++ b/runtime/main/extend/systemplugin/ai.js @@ -1,87 +1,102 @@ -import {paramMock} from "./utils" +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "./utils" export function mockAI() { - const TTSCallBackMock = { - key: "[PC preview] unknow key" - }; - global.systemplugin.ai = {}; - global.systemplugin.ai.TTS = { - getTTSClient: function () { - console.warn("ai.TTS.getTTSClient interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return TTSClient - }, - }; - const TTSClient = { - init: function (...args) { - console.warn("TTSClient.init interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramBooleanMock - }, - isSpeaking: function () { - console.warn("TTSClient.isSpeaking interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramBooleanMock - }, - setAudioType: function (...args) { - console.warn("TTSClient.setAudioType interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramBooleanMock - }, - setParams: function (...args) { - console.warn("TTSClient.setParams interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramBooleanMock - }, - connectService: function () { - console.warn("TTSClient.connectService interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - setIsSaveTtsData: function (...args) { - console.warn("TTSClient.setIsSaveTtsData interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) - }, - release: function () { - console.warn("TTSClient.release interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - speakLongText: function (...args) { - console.warn("TTSClient.speakLongText interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) - }, - speakText: function (...args) { - console.warn("TTSClient.speakText interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) - }, - stopSpeak: function () { - console.warn("TTSClient.stopSpeak interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - destroy: function () { - console.warn("TTSClient.destroy interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - on: function (...args) { - console.warn("TTSClient.on interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - const len = args.length - args[len - 1].call(this, TTSCallBackMock) - }, - getSupportMaxLength: function () { - console.warn("TTSClient.getSupportMaxLength interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramNumberMock - }, - getVersion: function () { - console.warn("TTSClient.getVersion 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 TTSCallBackMock = { + key: "[PC preview] unknow key" + }; + global.systemplugin.ai = {}; + global.systemplugin.ai.TTS = { + getTTSClient: function () { + console.warn("ai.TTS.getTTSClient interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return TTSClient + }, + }; + const TTSClient = { + init: function (...args) { + console.warn("TTSClient.init interface mocked in the Previewer. How this interface works on the Previewer may" + + " be different from that on a real device.") + return paramMock.paramBooleanMock + }, + isSpeaking: function () { + console.warn("TTSClient.isSpeaking interface mocked in the Previewer. How this interface works on the Previewer may" + + " be different from that on a real device.") + return paramMock.paramBooleanMock + }, + setAudioType: function (...args) { + console.warn("TTSClient.setAudioType interface mocked in the Previewer. How this interface works on the Previewer may" + + " be different from that on a real device.") + return paramMock.paramBooleanMock + }, + setParams: function (...args) { + console.warn("TTSClient.setParams interface mocked in the Previewer. How this interface works on the Previewer may" + + " be different from that on a real device.") + return paramMock.paramBooleanMock + }, + connectService: function () { + console.warn("TTSClient.connectService interface mocked in the Previewer. How this interface works on the Previewer may" + + " be different from that on a real device.") + }, + setIsSaveTtsData: function (...args) { + console.warn("TTSClient.setIsSaveTtsData interface mocked in the Previewer. How this interface works on the Previewer may" + + " be different from that on a real device.") + args[0].success() + hasComplete(args[0].complete) + }, + release: function () { + console.warn("TTSClient.release interface mocked in the Previewer. How this interface works on the Previewer may" + + " be different from that on a real device.") + }, + speakLongText: function (...args) { + console.warn("TTSClient.speakLongText interface mocked in the Previewer. How this interface works on the Previewer may" + + " be different from that on a real device.") + args[0].success() + hasComplete(args[0].complete) + }, + speakText: function (...args) { + console.warn("TTSClient.speakText interface mocked in the Previewer. How this interface works on the Previewer may" + + " be different from that on a real device.") + args[0].success() + hasComplete(args[0].complete) + }, + stopSpeak: function () { + console.warn("TTSClient.stopSpeak interface mocked in the Previewer. How this interface works on the Previewer may" + + " be different from that on a real device.") + }, + destroy: function () { + console.warn("TTSClient.destroy interface mocked in the Previewer. How this interface works on the Previewer may" + + " be different from that on a real device.") + }, + on: function (...args) { + console.warn("TTSClient.on interface mocked in the Previewer. How this interface works on the Previewer may be" + + " different from that on a real device.") + const len = args.length + args[len - 1].call(this, TTSCallBackMock) + }, + getSupportMaxLength: function () { + console.warn("TTSClient.getSupportMaxLength interface mocked in the Previewer. How this interface works on the Previewer may" + + " be different from that on a real device.") + return paramMock.paramNumberMock + }, + getVersion: function () { + console.warn("TTSClient.getVersion interface mocked in the Previewer. How this interface works on the Previewer may" + + " be different from that on a real device.") + return paramMock.paramStringMock + }, + }; } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/battery.js b/runtime/main/extend/systemplugin/battery.js index e06ef54b..184c8365 100644 --- a/runtime/main/extend/systemplugin/battery.js +++ b/runtime/main/extend/systemplugin/battery.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { hasComplete } from "./utils" export function mockBattery() { diff --git a/runtime/main/extend/systemplugin/batteryinfo.js b/runtime/main/extend/systemplugin/batteryinfo.js index 3f92182b..83647baa 100644 --- a/runtime/main/extend/systemplugin/batteryinfo.js +++ b/runtime/main/extend/systemplugin/batteryinfo.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + export function mockOhosBatteryinfo() { const BatteryPluggedType = { NONE: '[PC preview] unknow NONE', diff --git a/runtime/main/extend/systemplugin/bluetooth.js b/runtime/main/extend/systemplugin/bluetooth.js index 586b3f0a..47d15ac3 100644 --- a/runtime/main/extend/systemplugin/bluetooth.js +++ b/runtime/main/extend/systemplugin/bluetooth.js @@ -1,45 +1,59 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { hasComplete } from "./utils" export function mockBluetooth() { - global.systemplugin.bluetooth = { - startBLEScan: function (...args) { - console.warn("bluetooth.startBLEScan interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) - }, - stopBLEScan: function (...args) { - console.warn("bluetooth.stopBLEScan interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) - }, - subscribeBLEFound: function (...args) { - console.warn("bluetooth.subscribeBLEFound interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const options = { - addrType: 'public', - addr: 'xx:xx:xx:xx', - rssi: 123, - txpower: 'xxx', - data: 'xxx' - } - const min = 1 - const max = 6 - clearInterval(this.unsubscribeBLE) - delete this.unsubscribeBLE - this.unsubscribeBLE = setInterval(() => { - const randomAddr = Math.floor(Math.random() * (max - min)) + min - const optionsArr = Array(randomAddr).fill(options) - args[0].success(optionsArr) - }, 1000) - }, - unsubscribeBLEFound: function () { - console.warn("bluetooth.unsubscribeBLEFound interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - clearInterval(this.unsubscribeBLE) - delete this.unsubscribeBLE + global.systemplugin.bluetooth = { + startBLEScan: function (...args) { + console.warn("bluetooth.startBLEScan interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + args[0].success() + hasComplete(args[0].complete) + }, + stopBLEScan: function (...args) { + console.warn("bluetooth.stopBLEScan interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + args[0].success() + hasComplete(args[0].complete) + }, + subscribeBLEFound: function (...args) { + console.warn("bluetooth.subscribeBLEFound interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const options = { + addrType: 'public', + addr: 'xx:xx:xx:xx', + rssi: 123, + txpower: 'xxx', + data: 'xxx' } + const min = 1 + const max = 6 + clearInterval(this.unsubscribeBLE) + delete this.unsubscribeBLE + this.unsubscribeBLE = setInterval(() => { + const randomAddr = Math.floor(Math.random() * (max - min)) + min + const optionsArr = Array(randomAddr).fill(options) + args[0].success(optionsArr) + }, 1000) + }, + unsubscribeBLEFound: function () { + console.warn("bluetooth.unsubscribeBLEFound interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + clearInterval(this.unsubscribeBLE) + delete this.unsubscribeBLE } } - \ No newline at end of file +} diff --git a/runtime/main/extend/systemplugin/brightness.js b/runtime/main/extend/systemplugin/brightness.js index d73851cd..55fe8622 100644 --- a/runtime/main/extend/systemplugin/brightness.js +++ b/runtime/main/extend/systemplugin/brightness.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { hasComplete } from "./utils" export function mockBrightness() { diff --git a/runtime/main/extend/systemplugin/bytrace.js b/runtime/main/extend/systemplugin/bytrace.js index 2e0d44b6..eaff3c70 100644 --- a/runtime/main/extend/systemplugin/bytrace.js +++ b/runtime/main/extend/systemplugin/bytrace.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "./utils" export function mockBytrace() { diff --git a/runtime/main/extend/systemplugin/calendar.js b/runtime/main/extend/systemplugin/calendar.js index cd84afd1..6825a005 100644 --- a/runtime/main/extend/systemplugin/calendar.js +++ b/runtime/main/extend/systemplugin/calendar.js @@ -1,4 +1,19 @@ -import {paramMock} from './utils'; +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from './utils'; export function mockCalendar() { const CalendarEntityClass = class CalendarEntity { diff --git a/runtime/main/extend/systemplugin/cipher.js b/runtime/main/extend/systemplugin/cipher.js index ebe5b3f1..6af56eb3 100644 --- a/runtime/main/extend/systemplugin/cipher.js +++ b/runtime/main/extend/systemplugin/cipher.js @@ -1,20 +1,35 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { hasComplete } from "./utils" export function mockCipher() { - global.systemplugin.cipher = { - rsa: function(...args) { - console.warn("cipher.rsa interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - const result = '[PC preview] rsa xxxxxxxxxxxxx' - args[0].success(result) - hasComplete(args[0].complete) - }, - aes: function(...args) { - console.warn("cipher.aes interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - const result = '[PC preview] aes xxxxxxxxxxxxx' - args[0].success(result) - hasComplete(args[0].complete) - } + global.systemplugin.cipher = { + rsa: function (...args) { + console.warn("cipher.rsa interface mocked in the Previewer. How this interface works on the Previewer may be" + + " different from that on a real device.") + const result = '[PC preview] rsa xxxxxxxxxxxxx' + args[0].success(result) + hasComplete(args[0].complete) + }, + aes: function (...args) { + console.warn("cipher.aes interface mocked in the Previewer. How this interface works on the Previewer may be" + + " different from that on a real device.") + const result = '[PC preview] aes xxxxxxxxxxxxx' + args[0].success(result) + hasComplete(args[0].complete) } - } \ No newline at end of file + } +} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/contact.js b/runtime/main/extend/systemplugin/contact.js index ba6cef93..77276a0e 100644 --- a/runtime/main/extend/systemplugin/contact.js +++ b/runtime/main/extend/systemplugin/contact.js @@ -1,4 +1,19 @@ -import {paramMock} from "./utils" +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "./utils" export function mockContact() { const ContactClass = class Contact { diff --git a/runtime/main/extend/systemplugin/data.js b/runtime/main/extend/systemplugin/data.js index 122473e1..25ea906d 100644 --- a/runtime/main/extend/systemplugin/data.js +++ b/runtime/main/extend/systemplugin/data.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "./utils" export function mockDataStorage() { @@ -60,7 +75,6 @@ export function mockDataStorage() { deleteSync: function () { console.warn("Storage.deleteSync interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") - return }, delete: function (...args) { console.warn("Storage.delete interface mocked in the Previewer. How this interface works on the Previewer may" + diff --git a/runtime/main/extend/systemplugin/deviceInfo.js b/runtime/main/extend/systemplugin/deviceInfo.js index 3511c455..1196229c 100644 --- a/runtime/main/extend/systemplugin/deviceInfo.js +++ b/runtime/main/extend/systemplugin/deviceInfo.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + export function mockDeviceInfo() { global.systemplugin.deviceInfo = { deviceType: '[PC preview] unknow type', diff --git a/runtime/main/extend/systemplugin/deviceManager.js b/runtime/main/extend/systemplugin/deviceManager.js index a6c6164a..d6ba4f22 100644 --- a/runtime/main/extend/systemplugin/deviceManager.js +++ b/runtime/main/extend/systemplugin/deviceManager.js @@ -1,129 +1,144 @@ -import {paramMock} from "./utils" +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "./utils" export function mockDeviceManager() { - const deviceInfoMock = { - deviceId: "[PC Preview] unknow mDeviceId", - deviceName: "[PC Preview] unknow mDeviceName", - deviceType: 0x0E, - networkId: "[PC Preview] unknow mNetworkId" - } - const deviceStateChangeMock = { - action: 0, - device: deviceInfoMock - } - const deviceManagerMock = { - release: function () { - console.warn("DeviceManager.release interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - getTrustedDeviceListSync: function () { - console.warn("DeviceManager.getTrustedDeviceListSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - var array = new Array(); - array.push(deviceInfoMock); - return array ; - }, - getTrustedDeviceList: function (...args) { - console.warn("DeviceManager.getTrustedDeviceList interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - var array = new Array(); - array.push(deviceInfoMock); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, array); - } else { - return new Promise((resolve, reject) => { - resolve(array); - }) - } - }, - getLocalDeviceInfoSync: function () { - console.warn("DeviceManager.getLocalDeviceInfoSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return deviceInfoMock; - }, - getLocalDeviceInfo: function (...args) { - console.warn("DeviceManager.getLocalDeviceInfo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, deviceInfoMock); - } else { - return new Promise((resolve, reject) => { - resolve(deviceInfoMock); - }) - } - }, - startDeviceDiscovery: function (...args) { - console.warn("DeviceManager.startDeviceDiscovery interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - stopDeviceDiscovery: function (...args) { - console.warn("DeviceManager.stopDeviceDiscovery interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - authenticateDevice: function (...args) { - console.warn("DeviceManager.authenticateDevice interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, { - deviceId: "[PC Preview] unknow deviceId", - pinToken: "[PC Preview] unknow pinToken" - }); - } - }, - unAuthenticateDevice: function (...args) { - console.warn("DeviceManager.unAuthenticateDevice interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - verifyAuthInfo: function (...args) { - console.warn("DeviceManager.verifyAuthInfo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, { - deviceId: "[PC Preview] unknow deviceId", - level: "[PC Preview] unknow level" - }); - } - }, - on: function (...args) { - console.warn("DeviceManager.on interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - if (args[0] == 'deviceStateChange') { - args[len - 1].call(this, paramMock.businessErrorMock, deviceStateChangeMock); - } else if (args[0] == 'deviceFound') { - args[len - 1].call(this, paramMock.businessErrorMock, { - subscribeId: "[PC Preview] unknow subscribeId", - device: deviceInfoMock - }); - } else if (args[0] == 'discoverFail') { - args[len - 1].call(this, paramMock.businessErrorMock, { - subscribeId: "[PC Preview] unknow subscribeId", - reason: "[PC Preview] unknow reason" - }); - } else { - args[len - 1].call(this); - } - } - }, - off: function (...args) { - console.warn("DeviceManager.off interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") + const deviceInfoMock = { + deviceId: "[PC Preview] unknow mDeviceId", + deviceName: "[PC Preview] unknow mDeviceName", + deviceType: 0x0E, + networkId: "[PC Preview] unknow mNetworkId" + } + const deviceStateChangeMock = { + action: 0, + device: deviceInfoMock + } + const deviceManagerMock = { + release: function () { + console.warn("DeviceManager.release interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }, + getTrustedDeviceListSync: function () { + console.warn("DeviceManager.getTrustedDeviceListSync interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + var array = new Array(); + array.push(deviceInfoMock); + return array; + }, + getTrustedDeviceList: function (...args) { + console.warn("DeviceManager.getTrustedDeviceList interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + var array = new Array(); + array.push(deviceInfoMock); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, array); + } else { + return new Promise((resolve, reject) => { + resolve(array); + }) + } + }, + getLocalDeviceInfoSync: function () { + console.warn("DeviceManager.getLocalDeviceInfoSync interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return deviceInfoMock; + }, + getLocalDeviceInfo: function (...args) { + console.warn("DeviceManager.getLocalDeviceInfo interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, deviceInfoMock); + } else { + return new Promise((resolve, reject) => { + resolve(deviceInfoMock); + }) + } + }, + startDeviceDiscovery: function (...args) { + console.warn("DeviceManager.startDeviceDiscovery interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + stopDeviceDiscovery: function (...args) { + console.warn("DeviceManager.stopDeviceDiscovery interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + authenticateDevice: function (...args) { + console.warn("DeviceManager.authenticateDevice interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, { + deviceId: "[PC Preview] unknow deviceId", + pinToken: "[PC Preview] unknow pinToken" + }); + } + }, + unAuthenticateDevice: function (...args) { + console.warn("DeviceManager.unAuthenticateDevice interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + verifyAuthInfo: function (...args) { + console.warn("DeviceManager.verifyAuthInfo interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, { + deviceId: "[PC Preview] unknow deviceId", + level: "[PC Preview] unknow level" + }); + } + }, + on: function (...args) { + console.warn("DeviceManager.on interface mocked in the Previewer. How this interface works on the Previewer may" + + " be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + if (args[0] == 'deviceStateChange') { + args[len - 1].call(this, paramMock.businessErrorMock, deviceStateChangeMock); + } else if (args[0] == 'deviceFound') { + args[len - 1].call(this, paramMock.businessErrorMock, { + subscribeId: "[PC Preview] unknow subscribeId", + device: deviceInfoMock + }); + } else if (args[0] == 'discoverFail') { + args[len - 1].call(this, paramMock.businessErrorMock, { + subscribeId: "[PC Preview] unknow subscribeId", + reason: "[PC Preview] unknow reason" + }); + } else { + args[len - 1].call(this); } + } + }, + off: function (...args) { + console.warn("DeviceManager.off interface mocked in the Previewer. How this interface works on the Previewer may" + + " be different from that on a real device.") } - global.systemplugin.distributedHardware = global.systemplugin.distributedHardware || {}; - global.systemplugin.distributedHardware.deviceManager = { - createDeviceManager: function (...args) { - console.warn("distributedHardware.deviceManager.createDeviceManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, deviceManagerMock) - } - } + } + global.systemplugin.distributedHardware = global.systemplugin.distributedHardware || {}; + global.systemplugin.distributedHardware.deviceManager = { + createDeviceManager: function (...args) { + console.warn("distributedHardware.deviceManager.createDeviceManager interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, deviceManagerMock) + } } + } } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/display.js b/runtime/main/extend/systemplugin/display.js index a8281eef..720635a4 100644 --- a/runtime/main/extend/systemplugin/display.js +++ b/runtime/main/extend/systemplugin/display.js @@ -1,72 +1,87 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "./utils" export function mockDisplay() { - const displayMock = { - densityDPI: '[PC preview] unknow densityDPI', - densityPixels: '[PC preview] unknow densityPixels', - scaledDensity: '[PC preview] unknow scaledDensity', - xDPI: '[PC preview] unknow xDPI', - yDPI: '[PC preview] unknow yDPI', - width: '[PC preview] unknow width', - height: '[PC preview] unknow height', - alive: '[PC preview] unknow alive', - refreshRate: '[PC preview] unknow refreshRate', - id: '[PC preview] unknow id', - state: '[PC preview] unknow state', - rotation: '[PC preview] unknow rotation', - name: '[PC preview] unknow name' - } - const allDisplayMock = [{ - densityDPI: '[PC preview] unknow densityDPI', - densityPixels: '[PC preview] unknow densityPixels', - scaledDensity: '[PC preview] unknow scaledDensity', - xDPI: '[PC preview] unknow xDPI', - yDPI: '[PC preview] unknow yDPI', - width: '[PC preview] unknow width', - height: '[PC preview] unknow height', - alive: '[PC preview] unknow alive', - refreshRate: '[PC preview] unknow refreshRate', - id: '[PC preview] unknow id', - state: '[PC preview] unknow state', - rotation: '[PC preview] unknow rotation', - name: '[PC preview] unknow name' - }] - global.systemplugin.display = { - getDefaultDisplay: function (...args) { - console.warn("display.getDefaultDisplay interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, displayMock) - } else { - return new Promise((resolve, reject) => { - resolve(displayMock) - }) - } - }, - getAllDisplay: function (...args) { - console.warn("display.getAllDisplay interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, allDisplayMock) - } else { - return new Promise((resolve, reject) => { - resolve(allDisplayMock) - }) - } - }, - on: function (...args) { - console.warn("display.on interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - const len = args.length - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) - }, - off: function (...args) { - console.warn("display.off interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - const len = args.length - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) - }, - } + const displayMock = { + densityDPI: '[PC preview] unknow densityDPI', + densityPixels: '[PC preview] unknow densityPixels', + scaledDensity: '[PC preview] unknow scaledDensity', + xDPI: '[PC preview] unknow xDPI', + yDPI: '[PC preview] unknow yDPI', + width: '[PC preview] unknow width', + height: '[PC preview] unknow height', + alive: '[PC preview] unknow alive', + refreshRate: '[PC preview] unknow refreshRate', + id: '[PC preview] unknow id', + state: '[PC preview] unknow state', + rotation: '[PC preview] unknow rotation', + name: '[PC preview] unknow name' + } + const allDisplayMock = [{ + densityDPI: '[PC preview] unknow densityDPI', + densityPixels: '[PC preview] unknow densityPixels', + scaledDensity: '[PC preview] unknow scaledDensity', + xDPI: '[PC preview] unknow xDPI', + yDPI: '[PC preview] unknow yDPI', + width: '[PC preview] unknow width', + height: '[PC preview] unknow height', + alive: '[PC preview] unknow alive', + refreshRate: '[PC preview] unknow refreshRate', + id: '[PC preview] unknow id', + state: '[PC preview] unknow state', + rotation: '[PC preview] unknow rotation', + name: '[PC preview] unknow name' + }] + global.systemplugin.display = { + getDefaultDisplay: function (...args) { + console.warn("display.getDefaultDisplay interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, displayMock) + } else { + return new Promise((resolve, reject) => { + resolve(displayMock) + }) + } + }, + getAllDisplay: function (...args) { + console.warn("display.getAllDisplay interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, allDisplayMock) + } else { + return new Promise((resolve, reject) => { + resolve(allDisplayMock) + }) + } + }, + on: function (...args) { + console.warn("display.on interface mocked in the Previewer. How this interface works on the Previewer may be" + + " different from that on a real device.") + const len = args.length + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) + }, + off: function (...args) { + console.warn("display.off interface mocked in the Previewer. How this interface works on the Previewer may be" + + " different from that on a real device.") + const len = args.length + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) + }, + } } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/distributedSchedule.js b/runtime/main/extend/systemplugin/distributedSchedule.js index 10b7d9a2..9e7ba919 100644 --- a/runtime/main/extend/systemplugin/distributedSchedule.js +++ b/runtime/main/extend/systemplugin/distributedSchedule.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "./utils" export function mockDistributedSchedule() { @@ -25,7 +40,7 @@ export function mockDistributedSchedule() { permissions: ["[PC Preview] unknow permission", "[PC Preview] unknow permission"], moduleInfo: [ModuleInfoMock], entryDir: "[PC Preview] unknow entryDir", - customizeData:new Map([["[PC Preview] unknow customizeDataKey", CustomizeDataMock]]) + customizeData: new Map([["[PC Preview] unknow customizeDataKey", CustomizeDataMock]]) } const AbilityInfoMock = { bundleName: "[PC Preview] unknow bundleName", diff --git a/runtime/main/extend/systemplugin/document.js b/runtime/main/extend/systemplugin/document.js index 8120a716..15d8710c 100644 --- a/runtime/main/extend/systemplugin/document.js +++ b/runtime/main/extend/systemplugin/document.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "./utils" export function mockDocument() { diff --git a/runtime/main/extend/systemplugin/entry.js b/runtime/main/extend/systemplugin/entry.js index 655a2158..b9cd8d4d 100644 --- a/runtime/main/extend/systemplugin/entry.js +++ b/runtime/main/extend/systemplugin/entry.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { mockSystemPlugin } from './index'; mockSystemPlugin() \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/featureAbility.js b/runtime/main/extend/systemplugin/featureAbility.js index e814b5ab..01fb9743 100644 --- a/runtime/main/extend/systemplugin/featureAbility.js +++ b/runtime/main/extend/systemplugin/featureAbility.js @@ -1,3 +1,26 @@ +/* + * @Author: your name + * @Date: 2022-01-20 21:27:31 + * @LastEditTime: 2022-01-20 21:27:33 + * @LastEditors: your name + * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + * @FilePath: \third_party_jsframework\runtime\main\extend\systemplugin\featureAbility.js + */ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + export function mockFeatureAbility() { let FeatureAbilityObject = { getFeatureAbility: function () { diff --git a/runtime/main/extend/systemplugin/fetch.js b/runtime/main/extend/systemplugin/fetch.js index a13ff1b1..a44b17ec 100644 --- a/runtime/main/extend/systemplugin/fetch.js +++ b/runtime/main/extend/systemplugin/fetch.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + export function mockFetch() { global.sendGroupMessage = global.group.sendGroupMessage; let GroupMessenger = { @@ -45,7 +60,7 @@ export function mockFetch() { return messenger; } }; - + let CommonCallback = { commonCallback: function commonCallback(callback, flag, data, code) { if (typeof callback === 'function') { @@ -102,7 +117,7 @@ export function mockFetch() { }; global.commonCallbackEx = CommonCallbackEx.commonCallbackEx; global.systemplugin.catching = CommonCallbackEx.catching; - + let FetchObject = { getFetch: function () { let fetch = {} @@ -113,6 +128,6 @@ export function mockFetch() { return fetch } } - + global.systemplugin.fetch = FetchObject.getFetch(); } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/file.js b/runtime/main/extend/systemplugin/file.js index 3a4360a8..d49592a5 100644 --- a/runtime/main/extend/systemplugin/file.js +++ b/runtime/main/extend/systemplugin/file.js @@ -1,95 +1,110 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { hasComplete } from "./utils" export function mockFile() { - global.systemplugin.file = { - move: function(...args) { - console.warn("file.move interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - args[0].success(args[0].dstUri) - hasComplete(args[0].complete) - }, - copy: function(...args) { - console.warn("file.copy interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - args[0].success(args[0].dstUri) - hasComplete(args[0].complete) - }, - list: function(...args) { - console.warn("file.list interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - const data = { - fileList: [{ - uri: '[PC Preview]: no file', - lastModifiedTime: "[PC Preview]: no file", - length: "[PC Preview]: no file", - type: 'file' - }] - } - args[0].success(data) - hasComplete(args[0].complete) - }, - get: function(...args) { - console.warn("file.get interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - const data = { + global.systemplugin.file = { + move: function (...args) { + console.warn("file.move interface mocked in the Previewer. How this interface works on the Previewer may be" + + " different from that on a real device.") + args[0].success(args[0].dstUri) + hasComplete(args[0].complete) + }, + copy: function (...args) { + console.warn("file.copy interface mocked in the Previewer. How this interface works on the Previewer may be" + + " different from that on a real device.") + args[0].success(args[0].dstUri) + hasComplete(args[0].complete) + }, + list: function (...args) { + console.warn("file.list interface mocked in the Previewer. How this interface works on the Previewer may be" + + " different from that on a real device.") + const data = { + fileList: [{ uri: '[PC Preview]: no file', lastModifiedTime: "[PC Preview]: no file", length: "[PC Preview]: no file", - type: 'file', - subFiles: ["[PC Preview]: no file", "[PC Preview]: no file"] - } - args[0].success(data) - hasComplete(args[0].complete) - }, - delete: function(...args) { - console.warn("file.delete interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) - }, - writeText: function(...args) { - console.warn("file.writeText interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) - }, - writeArrayBuffer: function(...args) { - console.warn("file.writeArrayBuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) - }, - readText: function(...args) { - console.warn("file.readText interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - const data = {text: "[PC Preview]: success default"} - args[0].success(data) - hasComplete(args[0].complete) - }, - readArrayBuffer: function(...args) { - console.warn("file.readArrayBuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const data = {buffer: ["[PC Preview]: default", "[PC Preview]: default", "[PC Preview]: default"]} - args[0].success(data) - hasComplete(args[0].complete) - }, - access: function(...args) { - console.warn("file.access interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) - }, - mkdir: function(...args) { - console.warn("file.mkdir interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) - }, - rmdir: function(...args) { - console.warn("file.rmdir interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) + type: 'file' + }] } + args[0].success(data) + hasComplete(args[0].complete) + }, + get: function (...args) { + console.warn("file.get interface mocked in the Previewer. How this interface works on the Previewer may be" + + " different from that on a real device.") + const data = { + uri: '[PC Preview]: no file', + lastModifiedTime: "[PC Preview]: no file", + length: "[PC Preview]: no file", + type: 'file', + subFiles: ["[PC Preview]: no file", "[PC Preview]: no file"] + } + args[0].success(data) + hasComplete(args[0].complete) + }, + delete: function (...args) { + console.warn("file.delete interface mocked in the Previewer. How this interface works on the Previewer may be" + + " different from that on a real device.") + args[0].success() + hasComplete(args[0].complete) + }, + writeText: function (...args) { + console.warn("file.writeText interface mocked in the Previewer. How this interface works on the Previewer may" + + " be different from that on a real device.") + args[0].success() + hasComplete(args[0].complete) + }, + writeArrayBuffer: function (...args) { + console.warn("file.writeArrayBuffer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + args[0].success() + hasComplete(args[0].complete) + }, + readText: function (...args) { + console.warn("file.readText interface mocked in the Previewer. How this interface works on the Previewer may" + + " be different from that on a real device.") + const data = { text: "[PC Preview]: success default" } + args[0].success(data) + hasComplete(args[0].complete) + }, + readArrayBuffer: function (...args) { + console.warn("file.readArrayBuffer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const data = { buffer: ["[PC Preview]: default", "[PC Preview]: default", "[PC Preview]: default"] } + args[0].success(data) + hasComplete(args[0].complete) + }, + access: function (...args) { + console.warn("file.access interface mocked in the Previewer. How this interface works on the Previewer may be" + + " different from that on a real device.") + args[0].success() + hasComplete(args[0].complete) + }, + mkdir: function (...args) { + console.warn("file.mkdir interface mocked in the Previewer. How this interface works on the Previewer may be" + + " different from that on a real device.") + args[0].success() + hasComplete(args[0].complete) + }, + rmdir: function (...args) { + console.warn("file.rmdir interface mocked in the Previewer. How this interface works on the Previewer may be" + + " different from that on a real device.") + args[0].success() + hasComplete(args[0].complete) } - } \ No newline at end of file + } +} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/geolocation.js b/runtime/main/extend/systemplugin/geolocation.js index f18df123..80999264 100644 --- a/runtime/main/extend/systemplugin/geolocation.js +++ b/runtime/main/extend/systemplugin/geolocation.js @@ -1,48 +1,63 @@ -import {hasComplete, getRandomArbitrary} from "./utils" +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { hasComplete, getRandomArbitrary } from "./utils" export function mockGeolocation() { - const data = { - latitude: '121.61934', - longitude: '31.257907', - accuracy: '15', - time: '160332896544' - } - global.systemplugin.geolocation = { - getLocation: function (...args) { - console.warn("geolocation.getLocation interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - args[0].success(data) - hasComplete(args[0].complete) - }, - getLocationType: function(...args) { - console.warn("geolocation.getLocationType interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const info = {types: ['gps', 'network']} - args[0].success(info) - hasComplete(args[0].complete) - }, - getSupportedCoordTypes() { - console.warn("geolocation.getSupportedCoordTypes interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return ["wgs84"] - }, - subscribe: function(...args) { - console.warn("geolocation.subscribe interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (!this.unsubscribeLocation) { - this.unsubscribeLocation = setInterval(() => { - data.latitude = getRandomArbitrary(121, 122) - data.longitude = getRandomArbitrary(31, 32) - data.accuracy = getRandomArbitrary(14, 18) - args[0].success(data) - }, 1000) - } - }, - unsubscribe: function() { - console.warn("geolocation.unsubscribe interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - clearInterval(this.unsubscribeLocation) - delete this.unsubscribeLocation + const data = { + latitude: '121.61934', + longitude: '31.257907', + accuracy: '15', + time: '160332896544' + } + global.systemplugin.geolocation = { + getLocation: function (...args) { + console.warn("geolocation.getLocation interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + args[0].success(data) + hasComplete(args[0].complete) + }, + getLocationType: function (...args) { + console.warn("geolocation.getLocationType interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const info = { types: ['gps', 'network'] } + args[0].success(info) + hasComplete(args[0].complete) + }, + getSupportedCoordTypes() { + console.warn("geolocation.getSupportedCoordTypes interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return ["wgs84"] + }, + subscribe: function (...args) { + console.warn("geolocation.subscribe interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + if (!this.unsubscribeLocation) { + this.unsubscribeLocation = setInterval(() => { + data.latitude = getRandomArbitrary(121, 122) + data.longitude = getRandomArbitrary(31, 32) + data.accuracy = getRandomArbitrary(14, 18) + args[0].success(data) + }, 1000) } + }, + unsubscribe: function () { + console.warn("geolocation.unsubscribe interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + clearInterval(this.unsubscribeLocation) + delete this.unsubscribeLocation } - } \ No newline at end of file + } +} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/index.js b/runtime/main/extend/systemplugin/index.js index 26489abc..f588590c 100644 --- a/runtime/main/extend/systemplugin/index.js +++ b/runtime/main/extend/systemplugin/index.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import regeneratorRuntime from 'babel-runtime/regenerator' import { @@ -9,7 +24,7 @@ import { mockAbilityAbilityAgent, mockAbilityFormBindingData } from './ability' -import {mockAppAbilityManager} from './ohos/app' +import { mockAppAbilityManager } from './ohos/app' import { mockBackgroundTaskManager } from './ohos/backgroundTaskManager' import { mockBattery } from './battery' @@ -54,7 +69,7 @@ import { mockResourceManager } from './resourceManager' import { mockSensor } from './sensor' import { mockStorage } from './storage' -import { mockStorageInfoManager} from './ohos/storageInfoManager' +import { mockStorageInfoManager } from './ohos/storageInfoManager' import { mockSystemPackage } from './systemPackage' import { mockUserauth } from './userIAM' @@ -70,17 +85,17 @@ import { mockAI } from './ai' import { mockDisplay } from './display' import { mockDeviceManager } from './deviceManager' import { mockScreenshot } from './screenshot' -import {mockContact} from './contact' -import {mockScreenLock} from "./screenLock" -import { mockAppAccount} from './ohos/appAccount' -import { mockOsAccount} from './ohos/osAccount' +import { mockContact } from './contact' +import { mockScreenLock } from "./screenLock" +import { mockAppAccount } from './ohos/appAccount' +import { mockOsAccount } from './ohos/osAccount' import { mockOhosGeolocation } from './ohos/geolocation' -import { mockInputMonitor} from './ohos/inputMonitor' -import {mockUserIAMUserAuth} from './ohos/userIAMuserAuth.js' +import { mockInputMonitor } from './ohos/inputMonitor' +import { mockUserIAMUserAuth } from './ohos/userIAMuserAuth.js' import { mockBundleManager } from './ohos/bundleManager' import { mockPackageManager } from './ohos/packageManager' import { mockZlib } from './napi/zlib' -import {mockCalendar} from "./calendar" +import { mockCalendar } from "./calendar" export function mockSystemPlugin() { global.regeneratorRuntime = regeneratorRuntime diff --git a/runtime/main/extend/systemplugin/inputMethod.js b/runtime/main/extend/systemplugin/inputMethod.js index d9be8a61..1cbdb277 100644 --- a/runtime/main/extend/systemplugin/inputMethod.js +++ b/runtime/main/extend/systemplugin/inputMethod.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "./utils" export function mockInputMethod() { diff --git a/runtime/main/extend/systemplugin/inputMethodEngine.js b/runtime/main/extend/systemplugin/inputMethodEngine.js index c96c15e8..0d9f5272 100644 --- a/runtime/main/extend/systemplugin/inputMethodEngine.js +++ b/runtime/main/extend/systemplugin/inputMethodEngine.js @@ -1,407 +1,422 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "./utils" const NOTIFY = "[PC Preview] unknow" const Properties = [ - 'ENTER_KEY_TYPE_NEXT', - 'ENTER_KEY_TYPE_PREVIOUS', - 'ENTER_KEY_TYPE_UNSPECIFIED', - 'ENTER_KEY_TYPE_SEARCH', - 'ENTER_KEY_TYPE_GO', - 'ENTER_KEY_TYPE_SEND', - 'ENTER_KEY_TYPE_DONE', - 'DISPLAY_MODE_PART', - 'DISPLAY_MODE_FULL', - 'OPTION_AUTO_CAP_CHARACTERS', - 'OPTION_AUTO_CAP_WORDS', - 'OPTION_AUTO_CAP_SENTENCES', - 'OPTION_NO_FULLSCREEN', - 'OPTION_ASCII', - 'OPTION_NONE', - 'OPTION_MULTI_LINE', - 'FLAG_SINGLE_LINE', - 'FLAG_SELECTING', - 'PATTERN_TEXT', - 'PATTERN_NUMBER', - 'PATTERN_NULL', - 'PATTERN_PHONE', - 'PATTERN_DATETIME', - 'PATTERN_URI', - 'PATTERN_EMAIL', - 'PATTERN_PASSWORD' + 'ENTER_KEY_TYPE_NEXT', + 'ENTER_KEY_TYPE_PREVIOUS', + 'ENTER_KEY_TYPE_UNSPECIFIED', + 'ENTER_KEY_TYPE_SEARCH', + 'ENTER_KEY_TYPE_GO', + 'ENTER_KEY_TYPE_SEND', + 'ENTER_KEY_TYPE_DONE', + 'DISPLAY_MODE_PART', + 'DISPLAY_MODE_FULL', + 'OPTION_AUTO_CAP_CHARACTERS', + 'OPTION_AUTO_CAP_WORDS', + 'OPTION_AUTO_CAP_SENTENCES', + 'OPTION_NO_FULLSCREEN', + 'OPTION_ASCII', + 'OPTION_NONE', + 'OPTION_MULTI_LINE', + 'FLAG_SINGLE_LINE', + 'FLAG_SELECTING', + 'PATTERN_TEXT', + 'PATTERN_NUMBER', + 'PATTERN_NULL', + 'PATTERN_PHONE', + 'PATTERN_DATETIME', + 'PATTERN_URI', + 'PATTERN_EMAIL', + 'PATTERN_PASSWORD' ] export function mockInputMethodEngine() { - const EditingText = { - textContent: "[PC Preview] unknow textContent", - offset: 1, - changedStart: 2, - changedEnd: 3, - selectionStart: 4, - selectionEnd: 5, - additionalBitFlags: 6, - prompt: "[PC Preview] unknow prompt" + const EditingText = { + textContent: "[PC Preview] unknow textContent", + offset: 1, + changedStart: 2, + changedEnd: 3, + selectionStart: 4, + selectionEnd: 5, + additionalBitFlags: 6, + prompt: "[PC Preview] unknow prompt" + } + const EditingCapability = { + maxLines: 1, + maxChars: 2 + } + const EditorAttribute = { + inputPattern: 1, + enterKeyType: 2, + inputOption: 3 + } + const RichContent = { + contentURI: "[PC Preview] unknow contentURI", + linkURI: "[PC Preview] unknow linkURI", + mimeTypes: "[PC Preview] unknow mimeTypes", + detail: "[PC Preview] unknow detail" + } + const KeyboardControllerMock = { + setDisplayMode: function (...args) { + console.warn("KeyboardController.setDisplayMode interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + getDisplayMode: function (...args) { + console.warn("KeyboardController.getDisplayMode interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + hideKeyboard: function (...args) { + console.warn("KeyboardController.hideKeyboard interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + toNextInputMethod: function (...args) { + console.warn("KeyboardController.toNextInputMethod interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + getScreenOrientation: function (...args) { + console.warn("KeyboardController.getScreenOrientation interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } } - const EditingCapability = { - maxLines: 1, - maxChars:2 + } + const TextInputClientMock = { + getEditorAttribute: function (...args) { + console.warn("TextInputClientMock.getEditorAttribute interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, EditorAttribute); + } else { + return new Promise((resolve, reject) => { + resolve(EditorAttribute); + }) + } + }, + insertText: function (...args) { + console.warn("TextInputClientMock.insertText interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + insertRichContent: function (...args) { + console.warn("TextInputClientMock.insertRichContent interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + deleteBackward: function (...args) { + console.warn("TextInputClientMock.deleteBackward interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + deleteForward: function (...args) { + console.warn("TextInputClientMock.deleteForward interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + getForward: function (...args) { + console.warn("TextInputClientMock.getForward interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } + }, + getBackward: function (...args) { + console.warn("TextInputClientMock.getBackward interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } + }, + getEditingText: function (...args) { + console.warn("TextInputClientMock.getEditingText interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, EditingText); + } else { + return new Promise((resolve, reject) => { + resolve(EditingText); + }) + } + }, + sendKeyEvent: function (...args) { + console.warn("TextInputClientMock.sendKeyEvent interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + sendKeyFunction: function (...args) { + console.warn("TextInputClientMock.sendKeyFunction interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + selectText: function (...args) { + console.warn("TextInputClientMock.selectText interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + requestCurrentCursorContext: function (...args) { + console.warn("TextInputClientMock.requestCurrentCursorContext interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + getAutoCapitalizeMode: function (...args) { + console.warn("TextInputClientMock.getAutoCapitalizeMode interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + reviseText: function (...args) { + console.warn("TextInputClientMock.reviseText interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + markText: function (...args) { + console.warn("TextInputClientMock.markText interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + unmarkText: function (...args) { + console.warn("TextInputClientMock.unmarkText interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + replaceMarkedText: function (...args) { + console.warn("TextInputClientMock.replaceMarkedText interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } } - const EditorAttribute = { - inputPattern: 1, - enterKeyType: 2, - inputOption: 3 - } - const RichContent = { - contentURI: "[PC Preview] unknow contentURI", - linkURI: "[PC Preview] unknow linkURI", - mimeTypes: "[PC Preview] unknow mimeTypes", - detail: "[PC Preview] unknow detail" - } - const KeyboardControllerMock = { - setDisplayMode: function (...args) { - console.warn("KeyboardController.setDisplayMode interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getDisplayMode: function (...args) { - console.warn("KeyboardController.getDisplayMode interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - hideKeyboard: function (...args) { - console.warn("KeyboardController.hideKeyboard interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - toNextInputMethod: function (...args) { - console.warn("KeyboardController.toNextInputMethod interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getScreenOrientation: function (...args) { - console.warn("KeyboardController.getScreenOrientation interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } - } - const TextInputClientMock = { - getEditorAttribute: function (...args) { - console.warn("TextInputClientMock.getEditorAttribute interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, EditorAttribute); - } else { - return new Promise((resolve, reject) => { - resolve(EditorAttribute); - }) - } - }, - insertText: function (...args) { - console.warn("TextInputClientMock.insertText interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - insertRichContent: function (...args) { - console.warn("TextInputClientMock.insertRichContent interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - deleteBackward: function (...args) { - console.warn("TextInputClientMock.deleteBackward interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - deleteForward: function (...args) { - console.warn("TextInputClientMock.deleteForward interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getForward: function (...args) { - console.warn("TextInputClientMock.getForward interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getBackward: function (...args) { - console.warn("TextInputClientMock.getBackward interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getEditingText: function (...args) { - console.warn("TextInputClientMock.getEditingText interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, EditingText); - } else { - return new Promise((resolve, reject) => { - resolve(EditingText); - }) - } - }, - sendKeyEvent: function (...args) { - console.warn("TextInputClientMock.sendKeyEvent interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - sendKeyFunction: function (...args) { - console.warn("TextInputClientMock.sendKeyFunction interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - selectText: function (...args) { - console.warn("TextInputClientMock.selectText interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - requestCurrentCursorContext: function (...args) { - console.warn("TextInputClientMock.requestCurrentCursorContext interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getAutoCapitalizeMode: function (...args) { - console.warn("TextInputClientMock.getAutoCapitalizeMode interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - reviseText: function (...args) { - console.warn("TextInputClientMock.reviseText interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - markText: function (...args) { - console.warn("TextInputClientMock.markText interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - unmarkText: function (...args) { - console.warn("TextInputClientMock.unmarkText interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - replaceMarkedText: function (...args) { - console.warn("TextInputClientMock.replaceMarkedText interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - } - const InputMethodEngineMock = { - on: function (...args) { - console.warn("InputMethodEngine.on interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - if (args[0] == 'configurationUpdate') { - args[len - 1].call(this, paramMock.paramObjectMock); - } else if (args[0] == 'inputStart') { - args[len - 1].call(this, KeyboardControllerMock, TextInputClientMock); - } else if (args[0] == 'inputStop' || args[0] == 'keyboardShow' || args[0] == 'directionChange' || args[0] == 'keyboardHide') { - args[len - 1].call(this); - } - } - }, - off: function (...args) { - console.warn("InputMethodEngine.off interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - if (args[0] == 'configurationUpdate') { - args[len - 1].call(this, paramMock.paramObjectMock); - } else if (args[0] == 'inputStart') { - args[len - 1].call(this, KeyboardControllerMock, TextInputClientMock); - } else if (args[0] == 'inputStop' || args[0] == 'keyboardShow' || args[0] == 'directionChange' || args[0] == 'keyboardHide') { - args[len - 1].call(this); - } - } - } - } - const KeyboardDelegateMock = { - on: function (...args) { - console.warn("KeyboardDelegate.on interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - if (args[0] == 'keyDown' || args[0] == 'keyUp') { - args[len - 1].call(this, paramMock.paramObjectMock); - } else if (args[0] == 'selectionChange') { - args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock); - } else if (args[0] == 'cursorContextChange') { - args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock); - } else if (args[0] == 'textChange') { - args[len - 1].call(this, paramMock.paramStringMock); - } - } - }, - off: function (...args) { - console.warn("KeyboardDelegate.off interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - if (args[0] == 'keyDown' || args[0] == 'keyUp') { - args[len - 1].call(this, paramMock.paramObjectMock); - } else if (args[0] == 'selectionChange') { - args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock); - } else if (args[0] == 'cursorContextChange') { - args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock); - } else if (args[0] == 'textChange') { - args[len - 1].call(this, paramMock.paramStringMock); - } - } - }, - } - global.systemplugin.inputMethodEngine = { - getInputMethodEngine: function () { - console.warn("inputMethodEngine.getInputMethodEngine interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return InputMethodEngineMock; - }, - createKeyboardDelegate: function () { - console.warn("inputMethodEngine.createKeyboardDelegate interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return KeyboardDelegateMock; + } + const InputMethodEngineMock = { + on: function (...args) { + console.warn("InputMethodEngine.on interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + if (args[0] == 'configurationUpdate') { + args[len - 1].call(this, paramMock.paramObjectMock); + } else if (args[0] == 'inputStart') { + args[len - 1].call(this, KeyboardControllerMock, TextInputClientMock); + } else if (args[0] == 'inputStop' || args[0] == 'keyboardShow' || args[0] == 'directionChange' || args[0] == 'keyboardHide') { + args[len - 1].call(this); } } + }, + off: function (...args) { + console.warn("InputMethodEngine.off interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + if (args[0] == 'configurationUpdate') { + args[len - 1].call(this, paramMock.paramObjectMock); + } else if (args[0] == 'inputStart') { + args[len - 1].call(this, KeyboardControllerMock, TextInputClientMock); + } else if (args[0] == 'inputStop' || args[0] == 'keyboardShow' || args[0] == 'directionChange' || args[0] == 'keyboardHide') { + args[len - 1].call(this); + } + } + } + } + const KeyboardDelegateMock = { + on: function (...args) { + console.warn("KeyboardDelegate.on interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + if (args[0] == 'keyDown' || args[0] == 'keyUp') { + args[len - 1].call(this, paramMock.paramObjectMock); + } else if (args[0] == 'selectionChange') { + args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock); + } else if (args[0] == 'cursorContextChange') { + args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock); + } else if (args[0] == 'textChange') { + args[len - 1].call(this, paramMock.paramStringMock); + } + } + }, + off: function (...args) { + console.warn("KeyboardDelegate.off interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + if (args[0] == 'keyDown' || args[0] == 'keyUp') { + args[len - 1].call(this, paramMock.paramObjectMock); + } else if (args[0] == 'selectionChange') { + args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock); + } else if (args[0] == 'cursorContextChange') { + args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock); + } else if (args[0] == 'textChange') { + args[len - 1].call(this, paramMock.paramStringMock); + } + } + }, + } + global.systemplugin.inputMethodEngine = { + getInputMethodEngine: function () { + console.warn("inputMethodEngine.getInputMethodEngine interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return InputMethodEngineMock; + }, + createKeyboardDelegate: function () { + console.warn("inputMethodEngine.createKeyboardDelegate interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return KeyboardDelegateMock; + } + } - for(let Property of Properties) { - global.systemplugin.inputMethodEngine[Property] = NOTIFY + " " + Property - } + for (let Property of Properties) { + global.systemplugin.inputMethodEngine[Property] = NOTIFY + " " + Property + } } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/multimedia.js b/runtime/main/extend/systemplugin/multimedia.js index 50e15d68..5bd3485d 100644 --- a/runtime/main/extend/systemplugin/multimedia.js +++ b/runtime/main/extend/systemplugin/multimedia.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "./utils" const sizeMock = { diff --git a/runtime/main/extend/systemplugin/napi/application/abilityContext.js b/runtime/main/extend/systemplugin/napi/application/abilityContext.js index 5a27bd74..437b7a84 100644 --- a/runtime/main/extend/systemplugin/napi/application/abilityContext.js +++ b/runtime/main/extend/systemplugin/napi/application/abilityContext.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../../utils" const ModuleInfoMock = { diff --git a/runtime/main/extend/systemplugin/napi/applicationAbility.js b/runtime/main/extend/systemplugin/napi/applicationAbility.js index a4a29599..210f589f 100644 --- a/runtime/main/extend/systemplugin/napi/applicationAbility.js +++ b/runtime/main/extend/systemplugin/napi/applicationAbility.js @@ -1,54 +1,69 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" import { AbilityContextClass } from "./application/abilityContext" const WantClass = class Want { - constructor() { - console.warn('Ability.Want.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.deviceId = "[PC Preview] unknow deviceId"; - this.bundleName = "[PC Preview] unknow bundleName"; - this.abilityName = "[PC Preview] unknow abilityName"; - this.uri = "[PC Preview] unknow uri"; - this.type = "[PC Preview] unknow type"; - this.flag = "[PC Preview] unknow flag"; - this.action = "[PC Preview] unknow action"; - this.parameters = {}; - this.entities = [paramMock.paramStringMock]; - } + constructor() { + console.warn('Ability.Want.constructor interface mocked in the Previewer. How this interface works on' + + ' the Previewer may be different from that on a real device.'); + this.deviceId = "[PC Preview] unknow deviceId"; + this.bundleName = "[PC Preview] unknow bundleName"; + this.abilityName = "[PC Preview] unknow abilityName"; + this.uri = "[PC Preview] unknow uri"; + this.type = "[PC Preview] unknow type"; + this.flag = "[PC Preview] unknow flag"; + this.action = "[PC Preview] unknow action"; + this.parameters = {}; + this.entities = [paramMock.paramStringMock]; + } } export function mockAbility() { - const AbilityClass = class Ability { - constructor() { - console.warn('application.Ability.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.context = new AbilityContextClass(); - this.launchWant = new WantClass(); - this.lastRequestWant = new WantClass(); - this.onCreate = function (...args) { - console.warn("application.Ability.onCreate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onWindowStageCreate = function (...args) { - console.warn("application.Ability.onWindowStageCreate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onWindowStageDestroy = function () { - console.warn("application.Ability.onWindowStageDestroy interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onDestroy = function () { - console.warn("application.Ability.onDestroy interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onForeground = function () { - console.warn("application.Ability.onForeground interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onBackground = function () { - console.warn("application.Ability.onBackground interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - } + const AbilityClass = class Ability { + constructor() { + console.warn('application.Ability.constructor interface mocked in the Previewer. How this interface works on' + + ' the Previewer may be different from that on a real device.'); + this.context = new AbilityContextClass(); + this.launchWant = new WantClass(); + this.lastRequestWant = new WantClass(); + this.onCreate = function (...args) { + console.warn("application.Ability.onCreate interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }; + this.onWindowStageCreate = function (...args) { + console.warn("application.Ability.onWindowStageCreate interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }; + this.onWindowStageDestroy = function () { + console.warn("application.Ability.onWindowStageDestroy interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }; + this.onDestroy = function () { + console.warn("application.Ability.onDestroy interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }; + this.onForeground = function () { + console.warn("application.Ability.onForeground interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }; + this.onBackground = function () { + console.warn("application.Ability.onBackground interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }; } - return new AbilityClass(); + } + return new AbilityClass(); } diff --git a/runtime/main/extend/systemplugin/napi/applicationAbilityStage.js b/runtime/main/extend/systemplugin/napi/applicationAbilityStage.js index fb11cd4d..34f9ccf6 100644 --- a/runtime/main/extend/systemplugin/napi/applicationAbilityStage.js +++ b/runtime/main/extend/systemplugin/napi/applicationAbilityStage.js @@ -1,16 +1,31 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { abilityStageContextClass } from "./application/abilityContext" -export function mockAbilityStage(){ - const AbilityStageClass = class AbilityStage{ - constructor() { - console.warn('application.AbilityStage.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.context = new abilityStageContextClass(); - this.onCreate = function () { - console.warn("application.AbilityStage.onCreate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - } - } +export function mockAbilityStage() { + const AbilityStageClass = class AbilityStage { + constructor() { + console.warn('application.AbilityStage.constructor interface mocked in the Previewer. How this interface works on' + + ' the Previewer may be different from that on a real device.'); + this.context = new abilityStageContextClass(); + this.onCreate = function () { + console.warn("application.AbilityStage.onCreate interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + } } - return new AbilityStageClass(); + } + return new AbilityStageClass(); } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/applicationFormBindingData.js b/runtime/main/extend/systemplugin/napi/applicationFormBindingData.js index 9c0582ed..ee6a78a0 100644 --- a/runtime/main/extend/systemplugin/napi/applicationFormBindingData.js +++ b/runtime/main/extend/systemplugin/napi/applicationFormBindingData.js @@ -1,15 +1,30 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" -export function mockFormBindingData(){ - const formBindingDatasMock = { - data: paramMock.paramObjectMock - } - const formBindingDataMock = { - createFormBindingData: function (...args) { - console.warn("formBindingData.createFormBindingData interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return formBindingDatasMock; - }, - } - return formBindingDataMock; +export function mockFormBindingData() { + const formBindingDatasMock = { + data: paramMock.paramObjectMock + } + const formBindingDataMock = { + createFormBindingData: function (...args) { + console.warn("formBindingData.createFormBindingData interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return formBindingDatasMock; + }, + } + return formBindingDataMock; } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/applicationFormExtension.js b/runtime/main/extend/systemplugin/napi/applicationFormExtension.js index 242b2e55..0062016c 100644 --- a/runtime/main/extend/systemplugin/napi/applicationFormExtension.js +++ b/runtime/main/extend/systemplugin/napi/applicationFormExtension.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" import { ExtensionContextClass } from "./application/abilityContext" diff --git a/runtime/main/extend/systemplugin/napi/applicationServiceExtension.js b/runtime/main/extend/systemplugin/napi/applicationServiceExtension.js index 153019bc..fd0eb154 100644 --- a/runtime/main/extend/systemplugin/napi/applicationServiceExtension.js +++ b/runtime/main/extend/systemplugin/napi/applicationServiceExtension.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" import { ExtensionContextClass } from "./application/abilityContext" diff --git a/runtime/main/extend/systemplugin/napi/bytrace.js b/runtime/main/extend/systemplugin/napi/bytrace.js index 87ee405b..94a502ae 100644 --- a/runtime/main/extend/systemplugin/napi/bytrace.js +++ b/runtime/main/extend/systemplugin/napi/bytrace.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" export function mockBytrace() { diff --git a/runtime/main/extend/systemplugin/napi/convertxml.js b/runtime/main/extend/systemplugin/napi/convertxml.js index 217f231a..89db4709 100644 --- a/runtime/main/extend/systemplugin/napi/convertxml.js +++ b/runtime/main/extend/systemplugin/napi/convertxml.js @@ -1,19 +1,34 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" export function mockConvertXml() { - const result = { - ConvertXML: function(...args) { - console.warn("convertXml.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 result = { + ConvertXML: function (...args) { + console.warn("convertXml.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 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; - } + } + 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; + } + return result; } diff --git a/runtime/main/extend/systemplugin/napi/dataAbility.js b/runtime/main/extend/systemplugin/napi/dataAbility.js index c4bdcd70..16e8547d 100644 --- a/runtime/main/extend/systemplugin/napi/dataAbility.js +++ b/runtime/main/extend/systemplugin/napi/dataAbility.js @@ -1,5 +1,20 @@ -import {paramMock} from '../utils'; -import {RdbPredicatesClass} from './rdb' +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from '../utils'; +import { RdbPredicatesClass } from './rdb' export function mockDataAbility() { const DataAbilityPredicatesClass = class DataAbilityPredicates { diff --git a/runtime/main/extend/systemplugin/napi/distributedAccount.js b/runtime/main/extend/systemplugin/napi/distributedAccount.js index 4ac9325d..9f18bcd2 100644 --- a/runtime/main/extend/systemplugin/napi/distributedAccount.js +++ b/runtime/main/extend/systemplugin/napi/distributedAccount.js @@ -1,44 +1,59 @@ -import {paramMock} from "../utils" +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "../utils" export function mockDistributedAccount() { - const distributedInfoMock = { - name: "[PC Preview] unknown name", - id: "[PC Preview] unknown id", - event: "[PC Preview] unknown event", - scalableData: "[PC Preview] unknown scalableData" + const distributedInfoMock = { + name: "[PC Preview] unknown name", + id: "[PC Preview] unknown id", + event: "[PC Preview] unknown event", + scalableData: "[PC Preview] unknown scalableData" + } + const distributedAccountAbilityMock = { + queryOsAccountDistributedInfo: function (...args) { + console.warn("DistributedAccountAbility.queryOsAccountDistributedInfo interface mocked in the Previewer." + + " How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, distributedInfoMock); + } else { + return new Promise((resolve, reject) => { + resolve(distributedInfoMock); + }) + } + }, + updateOsAccountDistributedInfo: function (...args) { + console.warn("DistributedAccountAbility.updateOsAccountDistributedInfo interface mocked in the Previewer." + + " How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } } - const distributedAccountAbilityMock = { - queryOsAccountDistributedInfo: function (...args) { - console.warn("DistributedAccountAbility.queryOsAccountDistributedInfo interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, distributedInfoMock); - } else { - return new Promise((resolve, reject) => { - resolve(distributedInfoMock); - }) - } - }, - updateOsAccountDistributedInfo: function (...args) { - console.warn("DistributedAccountAbility.updateOsAccountDistributedInfo interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - }; - const distributedAccount = { - getDistributedAccountAbility : function (...args) { - console.warn("distributedAccount.getDistributedAccountAbility interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return distributedAccountAbilityMock; - } + }; + const distributedAccount = { + getDistributedAccountAbility: function (...args) { + console.warn("distributedAccount.getDistributedAccountAbility interface mocked in the Previewer." + + " How this interface works on the Previewer may be different from that on a real device.") + return distributedAccountAbilityMock; } - return distributedAccount; + } + return distributedAccount; } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/distributedData.js b/runtime/main/extend/systemplugin/napi/distributedData.js index 8c64502a..c01860f7 100644 --- a/runtime/main/extend/systemplugin/napi/distributedData.js +++ b/runtime/main/extend/systemplugin/napi/distributedData.js @@ -1,898 +1,913 @@ -import {paramMock} from "../utils" +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "../utils" export function mockDistributedData() { - const SchemaClass = class Schema { - constructor() { - console.warn('Schema.constructor interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - this.toJsonString = function (...args) { - console.warn("Schema.toJsonString 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 SchemaClass = class Schema { + constructor() { + console.warn('Schema.constructor interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + this.toJsonString = function (...args) { + console.warn("Schema.toJsonString 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 FieldNodeClass = class FieldNode { + constructor(...args) { + console.warn('FieldNode.constructor interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + + this.appendChild = function (...args) { + console.warn("FieldNode.appendChild interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }; + + this.toJson = function (...args) { + console.warn("FieldNode.toJson 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 QueryClass = class Query { + constructor() { + console.warn('Query.constructor interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + this.reset = function (...args) { + console.warn("Query.reset interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.equalTo = function (...args) { + console.warn("Query.equalTo interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.notEqualTo = function (...args) { + console.warn("Query.notEqualTo interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.greaterThan = function (...args) { + console.warn("Query.greaterThan interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.lessThan = function (...args) { + console.warn("Query.lessThan interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.greaterThanOrEqualTo = function (...args) { + console.warn("Query.greaterThanOrEqualTo interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.lessThanOrEqualTo = function (...args) { + console.warn("Query.lessThanOrEqualTo interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.isNull = function (...args) { + console.warn("Query.isNull interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.inNumber = function (...args) { + console.warn("Query.inNumber interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.inString = function (...args) { + console.warn("Query.inString interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.notInNumber = function (...args) { + console.warn("Query.notInNumber interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.notInString = function (...args) { + console.warn("Query.notInString interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.like = function (...args) { + console.warn("Query.like interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.unlike = function (...args) { + console.warn("Query.unlike interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.and = function (...args) { + console.warn("Query.and interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.or = function (...args) { + console.warn("Query.or interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.orderByAsc = function (...args) { + console.warn("Query.orderByAsc interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.orderByDesc = function (...args) { + console.warn("Query.orderByDesc interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.limit = function (...args) { + console.warn("Query.limit interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.isNotNull = function (...args) { + console.warn("Query.isNotNull interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.beginGroup = function (...args) { + console.warn("Query.beginGroup interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.endGroup = function (...args) { + console.warn("Query.endGroup interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.prefixKey = function (...args) { + console.warn("Query.prefixKey interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.setSuggestIndex = function (...args) { + console.warn("Query.setSuggestIndex interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.deviceId = function (...args) { + console.warn("Query.deviceId interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + + this.getSqlLike = function (...args) { + console.warn("Query.getSqlLike interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return QueryClass; + }; + } + }; + + const distributedDataMock = { + Schema: SchemaClass, + Query: QueryClass, + FieldNode: FieldNodeClass, + + KVStoreType: { + DEVICE_COLLABORATION: 0, + SINGLE_VERSION: 1, + MULTI_VERSION: 2, + }, + + SecurityLevel: { + NO_LEVEL: 0, + S0: 1, + S1: 2, + S2: 3, + S3: 5, + S4: 6, + }, + + createKVManager: function (...args) { + console.warn("distributedData.createKVManager interface mocked in the Previewer." + + " How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, KVManager); + } else { + return new Promise((resolve, reject) => { + resolve(KVManager); + }) + } + } + }; + + const userTypeMock = { + SAME_USER_ID: "[PC Preview] unknown SAME_USER_ID" + }; + const userInfoMock = { + userId: "[PC Preview] unknown userId", + userType: "[PC Preview] unknown userType" + }; + const kvManagerConfigMock = { + userInfo: "[PC Preview] unknown userInfo", + bundleName: "[PC Preview] unknown bundleName" + }; + const constantsMock = { + MAX_KEY_LENGTH: "[PC Preview] unknown MAX_KEY_LENGTH", + MAX_VALUE_LENGTH: "[PC Preview] unknown MAX_VALUE_LENGTH", + MAX_KEY_LENGTH_DEVICE: "[PC Preview] unknown MAX_KEY_LENGTH_DEVICE", + MAX_STORE_ID_LENGTH: "[PC Preview] unknown MAX_STORE_ID_LENGTH", + MAX_QUERY_LENGTH: "[PC Preview] unknown MAX_QUERY_LENGTH", + MAX_BATCH_SIZE: "[PC Preview] unknown MAX_BATCH_SIZE" + }; + const valueTypeMock = { + STRING: "[PC Preview] unknown STRING", + INTEGER: "[PC Preview] unknown INTEGER", + FLOAT: "[PC Preview] unknown FLOAT", + BYTE_ARRAY: "[PC Preview] unknown BYTE_ARRAY", + BOOLEAN: "[PC Preview] unknown BOOLEAN", + DOUBLE: "[PC Preview] unknown DOUBLE" + }; + const valueMock = { + type: valueTypeMock.STRING, + value: "[PC Preview] unknown value" + }; + const entryMock = { + key: "[PC Preview] unknown key", + value: valueMock + }; + const changeNotificationMock = { + insertEntries: new Array(entryMock), + updateEntries: new Array(entryMock), + deleteEntries: new Array(entryMock), + deviceId: "[PC Preview] unknown deviceId" + }; + const syncModeMock = { + PULL_ONLY: "[PC Preview] unknown PULL_ONLY", + PUSH_ONLY: "[PC Preview] unknown PUSH_ONLY", + PUSH_PULL: "[PC Preview] unknown PUSH_PULL" + }; + const subscribeTypeMock = { + SUBSCRIBE_TYPE_LOCAL: "[PC Preview] unknown SUBSCRIBE_TYPE_LOCAL", + SUBSCRIBE_TYPE_REMOTE: "[PC Preview] unknown SUBSCRIBE_TYPE_REMOTE", + SUBSCRIBE_TYPE_ALL: "[PC Preview] unknown SUBSCRIBE_TYPE_ALL" + }; + + const optionsMock = { + createIfMissing: "[PC Preview] unknown createIfMissing", + encrypt: "[PC Preview] unknown encrypt", + backup: "[PC Preview] unknown backup", + autoSync: "[PC Preview] unknown autoSync", + kvStoreType: "[PC Preview] unknown kvStoreType", + securityLevel: "[PC Preview] unknown securityLevel", + }; + + const KVStoreClass = class KVStore { + constructor() { + console.warn("KVStore.constructor interface mocked in the Previewer." + + " How this interface works on the Previewer may be different from that on a real device.") + this.put = function (...args) { + console.warn("KVStore.put interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve) => { + resolve() + }) } - }; + }; - const FieldNodeClass = class FieldNode { - constructor(...args) { - console.warn('FieldNode.constructor interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - - this.appendChild = function (...args) { - console.warn("FieldNode.appendChild interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - - this.toJson = function (...args) { - console.warn("FieldNode.toJson interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramStringMock; - }; + this.delete = function (...args) { + console.warn("KVStore.delete interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }) } - }; + }; - const QueryClass = class Query { - constructor() { - console.warn('Query.constructor interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - this.reset = function (...args) { - console.warn("Query.reset interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.equalTo = function (...args) { - console.warn("Query.equalTo interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.notEqualTo = function (...args) { - console.warn("Query.notEqualTo interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.greaterThan = function (...args) { - console.warn("Query.greaterThan interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.lessThan = function (...args) { - console.warn("Query.lessThan interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.greaterThanOrEqualTo = function (...args) { - console.warn("Query.greaterThanOrEqualTo interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.lessThanOrEqualTo = function (...args) { - console.warn("Query.lessThanOrEqualTo interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.isNull = function (...args) { - console.warn("Query.isNull interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.inNumber = function (...args) { - console.warn("Query.inNumber interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.inString = function (...args) { - console.warn("Query.inString interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.notInNumber = function (...args) { - console.warn("Query.notInNumber interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.notInString = function (...args) { - console.warn("Query.notInString interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.like = function (...args) { - console.warn("Query.like interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.unlike = function (...args) { - console.warn("Query.unlike interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.and = function (...args) { - console.warn("Query.and interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.or = function (...args) { - console.warn("Query.or interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.orderByAsc = function (...args) { - console.warn("Query.orderByAsc interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.orderByDesc = function (...args) { - console.warn("Query.orderByDesc interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.limit = function (...args) { - console.warn("Query.limit interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.isNotNull = function (...args) { - console.warn("Query.isNotNull interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.beginGroup = function (...args) { - console.warn("Query.beginGroup interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.endGroup = function (...args) { - console.warn("Query.endGroup interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.prefixKey = function (...args) { - console.warn("Query.prefixKey interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.setSuggestIndex = function (...args) { - console.warn("Query.setSuggestIndex interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.deviceId = function (...args) { - console.warn("Query.deviceId interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }, - - this.getSqlLike = function (...args) { - console.warn("Query.getSqlLike interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - } + this.setSyncRange = function (...args) { + console.warn("KVStore.setSyncRange interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }) } - }; + }; - const distributedDataMock = { - Schema: SchemaClass, - Query: QueryClass, - FieldNode: FieldNodeClass, - - KVStoreType: { - DEVICE_COLLABORATION: 0, - SINGLE_VERSION: 1, - MULTI_VERSION: 2, - }, - - SecurityLevel: { - NO_LEVEL: 0, - S0: 1, - S1: 2, - S2: 3, - S3: 5, - S4: 6, - }, - - createKVManager: function (...args) { - console.warn("distributedData.createKVManager interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, KVManager); - } else { - return new Promise((resolve, reject) => { - resolve(KVManager); - }) - } + this.on = function (...args) { + console.warn("KVStore.on interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + if (args[0] == 'dataChange') { + args[len - 1].call(this, paramMock.businessErrorMock, changeNotificationMock) + } } - }; + }; - const userTypeMock = { - SAME_USER_ID: "[PC Preview] unknown SAME_USER_ID" - }; - const userInfoMock = { - userId: "[PC Preview] unknown userId", - userType: "[PC Preview] unknown userType" - }; - const kvManagerConfigMock = { - userInfo: "[PC Preview] unknown userInfo", - bundleName: "[PC Preview] unknown bundleName" - }; - const constantsMock = { - MAX_KEY_LENGTH: "[PC Preview] unknown MAX_KEY_LENGTH", - MAX_VALUE_LENGTH: "[PC Preview] unknown MAX_VALUE_LENGTH", - MAX_KEY_LENGTH_DEVICE: "[PC Preview] unknown MAX_KEY_LENGTH_DEVICE", - MAX_STORE_ID_LENGTH: "[PC Preview] unknown MAX_STORE_ID_LENGTH", - MAX_QUERY_LENGTH: "[PC Preview] unknown MAX_QUERY_LENGTH", - MAX_BATCH_SIZE: "[PC Preview] unknown MAX_BATCH_SIZE" - }; - const valueTypeMock = { - STRING: "[PC Preview] unknown STRING", - INTEGER: "[PC Preview] unknown INTEGER", - FLOAT: "[PC Preview] unknown FLOAT", - BYTE_ARRAY: "[PC Preview] unknown BYTE_ARRAY", - BOOLEAN: "[PC Preview] unknown BOOLEAN", - DOUBLE: "[PC Preview] unknown DOUBLE" - }; - const valueMock = { - type: valueTypeMock.STRING, - value: "[PC Preview] unknown value" - }; - const entryMock = { - key: "[PC Preview] unknown key", - value: valueMock - }; - const changeNotificationMock = { - insertEntries: new Array(entryMock), - updateEntries: new Array(entryMock), - deleteEntries: new Array(entryMock), - deviceId: "[PC Preview] unknown deviceId" - }; - const syncModeMock = { - PULL_ONLY: "[PC Preview] unknown PULL_ONLY", - PUSH_ONLY: "[PC Preview] unknown PUSH_ONLY", - PUSH_PULL: "[PC Preview] unknown PUSH_PULL" - }; - const subscribeTypeMock = { - SUBSCRIBE_TYPE_LOCAL: "[PC Preview] unknown SUBSCRIBE_TYPE_LOCAL", - SUBSCRIBE_TYPE_REMOTE: "[PC Preview] unknown SUBSCRIBE_TYPE_REMOTE", - SUBSCRIBE_TYPE_ALL: "[PC Preview] unknown SUBSCRIBE_TYPE_ALL" - }; - - const optionsMock = { - createIfMissing: "[PC Preview] unknown createIfMissing", - encrypt: "[PC Preview] unknown encrypt", - backup: "[PC Preview] unknown backup", - autoSync: "[PC Preview] unknown autoSync", - kvStoreType: "[PC Preview] unknown kvStoreType", - securityLevel: "[PC Preview] unknown securityLevel", - }; - - const KVStoreClass = class KVStore { - constructor() { - console.warn("KVStore.constructor interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - this.put = function (...args) { - console.warn("KVStore.put interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - this.delete = function (...args) { - console.warn("KVStore.delete interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - this.setSyncRange = function (...args) { - console.warn("KVStore.setSyncRange interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - this.on = function (...args) { - console.warn("KVStore.on interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - if (args[0] == 'dataChange') { - args[len - 1].call(this, paramMock.businessErrorMock, changeNotificationMock) - } - } - }, - - this.off = function (...args) { - console.warn("KVStore.off interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - if (args[0] == 'dataChange') { - args[len - 1].call(this, paramMock.businessErrorMock, changeNotificationMock) - } - } - }, - - this.putBatch = function (...args) { - console.warn("KVStore.putBatch interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - this.deleteBatch = function (...args) { - console.warn("KVStore.deleteBatch interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - this.startTransaction = function (...args) { - console.warn("KVStore.startTransaction interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - this.commit = function (...args) { - console.warn("KVStore.commit interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - this.rollback = function (...args) { - console.warn("KVStore.rollback interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - this.enableSync = function (...args) { - console.warn("KVStore.enableSync interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }) - } - } + this.off = function (...args) { + console.warn("KVStore.off interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + if (args[0] == 'dataChange') { + args[len - 1].call(this, paramMock.businessErrorMock, changeNotificationMock) + } } - }; + }; - const SingleKVStoreClass = class SingleKVStore extends KVStoreClass { - constructor() { - super(); - console.warn("SingleKVStore.constructor interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - - this.put = function (...args) { - console.warn("SingleKVStore.put interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - - this.delete = function (...args) { - console.warn("SingleKVStore.delete interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - - this.on = function (...args) { - console.warn("SingleKVStore.on interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - if (args[0] === 'dataChange') { - args[len - 1].call(this, changeNotificationMock); - } else if (args[0] === 'syncComplete') { - var array = new Array([paramMock.paramStringMock, paramMock.paramNumberMock]); - args[len - 1].call(this, array); - } - } - }, - - this.off = function (...args) { - console.warn("SingleKVStore.off interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - var array = new Array([paramMock.paramStringMock, paramMock.paramNumberMock]); - if (typeof args[len - 1] === 'function') { - if (args[0] == 'syncComplete') { - args[len - 1].call(this, paramMock.businessErrorMock, array) - } else if (args[0] == 'dataChange') { - args[len - 1].call(this, paramMock.businessErrorMock, changeNotificationMock) - } - } - }, - - this.sync = function (...args) { - console.warn("SingleKVStore.sync interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - - this.get = function (...args) { - console.warn("SingleKVStore.get interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, - paramMock.paramBooleanMock | paramMock.paramStringMock | paramMock.paramNumberMock | paramMock.paramArrayMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock | paramMock.paramStringMock | paramMock.paramNumberMock | paramMock.paramArrayMock) - }) - } - }, - - this.getResultSet = function (...args) { - console.warn("SingleKVStore.getResultSet interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, KVStoreResultSet) - } else { - return new Promise((resolve) => { - resolve(KVStoreResultSet) - }) - } - }, - - this.closeResultSet = function (...args) { - console.warn("SingleKVStore.closeResultSet interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - this.getResultSize = function (...args) { - console.warn("SingleKVStore.getResultSize interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } - }, - - this.getEntries = function (...args) { - console.warn("SingleKVStore.getEntries interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - var array = new Array(entryMock) - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, array) - } else { - return new Promise((resolve) => { - resolve(array) - }) - } - }, - - this.removeDeviceData = function (...args) { - console.warn("SingleKVStore.removeDeviceData interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - this.setSyncParam = function (...args) { - console.warn("SingleKVStore.setSyncParam interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - this.getSecurityLevel = function (...args) { - console.warn("SingleKVStore.getSecurityLevel interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }) - } - } + this.putBatch = function (...args) { + console.warn("KVStore.putBatch interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }) } - }; + }; - const DeviceKVStoreClass = class DeviceKVStore extends KVStoreClass { - constructor() { - super(); - console.warn('DeviceKVStore.constructor interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - - this.get = function (...args) { - console.warn("DeviceKVStore.get interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, - paramMock.paramBooleanMock | paramMock.paramStringMock | paramMock.paramNumberMock | paramMock.paramArrayMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock | paramMock.paramStringMock | paramMock.paramNumberMock | paramMock.paramArrayMock) - }) - } - }, - - this.getEntries = function (...args) { - console.warn("DeviceKVStore.getEntries interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - var array = new Array(entryMock) - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, array) - } else { - return new Promise((resolve) => { - resolve(array) - }) - } - }, - - this.getResultSet = function (...args) { - console.warn("DeviceKVStore.getResultSet interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, KVStoreResultSet) - } else { - return new Promise((resolve) => { - resolve(KVStoreResultSet) - }) - } - }, - - this.closeResultSet = function (...args) { - console.warn("DeviceKVStore.closeResultSet interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - this.getResultSize = function (...args) { - console.warn("DeviceKVStore.getResultSize interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } - }, - - this.removeDeviceData = function (...args) { - console.warn("DeviceKVStore.removeDeviceData interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - this.sync = function (...args) { - console.warn("DeviceKVStore.sync interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - }, - - this.on = function (...args) { - console.warn("DeviceKVStore.on interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - var array = new Array([paramMock.paramStringMock, paramMock.paramNumberMock]); - if (typeof args[len - 1] === 'function') { - if (args[0] == 'syncComplete') { - args[len - 1].call(this, paramMock.businessErrorMock, array) - } else if (args[0] == 'dataChange') { - args[len - 1].call(this, paramMock.businessErrorMock, changeNotificationMock) - } - } - }, - - this.off = function (...args) { - console.warn("DeviceKVStore.off interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - var array = new Array([paramMock.paramStringMock, paramMock.paramNumberMock]); - if (typeof args[len - 1] === 'function') { - if (args[0] == 'syncComplete') { - args[len - 1].call(this, paramMock.businessErrorMock, array) - } else if (args[0] == 'dataChange') { - args[len - 1].call(this, paramMock.businessErrorMock, changeNotificationMock) - } - } - } + this.deleteBatch = function (...args) { + console.warn("KVStore.deleteBatch interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }) } - }; + }; - const KVManager = { - getKVStore: function (...args) { - console.warn("KVManager.getKVStore interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - var singleKVStoreClass = new SingleKVStoreClass - var deviceKVStoreClass = new DeviceKVStoreClass - if (len > 0 && typeof args[len - 1] === 'function') { - console.warn("getKVStore kvStoreType = " + args[1].kvStoreType); - if (args[1].kvStoreType == distributedDataMock.KVStoreType.DEVICE_COLLABORATION) { - args[len - 1].call(this, paramMock.businessErrorMock, deviceKVStoreClass); - } else if (args[1].kvStoreType == distributedDataMock.KVStoreType.SINGLE_VERSION) { - args[len - 1].call(this, paramMock.businessErrorMock, singleKVStoreClass); - } - } else { - return new Promise((resolve) => { - if (args[1].kvStoreType == distributedDataMock.KVStoreType.DEVICE_COLLABORATION) { - resolve(deviceKVStoreClass); - } else if (args[1].kvStoreType == distributedDataMock.KVStoreType.SINGLE_VERSION) { - resolve(singleKVStoreClass); - } - }) - } - }, - - closeKVStore: function (...args) { - console.warn("KVManager.closeKVStore interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - deleteKVStore: function (...args) { - console.warn("KVManager.deleteKVStore interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - getAllKVStoreId: function (...args) { - console.warn("KVManager.getAllKVStoreId interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - var array = new Array(paramMock.paramStringMock) - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, array) - } else { - return new Promise((resolve) => { - resolve(array) - }) - } - }, - - on: function (...args) { - console.warn("KVManager.on interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - if (args[0] == 'distributedDataServiceDie') { - args[len - 1].call(this, paramMock.businessErrorMock) - } - } - }, - - off: function (...args) { - console.warn("KVManager.off interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - if (args[0] == 'distributedDataServiceDie') { - args[len - 1].call(this, paramMock.businessErrorMock) - } - } + this.startTransaction = function (...args) { + console.warn("KVStore.startTransaction interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }) } - }; + }; - const KVStoreResultSet = { - getCount: function (...args) { - console.warn("KVStoreResultSet.getCount interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - - getPosition: function (...args) { - console.warn("KVStoreResultSet.getPosition interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - - moveToFirst: function (...args) { - console.warn("KVStoreResultSet.moveToFirst interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - moveToLast: function (...args) { - console.warn("KVStoreResultSet.moveToLast interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - moveToNext: function (...args) { - console.warn("KVStoreResultSet.moveToNext interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - moveToPrevious: function (...args) { - console.warn("KVStoreResultSet.moveToPrevious interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - move: function (...args) { - console.warn("KVStoreResultSet.move interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - moveToPosition: function (...args) { - console.warn("KVStoreResultSet.moveToPosition interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - isFirst: function (...args) { - console.warn("KVStoreResultSet.isFirst interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - isLast: function (...args) { - console.warn("KVStoreResultSet.isLast interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - isBeforeFirst: function (...args) { - console.warn("KVStoreResultSet.isBeforeFirst interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - isAfterLast: function (...args) { - console.warn("KVStoreResultSet.isAfterLast interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - getEntry: function (...args) { - console.warn("KVStoreResultSet.getEntry interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return entryMock; + this.commit = function (...args) { + console.warn("KVStore.commit interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }) } - }; + }; - return distributedDataMock; + this.rollback = function (...args) { + console.warn("KVStore.rollback interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }) + } + }; + + this.enableSync = function (...args) { + console.warn("KVStore.enableSync interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }) + } + }; + } + }; + + const SingleKVStoreClass = class SingleKVStore extends KVStoreClass { + constructor() { + super(); + console.warn("SingleKVStore.constructor interface mocked in the Previewer." + + " How this interface works on the Previewer may be different from that on a real device.") + + this.put = function (...args) { + console.warn("SingleKVStore.put interface mocked in the Previewer." + + " How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }; + + this.delete = function (...args) { + console.warn("SingleKVStore.delete interface mocked in the Previewer." + + " How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }; + + this.on = function (...args) { + console.warn("SingleKVStore.on interface mocked in the Previewer." + + " How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + if (args[0] === 'dataChange') { + args[len - 1].call(this, changeNotificationMock); + } else if (args[0] === 'syncComplete') { + var array = new Array([paramMock.paramStringMock, paramMock.paramNumberMock]); + args[len - 1].call(this, array); + } + } + }; + + this.off = function (...args) { + console.warn("SingleKVStore.off interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + var array = new Array([paramMock.paramStringMock, paramMock.paramNumberMock]); + if (typeof args[len - 1] === 'function') { + if (args[0] == 'syncComplete') { + args[len - 1].call(this, paramMock.businessErrorMock, array) + } else if (args[0] == 'dataChange') { + args[len - 1].call(this, paramMock.businessErrorMock, changeNotificationMock) + } + } + }; + + this.sync = function (...args) { + console.warn("SingleKVStore.sync interface mocked in the Previewer." + + " How this interface works on the Previewer may be different from that on a real device.") + }; + + this.get = function (...args) { + console.warn("SingleKVStore.get interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, + paramMock.paramBooleanMock | paramMock.paramStringMock | paramMock.paramNumberMock | paramMock.paramArrayMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock | paramMock.paramStringMock | paramMock.paramNumberMock | paramMock.paramArrayMock) + }) + } + }; + + this.getResultSet = function (...args) { + console.warn("SingleKVStore.getResultSet interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, KVStoreResultSet) + } else { + return new Promise((resolve) => { + resolve(KVStoreResultSet) + }) + } + }; + + this.closeResultSet = function (...args) { + console.warn("SingleKVStore.closeResultSet interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }) + } + }; + + this.getResultSize = function (...args) { + console.warn("SingleKVStore.getResultSize interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramNumberMock) + }) + } + }; + + this.getEntries = function (...args) { + console.warn("SingleKVStore.getEntries interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + var array = new Array(entryMock) + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, array) + } else { + return new Promise((resolve) => { + resolve(array) + }) + } + }; + + this.removeDeviceData = function (...args) { + console.warn("SingleKVStore.removeDeviceData interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }) + } + }; + + this.setSyncParam = function (...args) { + console.warn("SingleKVStore.setSyncParam interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }) + } + }; + + this.getSecurityLevel = function (...args) { + console.warn("SingleKVStore.getSecurityLevel interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }) + } + }; + } + }; + + const DeviceKVStoreClass = class DeviceKVStore extends KVStoreClass { + constructor() { + super(); + console.warn('DeviceKVStore.constructor interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + + this.get = function (...args) { + console.warn("DeviceKVStore.get interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, + paramMock.paramBooleanMock | paramMock.paramStringMock | paramMock.paramNumberMock | paramMock.paramArrayMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock | paramMock.paramStringMock | paramMock.paramNumberMock | paramMock.paramArrayMock) + }) + } + }; + + this.getEntries = function (...args) { + console.warn("DeviceKVStore.getEntries interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + var array = new Array(entryMock) + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, array) + } else { + return new Promise((resolve) => { + resolve(array) + }) + } + }; + + this.getResultSet = function (...args) { + console.warn("DeviceKVStore.getResultSet interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, KVStoreResultSet) + } else { + return new Promise((resolve) => { + resolve(KVStoreResultSet) + }) + } + }; + + this.closeResultSet = function (...args) { + console.warn("DeviceKVStore.closeResultSet interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }) + } + }; + + this.getResultSize = function (...args) { + console.warn("DeviceKVStore.getResultSize interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramNumberMock) + }) + } + }; + + this.removeDeviceData = function (...args) { + console.warn("DeviceKVStore.removeDeviceData interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }) + } + }; + + this.sync = function (...args) { + console.warn("DeviceKVStore.sync interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + }; + + this.on = function (...args) { + console.warn("DeviceKVStore.on interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + var array = new Array([paramMock.paramStringMock, paramMock.paramNumberMock]); + if (typeof args[len - 1] === 'function') { + if (args[0] == 'syncComplete') { + args[len - 1].call(this, paramMock.businessErrorMock, array) + } else if (args[0] == 'dataChange') { + args[len - 1].call(this, paramMock.businessErrorMock, changeNotificationMock) + } + } + }; + + this.off = function (...args) { + console.warn("DeviceKVStore.off interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + var array = new Array([paramMock.paramStringMock, paramMock.paramNumberMock]); + if (typeof args[len - 1] === 'function') { + if (args[0] == 'syncComplete') { + args[len - 1].call(this, paramMock.businessErrorMock, array) + } else if (args[0] == 'dataChange') { + args[len - 1].call(this, paramMock.businessErrorMock, changeNotificationMock) + } + } + }; + } + }; + + const KVManager = { + getKVStore: function (...args) { + console.warn("KVManager.getKVStore interface mocked in the Previewer." + + " How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + var singleKVStoreClass = new SingleKVStoreClass + var deviceKVStoreClass = new DeviceKVStoreClass + if (len > 0 && typeof args[len - 1] === 'function') { + console.warn("getKVStore kvStoreType = " + args[1].kvStoreType); + if (args[1].kvStoreType == distributedDataMock.KVStoreType.DEVICE_COLLABORATION) { + args[len - 1].call(this, paramMock.businessErrorMock, deviceKVStoreClass); + } else if (args[1].kvStoreType == distributedDataMock.KVStoreType.SINGLE_VERSION) { + args[len - 1].call(this, paramMock.businessErrorMock, singleKVStoreClass); + } + } else { + return new Promise((resolve) => { + if (args[1].kvStoreType == distributedDataMock.KVStoreType.DEVICE_COLLABORATION) { + resolve(deviceKVStoreClass); + } else if (args[1].kvStoreType == distributedDataMock.KVStoreType.SINGLE_VERSION) { + resolve(singleKVStoreClass); + } + }) + } + }, + + closeKVStore: function (...args) { + console.warn("KVManager.closeKVStore interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }) + } + }, + + deleteKVStore: function (...args) { + console.warn("KVManager.deleteKVStore interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }) + } + }, + + getAllKVStoreId: function (...args) { + console.warn("KVManager.getAllKVStoreId interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + var array = new Array(paramMock.paramStringMock) + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, array) + } else { + return new Promise((resolve) => { + resolve(array) + }) + } + }, + + on: function (...args) { + console.warn("KVManager.on interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + if (args[0] == 'distributedDataServiceDie') { + args[len - 1].call(this, paramMock.businessErrorMock) + } + } + }, + + off: function (...args) { + console.warn("KVManager.off interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + if (args[0] == 'distributedDataServiceDie') { + args[len - 1].call(this, paramMock.businessErrorMock) + } + } + } + }; + + const KVStoreResultSet = { + getCount: function (...args) { + console.warn("KVStoreResultSet.getCount interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + + getPosition: function (...args) { + console.warn("KVStoreResultSet.getPosition interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + + moveToFirst: function (...args) { + console.warn("KVStoreResultSet.moveToFirst interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + + moveToLast: function (...args) { + console.warn("KVStoreResultSet.moveToLast interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + + moveToNext: function (...args) { + console.warn("KVStoreResultSet.moveToNext interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + + moveToPrevious: function (...args) { + console.warn("KVStoreResultSet.moveToPrevious interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + move: function (...args) { + console.warn("KVStoreResultSet.move interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + + moveToPosition: function (...args) { + console.warn("KVStoreResultSet.moveToPosition interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + + isFirst: function (...args) { + console.warn("KVStoreResultSet.isFirst interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + + isLast: function (...args) { + console.warn("KVStoreResultSet.isLast interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isBeforeFirst: function (...args) { + console.warn("KVStoreResultSet.isBeforeFirst interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + + isAfterLast: function (...args) { + console.warn("KVStoreResultSet.isAfterLast interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + + getEntry: function (...args) { + console.warn("KVStoreResultSet.getEntry interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + return entryMock; + } + }; + + return distributedDataMock; } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/distributedDataObject.js b/runtime/main/extend/systemplugin/napi/distributedDataObject.js new file mode 100644 index 00000000..83f413c8 --- /dev/null +++ b/runtime/main/extend/systemplugin/napi/distributedDataObject.js @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "../utils" + +export function mockDistributedObject() { + const DistributedObject = { + setSessionId: function (...args) { + console.warn("DistributedObject.setSessionId interface mocked in the Previewer." + + " How this interface works on the Previewer may be different from that on a real device.") + }, + on: function (...args) { + console.warn("DistributedObject.on interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + }, + off: function (...args) { + console.warn("DistributedObject.off interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + } + }; + const distributedObjectMock = { + createDistributedObject: function (...args) { + console.warn("distributedObject.createDistributedObject interface mocked in the Previewer." + + " How this interface works on the Previewer may be different from that on a real device."); + return DistributedObject; + }, + genSessionId: function (...args) { + console.warn("distributedObject.genSessionId interface mocked in the Previewer." + + " How this interface works on the Previewer may be different from that on a real device."); + return 'just test'; + } + }; + return distributedObjectMock; +} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/dtv.js b/runtime/main/extend/systemplugin/napi/dtv.js index f145653e..d604bf1e 100644 --- a/runtime/main/extend/systemplugin/napi/dtv.js +++ b/runtime/main/extend/systemplugin/napi/dtv.js @@ -1,5676 +1,5691 @@ -import {paramMock} from "../utils" +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "../utils" export function mockDtv() { - const BookTask = { - id: "[PC Preview] unknow id", - channelId: "[PC Preview] unknow channelId", - eventId: "[PC Preview] unknow eventId", - isAdjustByEvent: "[PC Preview] unknow isAdjustByEvent", - name: "[PC Preview] unknow name", - startDate: "[PC Preview] unknow startDate", - duration: "[PC Preview] unknow duration", - type: "[PC Preview] unknow type", - cycle: "[PC Preview] unknow cycle", - isEnabled: "[PC Preview] unknow isEnabled", - lcn: "[PC Preview] unknow lcn", - programName: "[PC Preview] unknow programName", - signalType: "[PC Preview] unknow signalType", - startTime: "[PC Preview] unknow startTime" - } - const FavTags = { - FAV_ALL: "[PC Preview] unknow FAV_ALL", - FAV_1: "[PC Preview] unknow FAV_1", - FAV_2: "[PC Preview] unknow FAV_2", - FAV_3: "[PC Preview] unknow FAV_3", - FAV_4: "[PC Preview] unknow FAV_4", - FAV_5: "[PC Preview] unknow FAV_5", - FAV_6: "[PC Preview] unknow FAV_6", - FAV_7: "[PC Preview] unknow FAV_7", - FAV_8: "[PC Preview] unknow FAV_8", - FAV_9: "[PC Preview] unknow FAV_9", - FAV_10: "[PC Preview] unknow FAV_10", - FAV_11: "[PC Preview] unknow FAV_11", - FAV_12: "[PC Preview] unknow FAV_12", - FAV_13: "[PC Preview] unknow FAV_13", - FAV_14: "[PC Preview] unknow FAV_14", - FAV_15: "[PC Preview] unknow FAV_15", - FAV_16: "[PC Preview] unknow FAV_16" - } - const ChannelTsInfo = { - tsInfoNum: "[PC Preview] unknow tsInfoNum", - networkType: "[PC Preview] unknow networkType", - centerFreqList: "[PC Preview] unknow centerFreqList", - cabDeliveryDescriptor: "[PC Preview] unknow cabDeliveryDescriptor", - terDeliveryDescriptor: "[PC Preview] unknow terDeliveryDescriptor", - satDeliveryDescriptor: "[PC Preview] unknow satDeliveryDescriptor" - } - const ChannelFilter = { - siElement: "[PC Preview] unknow siElement", - tvRadio: "[PC Preview] unknow tvRadio", - favGroupTypes: "[PC Preview] unknow favGroupTypes", - scrambleType: "[PC Preview] unknow scrambleType", - editTags: "[PC Preview] unknow editTags", - letters: "[PC Preview] unknow letters", - mbServiceNameFilter: "[PC Preview] unknow mbServiceNameFilter" - } - const TVRadioFilters = { - ALL: "[PC Preview] unknow ALL", - TV: "[PC Preview] unknow TV", - RADIO: "[PC Preview] unknow RADIO", - DATA: "[PC Preview] unknow DATA", - BUTT: "[PC Preview] unknow BUTT" - } - const ChannelRegion = { - name: "[PC Preview] unknow name", - countryCode: "[PC Preview] unknow countryCode", - regionDepth: "[PC Preview] unknow regionDepth", - prc: "[PC Preview] unknow prc", - src: "[PC Preview] unknow src", - trc: "[PC Preview] unknow trc" - } - const ChannelRate = { - enUstvAll: "[PC Preview] unknow enUstvAll", - enUstvFv: "[PC Preview] unknow enUstvFv", - enUstvV: "[PC Preview] unknow enUstvV", - enUstvS: "[PC Preview] unknow enUstvS", - enUstvL: "[PC Preview] unknow enUstvL", - enUstvD: "[PC Preview] unknow enUstvD", - enMpaa: "[PC Preview] unknow enMpaa", - enCaen: "[PC Preview] unknow enCaen", - enCafr: "[PC Preview] unknow enCafr" - } - const ParentalContents = { - PARENTAL_CONTENT_NONE: "[PC Preview] unknow PARENTAL_CONTENT_NONE", - PARENTAL_CONTENT_DRUGS: "[PC Preview] unknow PARENTAL_CONTENT_DRUGS", - PARENTAL_CONTENT_VIOLENCE: "[PC Preview] unknow PARENTAL_CONTENT_VIOLENCE", - PARENTAL_CONTENT_VIOL_DRUG: "[PC Preview] unknow PARENTAL_CONTENT_VIOL_DRUG", - PARENTAL_CONTENT_SEX: "[PC Preview] unknow PARENTAL_CONTENT_SEX", - PARENTAL_CONTENT_SEX_DRUG: "[PC Preview] unknow PARENTAL_CONTENT_SEX_DRUG", - PARENTAL_CONTENT_SEX_VIOL: "[PC Preview] unknow PARENTAL_CONTENT_SEX_VIOL", - PARENTAL_CONTENT_SEX_VIOL_DRUG: "[PC Preview] unknow PARENTAL_CONTENT_SEX_VIOL_DRUG", - PARENTAL_CONTENT_BUTT: "[PC Preview] unknow PARENTAL_CONTENT_BUTT" - } - const EPGEvent = { - channelId: "[PC Preview] unknow channelId", - eventId: "[PC Preview] unknow eventId", - scramble: "[PC Preview] unknow scramble", - parentLockLevel: "[PC Preview] unknow parentLockLevel", - startTime: "[PC Preview] unknow startTime", - endTime: "[PC Preview] unknow endTime", - duration: "[PC Preview] unknow duration", - eventName: "[PC Preview] unknow eventName", - contentLevel1: "[PC Preview] unknow contentLevel1", - contentLevel2: "[PC Preview] unknow contentLevel2", - contentLevel3: "[PC Preview] unknow contentLevel3", - contentLevel4: "[PC Preview] unknow contentLevel4", - runningStatus: "[PC Preview] unknow runningStatus", - shortDescription: "[PC Preview] unknow shortDescription", - extendedDescription: "[PC Preview] unknow extendedDescription", - booked: "[PC Preview] unknow booked", - cridProgramme: "[PC Preview] unknow cridProgramme", - cridSeries: "[PC Preview] unknow cridSeries", - utcStartTime: "[PC Preview] unknow utcStartTime", - utcEndTime: "[PC Preview] unknow utcEndTime" - } - const NetworkTypes = { - NONE: "[PC Preview] unknow NONE", - CABLE: "[PC Preview] unknow CABLE", - SATELLITE: "[PC Preview] unknow SATELLITE", - TERRESTRIAL: "[PC Preview] unknow TERRESTRIAL", - ISDB_TER: "[PC Preview] unknow ISDB_TER", - ATSC_T: "[PC Preview] unknow ATSC_T", - DTMB: "[PC Preview] unknow DTMB", - J83B: "[PC Preview] unknow J83B", - RF: "[PC Preview] unknow RF", - ATSC_CAB: "[PC Preview] unknow ATSC_CAB", - ISDB_CAB: "[PC Preview] unknow ISDB_CAB" - } - const VersionTypes = { - Version_1: "[PC Preview] unknow Version_1", - Version_2: "[PC Preview] unknow Version_2", - Version_all: "[PC Preview] unknow Version_all" - } - const TunerStatus = { - UNLOCK: "[PC Preview] unknow UNLOCK", - LOCK: "[PC Preview] unknow LOCK", - UNKNOW: "[PC Preview] unknow UNKNOW" - } - const TimeShiftInfo = { - recordTime: "[PC Preview] unknow recordTime", - beginTimeSecond: "[PC Preview] unknow beginTimeSecond", - playTimeSecond: "[PC Preview] unknow playTimeSecond", - TERRESTRIAL: "[PC Preview] unknow TERRESTRIAL" - } - const TrickModes = { - FAST_FORWARD_NORMAL: "[PC Preview] unknow FAST_FORWARD_NORMAL", - FAST_FORWARD_TWO: "[PC Preview] unknow FAST_FORWARD_TWO", - FAST_FORWARD_FOUR: "[PC Preview] unknow FAST_FORWARD_FOUR", - FAST_FORWARD_EIGHT: "[PC Preview] unknow FAST_FORWARD_EIGHT", - FAST_FORWARD_SIXTEEN: "[PC Preview] unknow FAST_FORWARD_SIXTEEN", - FAST_FORWARD_THIRTYTWO: "[PC Preview] unknow FAST_FORWARD_THIRTYTWO", - FAST_FORWARD_SIXTYFOUR: "[PC Preview] unknow FAST_FORWARD_SIXTYFOUR", - FAST_BACKWARD_NORMAL: "[PC Preview] unknow FAST_BACKWARD_NORMAL", - FAST_BACKWARD_TWO: "[PC Preview] unknow FAST_BACKWARD_TWO", - FAST_BACKWARD_FOUR: "[PC Preview] unknow FAST_BACKWARD_FOUR", - FAST_BACKWARD_EIGHT: "[PC Preview] unknow FAST_BACKWARD_EIGHT", - FAST_BACKWARD_SIXTEEN: "[PC Preview] unknow FAST_BACKWARD_SIXTEEN", - FAST_BACKWARD_THIRTYTWO: "[PC Preview] unknow FAST_BACKWARD_THIRTYTWO", - FAST_BACKWARD_SIXTYFOUR: "[PC Preview] unknow FAST_BACKWARD_SIXTYFOUR", - SLOW_FORWARD_TWO: "[PC Preview] unknow SLOW_FORWARD_TWO", - SLOW_FORWARD_FOUR: "[PC Preview] unknow SLOW_FORWARD_FOUR", - SLOW_FORWARD_EIGHT: "[PC Preview] unknow SLOW_FORWARD_EIGHT", - SLOW_FORWARD_SIXTEEN: "[PC Preview] unknow SLOW_FORWARD_SIXTEEN", - SLOW_FORWARD_THIRTYTWO: "[PC Preview] unknow SLOW_FORWARD_THIRTYTWO", - SLOW_BACKWARD_TWO: "[PC Preview] unknow SLOW_BACKWARD_TWO", - SLOW_BACKWARD_FOUR: "[PC Preview] unknow SLOW_BACKWARD_FOUR", - SLOW_BACKWARD_EIGHT: "[PC Preview] unknow SLOW_BACKWARD_EIGHT", - SLOW_BACKWARD_SIXTEEN: "[PC Preview] unknow SLOW_BACKWARD_SIXTEEN", - SLOW_BACKWARD_THIRTYTWO: "[PC Preview] unknow SLOW_BACKWARD_THIRTYTWO", - INVALID_TRICK_MODE: "[PC Preview] unknow INVALID_TRICK_MODE" - } - const PlayStatus = { - STOP: "[PC Preview] unknow STOP", - LIVEPLAY: "[PC Preview] unknow LIVEPLAY", - TIMESHIFTPLAY: "[PC Preview] unknow TIMESHIFTPLAY", - PAUSE: "[PC Preview] unknow PAUSE", - IDLE: "[PC Preview] unknow IDLE", - RELEASEPLAYRESOURCE: "[PC Preview] unknow RELEASEPLAYRESOURCE", - PIPPLAY: "[PC Preview] unknow PIPPLAY", - EWSPLAY: "[PC Preview] unknow EWSPLAY", - INVALID: "[PC Preview] unknow INVALID" - } - const AudioComponent = { - pid: "[PC Preview] unknow pid", - type: "[PC Preview] unknow type", - languageCode: "[PC Preview] unknow languageCode", - audioTextDescription: "[PC Preview] unknow audioTextDescription", - audioDescriptionType: "[PC Preview] unknow audioDescriptionType", - audioTrackMode: "[PC Preview] unknow audioTrackMode", - audioComponentTag: "[PC Preview] unknow audioComponentTag" - } - const AudioTrackModes = { - AUDIO_TRACK_STEREO: "[PC Preview] unknow AUDIO_TRACK_STEREO", - AUDIO_TRACK_DOUBLE_MONO: "[PC Preview] unknow AUDIO_TRACK_DOUBLE_MONO", - AUDIO_TRACK_DOUBLE_LEFT: "[PC Preview] unknow AUDIO_TRACK_DOUBLE_LEFT", - AUDIO_TRACK_DOUBLE_RIGHT: "[PC Preview] unknow AUDIO_TRACK_DOUBLE_RIGHT", - AUDIO_TRACK_EXCHANGE: "[PC Preview] unknow AUDIO_TRACK_EXCHANGE", - AUDIO_TRACK_ONLY_RIGHT: "[PC Preview] unknow AUDIO_TRACK_ONLY_RIGHT", - AUDIO_TRACK_ONLY_LEFT: "[PC Preview] unknow AUDIO_TRACK_ONLY_LEFT", - AUDIO_TRACK_MUTED: "[PC Preview] unknow AUDIO_TRACK_MUTED", - AUDIO_TRACK_BUTT: "[PC Preview] unknow AUDIO_TRACK_BUTT" - } - const StopTypes = { - FREEZE: "[PC Preview] unknow FREEZE", - BLACKSCREEN: "[PC Preview] unknow BLACKSCREEN", - STOP_TYPE_BUTT: "[PC Preview] unknow STOP_TYPE_BUTT" - } - const AudioTypes = { - HI_DESC_AUDIO_UNDEFINED: "[PC Preview] unknow HI_DESC_AUDIO_UNDEFINED", - HI_DESC_AUDIO_VISUAL_IMPAIRED_COMMENTARY: "[PC Preview] unknow HI_DESC_AUDIO_VISUAL_IMPAIRED_COMMENTARY", - HI_DESC_AUDIO_HEARING_IMPAIRED: "[PC Preview] unknow HI_DESC_AUDIO_HEARING_IMPAIRED", - HI_DESC_AUDIO_CLEAN_EFFACTS: "[PC Preview] unknow HI_DESC_AUDIO_CLEAN_EFFACTS" - } - const PlayInfo = { - startVideoPlayStatus: "[PC Preview] unknow startVideoPlayStatus", - startAudioPlayStatus: "[PC Preview] unknow startAudioPlayStatus", - signalStatus: "[PC Preview] unknow signalStatus", - caStatus: "[PC Preview] unknow caStatus", - frontendDataStatus: "[PC Preview] unknow frontendDataStatus" - } - const SubtitleTypes = { - SUBTITLE: "[PC Preview] unknow SUBTITLE", - TELETEXT: "[PC Preview] unknow TELETEXT", - CC: "[PC Preview] unknow CC" - } - const SubtComponentTypes = { - NORMAL: "[PC Preview] unknow NORMAL", - HOH: "[PC Preview] unknow HOH" - } - const TeletextComponent = { - motor: "[PC Preview] unknow motor", - magazingNum: "[PC Preview] unknow magazingNum", - pageNum: "[PC Preview] unknow pageNum" - } - const TTXRegions = { - TTX_REGION_WEST_EUROPE: "[PC Preview] unknow TTX_REGION_WEST_EUROPE", - TTX_REGION_EAST_EUROPE: "[PC Preview] unknow TTX_REGION_EAST_EUROPE", - TTX_REGION_RUSSIAN: "[PC Preview] unknow TTX_REGION_RUSSIAN", - TTX_REGION_ARABIC: "[PC Preview] unknow TTX_REGION_ARABIC", - TTX_REGION_FARSI: "[PC Preview] unknow TTX_REGION_FARSI", - TTX_REGION_BUTT: "[PC Preview] unknow TTX_REGION_BUTT" - } - const Modulations = { - QAM_AUTO: "[PC Preview] unknow QAM_AUTO", - QAM4_NR: "[PC Preview] unknow QAM4_NR", - QAM4: "[PC Preview] unknow QAM4", - QAM16: "[PC Preview] unknow QAM16", - QAM32: "[PC Preview] unknow QAM32", - QAM64: "[PC Preview] unknow QAM64", - QAM128: "[PC Preview] unknow QAM128", - QAM256: "[PC Preview] unknow QAM256", - QAM512: "[PC Preview] unknow QAM512", - QAM640: "[PC Preview] unknow QAM640", - QAM768: "[PC Preview] unknow QAM768", - QAM896: "[PC Preview] unknow QAM896", - QAM1024: "[PC Preview] unknow QAM1024", - QPSK: "[PC Preview] unknow QPSK", - BPSK: "[PC Preview] unknow BPSK", - OQPSK: "[PC Preview] unknow OQPSK", - MODU_8VSB: "[PC Preview] unknow MODU_8VSB", - MODU_16VSB: "[PC Preview] unknow MODU_16VSB" - } - const Status = { - RUNNING: "[PC Preview] unknow RUNNING", - UNSTART: "[PC Preview] unknow UNSTART" - } - const PVRFileInfo = { - fullPath: "[PC Preview] unknow fullPath", - size: "[PC Preview] unknow size", - duration: "[PC Preview] unknow duration", - videoResolution: "[PC Preview] unknow videoResolution", - audioComponents: "[PC Preview] unknow audioComponents", - subtitleComponents: "[PC Preview] unknow subtitleComponents", - isRadio: "[PC Preview] unknow isRadio" - } - const DtvSystems = { - DVB_STANDARD: "[PC Preview] unknow DVB_STANDARD", - ATSC_STANDARD: "[PC Preview] unknow ATSC_STANDARD" - } + const BookTask = { + id: "[PC Preview] unknow id", + channelId: "[PC Preview] unknow channelId", + eventId: "[PC Preview] unknow eventId", + isAdjustByEvent: "[PC Preview] unknow isAdjustByEvent", + name: "[PC Preview] unknow name", + startDate: "[PC Preview] unknow startDate", + duration: "[PC Preview] unknow duration", + type: "[PC Preview] unknow type", + cycle: "[PC Preview] unknow cycle", + isEnabled: "[PC Preview] unknow isEnabled", + lcn: "[PC Preview] unknow lcn", + programName: "[PC Preview] unknow programName", + signalType: "[PC Preview] unknow signalType", + startTime: "[PC Preview] unknow startTime" + } + const FavTags = { + FAV_ALL: "[PC Preview] unknow FAV_ALL", + FAV_1: "[PC Preview] unknow FAV_1", + FAV_2: "[PC Preview] unknow FAV_2", + FAV_3: "[PC Preview] unknow FAV_3", + FAV_4: "[PC Preview] unknow FAV_4", + FAV_5: "[PC Preview] unknow FAV_5", + FAV_6: "[PC Preview] unknow FAV_6", + FAV_7: "[PC Preview] unknow FAV_7", + FAV_8: "[PC Preview] unknow FAV_8", + FAV_9: "[PC Preview] unknow FAV_9", + FAV_10: "[PC Preview] unknow FAV_10", + FAV_11: "[PC Preview] unknow FAV_11", + FAV_12: "[PC Preview] unknow FAV_12", + FAV_13: "[PC Preview] unknow FAV_13", + FAV_14: "[PC Preview] unknow FAV_14", + FAV_15: "[PC Preview] unknow FAV_15", + FAV_16: "[PC Preview] unknow FAV_16" + } + const ChannelTsInfo = { + tsInfoNum: "[PC Preview] unknow tsInfoNum", + networkType: "[PC Preview] unknow networkType", + centerFreqList: "[PC Preview] unknow centerFreqList", + cabDeliveryDescriptor: "[PC Preview] unknow cabDeliveryDescriptor", + terDeliveryDescriptor: "[PC Preview] unknow terDeliveryDescriptor", + satDeliveryDescriptor: "[PC Preview] unknow satDeliveryDescriptor" + } + const ChannelFilter = { + siElement: "[PC Preview] unknow siElement", + tvRadio: "[PC Preview] unknow tvRadio", + favGroupTypes: "[PC Preview] unknow favGroupTypes", + scrambleType: "[PC Preview] unknow scrambleType", + editTags: "[PC Preview] unknow editTags", + letters: "[PC Preview] unknow letters", + mbServiceNameFilter: "[PC Preview] unknow mbServiceNameFilter" + } + const TVRadioFilters = { + ALL: "[PC Preview] unknow ALL", + TV: "[PC Preview] unknow TV", + RADIO: "[PC Preview] unknow RADIO", + DATA: "[PC Preview] unknow DATA", + BUTT: "[PC Preview] unknow BUTT" + } + const ChannelRegion = { + name: "[PC Preview] unknow name", + countryCode: "[PC Preview] unknow countryCode", + regionDepth: "[PC Preview] unknow regionDepth", + prc: "[PC Preview] unknow prc", + src: "[PC Preview] unknow src", + trc: "[PC Preview] unknow trc" + } + const ChannelRate = { + enUstvAll: "[PC Preview] unknow enUstvAll", + enUstvFv: "[PC Preview] unknow enUstvFv", + enUstvV: "[PC Preview] unknow enUstvV", + enUstvS: "[PC Preview] unknow enUstvS", + enUstvL: "[PC Preview] unknow enUstvL", + enUstvD: "[PC Preview] unknow enUstvD", + enMpaa: "[PC Preview] unknow enMpaa", + enCaen: "[PC Preview] unknow enCaen", + enCafr: "[PC Preview] unknow enCafr" + } + const ParentalContents = { + PARENTAL_CONTENT_NONE: "[PC Preview] unknow PARENTAL_CONTENT_NONE", + PARENTAL_CONTENT_DRUGS: "[PC Preview] unknow PARENTAL_CONTENT_DRUGS", + PARENTAL_CONTENT_VIOLENCE: "[PC Preview] unknow PARENTAL_CONTENT_VIOLENCE", + PARENTAL_CONTENT_VIOL_DRUG: "[PC Preview] unknow PARENTAL_CONTENT_VIOL_DRUG", + PARENTAL_CONTENT_SEX: "[PC Preview] unknow PARENTAL_CONTENT_SEX", + PARENTAL_CONTENT_SEX_DRUG: "[PC Preview] unknow PARENTAL_CONTENT_SEX_DRUG", + PARENTAL_CONTENT_SEX_VIOL: "[PC Preview] unknow PARENTAL_CONTENT_SEX_VIOL", + PARENTAL_CONTENT_SEX_VIOL_DRUG: "[PC Preview] unknow PARENTAL_CONTENT_SEX_VIOL_DRUG", + PARENTAL_CONTENT_BUTT: "[PC Preview] unknow PARENTAL_CONTENT_BUTT" + } + const EPGEvent = { + channelId: "[PC Preview] unknow channelId", + eventId: "[PC Preview] unknow eventId", + scramble: "[PC Preview] unknow scramble", + parentLockLevel: "[PC Preview] unknow parentLockLevel", + startTime: "[PC Preview] unknow startTime", + endTime: "[PC Preview] unknow endTime", + duration: "[PC Preview] unknow duration", + eventName: "[PC Preview] unknow eventName", + contentLevel1: "[PC Preview] unknow contentLevel1", + contentLevel2: "[PC Preview] unknow contentLevel2", + contentLevel3: "[PC Preview] unknow contentLevel3", + contentLevel4: "[PC Preview] unknow contentLevel4", + runningStatus: "[PC Preview] unknow runningStatus", + shortDescription: "[PC Preview] unknow shortDescription", + extendedDescription: "[PC Preview] unknow extendedDescription", + booked: "[PC Preview] unknow booked", + cridProgramme: "[PC Preview] unknow cridProgramme", + cridSeries: "[PC Preview] unknow cridSeries", + utcStartTime: "[PC Preview] unknow utcStartTime", + utcEndTime: "[PC Preview] unknow utcEndTime" + } + const NetworkTypes = { + NONE: "[PC Preview] unknow NONE", + CABLE: "[PC Preview] unknow CABLE", + SATELLITE: "[PC Preview] unknow SATELLITE", + TERRESTRIAL: "[PC Preview] unknow TERRESTRIAL", + ISDB_TER: "[PC Preview] unknow ISDB_TER", + ATSC_T: "[PC Preview] unknow ATSC_T", + DTMB: "[PC Preview] unknow DTMB", + J83B: "[PC Preview] unknow J83B", + RF: "[PC Preview] unknow RF", + ATSC_CAB: "[PC Preview] unknow ATSC_CAB", + ISDB_CAB: "[PC Preview] unknow ISDB_CAB" + } + const VersionTypes = { + Version_1: "[PC Preview] unknow Version_1", + Version_2: "[PC Preview] unknow Version_2", + Version_all: "[PC Preview] unknow Version_all" + } + const TunerStatus = { + UNLOCK: "[PC Preview] unknow UNLOCK", + LOCK: "[PC Preview] unknow LOCK", + UNKNOW: "[PC Preview] unknow UNKNOW" + } + const TimeShiftInfo = { + recordTime: "[PC Preview] unknow recordTime", + beginTimeSecond: "[PC Preview] unknow beginTimeSecond", + playTimeSecond: "[PC Preview] unknow playTimeSecond", + TERRESTRIAL: "[PC Preview] unknow TERRESTRIAL" + } + const TrickModes = { + FAST_FORWARD_NORMAL: "[PC Preview] unknow FAST_FORWARD_NORMAL", + FAST_FORWARD_TWO: "[PC Preview] unknow FAST_FORWARD_TWO", + FAST_FORWARD_FOUR: "[PC Preview] unknow FAST_FORWARD_FOUR", + FAST_FORWARD_EIGHT: "[PC Preview] unknow FAST_FORWARD_EIGHT", + FAST_FORWARD_SIXTEEN: "[PC Preview] unknow FAST_FORWARD_SIXTEEN", + FAST_FORWARD_THIRTYTWO: "[PC Preview] unknow FAST_FORWARD_THIRTYTWO", + FAST_FORWARD_SIXTYFOUR: "[PC Preview] unknow FAST_FORWARD_SIXTYFOUR", + FAST_BACKWARD_NORMAL: "[PC Preview] unknow FAST_BACKWARD_NORMAL", + FAST_BACKWARD_TWO: "[PC Preview] unknow FAST_BACKWARD_TWO", + FAST_BACKWARD_FOUR: "[PC Preview] unknow FAST_BACKWARD_FOUR", + FAST_BACKWARD_EIGHT: "[PC Preview] unknow FAST_BACKWARD_EIGHT", + FAST_BACKWARD_SIXTEEN: "[PC Preview] unknow FAST_BACKWARD_SIXTEEN", + FAST_BACKWARD_THIRTYTWO: "[PC Preview] unknow FAST_BACKWARD_THIRTYTWO", + FAST_BACKWARD_SIXTYFOUR: "[PC Preview] unknow FAST_BACKWARD_SIXTYFOUR", + SLOW_FORWARD_TWO: "[PC Preview] unknow SLOW_FORWARD_TWO", + SLOW_FORWARD_FOUR: "[PC Preview] unknow SLOW_FORWARD_FOUR", + SLOW_FORWARD_EIGHT: "[PC Preview] unknow SLOW_FORWARD_EIGHT", + SLOW_FORWARD_SIXTEEN: "[PC Preview] unknow SLOW_FORWARD_SIXTEEN", + SLOW_FORWARD_THIRTYTWO: "[PC Preview] unknow SLOW_FORWARD_THIRTYTWO", + SLOW_BACKWARD_TWO: "[PC Preview] unknow SLOW_BACKWARD_TWO", + SLOW_BACKWARD_FOUR: "[PC Preview] unknow SLOW_BACKWARD_FOUR", + SLOW_BACKWARD_EIGHT: "[PC Preview] unknow SLOW_BACKWARD_EIGHT", + SLOW_BACKWARD_SIXTEEN: "[PC Preview] unknow SLOW_BACKWARD_SIXTEEN", + SLOW_BACKWARD_THIRTYTWO: "[PC Preview] unknow SLOW_BACKWARD_THIRTYTWO", + INVALID_TRICK_MODE: "[PC Preview] unknow INVALID_TRICK_MODE" + } + const PlayStatus = { + STOP: "[PC Preview] unknow STOP", + LIVEPLAY: "[PC Preview] unknow LIVEPLAY", + TIMESHIFTPLAY: "[PC Preview] unknow TIMESHIFTPLAY", + PAUSE: "[PC Preview] unknow PAUSE", + IDLE: "[PC Preview] unknow IDLE", + RELEASEPLAYRESOURCE: "[PC Preview] unknow RELEASEPLAYRESOURCE", + PIPPLAY: "[PC Preview] unknow PIPPLAY", + EWSPLAY: "[PC Preview] unknow EWSPLAY", + INVALID: "[PC Preview] unknow INVALID" + } + const AudioComponent = { + pid: "[PC Preview] unknow pid", + type: "[PC Preview] unknow type", + languageCode: "[PC Preview] unknow languageCode", + audioTextDescription: "[PC Preview] unknow audioTextDescription", + audioDescriptionType: "[PC Preview] unknow audioDescriptionType", + audioTrackMode: "[PC Preview] unknow audioTrackMode", + audioComponentTag: "[PC Preview] unknow audioComponentTag" + } + const AudioTrackModes = { + AUDIO_TRACK_STEREO: "[PC Preview] unknow AUDIO_TRACK_STEREO", + AUDIO_TRACK_DOUBLE_MONO: "[PC Preview] unknow AUDIO_TRACK_DOUBLE_MONO", + AUDIO_TRACK_DOUBLE_LEFT: "[PC Preview] unknow AUDIO_TRACK_DOUBLE_LEFT", + AUDIO_TRACK_DOUBLE_RIGHT: "[PC Preview] unknow AUDIO_TRACK_DOUBLE_RIGHT", + AUDIO_TRACK_EXCHANGE: "[PC Preview] unknow AUDIO_TRACK_EXCHANGE", + AUDIO_TRACK_ONLY_RIGHT: "[PC Preview] unknow AUDIO_TRACK_ONLY_RIGHT", + AUDIO_TRACK_ONLY_LEFT: "[PC Preview] unknow AUDIO_TRACK_ONLY_LEFT", + AUDIO_TRACK_MUTED: "[PC Preview] unknow AUDIO_TRACK_MUTED", + AUDIO_TRACK_BUTT: "[PC Preview] unknow AUDIO_TRACK_BUTT" + } + const StopTypes = { + FREEZE: "[PC Preview] unknow FREEZE", + BLACKSCREEN: "[PC Preview] unknow BLACKSCREEN", + STOP_TYPE_BUTT: "[PC Preview] unknow STOP_TYPE_BUTT" + } + const AudioTypes = { + HI_DESC_AUDIO_UNDEFINED: "[PC Preview] unknow HI_DESC_AUDIO_UNDEFINED", + HI_DESC_AUDIO_VISUAL_IMPAIRED_COMMENTARY: "[PC Preview] unknow HI_DESC_AUDIO_VISUAL_IMPAIRED_COMMENTARY", + HI_DESC_AUDIO_HEARING_IMPAIRED: "[PC Preview] unknow HI_DESC_AUDIO_HEARING_IMPAIRED", + HI_DESC_AUDIO_CLEAN_EFFACTS: "[PC Preview] unknow HI_DESC_AUDIO_CLEAN_EFFACTS" + } + const PlayInfo = { + startVideoPlayStatus: "[PC Preview] unknow startVideoPlayStatus", + startAudioPlayStatus: "[PC Preview] unknow startAudioPlayStatus", + signalStatus: "[PC Preview] unknow signalStatus", + caStatus: "[PC Preview] unknow caStatus", + frontendDataStatus: "[PC Preview] unknow frontendDataStatus" + } + const SubtitleTypes = { + SUBTITLE: "[PC Preview] unknow SUBTITLE", + TELETEXT: "[PC Preview] unknow TELETEXT", + CC: "[PC Preview] unknow CC" + } + const SubtComponentTypes = { + NORMAL: "[PC Preview] unknow NORMAL", + HOH: "[PC Preview] unknow HOH" + } + const TeletextComponent = { + motor: "[PC Preview] unknow motor", + magazingNum: "[PC Preview] unknow magazingNum", + pageNum: "[PC Preview] unknow pageNum" + } + const TTXRegions = { + TTX_REGION_WEST_EUROPE: "[PC Preview] unknow TTX_REGION_WEST_EUROPE", + TTX_REGION_EAST_EUROPE: "[PC Preview] unknow TTX_REGION_EAST_EUROPE", + TTX_REGION_RUSSIAN: "[PC Preview] unknow TTX_REGION_RUSSIAN", + TTX_REGION_ARABIC: "[PC Preview] unknow TTX_REGION_ARABIC", + TTX_REGION_FARSI: "[PC Preview] unknow TTX_REGION_FARSI", + TTX_REGION_BUTT: "[PC Preview] unknow TTX_REGION_BUTT" + } + const Modulations = { + QAM_AUTO: "[PC Preview] unknow QAM_AUTO", + QAM4_NR: "[PC Preview] unknow QAM4_NR", + QAM4: "[PC Preview] unknow QAM4", + QAM16: "[PC Preview] unknow QAM16", + QAM32: "[PC Preview] unknow QAM32", + QAM64: "[PC Preview] unknow QAM64", + QAM128: "[PC Preview] unknow QAM128", + QAM256: "[PC Preview] unknow QAM256", + QAM512: "[PC Preview] unknow QAM512", + QAM640: "[PC Preview] unknow QAM640", + QAM768: "[PC Preview] unknow QAM768", + QAM896: "[PC Preview] unknow QAM896", + QAM1024: "[PC Preview] unknow QAM1024", + QPSK: "[PC Preview] unknow QPSK", + BPSK: "[PC Preview] unknow BPSK", + OQPSK: "[PC Preview] unknow OQPSK", + MODU_8VSB: "[PC Preview] unknow MODU_8VSB", + MODU_16VSB: "[PC Preview] unknow MODU_16VSB" + } + const Status = { + RUNNING: "[PC Preview] unknow RUNNING", + UNSTART: "[PC Preview] unknow UNSTART" + } + const PVRFileInfo = { + fullPath: "[PC Preview] unknow fullPath", + size: "[PC Preview] unknow size", + duration: "[PC Preview] unknow duration", + videoResolution: "[PC Preview] unknow videoResolution", + audioComponents: "[PC Preview] unknow audioComponents", + subtitleComponents: "[PC Preview] unknow subtitleComponents", + isRadio: "[PC Preview] unknow isRadio" + } + const DtvSystems = { + DVB_STANDARD: "[PC Preview] unknow DVB_STANDARD", + ATSC_STANDARD: "[PC Preview] unknow ATSC_STANDARD" + } - const ClosedCaptionList = { - listName: "[PC Preview] unknow listName", - ccList: "[PC Preview] unknow ccList", - listType: "[PC Preview] unknow listType", - currentPosition: "[PC Preview] unknow currentPosition" - } - const ClosedCaptionComponent = { - languageCode: "[PC Preview] unknow languageCode", - enCCType: "[PC Preview] unknow enCCType", - dataType: "[PC Preview] unknow dataType", - currentPosition: "[PC Preview] unknow currentPosition" - } - const CCAnalogSelectors = { - CC1: "[PC Preview] unknow CC1", - CC2: "[PC Preview] unknow CC2", - CC3: "[PC Preview] unknow CC3", - CC4: "[PC Preview] unknow CC4", - TEXT1: "[PC Preview] unknow TEXT1", - TEXT2: "[PC Preview] unknow TEXT2", - TEXT3: "[PC Preview] unknow TEXT3", - TEXT4: "[PC Preview] unknow TEXT4" - } - const CCDigitalSelectors = { - OFF: "[PC Preview] unknow OFF", - SERVICE1: "[PC Preview] unknow SERVICE1", - SERVICE2: "[PC Preview] unknow SERVICE2", - SERVICE3: "[PC Preview] unknow SERVICE3", - SERVICE4: "[PC Preview] unknow SERVICE4", - SERVICE5: "[PC Preview] unknow SERVICE5", - SERVICE6: "[PC Preview] unknow SERVICE6" - } - const FontSizes = { - DEFAULT: "[PC Preview] unknow DEFAULT", - SMALL: "[PC Preview] unknow SMALL", - NORMAL: "[PC Preview] unknow NORMAL", - LARGE: "[PC Preview] unknow LARGE" - } - const FontStyles = { - DEFAULT: "[PC Preview] unknow DEFAULT", - STYLE0: "[PC Preview] unknow STYLE0", - STYLE1: "[PC Preview] unknow STYLE1", - STYLE2: "[PC Preview] unknow STYLE2", - STYLE3: "[PC Preview] unknow STYLE3", - STYLE4: "[PC Preview] unknow STYLE4", - STYLE5: "[PC Preview] unknow STYLE5", - STYLE6: "[PC Preview] unknow STYLE6", - STYLE7: "[PC Preview] unknow STYLE7" - } - const Colors = { - DEFAULT: "[PC Preview] unknow DEFAULT", - BLACK: "[PC Preview] unknow BLACK", - RED: "[PC Preview] unknow RED", - GREEN: "[PC Preview] unknow GREEN", - BLUE: "[PC Preview] unknow BLUE", - YELLOW: "[PC Preview] unknow YELLOW", - MAGENTA: "[PC Preview] unknow MAGENTA", - STYLE6: "[PC Preview] unknow STYLE6", - CYAN: "[PC Preview] unknow CYAN" - } - const Opacities = { - DEFAULT: "[PC Preview] unknow DEFAULT", - SOLID: "[PC Preview] unknow SOLID", - FLASHING: "[PC Preview] unknow FLASHING", - TRANSLUCENT: "[PC Preview] unknow TRANSLUCENT", - TRANSPARENT: "[PC Preview] unknow TRANSPARENT" - } - const FontEdgeEffects = { - DEFAULT: "[PC Preview] unknow DEFAULT", - NONE: "[PC Preview] unknow NONE", - RAISED: "[PC Preview] unknow RAISED", - DEPRESSED: "[PC Preview] unknow DEPRESSED", - UNIFORM: "[PC Preview] unknow UNIFORM", - LETF_DROP_SHADOW: "[PC Preview] unknow LETF_DROP_SHADOW", - RIGHT_DROP_SHADOW: "[PC Preview] unknow RIGHT_DROP_SHADOW" - } + const ClosedCaptionList = { + listName: "[PC Preview] unknow listName", + ccList: "[PC Preview] unknow ccList", + listType: "[PC Preview] unknow listType", + currentPosition: "[PC Preview] unknow currentPosition" + } + const ClosedCaptionComponent = { + languageCode: "[PC Preview] unknow languageCode", + enCCType: "[PC Preview] unknow enCCType", + dataType: "[PC Preview] unknow dataType", + currentPosition: "[PC Preview] unknow currentPosition" + } + const CCAnalogSelectors = { + CC1: "[PC Preview] unknow CC1", + CC2: "[PC Preview] unknow CC2", + CC3: "[PC Preview] unknow CC3", + CC4: "[PC Preview] unknow CC4", + TEXT1: "[PC Preview] unknow TEXT1", + TEXT2: "[PC Preview] unknow TEXT2", + TEXT3: "[PC Preview] unknow TEXT3", + TEXT4: "[PC Preview] unknow TEXT4" + } + const CCDigitalSelectors = { + OFF: "[PC Preview] unknow OFF", + SERVICE1: "[PC Preview] unknow SERVICE1", + SERVICE2: "[PC Preview] unknow SERVICE2", + SERVICE3: "[PC Preview] unknow SERVICE3", + SERVICE4: "[PC Preview] unknow SERVICE4", + SERVICE5: "[PC Preview] unknow SERVICE5", + SERVICE6: "[PC Preview] unknow SERVICE6" + } + const FontSizes = { + DEFAULT: "[PC Preview] unknow DEFAULT", + SMALL: "[PC Preview] unknow SMALL", + NORMAL: "[PC Preview] unknow NORMAL", + LARGE: "[PC Preview] unknow LARGE" + } + const FontStyles = { + DEFAULT: "[PC Preview] unknow DEFAULT", + STYLE0: "[PC Preview] unknow STYLE0", + STYLE1: "[PC Preview] unknow STYLE1", + STYLE2: "[PC Preview] unknow STYLE2", + STYLE3: "[PC Preview] unknow STYLE3", + STYLE4: "[PC Preview] unknow STYLE4", + STYLE5: "[PC Preview] unknow STYLE5", + STYLE6: "[PC Preview] unknow STYLE6", + STYLE7: "[PC Preview] unknow STYLE7" + } + const Colors = { + DEFAULT: "[PC Preview] unknow DEFAULT", + BLACK: "[PC Preview] unknow BLACK", + RED: "[PC Preview] unknow RED", + GREEN: "[PC Preview] unknow GREEN", + BLUE: "[PC Preview] unknow BLUE", + YELLOW: "[PC Preview] unknow YELLOW", + MAGENTA: "[PC Preview] unknow MAGENTA", + STYLE6: "[PC Preview] unknow STYLE6", + CYAN: "[PC Preview] unknow CYAN" + } + const Opacities = { + DEFAULT: "[PC Preview] unknow DEFAULT", + SOLID: "[PC Preview] unknow SOLID", + FLASHING: "[PC Preview] unknow FLASHING", + TRANSLUCENT: "[PC Preview] unknow TRANSLUCENT", + TRANSPARENT: "[PC Preview] unknow TRANSPARENT" + } + const FontEdgeEffects = { + DEFAULT: "[PC Preview] unknow DEFAULT", + NONE: "[PC Preview] unknow NONE", + RAISED: "[PC Preview] unknow RAISED", + DEPRESSED: "[PC Preview] unknow DEPRESSED", + UNIFORM: "[PC Preview] unknow UNIFORM", + LETF_DROP_SHADOW: "[PC Preview] unknow LETF_DROP_SHADOW", + RIGHT_DROP_SHADOW: "[PC Preview] unknow RIGHT_DROP_SHADOW" + } - const result = { - getBookManager: function () { - console.warn("dtv.getBookManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return BookManager; - }, - getChannelManager: function () { - console.warn("dtv.getChannelManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return ChannelManager; - }, - getAtvChannelManager: function () { - console.warn("dtv.getAtvChannelManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return AtvChannelManager; - }, - getParentalControlManager: function () { - console.warn("dtv.getParentalControlManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return ParentalControlManager; - }, - getConfigManager: function () { - console.warn("dtv.getConfigManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return DTVConfigManager; - }, - getEPGManager: function () { - console.warn("dtv.getEPGManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return EPGManager; - }, - getOTAManager: function () { - console.warn("dtv.getOTAManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return OTAManager; - }, - getHardwareManager: function () { - console.warn("dtv.getHardwareManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return HardwareManager; - }, - getNetworkManager: function () { - console.warn("dtv.getNetworkManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return NetworkManager; - }, - getPlayerManager: function () { - console.warn("dtv.getPlayerManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return PlayerManager; - }, - getRecorderManager: function () { - console.warn("dtv.getRecorderManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return RecorderManager; - }, - getPVRFilePlayer: function () { - console.warn("dtv.getPVRFilePlayer interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return PVRFilePlayer; - }, - getPVRFileManager: function () { - console.warn("dtv.getPVRFileManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return PVRFileManager; - }, - getDTVManager: function () { - console.warn("dtv.getDTVManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return DTVManager; - }, - getClosedCaptionManager: function () { - console.warn("dtv.getClosedCaptionManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return ClosedCaptionManager; - }, - getDtvEventManager: function () { - console.warn("dtv.getDtvEventManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return DtvEventManager; - } + const result = { + getBookManager: function () { + console.warn("dtv.getBookManager interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return BookManager; + }, + getChannelManager: function () { + console.warn("dtv.getChannelManager interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return ChannelManager; + }, + getAtvChannelManager: function () { + console.warn("dtv.getAtvChannelManager interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return AtvChannelManager; + }, + getParentalControlManager: function () { + console.warn("dtv.getParentalControlManager interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return ParentalControlManager; + }, + getConfigManager: function () { + console.warn("dtv.getConfigManager interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return DTVConfigManager; + }, + getEPGManager: function () { + console.warn("dtv.getEPGManager interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return EPGManager; + }, + getOTAManager: function () { + console.warn("dtv.getOTAManager interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return OTAManager; + }, + getHardwareManager: function () { + console.warn("dtv.getHardwareManager interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return HardwareManager; + }, + getNetworkManager: function () { + console.warn("dtv.getNetworkManager interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return NetworkManager; + }, + getPlayerManager: function () { + console.warn("dtv.getPlayerManager interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return PlayerManager; + }, + getRecorderManager: function () { + console.warn("dtv.getRecorderManager interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return RecorderManager; + }, + getPVRFilePlayer: function () { + console.warn("dtv.getPVRFilePlayer interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return PVRFilePlayer; + }, + getPVRFileManager: function () { + console.warn("dtv.getPVRFileManager interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return PVRFileManager; + }, + getDTVManager: function () { + console.warn("dtv.getDTVManager interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return DTVManager; + }, + getClosedCaptionManager: function () { + console.warn("dtv.getClosedCaptionManager interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return ClosedCaptionManager; + }, + getDtvEventManager: function () { + console.warn("dtv.getDtvEventManager interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return DtvEventManager; } + } - const BookManager = { - addTask: function (...args) { - console.warn("BookManager.addTask interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - clearAllTasks: function (...args) { - console.warn("BookManager.clearAllTasks interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - createTask: function (...args) { - console.warn("BookManager.createTask interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, BookTask); - } else { - return new Promise((resolve, reject) => { - resolve(BookTask); - }) - } - }, - deleteTask: function (...args) { - console.warn("BookManager.deleteTask interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - updateTask: function (...args) { - console.warn("BookManager.updateTask interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - findConflictTasks: function (...args) { - console.warn("BookManager.findConflictTasks interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var bookTaskArray = new Array(); - bookTaskArray.push(BookTask); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, bookTaskArray); - } else { - return new Promise((resolve, reject) => { - resolve(bookTaskArray); - }) - } - }, - getTaskByID: function (...args) { - console.warn("BookManager.getTaskByID interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var bookTaskArray = new Array(); - bookTaskArray.push(BookTask); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, BookTask); - } else { - return new Promise((resolve, reject) => { - resolve(BookTask); - }) - } - }, - getAllTasks: function (...args) { - console.warn("BookManager.getAllTasks interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var bookTaskArray = new Array(); - bookTaskArray.push(BookTask); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, bookTaskArray); - } else { - return new Promise((resolve, reject) => { - resolve(bookTaskArray); - }) - } - }, - getComingTask: function (...args) { - console.warn("BookManager.getComingTask interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, BookTask); - } else { - return new Promise((resolve, reject) => { - resolve(BookTask); - }) - } - } + const BookManager = { + addTask: function (...args) { + console.warn("BookManager.addTask interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + clearAllTasks: function (...args) { + console.warn("BookManager.clearAllTasks interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + createTask: function (...args) { + console.warn("BookManager.createTask interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, BookTask); + } else { + return new Promise((resolve, reject) => { + resolve(BookTask); + }) + } + }, + deleteTask: function (...args) { + console.warn("BookManager.deleteTask interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + updateTask: function (...args) { + console.warn("BookManager.updateTask interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + findConflictTasks: function (...args) { + console.warn("BookManager.findConflictTasks interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var bookTaskArray = new Array(); + bookTaskArray.push(BookTask); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, bookTaskArray); + } else { + return new Promise((resolve, reject) => { + resolve(bookTaskArray); + }) + } + }, + getTaskByID: function (...args) { + console.warn("BookManager.getTaskByID interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var bookTaskArray = new Array(); + bookTaskArray.push(BookTask); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, BookTask); + } else { + return new Promise((resolve, reject) => { + resolve(BookTask); + }) + } + }, + getAllTasks: function (...args) { + console.warn("BookManager.getAllTasks interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var bookTaskArray = new Array(); + bookTaskArray.push(BookTask); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, bookTaskArray); + } else { + return new Promise((resolve, reject) => { + resolve(bookTaskArray); + }) + } + }, + getComingTask: function (...args) { + console.warn("BookManager.getComingTask interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, BookTask); + } else { + return new Promise((resolve, reject) => { + resolve(BookTask); + }) + } } - const Channel = { - getChannelName: function (...args) { - console.warn("Channel.getChannelName interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getFavTag: function (...args) { - console.warn("Channel.getFavTag interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var favTagArray = new Array(); - favTagArray.push(FavTags); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, favTagArray); - } else { - return new Promise((resolve, reject) => { - resolve(favTagArray); - }) - } - }, - getCaTag: function (...args) { - console.warn("Channel.getCaTag interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTag: function (...args) { - console.warn("Channel.getTag interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getVolume: function (...args) { - console.warn("Channel.getVolume interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTrackMode: function (...args) { - console.warn("Channel.getTrackMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, AudioTrackModes); - } else { - return new Promise((resolve, reject) => { - resolve(AudioTrackModes); - }) - } - }, - setChannelName: function (...args) { - console.warn("Channel.setChannelName interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setFavTag: function (...args) { - console.warn("Channel.setFavTag interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setTag: function (...args) { - console.warn("Channel.setTag interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setVolume: function (...args) { - console.warn("Channel.setVolume interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setTrackMode: function (...args) { - console.warn("Channel.setTrackMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getRunningStatus: function (...args) { - console.warn("Channel.getRunningStatus interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getStatusTag: function (...args) { - console.warn("Channel.getStatusTag interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setStatusTag: function (...args) { - console.warn("Channel.setStatusTag interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setSortTag: function (...args) { - console.warn("Channel.setSortTag interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSortTag: function (...args) { - console.warn("Channel.getSortTag interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getChannelID: function (...args) { - console.warn("Channel.getChannelID interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getChannelNo: function (...args) { - console.warn("Channel.getChannelNo interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getNetWorkName: function (...args) { - console.warn("Channel.getNetWorkName interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - } + } + const Channel = { + getChannelName: function (...args) { + console.warn("Channel.getChannelName interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } + }, + getFavTag: function (...args) { + console.warn("Channel.getFavTag interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var favTagArray = new Array(); + favTagArray.push(FavTags); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, favTagArray); + } else { + return new Promise((resolve, reject) => { + resolve(favTagArray); + }) + } + }, + getCaTag: function (...args) { + console.warn("Channel.getCaTag interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getTag: function (...args) { + console.warn("Channel.getTag interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + getVolume: function (...args) { + console.warn("Channel.getVolume interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getTrackMode: function (...args) { + console.warn("Channel.getTrackMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, AudioTrackModes); + } else { + return new Promise((resolve, reject) => { + resolve(AudioTrackModes); + }) + } + }, + setChannelName: function (...args) { + console.warn("Channel.setChannelName interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + setFavTag: function (...args) { + console.warn("Channel.setFavTag interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setTag: function (...args) { + console.warn("Channel.setTag interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setVolume: function (...args) { + console.warn("Channel.setVolume interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setTrackMode: function (...args) { + console.warn("Channel.setTrackMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getRunningStatus: function (...args) { + console.warn("Channel.getRunningStatus interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getStatusTag: function (...args) { + console.warn("Channel.getStatusTag interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setStatusTag: function (...args) { + console.warn("Channel.setStatusTag interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setSortTag: function (...args) { + console.warn("Channel.setSortTag interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getSortTag: function (...args) { + console.warn("Channel.getSortTag interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getChannelID: function (...args) { + console.warn("Channel.getChannelID interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getChannelNo: function (...args) { + console.warn("Channel.getChannelNo interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getNetWorkName: function (...args) { + console.warn("Channel.getNetWorkName interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } } - const ChannelList = { - setFilter: function (...args) { - console.warn("ChannelList.setFilter interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getFilter: function (...args) { - console.warn("ChannelList.getFilter interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ChannelFilter); - } else { - return new Promise((resolve, reject) => { - resolve(ChannelFilter); - }) - } - }, - getChannelCount: function (...args) { - console.warn("ChannelList.getChannelCount interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getChannels: function (...args) { - console.warn("ChannelList.getChannels interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var channelArray = new Array(); - channelArray.push(Channel); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, channelArray); - } else { - return new Promise((resolve, reject) => { - resolve(channelArray); - }) - } - }, - getChannelByIndex: function (...args) { - console.warn("ChannelList.getChannelByIndex interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Channel); - } else { - return new Promise((resolve, reject) => { - resolve(Channel); - }) - } - }, - setListName: function (...args) { - console.warn("ChannelList.setListName interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getListName: function (...args) { - console.warn("ChannelList.getListName interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - move: function (...args) { - console.warn("ChannelList.move interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - swap: function (...args) { - console.warn("ChannelList.swap interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getPosByChannelID: function (...args) { - console.warn("ChannelList.getPosByChannelID interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getPosByChannelLcn: function (...args) { - console.warn("ChannelList.getPosByChannelLcn interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getGroupType: function (...args) { - console.warn("ChannelList.getGroupType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setChannelNameLang: function (...args) { - console.warn("ChannelList.setChannelNameLang interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } + } + const ChannelList = { + setFilter: function (...args) { + console.warn("ChannelList.setFilter interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + getFilter: function (...args) { + console.warn("ChannelList.getFilter interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ChannelFilter); + } else { + return new Promise((resolve, reject) => { + resolve(ChannelFilter); + }) + } + }, + getChannelCount: function (...args) { + console.warn("ChannelList.getChannelCount interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getChannels: function (...args) { + console.warn("ChannelList.getChannels interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var channelArray = new Array(); + channelArray.push(Channel); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, channelArray); + } else { + return new Promise((resolve, reject) => { + resolve(channelArray); + }) + } + }, + getChannelByIndex: function (...args) { + console.warn("ChannelList.getChannelByIndex interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Channel); + } else { + return new Promise((resolve, reject) => { + resolve(Channel); + }) + } + }, + setListName: function (...args) { + console.warn("ChannelList.setListName interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getListName: function (...args) { + console.warn("ChannelList.getListName interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } + }, + move: function (...args) { + console.warn("ChannelList.move interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + swap: function (...args) { + console.warn("ChannelList.swap interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getPosByChannelID: function (...args) { + console.warn("ChannelList.getPosByChannelID interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getPosByChannelLcn: function (...args) { + console.warn("ChannelList.getPosByChannelLcn interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getGroupType: function (...args) { + console.warn("ChannelList.getGroupType interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setChannelNameLang: function (...args) { + console.warn("ChannelList.setChannelNameLang interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } } - const ChannelManager = { - getChannelByNo: function (...args) { - console.warn("ChannelManager.getChannelByNo interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Channel); - } else { - return new Promise((resolve, reject) => { - resolve(Channel); - }) - } - }, - getChannelById: function (...args) { - console.warn("ChannelManager.getChannelById interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Channel); - } else { - return new Promise((resolve, reject) => { - resolve(Channel); - }) - } - }, - getTsInfoByID: function (...args) { - console.warn("ChannelManager.getTsInfoByID interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ChannelTsInfo); - } else { - return new Promise((resolve, reject) => { - resolve(ChannelTsInfo); - }) - } - }, - importDBFromIniFile: function (...args) { - console.warn("ChannelManager.importDBFromIniFile interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - exportDBToFile: function (...args) { - console.warn("ChannelManager.exportDBToFile interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - importDBFromFile: function (...args) { - console.warn("ChannelManager.importDBFromFile interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - deleteAll: function (...args) { - console.warn("ChannelManager.deleteAll interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - deleteChannelByID: function (...args) { - console.warn("ChannelManager.deleteChannelByID interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - restoreChannelByID: function (...args) { - console.warn("ChannelManager.restoreChannelByID interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - delChannelByTag: function (...args) { - console.warn("ChannelManager.delChannelByTag interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - deleteChannelsByNetworkType: function (...args) { - console.warn("ChannelManager.deleteChannelsByNetworkType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - deleteChannelsBySIElement: function (...args) { - console.warn("ChannelManager.deleteChannelsBySIElement interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - save: function (...args) { - console.warn("ChannelManager.save interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - recover: function (...args) { - console.warn("ChannelManager.recover interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - createChannel: function (...args) { - console.warn("ChannelManager.createChannel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Channel); - } else { - return new Promise((resolve, reject) => { - resolve(Channel); - }) - } - }, - getChannelList: function (...args) { - console.warn("ChannelManager.getChannelList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ChannelList); - } else { - return new Promise((resolve, reject) => { - resolve(ChannelList); - }) - } - }, - sort: function (...args) { - console.warn("ChannelManager.sort interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - sortProgramView: function (...args) { - console.warn("ChannelManager.sortProgramView interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setDefaultOpenChannel: function (...args) { - console.warn("ChannelManager.setDefaultOpenChannel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setChannelServiceTypeMode: function (...args) { - console.warn("ChannelManager.setChannelServiceTypeMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - rebuildAllGroup: function (...args) { - console.warn("ChannelManager.rebuildAllGroup interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getChannelServiceTypeMode: function (...args) { - console.warn("ChannelManager.getChannelServiceTypeMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, TVRadioFilters); - } else { - return new Promise((resolve, reject) => { - resolve(TVRadioFilters); - }) - } - }, - getChannelListByGroupType: function (...args) { - console.warn("ChannelManager.getChannelListByGroupType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ChannelList); - } else { - return new Promise((resolve, reject) => { - resolve(ChannelList); - }) - } - }, - getDefaultOpenChannel: function (...args) { - console.warn("ChannelManager.getDefaultOpenChannel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Channel); - } else { - return new Promise((resolve, reject) => { - resolve(Channel); - }) - } - }, - setChannelServiceTypeMode: function (...args) { - console.warn("ChannelManager.setChannelServiceTypeMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - rebuildAllGroup: function (...args) { - console.warn("ChannelManager.rebuildAllGroup interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getChannelServiceTypeMode: function (...args) { - console.warn("ChannelManager.getChannelServiceTypeMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, TVRadioFilters); - } else { - return new Promise((resolve, reject) => { - resolve(TVRadioFilters); - }) - } - }, - getDefaultOpenGroupType: function (...args) { - console.warn("ChannelManager.getDefaultOpenGroupType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getUseFavGroups: function (...args) { - console.warn("ChannelManager.getUseFavGroups interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var channelListArray = new Array(); - channelListArray.push(ChannelList); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, channelListArray); - } else { - return new Promise((resolve, reject) => { - resolve(channelListArray); - }) - } - }, - getUseStatalliteGroups: function (...args) { - console.warn("ChannelManager.getUseStatalliteGroups interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var channelListArray = new Array(); - channelListArray.push(ChannelList); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, channelListArray); - } else { - return new Promise((resolve, reject) => { - resolve(channelListArray); - }) - } - }, - getUseGroups: function (...args) { - console.warn("ChannelManager.getUseGroups interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var channelListArray = new Array(); - channelListArray.push(ChannelList); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, channelListArray); - } else { - return new Promise((resolve, reject) => { - resolve(channelListArray); - }) - } - }, - regenerateChannels: function (...args) { - console.warn("ChannelManager.regenerateChannels interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setFavNetworkName: function (...args) { - console.warn("ChannelManager.setFavNetworkName interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getLcnList: function (...args) { - console.warn("ChannelManager.getLcnList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var stringArray = new Array(); - stringArray.push(paramMock.paramStringMock); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, stringArray); - } else { - return new Promise((resolve, reject) => { - resolve(stringArray); - }) - } - }, - selectLcnList: function (...args) { - console.warn("ChannelManager.selectLcnList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getConflictLcnGroupNum: function (...args) { - console.warn("ChannelManager.getConflictLcnGroupNum interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getConflictLcnChannelId: function (...args) { - console.warn("ChannelManager.getConflictLcnChannelId interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var numberArray = new Array(); - numberArray.push(paramMock.paramNumberMock); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, numberArray); - } else { - return new Promise((resolve, reject) => { - resolve(numberArray); - }) - } - }, - getRegionList: function (...args) { - console.warn("ChannelManager.getRegionList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var channelRegionArray = new Array(); - channelRegionArray.push(ChannelRegion); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, channelRegionArray); - } else { - return new Promise((resolve, reject) => { - resolve(channelRegionArray); - }) - } - }, - setRegionInfo: function (...args) { - console.warn("ChannelManager.setRegionInfo interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - reAssignLcn: function (...args) { - console.warn("ChannelManager.reAssignLcn interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - addUserChannel: function (...args) { - console.warn("ChannelManager.addUserChannel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } + } + const ChannelManager = { + getChannelByNo: function (...args) { + console.warn("ChannelManager.getChannelByNo interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Channel); + } else { + return new Promise((resolve, reject) => { + resolve(Channel); + }) + } + }, + getChannelById: function (...args) { + console.warn("ChannelManager.getChannelById interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Channel); + } else { + return new Promise((resolve, reject) => { + resolve(Channel); + }) + } + }, + getTsInfoByID: function (...args) { + console.warn("ChannelManager.getTsInfoByID interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ChannelTsInfo); + } else { + return new Promise((resolve, reject) => { + resolve(ChannelTsInfo); + }) + } + }, + importDBFromIniFile: function (...args) { + console.warn("ChannelManager.importDBFromIniFile interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + exportDBToFile: function (...args) { + console.warn("ChannelManager.exportDBToFile interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + importDBFromFile: function (...args) { + console.warn("ChannelManager.importDBFromFile interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + deleteAll: function (...args) { + console.warn("ChannelManager.deleteAll interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + deleteChannelByID: function (...args) { + console.warn("ChannelManager.deleteChannelByID interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + restoreChannelByID: function (...args) { + console.warn("ChannelManager.restoreChannelByID interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + delChannelByTag: function (...args) { + console.warn("ChannelManager.delChannelByTag interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + deleteChannelsByNetworkType: function (...args) { + console.warn("ChannelManager.deleteChannelsByNetworkType interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + deleteChannelsBySIElement: function (...args) { + console.warn("ChannelManager.deleteChannelsBySIElement interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + save: function (...args) { + console.warn("ChannelManager.save interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + recover: function (...args) { + console.warn("ChannelManager.recover interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + createChannel: function (...args) { + console.warn("ChannelManager.createChannel interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Channel); + } else { + return new Promise((resolve, reject) => { + resolve(Channel); + }) + } + }, + getChannelList: function (...args) { + console.warn("ChannelManager.getChannelList interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ChannelList); + } else { + return new Promise((resolve, reject) => { + resolve(ChannelList); + }) + } + }, + sort: function (...args) { + console.warn("ChannelManager.sort interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + sortProgramView: function (...args) { + console.warn("ChannelManager.sortProgramView interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setDefaultOpenChannel: function (...args) { + console.warn("ChannelManager.setDefaultOpenChannel interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setChannelServiceTypeMode: function (...args) { + console.warn("ChannelManager.setChannelServiceTypeMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + rebuildAllGroup: function (...args) { + console.warn("ChannelManager.rebuildAllGroup interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getChannelServiceTypeMode: function (...args) { + console.warn("ChannelManager.getChannelServiceTypeMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, TVRadioFilters); + } else { + return new Promise((resolve, reject) => { + resolve(TVRadioFilters); + }) + } + }, + getChannelListByGroupType: function (...args) { + console.warn("ChannelManager.getChannelListByGroupType interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ChannelList); + } else { + return new Promise((resolve, reject) => { + resolve(ChannelList); + }) + } + }, + getDefaultOpenChannel: function (...args) { + console.warn("ChannelManager.getDefaultOpenChannel interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Channel); + } else { + return new Promise((resolve, reject) => { + resolve(Channel); + }) + } + }, + setChannelServiceTypeMode: function (...args) { + console.warn("ChannelManager.setChannelServiceTypeMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + rebuildAllGroup: function (...args) { + console.warn("ChannelManager.rebuildAllGroup interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getChannelServiceTypeMode: function (...args) { + console.warn("ChannelManager.getChannelServiceTypeMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, TVRadioFilters); + } else { + return new Promise((resolve, reject) => { + resolve(TVRadioFilters); + }) + } + }, + getDefaultOpenGroupType: function (...args) { + console.warn("ChannelManager.getDefaultOpenGroupType interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getUseFavGroups: function (...args) { + console.warn("ChannelManager.getUseFavGroups interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var channelListArray = new Array(); + channelListArray.push(ChannelList); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, channelListArray); + } else { + return new Promise((resolve, reject) => { + resolve(channelListArray); + }) + } + }, + getUseStatalliteGroups: function (...args) { + console.warn("ChannelManager.getUseStatalliteGroups interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var channelListArray = new Array(); + channelListArray.push(ChannelList); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, channelListArray); + } else { + return new Promise((resolve, reject) => { + resolve(channelListArray); + }) + } + }, + getUseGroups: function (...args) { + console.warn("ChannelManager.getUseGroups interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var channelListArray = new Array(); + channelListArray.push(ChannelList); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, channelListArray); + } else { + return new Promise((resolve, reject) => { + resolve(channelListArray); + }) + } + }, + regenerateChannels: function (...args) { + console.warn("ChannelManager.regenerateChannels interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setFavNetworkName: function (...args) { + console.warn("ChannelManager.setFavNetworkName interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getLcnList: function (...args) { + console.warn("ChannelManager.getLcnList interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var stringArray = new Array(); + stringArray.push(paramMock.paramStringMock); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, stringArray); + } else { + return new Promise((resolve, reject) => { + resolve(stringArray); + }) + } + }, + selectLcnList: function (...args) { + console.warn("ChannelManager.selectLcnList interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getConflictLcnGroupNum: function (...args) { + console.warn("ChannelManager.getConflictLcnGroupNum interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getConflictLcnChannelId: function (...args) { + console.warn("ChannelManager.getConflictLcnChannelId interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var numberArray = new Array(); + numberArray.push(paramMock.paramNumberMock); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, numberArray); + } else { + return new Promise((resolve, reject) => { + resolve(numberArray); + }) + } + }, + getRegionList: function (...args) { + console.warn("ChannelManager.getRegionList interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var channelRegionArray = new Array(); + channelRegionArray.push(ChannelRegion); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, channelRegionArray); + } else { + return new Promise((resolve, reject) => { + resolve(channelRegionArray); + }) + } + }, + setRegionInfo: function (...args) { + console.warn("ChannelManager.setRegionInfo interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + reAssignLcn: function (...args) { + console.warn("ChannelManager.reAssignLcn interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + addUserChannel: function (...args) { + console.warn("ChannelManager.addUserChannel interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } } - const AnalogChannel = { - enableAFT: function (...args) { - console.warn("AnalogChannel.enableAFT interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isAFTEnable: function (...args) { - console.warn("AnalogChannel.isAFTEnable interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setColorSystem: function (...args) { - console.warn("AnalogChannel.setColorSystem interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getColorSystem: function (...args) { - console.warn("AnalogChannel.getColorSystem interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getOriginalColorSystem: function (...args) { - console.warn("AnalogChannel.getOriginalColorSystem interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setAudioSystem: function (...args) { - console.warn("AnalogChannel.setAudioSystem interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAudioSystem: function (...args) { - console.warn("AnalogChannel.getAudioSystem interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setMtsMode: function (...args) { - console.warn("AnalogChannel.setMtsMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getMtsMode: function (...args) { - console.warn("AnalogChannel.getMtsMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } + } + const AnalogChannel = { + enableAFT: function (...args) { + console.warn("AnalogChannel.enableAFT interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isAFTEnable: function (...args) { + console.warn("AnalogChannel.isAFTEnable interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setColorSystem: function (...args) { + console.warn("AnalogChannel.setColorSystem interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getColorSystem: function (...args) { + console.warn("AnalogChannel.getColorSystem interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getOriginalColorSystem: function (...args) { + console.warn("AnalogChannel.getOriginalColorSystem interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setAudioSystem: function (...args) { + console.warn("AnalogChannel.setAudioSystem interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getAudioSystem: function (...args) { + console.warn("AnalogChannel.getAudioSystem interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setMtsMode: function (...args) { + console.warn("AnalogChannel.setMtsMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + getMtsMode: function (...args) { + console.warn("AnalogChannel.getMtsMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } } - const AtvChannelManager = { - createChannel: function (...args) { - console.warn("AtvChannelManager.createChannel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, AnalogChannel); - } else { - return new Promise((resolve, reject) => { - resolve(AnalogChannel); - }) - } - }, - getChannelByID: function (...args) { - console.warn("AtvChannelManager.getChannelByID interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, AnalogChannel); - } else { - return new Promise((resolve, reject) => { - resolve(AnalogChannel); - }) - } - }, - getAllChannelList: function (...args) { - console.warn("AtvChannelManager.getAllChannelList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ChannelList); - } else { - return new Promise((resolve, reject) => { - resolve(ChannelList); - }) - } - }, - getChannelList: function (...args) { - console.warn("AtvChannelManager.getChannelList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ChannelList); - } else { - return new Promise((resolve, reject) => { - resolve(ChannelList); - }) - } - }, - deleteAll: function (...args) { - console.warn("AtvChannelManager.deleteAll interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - deleteChannelByID: function (...args) { - console.warn("AtvChannelManager.deleteChannelByID interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getDefaultOpenChannel: function (...args) { - console.warn("AtvChannelManager.getDefaultOpenChannel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, AnalogChannel); - } else { - return new Promise((resolve, reject) => { - resolve(AnalogChannel); - }) - } - }, - getUseGroups: function (...args) { - console.warn("AtvChannelManager.getUseGroups interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var channelListArray = new Array(); - channelListArray.push(ChannelList); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, channelListArray); - } else { - return new Promise((resolve, reject) => { - resolve(channelListArray); - }) - } - }, - getUseFavGroups: function (...args) { - console.warn("AtvChannelManager.getUseFavGroups interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var channelListArray = new Array(); - channelListArray.push(ChannelList); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, channelListArray); - } else { - return new Promise((resolve, reject) => { - resolve(channelListArray); - }) - } - } + } + const AtvChannelManager = { + createChannel: function (...args) { + console.warn("AtvChannelManager.createChannel interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, AnalogChannel); + } else { + return new Promise((resolve, reject) => { + resolve(AnalogChannel); + }) + } + }, + getChannelByID: function (...args) { + console.warn("AtvChannelManager.getChannelByID interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, AnalogChannel); + } else { + return new Promise((resolve, reject) => { + resolve(AnalogChannel); + }) + } + }, + getAllChannelList: function (...args) { + console.warn("AtvChannelManager.getAllChannelList interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ChannelList); + } else { + return new Promise((resolve, reject) => { + resolve(ChannelList); + }) + } + }, + getChannelList: function (...args) { + console.warn("AtvChannelManager.getChannelList interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ChannelList); + } else { + return new Promise((resolve, reject) => { + resolve(ChannelList); + }) + } + }, + deleteAll: function (...args) { + console.warn("AtvChannelManager.deleteAll interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + deleteChannelByID: function (...args) { + console.warn("AtvChannelManager.deleteChannelByID interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getDefaultOpenChannel: function (...args) { + console.warn("AtvChannelManager.getDefaultOpenChannel interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, AnalogChannel); + } else { + return new Promise((resolve, reject) => { + resolve(AnalogChannel); + }) + } + }, + getUseGroups: function (...args) { + console.warn("AtvChannelManager.getUseGroups interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var channelListArray = new Array(); + channelListArray.push(ChannelList); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, channelListArray); + } else { + return new Promise((resolve, reject) => { + resolve(channelListArray); + }) + } + }, + getUseFavGroups: function (...args) { + console.warn("AtvChannelManager.getUseFavGroups interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var channelListArray = new Array(); + channelListArray.push(ChannelList); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, channelListArray); + } else { + return new Promise((resolve, reject) => { + resolve(channelListArray); + }) + } } - const RRTInfo = { - getRRTDimensionsNum: function (...args) { - console.warn("RRTInfo.getRRTDimensionsNum interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getRRTDimensionName: function (...args) { - console.warn("RRTInfo.getRRTDimensionName interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getRRTDimensionTypeNum: function (...args) { - console.warn("RRTInfo.getRRTDimensionTypeNum interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getRRTDimensionValueName: function (...args) { - console.warn("RRTInfo.getRRTDimensionValueName interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - } + } + const RRTInfo = { + getRRTDimensionsNum: function (...args) { + console.warn("RRTInfo.getRRTDimensionsNum interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getRRTDimensionName: function (...args) { + console.warn("RRTInfo.getRRTDimensionName interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getRRTDimensionTypeNum: function (...args) { + console.warn("RRTInfo.getRRTDimensionTypeNum interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getRRTDimensionValueName: function (...args) { + console.warn("RRTInfo.getRRTDimensionValueName interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } } - const ParentalControlManager = { - setParentalRateUstvAllTypes: function (...args) { - console.warn("ParentalControlManager.setParentalRateUstvAllTypes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setParentalRateUstvFvTypes: function (...args) { - console.warn("ParentalControlManager.setParentalRateUstvFvTypes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setParentalRateUstvVTypes: function (...args) { - console.warn("ParentalControlManager.setParentalRateUstvVTypes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setParentalRateUstvSTypes: function (...args) { - console.warn("ParentalControlManager.setParentalRateUstvSTypes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setParentalRateUstvLTypes: function (...args) { - console.warn("ParentalControlManager.setParentalRateUstvLTypes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setParentalRateUstvDTypes: function (...args) { - console.warn("ParentalControlManager.setParentalRateUstvDTypes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setParentalRateMpaaTypes: function (...args) { - console.warn("ParentalControlManager.setParentalRateMpaaTypes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setParentalRateCaenTypes: function (...args) { - console.warn("ParentalControlManager.setParentalRateCaenTypes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setParentalRateCafrTypes: function (...args) { - console.warn("ParentalControlManager.setParentalRateCafrTypes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setParentalRate: function (...args) { - console.warn("ParentalControlManager.setParentalRate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getParentalRateUstvAllTypes: function (...args) { - console.warn("ParentalControlManager.getParentalRateUstvAllTypes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getParentalRateUstvFvTypes: function (...args) { - console.warn("ParentalControlManager.getParentalRateUstvFvTypes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getParentalRateUstvVTypes: function (...args) { - console.warn("ParentalControlManager.getParentalRateUstvVTypes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getParentalRateUstvSTypes: function (...args) { - console.warn("ParentalControlManager.getParentalRateUstvSTypes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getParentalRateUstvLTypes: function (...args) { - console.warn("ParentalControlManager.getParentalRateUstvLTypes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getParentalRateUstvDTypes: function (...args) { - console.warn("ParentalControlManager.getParentalRateUstvDTypes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getParentalRateMpaaTypes: function (...args) { - console.warn("ParentalControlManager.getParentalRateMpaaTypes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getParentalRateCaenTypes: function (...args) { - console.warn("ParentalControlManager.getParentalRateCaenTypes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getParentalRateCafrTypes: function (...args) { - console.warn("ParentalControlManager.getParentalRateCafrTypes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getParentalRate: function (...args) { - console.warn("ParentalControlManager.getParentalRate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getChannelParental: function (...args) { - console.warn("ParentalControlManager.getChannelParental interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ChannelRate); - } else { - return new Promise((resolve, reject) => { - resolve(ChannelRate); - }) - } - }, - getChannelParentalChannel: function (...args) { - console.warn("ParentalControlManager.getChannelParentalChannel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getParental: function (...args) { - console.warn("ParentalControlManager.getParental interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getParentalContent: function (...args) { - console.warn("ParentalControlManager.getParentalContent interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ParentalContents); - } else { - return new Promise((resolve, reject) => { - resolve(ParentalContents); - }) - } - }, - getParentalStatus: function (...args) { - console.warn("ParentalControlManager.getParentalStatus interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getRRT: function (...args) { - console.warn("ParentalControlManager.getRRT interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, RRTInfo); - } else { - return new Promise((resolve, reject) => { - resolve(RRTInfo); - }) - } - }, - resetRRT: function (...args) { - console.warn("ParentalControlManager.resetRRT interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getParentLockAge: function (...args) { - console.warn("ParentalControlManager.getParentLockAge interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setParentLockAge: function (...args) { - console.warn("ParentalControlManager.setParentLockAge interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } + } + const ParentalControlManager = { + setParentalRateUstvAllTypes: function (...args) { + console.warn("ParentalControlManager.setParentalRateUstvAllTypes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setParentalRateUstvFvTypes: function (...args) { + console.warn("ParentalControlManager.setParentalRateUstvFvTypes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setParentalRateUstvVTypes: function (...args) { + console.warn("ParentalControlManager.setParentalRateUstvVTypes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setParentalRateUstvSTypes: function (...args) { + console.warn("ParentalControlManager.setParentalRateUstvSTypes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setParentalRateUstvLTypes: function (...args) { + console.warn("ParentalControlManager.setParentalRateUstvLTypes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setParentalRateUstvDTypes: function (...args) { + console.warn("ParentalControlManager.setParentalRateUstvDTypes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setParentalRateMpaaTypes: function (...args) { + console.warn("ParentalControlManager.setParentalRateMpaaTypes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setParentalRateCaenTypes: function (...args) { + console.warn("ParentalControlManager.setParentalRateCaenTypes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setParentalRateCafrTypes: function (...args) { + console.warn("ParentalControlManager.setParentalRateCafrTypes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setParentalRate: function (...args) { + console.warn("ParentalControlManager.setParentalRate interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getParentalRateUstvAllTypes: function (...args) { + console.warn("ParentalControlManager.getParentalRateUstvAllTypes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + getParentalRateUstvFvTypes: function (...args) { + console.warn("ParentalControlManager.getParentalRateUstvFvTypes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + getParentalRateUstvVTypes: function (...args) { + console.warn("ParentalControlManager.getParentalRateUstvVTypes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + getParentalRateUstvSTypes: function (...args) { + console.warn("ParentalControlManager.getParentalRateUstvSTypes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + getParentalRateUstvLTypes: function (...args) { + console.warn("ParentalControlManager.getParentalRateUstvLTypes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + getParentalRateUstvDTypes: function (...args) { + console.warn("ParentalControlManager.getParentalRateUstvDTypes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + getParentalRateMpaaTypes: function (...args) { + console.warn("ParentalControlManager.getParentalRateMpaaTypes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + getParentalRateCaenTypes: function (...args) { + console.warn("ParentalControlManager.getParentalRateCaenTypes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + getParentalRateCafrTypes: function (...args) { + console.warn("ParentalControlManager.getParentalRateCafrTypes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + getParentalRate: function (...args) { + console.warn("ParentalControlManager.getParentalRate interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + getChannelParental: function (...args) { + console.warn("ParentalControlManager.getChannelParental interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ChannelRate); + } else { + return new Promise((resolve, reject) => { + resolve(ChannelRate); + }) + } + }, + getChannelParentalChannel: function (...args) { + console.warn("ParentalControlManager.getChannelParentalChannel interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getParental: function (...args) { + console.warn("ParentalControlManager.getParental interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getParentalContent: function (...args) { + console.warn("ParentalControlManager.getParentalContent interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ParentalContents); + } else { + return new Promise((resolve, reject) => { + resolve(ParentalContents); + }) + } + }, + getParentalStatus: function (...args) { + console.warn("ParentalControlManager.getParentalStatus interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + getRRT: function (...args) { + console.warn("ParentalControlManager.getRRT interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, RRTInfo); + } else { + return new Promise((resolve, reject) => { + resolve(RRTInfo); + }) + } + }, + resetRRT: function (...args) { + console.warn("ParentalControlManager.resetRRT interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getParentLockAge: function (...args) { + console.warn("ParentalControlManager.getParentLockAge interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setParentLockAge: function (...args) { + console.warn("ParentalControlManager.setParentLockAge interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } } - const DTVConfigManager = { - setString: function (...args) { - console.warn("DTVConfigManager.setString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setInt: function (...args) { - console.warn("DTVConfigManager.setInt interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getString: function (...args) { - console.warn("DTVConfigManager.getString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getInt: function (...args) { - console.warn("DTVConfigManager.getInt interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - restoreDefaultConfig: function (...args) { - console.warn("DTVConfigManager.restoreDefaultConfig interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getConfigFileInt: function (...args) { - console.warn("DTVConfigManager.getConfigFileInt interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - switchTunerSignal: function (...args) { - console.warn("DTVConfigManager.switchTunerSignal interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } + } + const DTVConfigManager = { + setString: function (...args) { + console.warn("DTVConfigManager.setString interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setInt: function (...args) { + console.warn("DTVConfigManager.setInt interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getString: function (...args) { + console.warn("DTVConfigManager.getString interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } + }, + getInt: function (...args) { + console.warn("DTVConfigManager.getInt interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + restoreDefaultConfig: function (...args) { + console.warn("DTVConfigManager.restoreDefaultConfig interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getConfigFileInt: function (...args) { + console.warn("DTVConfigManager.getConfigFileInt interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + switchTunerSignal: function (...args) { + console.warn("DTVConfigManager.switchTunerSignal interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } } - const EPGManager = { - setEventLang: function (...args) { - console.warn("EPGManager.setEventLang interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - startEpg: function (...args) { - console.warn("EPGManager.startEpg interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getPresentEvent: function (...args) { - console.warn("EPGManager.getPresentEvent interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, EPGEvent); - } else { - return new Promise((resolve, reject) => { - resolve(EPGEvent); - }) - } - }, - getFollowEvent: function (...args) { - console.warn("EPGManager.getFollowEvent interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, EPGEvent); - } else { - return new Promise((resolve, reject) => { - resolve(EPGEvent); - }) - } - }, - getEvents: function (...args) { - console.warn("EPGManager.getEvents interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var ePGEventArray = new Array(); - ePGEventArray.push(EPGEvent); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ePGEventArray); - } else { - return new Promise((resolve, reject) => { - resolve(ePGEventArray); - }) - } - }, - getEventById: function (...args) { - console.warn("EPGManager.getEventById interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, EPGEvent); - } else { - return new Promise((resolve, reject) => { - resolve(EPGEvent); - }) - } - }, - getRelevantEvents: function (...args) { - console.warn("EPGManager.getEventById interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, EPGEvent); - } else { - return new Promise((resolve, reject) => { - resolve(EPGEvent); - }) - } - } + } + const EPGManager = { + setEventLang: function (...args) { + console.warn("EPGManager.setEventLang interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + startEpg: function (...args) { + console.warn("EPGManager.startEpg interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getPresentEvent: function (...args) { + console.warn("EPGManager.getPresentEvent interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, EPGEvent); + } else { + return new Promise((resolve, reject) => { + resolve(EPGEvent); + }) + } + }, + getFollowEvent: function (...args) { + console.warn("EPGManager.getFollowEvent interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, EPGEvent); + } else { + return new Promise((resolve, reject) => { + resolve(EPGEvent); + }) + } + }, + getEvents: function (...args) { + console.warn("EPGManager.getEvents interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var ePGEventArray = new Array(); + ePGEventArray.push(EPGEvent); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ePGEventArray); + } else { + return new Promise((resolve, reject) => { + resolve(ePGEventArray); + }) + } + }, + getEventById: function (...args) { + console.warn("EPGManager.getEventById interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, EPGEvent); + } else { + return new Promise((resolve, reject) => { + resolve(EPGEvent); + }) + } + }, + getRelevantEvents: function (...args) { + console.warn("EPGManager.getEventById interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, EPGEvent); + } else { + return new Promise((resolve, reject) => { + resolve(EPGEvent); + }) + } } - const OTAManager = { - startOta: function (...args) { - console.warn("OTAManager.startOta interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - stopOta: function (...args) { - console.warn("OTAManager.stopOta interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - startDownloadFile: function (...args) { - console.warn("OTAManager.startDownloadFile interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - stopDownloadFile: function (...args) { - console.warn("OTAManager.stopDownloadFile interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } + } + const OTAManager = { + startOta: function (...args) { + console.warn("OTAManager.startOta interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + stopOta: function (...args) { + console.warn("OTAManager.stopOta interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + startDownloadFile: function (...args) { + console.warn("OTAManager.startDownloadFile interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + stopDownloadFile: function (...args) { + console.warn("OTAManager.stopDownloadFile interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } } - const Motor = { - setLimit: function (...args) { - console.warn("Motor.setLimit interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - move: function (...args) { - console.warn("Motor.move interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - stopMove: function (...args) { - console.warn("Motor.stopMove interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setAutoRolationSwitch: function (...args) { - console.warn("Motor.setAutoRolationSwitch interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } + } + const Motor = { + setLimit: function (...args) { + console.warn("Motor.setLimit interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + move: function (...args) { + console.warn("Motor.move interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + stopMove: function (...args) { + console.warn("Motor.stopMove interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setAutoRolationSwitch: function (...args) { + console.warn("Motor.setAutoRolationSwitch interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } } - const Multiplex = { - getBelongNetwork: function (...args) { - console.warn("Multiplex.getBelongNetwork interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Network); - } else { - return new Promise((resolve, reject) => { - resolve(Network); - }) - } - }, - getID: function (...args) { - console.warn("Multiplex.getID interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getFrequency: function (...args) { - console.warn("Multiplex.getFrequency interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setFrequency: function (...args) { - console.warn("Multiplex.setFrequency interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getVersion: function (...args) { - console.warn("Multiplex.getVersion interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, VersionTypes); - } else { - return new Promise((resolve, reject) => { - resolve(VersionTypes); - }) - } - }, - setVersion: function (...args) { - console.warn("Multiplex.setVersion interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getName: function (...args) { - console.warn("Multiplex.getName interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getBandWidth: function (...args) { - console.warn("Multiplex.getBandWidth interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSymbolRate: function (...args) { - console.warn("Multiplex.getSymbolRate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getModulation: function (...args) { - console.warn("Multiplex.getModulation interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getPolarity: function (...args) { - console.warn("Multiplex.getPolarity interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } + } + const Multiplex = { + getBelongNetwork: function (...args) { + console.warn("Multiplex.getBelongNetwork interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Network); + } else { + return new Promise((resolve, reject) => { + resolve(Network); + }) + } + }, + getID: function (...args) { + console.warn("Multiplex.getID interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getFrequency: function (...args) { + console.warn("Multiplex.getFrequency interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setFrequency: function (...args) { + console.warn("Multiplex.setFrequency interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getVersion: function (...args) { + console.warn("Multiplex.getVersion interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, VersionTypes); + } else { + return new Promise((resolve, reject) => { + resolve(VersionTypes); + }) + } + }, + setVersion: function (...args) { + console.warn("Multiplex.setVersion interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getName: function (...args) { + console.warn("Multiplex.getName interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } + }, + getBandWidth: function (...args) { + console.warn("Multiplex.getBandWidth interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getSymbolRate: function (...args) { + console.warn("Multiplex.getSymbolRate interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getModulation: function (...args) { + console.warn("Multiplex.getModulation interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getPolarity: function (...args) { + console.warn("Multiplex.getPolarity interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } } - const Tuner = { - getSignalStrength: function (...args) { - console.warn("Tuner.getSignalStrength interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSignalQuality: function (...args) { - console.warn("Tuner.getSignalQuality interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - connect: function (...args) { - console.warn("Tuner.connect interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - disconnect: function (...args) { - console.warn("Tuner.disconnect interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getBER: function (...args) { - console.warn("Tuner.getBER interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSNR: function (...args) { - console.warn("Tuner.getSNR interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSignalType: function (...args) { - console.warn("Tuner.getSignalType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, NetworkTypes); - } else { - return new Promise((resolve, reject) => { - resolve(NetworkTypes); - }) - } - }, - getTunerID: function (...args) { - console.warn("Tuner.getTunerID interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, NetworkTypes); - } else { - return new Promise((resolve, reject) => { - resolve(NetworkTypes); - }) - } - }, - getTuningMultiplexe: function (...args) { - console.warn("Tuner.getTuningMultiplexe interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Multiplex); - } else { - return new Promise((resolve, reject) => { - resolve(Multiplex); - }) - } - }, - getTunerStatus: function (...args) { - console.warn("Tuner.getTunerStatus interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, TunerStatus); - } else { - return new Promise((resolve, reject) => { - resolve(TunerStatus); - }) - } - }, - getModulation: function (...args) { - console.warn("Tuner.getModulation interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Modulations); - } else { - return new Promise((resolve, reject) => { - resolve(Modulations); - }) - } - } + } + const Tuner = { + getSignalStrength: function (...args) { + console.warn("Tuner.getSignalStrength interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getSignalQuality: function (...args) { + console.warn("Tuner.getSignalQuality interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + connect: function (...args) { + console.warn("Tuner.connect interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + disconnect: function (...args) { + console.warn("Tuner.disconnect interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getBER: function (...args) { + console.warn("Tuner.getBER interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getSNR: function (...args) { + console.warn("Tuner.getSNR interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getSignalType: function (...args) { + console.warn("Tuner.getSignalType interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, NetworkTypes); + } else { + return new Promise((resolve, reject) => { + resolve(NetworkTypes); + }) + } + }, + getTunerID: function (...args) { + console.warn("Tuner.getTunerID interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, NetworkTypes); + } else { + return new Promise((resolve, reject) => { + resolve(NetworkTypes); + }) + } + }, + getTuningMultiplexe: function (...args) { + console.warn("Tuner.getTuningMultiplexe interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Multiplex); + } else { + return new Promise((resolve, reject) => { + resolve(Multiplex); + }) + } + }, + getTunerStatus: function (...args) { + console.warn("Tuner.getTunerStatus interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, TunerStatus); + } else { + return new Promise((resolve, reject) => { + resolve(TunerStatus); + }) + } + }, + getModulation: function (...args) { + console.warn("Tuner.getModulation interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Modulations); + } else { + return new Promise((resolve, reject) => { + resolve(Modulations); + }) + } } - const HardwareManager = { - getMotor: function (...args) { - console.warn("HardwareManager.getMotor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Motor); - } else { - return new Promise((resolve, reject) => { - resolve(Motor); - }) - } - }, - getTunerNum: function (...args) { - console.warn("HardwareManager.getTunerNum interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAllTuners: function (...args) { - console.warn("HardwareManager.getAllTuners interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var tunerArray = new Array(); - tunerArray.push(Tuner); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, tunerArray); - } else { - return new Promise((resolve, reject) => { - resolve(tunerArray); - }) - } - }, - getTunersByStatus: function (...args) { - console.warn("HardwareManager.getTunersByStatus interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var tunerArray = new Array(); - tunerArray.push(Tuner); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, tunerArray); - } else { - return new Promise((resolve, reject) => { - resolve(tunerArray); - }) - } - }, - getTunerByID: function (...args) { - console.warn("HardwareManager.getTunerByID interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Tuner); - } else { - return new Promise((resolve, reject) => { - resolve(Tuner); - }) - } - } + } + const HardwareManager = { + getMotor: function (...args) { + console.warn("HardwareManager.getMotor interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Motor); + } else { + return new Promise((resolve, reject) => { + resolve(Motor); + }) + } + }, + getTunerNum: function (...args) { + console.warn("HardwareManager.getTunerNum interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getAllTuners: function (...args) { + console.warn("HardwareManager.getAllTuners interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var tunerArray = new Array(); + tunerArray.push(Tuner); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, tunerArray); + } else { + return new Promise((resolve, reject) => { + resolve(tunerArray); + }) + } + }, + getTunersByStatus: function (...args) { + console.warn("HardwareManager.getTunersByStatus interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var tunerArray = new Array(); + tunerArray.push(Tuner); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, tunerArray); + } else { + return new Promise((resolve, reject) => { + resolve(tunerArray); + }) + } + }, + getTunerByID: function (...args) { + console.warn("HardwareManager.getTunerByID interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Tuner); + } else { + return new Promise((resolve, reject) => { + resolve(Tuner); + }) + } } - const Network = { - getID: function (...args) { - console.warn("Network.getID interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getMultiplexes: function (...args) { - console.warn("Network.getMultiplexes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var multiplexArray = new Array(); - multiplexArray.push(Multiplex); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, multiplexArray); - } else { - return new Promise((resolve, reject) => { - resolve(multiplexArray); - }) - } - }, - setScanMultiplexes: function (...args) { - console.warn("Network.setScanMultiplexes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getScanMultiplexes: function (...args) { - console.warn("Network.getScanMultiplexes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var multiplexArray = new Array(); - multiplexArray.push(Multiplex); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, multiplexArray); - } else { - return new Promise((resolve, reject) => { - resolve(multiplexArray); - }) - } - }, - createMultiplex: function (...args) { - console.warn("Network.createMultiplex interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Multiplex); - } else { - return new Promise((resolve, reject) => { - resolve(Multiplex); - }) - } - }, - createTmpMultiplex: function (...args) { - console.warn("Network.createTmpMultiplex interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Multiplex); - } else { - return new Promise((resolve, reject) => { - resolve(Multiplex); - }) - } - }, - getPresetMultiplexes: function (...args) { - console.warn("Network.getPresetMultiplexes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var multiplexArray = new Array(); - multiplexArray.push(Multiplex); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, multiplexArray); - } else { - return new Promise((resolve, reject) => { - resolve(multiplexArray); - }) - } - }, - getMultiplexById: function (...args) { - console.warn("Network.getMultiplexById interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Multiplex); - } else { - return new Promise((resolve, reject) => { - resolve(Multiplex); - }) - } - }, - removeMultiplex: function (...args) { - console.warn("Network.removeMultiplex interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - saveMultiplexes: function (...args) { - console.warn("Network.saveMultiplexes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - recoverMultiplexes: function (...args) { - console.warn("Network.recoverMultiplexes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isSelected: function (...args) { - console.warn("Network.isSelected interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setSelect: function (...args) { - console.warn("Network.setSelect interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getNetworkNameList: function (...args) { - console.warn("Network.getNetworkNameList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var stringArray = new Array(); - stringArray.push(paramMock.paramStringMock); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, stringArray); - } else { - return new Promise((resolve, reject) => { - resolve(stringArray); - }) - } - }, + } + const Network = { + getID: function (...args) { + console.warn("Network.getID interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getMultiplexes: function (...args) { + console.warn("Network.getMultiplexes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var multiplexArray = new Array(); + multiplexArray.push(Multiplex); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, multiplexArray); + } else { + return new Promise((resolve, reject) => { + resolve(multiplexArray); + }) + } + }, + setScanMultiplexes: function (...args) { + console.warn("Network.setScanMultiplexes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + getScanMultiplexes: function (...args) { + console.warn("Network.getScanMultiplexes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var multiplexArray = new Array(); + multiplexArray.push(Multiplex); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, multiplexArray); + } else { + return new Promise((resolve, reject) => { + resolve(multiplexArray); + }) + } + }, + createMultiplex: function (...args) { + console.warn("Network.createMultiplex interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Multiplex); + } else { + return new Promise((resolve, reject) => { + resolve(Multiplex); + }) + } + }, + createTmpMultiplex: function (...args) { + console.warn("Network.createTmpMultiplex interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Multiplex); + } else { + return new Promise((resolve, reject) => { + resolve(Multiplex); + }) + } + }, + getPresetMultiplexes: function (...args) { + console.warn("Network.getPresetMultiplexes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var multiplexArray = new Array(); + multiplexArray.push(Multiplex); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, multiplexArray); + } else { + return new Promise((resolve, reject) => { + resolve(multiplexArray); + }) + } + }, + getMultiplexById: function (...args) { + console.warn("Network.getMultiplexById interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Multiplex); + } else { + return new Promise((resolve, reject) => { + resolve(Multiplex); + }) + } + }, + removeMultiplex: function (...args) { + console.warn("Network.removeMultiplex interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + saveMultiplexes: function (...args) { + console.warn("Network.saveMultiplexes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + recoverMultiplexes: function (...args) { + console.warn("Network.recoverMultiplexes interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isSelected: function (...args) { + console.warn("Network.isSelected interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setSelect: function (...args) { + console.warn("Network.setSelect interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getNetworkNameList: function (...args) { + console.warn("Network.getNetworkNameList interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var stringArray = new Array(); + stringArray.push(paramMock.paramStringMock); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, stringArray); + } else { + return new Promise((resolve, reject) => { + resolve(stringArray); + }) + } + }, + } + const TimeManager = { + getCalendarTime: function (...args) { + console.warn("TimeManager.getCalendarTime interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramObjectMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramObjectMock); + }) + } + }, + setCalendarTime: function (...args) { + console.warn("TimeManager.setCalendarTime interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramObjectMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramObjectMock); + }) + } + }, + getTimeZone: function (...args) { + console.warn("TimeManager.getTimeZone interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setTimeZone: function (...args) { + console.warn("TimeManager.setTimeZone interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + secondToDate: function (...args) { + console.warn("TimeManager.secondToDate interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramObjectMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramObjectMock); + }) + } + }, + dateToSecond: function (...args) { + console.warn("TimeManager.dateToSecond interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + syncTime: function (...args) { + console.warn("TimeManager.syncTime interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getSyncTimeFlag: function (...args) { + console.warn("TimeManager.getSyncTimeFlag interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + syncTimeZone: function (...args) { + console.warn("TimeManager.syncTimeZone interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getSyncTimeZoneFlag: function (...args) { + console.warn("TimeManager.getSyncTimeZoneFlag interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + getSleepTime: function (...args) { + console.warn("TimeManager.getSleepTime interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setWakeupInternal: function (...args) { + console.warn("TimeManager.setWakeupInternal interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setTimeToSystem: function (...args) { + console.warn("TimeManager.setTimeToSystem interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + syncDaylight: function (...args) { + console.warn("TimeManager.syncDaylight interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getSyncDaylightFlag: function (...args) { + console.warn("TimeManager.getSyncDaylightFlag interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setDaylight: function (...args) { + console.warn("TimeManager.setDaylight interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getDaylight: function (...args) { + console.warn("TimeManager.getDaylight interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + } + const NetworkManager = { + getAllSupportNetworks: function (...args) { + console.warn("NetworkManager.getAllSupportNetworks interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var networkArray = new Array(); + networkArray.push(Network); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, networkArray); + } else { + return new Promise((resolve, reject) => { + resolve(networkArray); + }) + } + }, + getNetworks: function (...args) { + console.warn("NetworkManager.getNetworks interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var networkArray = new Array(); + networkArray.push(Network); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, networkArray); + } else { + return new Promise((resolve, reject) => { + resolve(networkArray); + }) + } + }, + getNetworks: function (...args) { + console.warn("NetworkManager.getNetworks interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var networkArray = new Array(); + networkArray.push(Network); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, networkArray); + } else { + return new Promise((resolve, reject) => { + resolve(networkArray); + }) + } + }, + getCurrentNetworkType: function (...args) { + console.warn("NetworkManager.getCurrentNetworkType interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, NetworkTypes); + } else { + return new Promise((resolve, reject) => { + resolve(NetworkTypes); + }) + } + }, + setCurrentNetworkType: function (...args) { + console.warn("NetworkManager.setCurrentNetworkType interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + createNetwork: function (...args) { + console.warn("NetworkManager.createNetwork interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Network); + } else { + return new Promise((resolve, reject) => { + resolve(Network); + }) + } + }, + getNetworkById: function (...args) { + console.warn("NetworkManager.getNetworkById interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Network); + } else { + return new Promise((resolve, reject) => { + resolve(Network); + }) + } + }, + removeNetwork: function (...args) { + console.warn("NetworkManager.removeNetwork interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + removeAllSatellite: function (...args) { + console.warn("NetworkManager.removeAllSatellite interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + clearNetworks: function (...args) { + console.warn("NetworkManager.clearNetworks interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + saveNetworks: function (...args) { + console.warn("NetworkManager.saveNetworks interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + recoverNetworks: function (...args) { + console.warn("NetworkManager.recoverNetworks interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getTimeManager: function (...args) { + console.warn("NetworkManager.getTimeManager interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, TimeManager); + } else { + return new Promise((resolve, reject) => { + resolve(TimeManager); + }) + } + }, + setNetworkType: function (...args) { + console.warn("NetworkManager.setNetworkType interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + } + const SubtitleComponent = { + getLanguageCode: function (...args) { + console.warn("SubtitleComponent.getLanguageCode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } + }, + getSubtitleType: function (...args) { + console.warn("SubtitleComponent.getSubtitleType interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, SubtitleTypes); + } else { + return new Promise((resolve, reject) => { + resolve(SubtitleTypes); + }) + } + }, + getSubtComponentType: function (...args) { + console.warn("SubtitleComponent.getSubtComponentType interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, SubtComponentTypes); + } else { + return new Promise((resolve, reject) => { + resolve(SubtComponentTypes); + }) + } + }, + getPID: function (...args) { + console.warn("SubtitleComponent.getPID interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getMagazingNum: function (...args) { + console.warn("SubtitleComponent.getMagazingNum interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getPageNum: function (...args) { + console.warn("SubtitleComponent.getPageNum interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getPos: function (...args) { + console.warn("SubtitleComponent.getPos interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isHdSubtitle: function (...args) { + console.warn("SubtitleComponent.isHdSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + getSubtComponentTag: function (...args) { + console.warn("SubtitleComponent.getSubtComponentTag interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + } + const TeletextControl = { + showTTX: function (...args) { + console.warn("TeletextControl.showTTX interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isTTXVisible: function (...args) { + console.warn("TeletextControl.isTTXVisible interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + isTTXAvailable: function (...args) { + console.warn("TeletextControl.isTTXAvailable interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + getCurrentTTX: function (...args) { + console.warn("TeletextControl.getCurrentTTX interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, TeletextComponent); + } else { + return new Promise((resolve, reject) => { + resolve(TeletextComponent); + }) + } + }, + setCommand: function (...args) { + console.warn("TeletextControl.setCommand interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setTTXLanguage: function (...args) { + console.warn("TeletextControl.setTTXLanguage interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getTTXLanguage: function (...args) { + console.warn("TeletextControl.getTTXLanguage interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } + }, + setTTXRegion: function (...args) { + console.warn("TeletextControl.setTTXRegion interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getTTXRegion: function (...args) { + console.warn("TeletextControl.getTTXRegion interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, TTXRegions); + } else { + return new Promise((resolve, reject) => { + resolve(TTXRegions); + }) + } + }, + showHbbtvTtxApp: function (...args) { + console.warn("TeletextControl.showHbbtvTtxApp interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isHbbtvTtxAppVisible: function (...args) { + console.warn("TeletextControl.isHbbtvTtxAppVisible interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + isHbbtvTtxAppAvailable: function (...args) { + console.warn("TeletextControl.isHbbtvTtxAppAvailable interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + showSubtitle: function (...args) { + console.warn("TeletextControl.showSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + } + const AdControl = { + setAdEnable: function (...args) { + console.warn("AdControl.setAdEnable interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isAdEnable: function (...args) { + console.warn("AdControl.isAdEnable interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setAdBalance: function (...args) { + console.warn("AdControl.setAdBalance interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getAdBalance: function (...args) { + console.warn("AdControl.getAdBalance interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setAdToSomePort: function (...args) { + console.warn("AdControl.setAdToSomePort interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isAdToSomePort: function (...args) { + console.warn("AdControl.isAdToSomePort interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + } + const Ginga = { + init: function (...args) { + console.warn("Ginga.init interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + deinit: function (...args) { + console.warn("Ginga.deinit interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + dispatchKey: function (...args) { + console.warn("Ginga.dispatchKey interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + getAppList: function (...args) { + console.warn("Ginga.getAppList interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var stringArray = new Array(); + stringArray.push(paramMock.paramStringMock); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, stringArray); + } else { + return new Promise((resolve, reject) => { + resolve(stringArray); + }) + } + }, + startApp: function (...args) { + console.warn("Ginga.startApp interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setGraphicSurface: function (...args) { + console.warn("Ginga.setGraphicSurface interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + } + const Player = { + showVideo: function (...args) { + console.warn("Player.showVideo interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + freezeVideo: function (...args) { + console.warn("Player.freezeVideo interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isVideoFrozen: function (...args) { + console.warn("Player.isVideoFrozen interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + changeChannel: function (...args) { + console.warn("Player.changeChannel interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + stopSync: function (...args) { + console.warn("Player.stopSync interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getCurrentChannel: function (...args) { + console.warn("Player.getCurrentChannel interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Channel); + } else { + return new Promise((resolve, reject) => { + resolve(Channel); + }) + } + }, + getReplaceChannel: function (...args) { + console.warn("Player.getReplaceChannel interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Channel); + } else { + return new Promise((resolve, reject) => { + resolve(Channel); + }) + } + }, + getPreviousChannel: function (...args) { + console.warn("Player.getPreviousChannel interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Channel); + } else { + return new Promise((resolve, reject) => { + resolve(Channel); + }) + } + }, + setTimeShiftEncryption: function (...args) { + console.warn("Player.setTimeShiftEncryption interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + play: function (...args) { + console.warn("Player.play interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + pause: function (...args) { + console.warn("Player.pause interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getTimeShiftInfo: function (...args) { + console.warn("Player.getTimeShiftInfo interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, TimeShiftInfo); + } else { + return new Promise((resolve, reject) => { + resolve(TimeShiftInfo); + }) + } + }, + startTimeShift: function (...args) { + console.warn("Player.startTimeShift interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + stopTimeShift: function (...args) { + console.warn("Player.stopTimeShift interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + seek: function (...args) { + console.warn("Player.seek interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + trickPlay: function (...args) { + console.warn("Player.trickPlay interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getTrickMode: function (...args) { + console.warn("Player.getTrickMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, TrickModes); + } else { + return new Promise((resolve, reject) => { + resolve(TrickModes); + }) + } + }, + getStatus: function (...args) { + console.warn("Player.getStatus interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, PlayStatus); + } else { + return new Promise((resolve, reject) => { + resolve(PlayStatus); + }) + } + }, + setMute: function (...args) { + console.warn("Player.setMute interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getMuteStatus: function (...args) { + console.warn("Player.getMuteStatus interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setDisplay: function (...args) { + console.warn("Player.setDisplay interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + clearDisplay: function (...args) { + console.warn("Player.clearDisplay interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getCurrentAudioComponents: function (...args) { + console.warn("Player.getCurrentAudioComponents interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var audioComponentArray = new Array(); + audioComponentArray.push(AudioComponent); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, audioComponentArray); + } else { + return new Promise((resolve, reject) => { + resolve(audioComponentArray); + }) + } + }, + selectAudio: function (...args) { + console.warn("Player.selectAudio interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getCurrentAudio: function (...args) { + console.warn("Player.getCurrentAudio interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, AudioComponent); + } else { + return new Promise((resolve, reject) => { + resolve(AudioComponent); + }) + } + }, + showSubtitle: function (...args) { + console.warn("Player.showSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isSubtitleVisible: function (...args) { + console.warn("Player.isSubtitleVisible interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + pauseSubtitle: function (...args) { + console.warn("Player.pauseSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + resumeSubtitle: function (...args) { + console.warn("Player.resumeSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setSubtitleHiAvailable: function (...args) { + console.warn("Player.setSubtitleHiAvailable interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setSubtitleHiStatus: function (...args) { + console.warn("Player.setSubtitleHiStatus interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getSubtitleHiStatus: function (...args) { + console.warn("Player.getSubtitleHiStatus interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setSubtitleLanguage: function (...args) { + console.warn("Player.setSubtitleLanguage interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + selectSubtitle: function (...args) { + console.warn("Player.selectSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setSurface: function (...args) { + console.warn("Player.setSurface interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getCurrentSubtitle: function (...args) { + console.warn("Player.getCurrentSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, SubtitleComponent); + } else { + return new Promise((resolve, reject) => { + resolve(SubtitleComponent); + }) + } + }, + getTeletextControl: function (...args) { + console.warn("Player.getTeletextControl interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, TeletextControl); + } else { + return new Promise((resolve, reject) => { + resolve(TeletextControl); + }) + } + }, + releaseResource: function (...args) { + console.warn("Player.releaseResource interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + resumeResource: function (...args) { + console.warn("Player.resumeResource interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setWindowRect: function (...args) { + console.warn("Player.setWindowRect interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getWindowRect: function (...args) { + console.warn("Player.getWindowRect interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramObjectMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramObjectMock); + }) + } + }, + setClipRect: function (...args) { + console.warn("Player.setClipRect interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getClipRect: function (...args) { + console.warn("Player.getClipRect interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramObjectMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramObjectMock); + }) + } + }, + snapshot: function (...args) { + console.warn("Player.snapshot interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getTuner: function (...args) { + console.warn("Player.getTuner interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Tuner); + } else { + return new Promise((resolve, reject) => { + resolve(Tuner); + }) + } + }, + setZOrder: function (...args) { + console.warn("Player.setZOrder interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setAudioTrackMode: function (...args) { + console.warn("Player.setAudioTrackMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setAudioLanguage: function (...args) { + console.warn("Player.setAudioLanguage interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getAudioTrackMode: function (...args) { + console.warn("Player.getAudioTrackMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, AudioTrackModes); + } else { + return new Promise((resolve, reject) => { + resolve(AudioTrackModes); + }) + } + }, + setStopMode: function (...args) { + console.warn("Player.setStopMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getStopMode: function (...args) { + console.warn("Player.getStopMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, StopTypes); + } else { + return new Promise((resolve, reject) => { + resolve(StopTypes); + }) + } + }, + getVideoResolutionHeight: function (...args) { + console.warn("Player.getVideoResolutionHeight interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getVideoResolutionWidth: function (...args) { + console.warn("Player.getVideoResolutionWidth interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getFPS: function (...args) { + console.warn("Player.getFPS interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setVolume: function (...args) { + console.warn("Player.setVolume interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getVolume: function (...args) { + console.warn("Player.getVolume interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + stopAudioStreamOutput: function (...args) { + console.warn("Player.stopAudioStreamOutput interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + startAudioStreamOutput: function (...args) { + console.warn("Player.startAudioStreamOutput interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getDolbyInfoStreamType: function (...args) { + console.warn("Player.getDolbyInfoStreamType interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getDolbyInfoAcmod: function (...args) { + console.warn("Player.getDolbyInfoAcmod interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setDolbyRange: function (...args) { + console.warn("Player.setDolbyRange interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getDRARawChannel: function (...args) { + console.warn("Player.getDRARawChannel interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getAdControl: function (...args) { + console.warn("Player.getAdControl interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, AdControl); + } else { + return new Promise((resolve, reject) => { + resolve(AdControl); + }) + } + }, + ewsActionControl: function (...args) { + console.warn("Player.ewsActionControl interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getGinga: function (...args) { + console.warn("Player.getGinga interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Ginga); + } else { + return new Promise((resolve, reject) => { + resolve(Ginga); + }) + } + }, + getSupportStatus: function (...args) { + console.warn("Player.getSupportStatus interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + switchToBarkerChannelFreSync: function (...args) { + console.warn("Player.switchToBarkerChannelFreSync interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getAvFramePlaying: function (...args) { + console.warn("Player.getAvFramePlaying interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + getTimeShiftAudioComponents: function (...args) { + console.warn("Player.getTimeShiftAudioComponents interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var audioComponentArray = new Array(); + audioComponentArray.push(AudioComponent); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, audioComponentArray); + } else { + return new Promise((resolve, reject) => { + resolve(audioComponentArray); + }) + } + }, + selectTimeShiftAudio: function (...args) { + console.warn("Player.selectTimeShiftAudio interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getSubtitleFirSecLang: function (...args) { + console.warn("Player.getSubtitleFirSecLang interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var stringArray = new Array(); + stringArray.push(paramMock.paramStringMock); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, stringArray); + } else { + return new Promise((resolve, reject) => { + resolve(stringArray); + }) + } + }, + getAudioFirSecLang: function (...args) { + console.warn("Player.getAudioFirSecLang interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var stringArray = new Array(); + stringArray.push(paramMock.paramStringMock); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, stringArray); + } else { + return new Promise((resolve, reject) => { + resolve(stringArray); + }) + } + }, + setAudioType: function (...args) { + console.warn("Player.setAudioType interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getAudioType: function (...args) { + console.warn("Player.getAudioType interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, AudioTypes); + } else { + return new Promise((resolve, reject) => { + resolve(AudioTypes); + }) + } + }, + getCurrentPlayInfo: function (...args) { + console.warn("Player.getCurrentPlayInfo interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, PlayInfo); + } else { + return new Promise((resolve, reject) => { + resolve(PlayInfo); + }) + } + }, + } + const PlayerManager = { + createPlayer: function (...args) { + console.warn("PlayerManager.createPlayer interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Player); + } else { + return new Promise((resolve, reject) => { + resolve(Player); + }) + } + }, + getPlayers: function (...args) { + console.warn("PlayerManager.getPlayers interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var playerArray = new Array(); + playerArray.push(Player); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, playerArray); + } else { + return new Promise((resolve, reject) => { + resolve(playerArray); + }) + } + }, + destroyPlayer: function (...args) { + console.warn("PlayerManager.destroyPlayer interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + } + const Recorder = { + start: function (...args) { + console.warn("Recorder.start interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + startpvrEncryption: function (...args) { + console.warn("Recorder.startpvrEncryption interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getChannel: function (...args) { + console.warn("Recorder.getChannel interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Channel); + } else { + return new Promise((resolve, reject) => { + resolve(Channel); + }) + } + }, + getRecordFile: function (...args) { + console.warn("Recorder.getRecordFile interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var objectArray = new Array(); + objectArray.push(paramMock.paramObjectMock); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, objectArray); + } else { + return new Promise((resolve, reject) => { + resolve(objectArray); + }) + } + }, + stop: function (...args) { + console.warn("Recorder.stop interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getTuner: function (...args) { + console.warn("Recorder.getTuner interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Tuner); + } else { + return new Promise((resolve, reject) => { + resolve(Tuner); + }) + } + }, + getAlreadyRecordTime: function (...args) { + console.warn("Recorder.getAlreadyRecordTime interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getDuration: function (...args) { + console.warn("Recorder.getDuration interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getRecordStatus: function (...args) { + console.warn("Recorder.getRecordStatus interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Status); + } else { + return new Promise((resolve, reject) => { + resolve(Status); + }) + } + }, + } + const RecorderManager = { + createRecorder: function (...args) { + console.warn("RecorderManager.createRecorder interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Recorder); + } else { + return new Promise((resolve, reject) => { + resolve(Recorder); + }) + } + }, + getAllRecorders: function (...args) { + console.warn("RecorderManager.getAllRecorders interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Recorder); + } else { + return new Promise((resolve, reject) => { + resolve(Recorder); + }) + } + }, + destroyRecorder: function (...args) { + console.warn("RecorderManager.destroyRecorder interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + } + const PVRFilePlayer = { + start: function (...args) { + console.warn("PVRFilePlayer.start interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + start: function (...args) { + console.warn("PVRFilePlayer.start interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + stop: function (...args) { + console.warn("PVRFilePlayer.stop interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + pause: function (...args) { + console.warn("PVRFilePlayer.pause interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + resume: function (...args) { + console.warn("PVRFilePlayer.resume interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + trickPlay: function (...args) { + console.warn("PVRFilePlayer.trickPlay interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getCurrentTrickMode: function (...args) { + console.warn("PVRFilePlayer.getCurrentTrickMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, TrickModes); + } else { + return new Promise((resolve, reject) => { + resolve(TrickModes); + }) + } + }, + seekTo: function (...args) { + console.warn("PVRFilePlayer.seekTo interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getCurrentAudio: function (...args) { + console.warn("PVRFilePlayer.getCurrentAudio interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, AudioComponent); + } else { + return new Promise((resolve, reject) => { + resolve(AudioComponent); + }) + } + }, + selectAudio: function (...args) { + console.warn("PVRFilePlayer.selectAudio interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getCurrentSubtitle: function (...args) { + console.warn("PVRFilePlayer.getCurrentSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, SubtitleComponent); + } else { + return new Promise((resolve, reject) => { + resolve(SubtitleComponent); + }) + } + }, + getSubtitleComponents: function (...args) { + console.warn("PVRFilePlayer.getSubtitleComponents interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var subtitleComponentArray = new Array(); + subtitleComponentArray.push(SubtitleComponent); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, subtitleComponentArray); + } else { + return new Promise((resolve, reject) => { + resolve(subtitleComponentArray); + }) + } + }, + selectSubtitle: function (...args) { + console.warn("PVRFilePlayer.selectSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + showSubtitle: function (...args) { + console.warn("PVRFilePlayer.showSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isSubtitleVisible: function (...args) { + console.warn("PVRFilePlayer.isSubtitleVisible interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + pauseSubtitle: function (...args) { + console.warn("PVRFilePlayer.pauseSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + resumeSubtitle: function (...args) { + console.warn("PVRFilePlayer.resumeSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getTeletextControl: function (...args) { + console.warn("PVRFilePlayer.getTeletextControl interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, TeletextControl); + } else { + return new Promise((resolve, reject) => { + resolve(TeletextControl); + }) + } + }, + getCurrentPosition: function (...args) { + console.warn("PVRFilePlayer.getCurrentPosition interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setSurface: function (...args) { + console.warn("PVRFilePlayer.setSurface interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setWindowRect: function (...args) { + console.warn("PVRFilePlayer.setWindowRect interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getWindowRect: function (...args) { + console.warn("PVRFilePlayer.getWindowRect interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramObjectMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramObjectMock); + }) + } + }, + getPVRFileInfo: function (...args) { + console.warn("PVRFilePlayer.getPVRFileInfo interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, PVRFileInfo); + } else { + return new Promise((resolve, reject) => { + resolve(PVRFileInfo); + }) + } + }, + setAudioTrackMode: function (...args) { + console.warn("PVRFilePlayer.setAudioTrackMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getAudioTrackMode: function (...args) { + console.warn("PVRFilePlayer.getAudioTrackMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, AudioTrackModes); + } else { + return new Promise((resolve, reject) => { + resolve(AudioTrackModes); + }) + } + }, + getCurrentChannel: function (...args) { + console.warn("PVRFilePlayer.getCurrentChannel interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Channel); + } else { + return new Promise((resolve, reject) => { + resolve(Channel); + }) + } } - const TimeManager = { - getCalendarTime: function (...args) { - console.warn("TimeManager.getCalendarTime interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramObjectMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramObjectMock); - }) - } - }, - setCalendarTime: function (...args) { - console.warn("TimeManager.setCalendarTime interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramObjectMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramObjectMock); - }) - } - }, - getTimeZone: function (...args) { - console.warn("TimeManager.getTimeZone interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setTimeZone: function (...args) { - console.warn("TimeManager.setTimeZone interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - secondToDate: function (...args) { - console.warn("TimeManager.secondToDate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramObjectMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramObjectMock); - }) - } - }, - dateToSecond: function (...args) { - console.warn("TimeManager.dateToSecond interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - syncTime: function (...args) { - console.warn("TimeManager.syncTime interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSyncTimeFlag: function (...args) { - console.warn("TimeManager.getSyncTimeFlag interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - syncTimeZone: function (...args) { - console.warn("TimeManager.syncTimeZone interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSyncTimeZoneFlag: function (...args) { - console.warn("TimeManager.getSyncTimeZoneFlag interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getSleepTime: function (...args) { - console.warn("TimeManager.getSleepTime interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setWakeupInternal: function (...args) { - console.warn("TimeManager.setWakeupInternal interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setTimeToSystem: function (...args) { - console.warn("TimeManager.setTimeToSystem interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - syncDaylight: function (...args) { - console.warn("TimeManager.syncDaylight interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSyncDaylightFlag: function (...args) { - console.warn("TimeManager.getSyncDaylightFlag interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setDaylight: function (...args) { - console.warn("TimeManager.setDaylight interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getDaylight: function (...args) { - console.warn("TimeManager.getDaylight interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, + } + const PVRFileManager = { + delete: function (...args) { + console.warn("PVRFileManager.delete interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + rename: function (...args) { + console.warn("PVRFileManager.rename interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setUserData: function (...args) { + console.warn("PVRFileManager.setUserData interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getUserData: function (...args) { + console.warn("PVRFileManager.getUserData interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } } - const NetworkManager = { - getAllSupportNetworks: function (...args) { - console.warn("NetworkManager.getAllSupportNetworks interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var networkArray = new Array(); - networkArray.push(Network); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, networkArray); - } else { - return new Promise((resolve, reject) => { - resolve(networkArray); - }) - } - }, - getNetworks: function (...args) { - console.warn("NetworkManager.getNetworks interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var networkArray = new Array(); - networkArray.push(Network); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, networkArray); - } else { - return new Promise((resolve, reject) => { - resolve(networkArray); - }) - } - }, - getNetworks: function (...args) { - console.warn("NetworkManager.getNetworks interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var networkArray = new Array(); - networkArray.push(Network); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, networkArray); - } else { - return new Promise((resolve, reject) => { - resolve(networkArray); - }) - } - }, - getCurrentNetworkType: function (...args) { - console.warn("NetworkManager.getCurrentNetworkType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, NetworkTypes); - } else { - return new Promise((resolve, reject) => { - resolve(NetworkTypes); - }) - } - }, - setCurrentNetworkType: function (...args) { - console.warn("NetworkManager.setCurrentNetworkType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - createNetwork: function (...args) { - console.warn("NetworkManager.createNetwork interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Network); - } else { - return new Promise((resolve, reject) => { - resolve(Network); - }) - } - }, - getNetworkById: function (...args) { - console.warn("NetworkManager.getNetworkById interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Network); - } else { - return new Promise((resolve, reject) => { - resolve(Network); - }) - } - }, - removeNetwork: function (...args) { - console.warn("NetworkManager.removeNetwork interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - removeAllSatellite: function (...args) { - console.warn("NetworkManager.removeAllSatellite interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - clearNetworks: function (...args) { - console.warn("NetworkManager.clearNetworks interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - saveNetworks: function (...args) { - console.warn("NetworkManager.saveNetworks interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - recoverNetworks: function (...args) { - console.warn("NetworkManager.recoverNetworks interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTimeManager: function (...args) { - console.warn("NetworkManager.getTimeManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, TimeManager); - } else { - return new Promise((resolve, reject) => { - resolve(TimeManager); - }) - } - }, - setNetworkType: function (...args) { - console.warn("NetworkManager.setNetworkType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, + } + const DTVManager = { + prepareDTV: function (...args) { + console.warn("DTVManager.prepareDTV interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + unPrepareDTV: function (...args) { + console.warn("DTVManager.unPrepareDTV interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + releaseDTVMem: function (...args) { + console.warn("DTVManager.releaseDTVMem interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + resumeDTVMem: function (...args) { + console.warn("DTVManager.resumeDTVMem interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + onStandby: function (...args) { + console.warn("DTVManager.onStandby interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + onWakeup: function (...args) { + console.warn("DTVManager.onWakeup interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setCountry: function (...args) { + console.warn("DTVManager.setCountry interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getCountry: function (...args) { + console.warn("DTVManager.getCountry interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } + }, + setAreaCode: function (...args) { + console.warn("DTVManager.setAreaCode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getAreaCode: function (...args) { + console.warn("DTVManager.getAreaCode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setSysLang: function (...args) { + console.warn("DTVManager.setSysLang interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getSysLang: function (...args) { + console.warn("DTVManager.getSysLang interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var subtitleComponentArray = new Array(); + subtitleComponentArray.push(SubtitleComponent); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } + }, + setScreenBlueEnable: function (...args) { + console.warn("DTVManager.setScreenBlueEnable interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getScreenBlueEnable: function (...args) { + console.warn("DTVManager.getScreenBlueEnable interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setDtvSystem: function (...args) { + console.warn("DTVManager.setDtvSystem interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getDtvSystem: function (...args) { + console.warn("DTVManager.getDtvSystem interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, DtvSystems); + } else { + return new Promise((resolve, reject) => { + resolve(DtvSystems); + }) + } + }, + setFeFakeMode: function (...args) { + console.warn("DTVManager.setFeFakeMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getJavaAPIVersion: function (...args) { + console.warn("DTVManager.getJavaAPIVersion interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } } - const SubtitleComponent = { - getLanguageCode: function (...args) { - console.warn("SubtitleComponent.getLanguageCode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getSubtitleType: function (...args) { - console.warn("SubtitleComponent.getSubtitleType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, SubtitleTypes); - } else { - return new Promise((resolve, reject) => { - resolve(SubtitleTypes); - }) - } - }, - getSubtComponentType: function (...args) { - console.warn("SubtitleComponent.getSubtComponentType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, SubtComponentTypes); - } else { - return new Promise((resolve, reject) => { - resolve(SubtComponentTypes); - }) - } - }, - getPID: function (...args) { - console.warn("SubtitleComponent.getPID interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getMagazingNum: function (...args) { - console.warn("SubtitleComponent.getMagazingNum interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getPageNum: function (...args) { - console.warn("SubtitleComponent.getPageNum interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getPos: function (...args) { - console.warn("SubtitleComponent.getPos interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isHdSubtitle: function (...args) { - console.warn("SubtitleComponent.isHdSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getSubtComponentTag: function (...args) { - console.warn("SubtitleComponent.getSubtComponentTag interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, + } + const ClosedCaptionManager = { + getUsedCCLists: function (...args) { + console.warn("ClosedCaptionManager.getUsedCCLists interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var closedCaptionListArray = new Array(); + closedCaptionListArray.push(ClosedCaptionList); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, closedCaptionListArray); + } else { + return new Promise((resolve, reject) => { + resolve(closedCaptionListArray); + }) + } + }, + getCurrentCC: function (...args) { + console.warn("ClosedCaptionManager.getCurrentCC interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ClosedCaptionComponent); + } else { + return new Promise((resolve, reject) => { + resolve(ClosedCaptionComponent); + }) + } + }, + isCCVisible: function (...args) { + console.warn("ClosedCaptionManager.isCCVisible interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + showCC: function (...args) { + console.warn("ClosedCaptionManager.showCC interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + showCC: function (...args) { + console.warn("ClosedCaptionManager.showCC interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isCCShow: function (...args) { + console.warn("ClosedCaptionManager.isCCShow interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setAnalogSelector: function (...args) { + console.warn("ClosedCaptionManager.setAnalogSelector interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getAnalogSelector: function (...args) { + console.warn("ClosedCaptionManager.setAnalogSelector interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, CCAnalogSelectors); + } else { + return new Promise((resolve, reject) => { + resolve(CCAnalogSelectors); + }) + } + }, + setDigitalSelector: function (...args) { + console.warn("ClosedCaptionManager.setDigitalSelector interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getDigitalSelector: function (...args) { + console.warn("ClosedCaptionManager.getDigitalSelector interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, CCDigitalSelectors); + } else { + return new Promise((resolve, reject) => { + resolve(CCDigitalSelectors); + }) + } + }, + setFontSize: function (...args) { + console.warn("ClosedCaptionManager.setFontSize interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getFontSize: function (...args) { + console.warn("ClosedCaptionManager.getFontSize interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, FontSizes); + } else { + return new Promise((resolve, reject) => { + resolve(FontSizes); + }) + } + }, + setFontStyle: function (...args) { + console.warn("ClosedCaptionManager.setFontStyle interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getFontStyle: function (...args) { + console.warn("ClosedCaptionManager.getFontStyle interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, FontStyles); + } else { + return new Promise((resolve, reject) => { + resolve(FontStyles); + }) + } + }, + setFontColor: function (...args) { + console.warn("ClosedCaptionManager.setFontColor interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getFontColor: function (...args) { + console.warn("ClosedCaptionManager.getFontColor interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Colors); + } else { + return new Promise((resolve, reject) => { + resolve(Colors); + }) + } + }, + setFontOpacity: function (...args) { + console.warn("ClosedCaptionManager.setFontOpacity interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getFontOpacity: function (...args) { + console.warn("ClosedCaptionManager.getFontOpacity interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Opacities); + } else { + return new Promise((resolve, reject) => { + resolve(Opacities); + }) + } + }, + setBackgroundColor: function (...args) { + console.warn("ClosedCaptionManager.setBackgroundColor interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getBackgroundColor: function (...args) { + console.warn("ClosedCaptionManager.getBackgroundColor interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Colors); + } else { + return new Promise((resolve, reject) => { + resolve(Colors); + }) + } + }, + setBackgroundOpacity: function (...args) { + console.warn("ClosedCaptionManager.setBackgroundOpacity interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getBackgroundOpacity: function (...args) { + console.warn("ClosedCaptionManager.getBackgroundOpacity interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Opacities); + } else { + return new Promise((resolve, reject) => { + resolve(Opacities); + }) + } + }, + setFontEdgeEffect: function (...args) { + console.warn("ClosedCaptionManager.setFontEdgeEffect interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getFontEdgeEffect: function (...args) { + console.warn("ClosedCaptionManager.getFontEdgeEffect interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, FontEdgeEffects); + } else { + return new Promise((resolve, reject) => { + resolve(FontEdgeEffects); + }) + } + }, + setFontEdgeColor: function (...args) { + console.warn("ClosedCaptionManager.setFontEdgeColor interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getFontEdgeColor: function (...args) { + console.warn("ClosedCaptionManager.getFontEdgeColor interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Colors); + } else { + return new Promise((resolve, reject) => { + resolve(Colors); + }) + } } - const TeletextControl = { - showTTX: function (...args) { - console.warn("TeletextControl.showTTX interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isTTXVisible: function (...args) { - console.warn("TeletextControl.isTTXVisible interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isTTXAvailable: function (...args) { - console.warn("TeletextControl.isTTXAvailable interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getCurrentTTX: function (...args) { - console.warn("TeletextControl.getCurrentTTX interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, TeletextComponent); - } else { - return new Promise((resolve, reject) => { - resolve(TeletextComponent); - }) - } - }, - setCommand: function (...args) { - console.warn("TeletextControl.setCommand interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setTTXLanguage: function (...args) { - console.warn("TeletextControl.setTTXLanguage interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTTXLanguage: function (...args) { - console.warn("TeletextControl.getTTXLanguage interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - setTTXRegion: function (...args) { - console.warn("TeletextControl.setTTXRegion interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTTXRegion: function (...args) { - console.warn("TeletextControl.getTTXRegion interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, TTXRegions); - } else { - return new Promise((resolve, reject) => { - resolve(TTXRegions); - }) - } - }, - showHbbtvTtxApp: function (...args) { - console.warn("TeletextControl.showHbbtvTtxApp interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isHbbtvTtxAppVisible: function (...args) { - console.warn("TeletextControl.isHbbtvTtxAppVisible interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isHbbtvTtxAppAvailable: function (...args) { - console.warn("TeletextControl.isHbbtvTtxAppAvailable interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - showSubtitle: function (...args) { - console.warn("TeletextControl.showSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, + } + const DtvEventManager = { + on: function (...args) { + console.warn("DtvEventManager.on interface mocked in the Previewer. How this interface works on the Previewer may" + + " be different from that on a real device.") + }, + off: function (...args) { + console.warn("DtvEventManager.off interface mocked in the Previewer. How this interface works on the Previewer may" + + " be different from that on a real device.") } - const AdControl = { - setAdEnable: function (...args) { - console.warn("AdControl.setAdEnable interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isAdEnable: function (...args) { - console.warn("AdControl.isAdEnable interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setAdBalance: function (...args) { - console.warn("AdControl.setAdBalance interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAdBalance: function (...args) { - console.warn("AdControl.getAdBalance interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setAdToSomePort: function (...args) { - console.warn("AdControl.setAdToSomePort interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isAdToSomePort: function (...args) { - console.warn("AdControl.isAdToSomePort interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - } - const Ginga = { - init: function (...args) { - console.warn("Ginga.init interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - deinit: function (...args) { - console.warn("Ginga.deinit interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - dispatchKey: function (...args) { - console.warn("Ginga.dispatchKey interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getAppList: function (...args) { - console.warn("Ginga.getAppList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var stringArray = new Array(); - stringArray.push(paramMock.paramStringMock); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, stringArray); - } else { - return new Promise((resolve, reject) => { - resolve(stringArray); - }) - } - }, - startApp: function (...args) { - console.warn("Ginga.startApp interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setGraphicSurface: function (...args) { - console.warn("Ginga.setGraphicSurface interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - } - const Player = { - showVideo: function (...args) { - console.warn("Player.showVideo interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - freezeVideo: function (...args) { - console.warn("Player.freezeVideo interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isVideoFrozen: function (...args) { - console.warn("Player.isVideoFrozen interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - changeChannel: function (...args) { - console.warn("Player.changeChannel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - stopSync: function (...args) { - console.warn("Player.stopSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getCurrentChannel: function (...args) { - console.warn("Player.getCurrentChannel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Channel); - } else { - return new Promise((resolve, reject) => { - resolve(Channel); - }) - } - }, - getReplaceChannel: function (...args) { - console.warn("Player.getReplaceChannel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Channel); - } else { - return new Promise((resolve, reject) => { - resolve(Channel); - }) - } - }, - getPreviousChannel: function (...args) { - console.warn("Player.getPreviousChannel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Channel); - } else { - return new Promise((resolve, reject) => { - resolve(Channel); - }) - } - }, - setTimeShiftEncryption: function (...args) { - console.warn("Player.setTimeShiftEncryption interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - play: function (...args) { - console.warn("Player.play interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - pause: function (...args) { - console.warn("Player.pause interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTimeShiftInfo: function (...args) { - console.warn("Player.getTimeShiftInfo interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, TimeShiftInfo); - } else { - return new Promise((resolve, reject) => { - resolve(TimeShiftInfo); - }) - } - }, - startTimeShift: function (...args) { - console.warn("Player.startTimeShift interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - stopTimeShift: function (...args) { - console.warn("Player.stopTimeShift interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - seek: function (...args) { - console.warn("Player.seek interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - trickPlay: function (...args) { - console.warn("Player.trickPlay interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTrickMode: function (...args) { - console.warn("Player.getTrickMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, TrickModes); - } else { - return new Promise((resolve, reject) => { - resolve(TrickModes); - }) - } - }, - getStatus: function (...args) { - console.warn("Player.getStatus interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, PlayStatus); - } else { - return new Promise((resolve, reject) => { - resolve(PlayStatus); - }) - } - }, - setMute: function (...args) { - console.warn("Player.setMute interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getMuteStatus: function (...args) { - console.warn("Player.getMuteStatus interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setDisplay: function (...args) { - console.warn("Player.setDisplay interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - clearDisplay: function (...args) { - console.warn("Player.clearDisplay interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getCurrentAudioComponents: function (...args) { - console.warn("Player.getCurrentAudioComponents interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var audioComponentArray = new Array(); - audioComponentArray.push(AudioComponent); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, audioComponentArray); - } else { - return new Promise((resolve, reject) => { - resolve(audioComponentArray); - }) - } - }, - selectAudio: function (...args) { - console.warn("Player.selectAudio interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getCurrentAudio: function (...args) { - console.warn("Player.getCurrentAudio interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, AudioComponent); - } else { - return new Promise((resolve, reject) => { - resolve(AudioComponent); - }) - } - }, - showSubtitle: function (...args) { - console.warn("Player.showSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isSubtitleVisible: function (...args) { - console.warn("Player.isSubtitleVisible interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - pauseSubtitle: function (...args) { - console.warn("Player.pauseSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - resumeSubtitle: function (...args) { - console.warn("Player.resumeSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setSubtitleHiAvailable: function (...args) { - console.warn("Player.setSubtitleHiAvailable interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setSubtitleHiStatus: function (...args) { - console.warn("Player.setSubtitleHiStatus interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSubtitleHiStatus: function (...args) { - console.warn("Player.getSubtitleHiStatus interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setSubtitleLanguage: function (...args) { - console.warn("Player.setSubtitleLanguage interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - selectSubtitle: function (...args) { - console.warn("Player.selectSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setSurface: function (...args) { - console.warn("Player.setSurface interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getCurrentSubtitle: function (...args) { - console.warn("Player.getCurrentSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, SubtitleComponent); - } else { - return new Promise((resolve, reject) => { - resolve(SubtitleComponent); - }) - } - }, - getTeletextControl: function (...args) { - console.warn("Player.getTeletextControl interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, TeletextControl); - } else { - return new Promise((resolve, reject) => { - resolve(TeletextControl); - }) - } - }, - releaseResource: function (...args) { - console.warn("Player.releaseResource interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - resumeResource: function (...args) { - console.warn("Player.resumeResource interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setWindowRect: function (...args) { - console.warn("Player.setWindowRect interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getWindowRect: function (...args) { - console.warn("Player.getWindowRect interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramObjectMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramObjectMock); - }) - } - }, - setClipRect: function (...args) { - console.warn("Player.setClipRect interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getClipRect: function (...args) { - console.warn("Player.getClipRect interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramObjectMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramObjectMock); - }) - } - }, - snapshot: function (...args) { - console.warn("Player.snapshot interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTuner: function (...args) { - console.warn("Player.getTuner interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Tuner); - } else { - return new Promise((resolve, reject) => { - resolve(Tuner); - }) - } - }, - setZOrder: function (...args) { - console.warn("Player.setZOrder interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setAudioTrackMode: function (...args) { - console.warn("Player.setAudioTrackMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setAudioLanguage: function (...args) { - console.warn("Player.setAudioLanguage interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAudioTrackMode: function (...args) { - console.warn("Player.getAudioTrackMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, AudioTrackModes); - } else { - return new Promise((resolve, reject) => { - resolve(AudioTrackModes); - }) - } - }, - setStopMode: function (...args) { - console.warn("Player.setStopMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getStopMode: function (...args) { - console.warn("Player.getStopMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, StopTypes); - } else { - return new Promise((resolve, reject) => { - resolve(StopTypes); - }) - } - }, - getVideoResolutionHeight: function (...args) { - console.warn("Player.getVideoResolutionHeight interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getVideoResolutionWidth: function (...args) { - console.warn("Player.getVideoResolutionWidth interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getFPS: function (...args) { - console.warn("Player.getFPS interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setVolume: function (...args) { - console.warn("Player.setVolume interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getVolume: function (...args) { - console.warn("Player.getVolume interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - stopAudioStreamOutput: function (...args) { - console.warn("Player.stopAudioStreamOutput interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - startAudioStreamOutput: function (...args) { - console.warn("Player.startAudioStreamOutput interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getDolbyInfoStreamType: function (...args) { - console.warn("Player.getDolbyInfoStreamType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getDolbyInfoAcmod: function (...args) { - console.warn("Player.getDolbyInfoAcmod interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setDolbyRange: function (...args) { - console.warn("Player.setDolbyRange interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getDRARawChannel: function (...args) { - console.warn("Player.getDRARawChannel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAdControl: function (...args) { - console.warn("Player.getAdControl interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, AdControl); - } else { - return new Promise((resolve, reject) => { - resolve(AdControl); - }) - } - }, - ewsActionControl: function (...args) { - console.warn("Player.ewsActionControl interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getGinga: function (...args) { - console.warn("Player.getGinga interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Ginga); - } else { - return new Promise((resolve, reject) => { - resolve(Ginga); - }) - } - }, - getSupportStatus: function (...args) { - console.warn("Player.getSupportStatus interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - switchToBarkerChannelFreSync: function (...args) { - console.warn("Player.switchToBarkerChannelFreSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAvFramePlaying: function (...args) { - console.warn("Player.getAvFramePlaying interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getTimeShiftAudioComponents: function (...args) { - console.warn("Player.getTimeShiftAudioComponents interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var audioComponentArray = new Array(); - audioComponentArray.push(AudioComponent); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, audioComponentArray); - } else { - return new Promise((resolve, reject) => { - resolve(audioComponentArray); - }) - } - }, - selectTimeShiftAudio: function (...args) { - console.warn("Player.selectTimeShiftAudio interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSubtitleFirSecLang: function (...args) { - console.warn("Player.getSubtitleFirSecLang interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var stringArray = new Array(); - stringArray.push(paramMock.paramStringMock); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, stringArray); - } else { - return new Promise((resolve, reject) => { - resolve(stringArray); - }) - } - }, - getAudioFirSecLang: function (...args) { - console.warn("Player.getAudioFirSecLang interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var stringArray = new Array(); - stringArray.push(paramMock.paramStringMock); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, stringArray); - } else { - return new Promise((resolve, reject) => { - resolve(stringArray); - }) - } - }, - setAudioType: function (...args) { - console.warn("Player.setAudioType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAudioType: function (...args) { - console.warn("Player.getAudioType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, AudioTypes); - } else { - return new Promise((resolve, reject) => { - resolve(AudioTypes); - }) - } - }, - getCurrentPlayInfo: function (...args) { - console.warn("Player.getCurrentPlayInfo interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, PlayInfo); - } else { - return new Promise((resolve, reject) => { - resolve(PlayInfo); - }) - } - }, - } - const PlayerManager = { - createPlayer: function (...args) { - console.warn("PlayerManager.createPlayer interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Player); - } else { - return new Promise((resolve, reject) => { - resolve(Player); - }) - } - }, - getPlayers: function (...args) { - console.warn("PlayerManager.getPlayers interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var playerArray = new Array(); - playerArray.push(Player); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, playerArray); - } else { - return new Promise((resolve, reject) => { - resolve(playerArray); - }) - } - }, - destroyPlayer: function (...args) { - console.warn("PlayerManager.destroyPlayer interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - } - const Recorder = { - start: function (...args) { - console.warn("Recorder.start interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - startpvrEncryption: function (...args) { - console.warn("Recorder.startpvrEncryption interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getChannel: function (...args) { - console.warn("Recorder.getChannel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Channel); - } else { - return new Promise((resolve, reject) => { - resolve(Channel); - }) - } - }, - getRecordFile: function (...args) { - console.warn("Recorder.getRecordFile interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var objectArray = new Array(); - objectArray.push(paramMock.paramObjectMock); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, objectArray); - } else { - return new Promise((resolve, reject) => { - resolve(objectArray); - }) - } - }, - stop: function (...args) { - console.warn("Recorder.stop interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTuner: function (...args) { - console.warn("Recorder.getTuner interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Tuner); - } else { - return new Promise((resolve, reject) => { - resolve(Tuner); - }) - } - }, - getAlreadyRecordTime: function (...args) { - console.warn("Recorder.getAlreadyRecordTime interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getDuration: function (...args) { - console.warn("Recorder.getDuration interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getRecordStatus: function (...args) { - console.warn("Recorder.getRecordStatus interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Status); - } else { - return new Promise((resolve, reject) => { - resolve(Status); - }) - } - }, - } - const RecorderManager = { - createRecorder: function (...args) { - console.warn("RecorderManager.createRecorder interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Recorder); - } else { - return new Promise((resolve, reject) => { - resolve(Recorder); - }) - } - }, - getAllRecorders: function (...args) { - console.warn("RecorderManager.getAllRecorders interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Recorder); - } else { - return new Promise((resolve, reject) => { - resolve(Recorder); - }) - } - }, - destroyRecorder: function (...args) { - console.warn("RecorderManager.destroyRecorder interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - } - const PVRFilePlayer = { - start: function (...args) { - console.warn("PVRFilePlayer.start interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - start: function (...args) { - console.warn("PVRFilePlayer.start interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - stop: function (...args) { - console.warn("PVRFilePlayer.stop interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - pause: function (...args) { - console.warn("PVRFilePlayer.pause interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - resume: function (...args) { - console.warn("PVRFilePlayer.resume interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - trickPlay: function (...args) { - console.warn("PVRFilePlayer.trickPlay interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getCurrentTrickMode: function (...args) { - console.warn("PVRFilePlayer.getCurrentTrickMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, TrickModes); - } else { - return new Promise((resolve, reject) => { - resolve(TrickModes); - }) - } - }, - seekTo: function (...args) { - console.warn("PVRFilePlayer.seekTo interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getCurrentAudio: function (...args) { - console.warn("PVRFilePlayer.getCurrentAudio interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, AudioComponent); - } else { - return new Promise((resolve, reject) => { - resolve(AudioComponent); - }) - } - }, - selectAudio: function (...args) { - console.warn("PVRFilePlayer.selectAudio interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getCurrentSubtitle: function (...args) { - console.warn("PVRFilePlayer.getCurrentSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, SubtitleComponent); - } else { - return new Promise((resolve, reject) => { - resolve(SubtitleComponent); - }) - } - }, - getSubtitleComponents: function (...args) { - console.warn("PVRFilePlayer.getSubtitleComponents interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var subtitleComponentArray = new Array(); - subtitleComponentArray.push(SubtitleComponent); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, subtitleComponentArray); - } else { - return new Promise((resolve, reject) => { - resolve(subtitleComponentArray); - }) - } - }, - selectSubtitle: function (...args) { - console.warn("PVRFilePlayer.selectSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - showSubtitle: function (...args) { - console.warn("PVRFilePlayer.showSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isSubtitleVisible: function (...args) { - console.warn("PVRFilePlayer.isSubtitleVisible interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - pauseSubtitle: function (...args) { - console.warn("PVRFilePlayer.pauseSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - resumeSubtitle: function (...args) { - console.warn("PVRFilePlayer.resumeSubtitle interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTeletextControl: function (...args) { - console.warn("PVRFilePlayer.getTeletextControl interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, TeletextControl); - } else { - return new Promise((resolve, reject) => { - resolve(TeletextControl); - }) - } - }, - getCurrentPosition: function (...args) { - console.warn("PVRFilePlayer.getCurrentPosition interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setSurface: function (...args) { - console.warn("PVRFilePlayer.setSurface interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setWindowRect: function (...args) { - console.warn("PVRFilePlayer.setWindowRect interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getWindowRect: function (...args) { - console.warn("PVRFilePlayer.getWindowRect interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramObjectMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramObjectMock); - }) - } - }, - getPVRFileInfo: function (...args) { - console.warn("PVRFilePlayer.getPVRFileInfo interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, PVRFileInfo); - } else { - return new Promise((resolve, reject) => { - resolve(PVRFileInfo); - }) - } - }, - setAudioTrackMode: function (...args) { - console.warn("PVRFilePlayer.setAudioTrackMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAudioTrackMode: function (...args) { - console.warn("PVRFilePlayer.getAudioTrackMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, AudioTrackModes); - } else { - return new Promise((resolve, reject) => { - resolve(AudioTrackModes); - }) - } - }, - getCurrentChannel: function (...args) { - console.warn("PVRFilePlayer.getCurrentChannel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Channel); - } else { - return new Promise((resolve, reject) => { - resolve(Channel); - }) - } - } - } - const PVRFileManager = { - delete: function (...args) { - console.warn("PVRFileManager.delete interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - rename: function (...args) { - console.warn("PVRFileManager.rename interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setUserData: function (...args) { - console.warn("PVRFileManager.setUserData interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getUserData: function (...args) { - console.warn("PVRFileManager.getUserData interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - } - } - const DTVManager = { - prepareDTV: function (...args) { - console.warn("DTVManager.prepareDTV interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - unPrepareDTV: function (...args) { - console.warn("DTVManager.unPrepareDTV interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - releaseDTVMem: function (...args) { - console.warn("DTVManager.releaseDTVMem interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - resumeDTVMem: function (...args) { - console.warn("DTVManager.resumeDTVMem interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - onStandby: function (...args) { - console.warn("DTVManager.onStandby interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - onWakeup: function (...args) { - console.warn("DTVManager.onWakeup interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setCountry: function (...args) { - console.warn("DTVManager.setCountry interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getCountry: function (...args) { - console.warn("DTVManager.getCountry interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - setAreaCode: function (...args) { - console.warn("DTVManager.setAreaCode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAreaCode: function (...args) { - console.warn("DTVManager.getAreaCode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setSysLang: function (...args) { - console.warn("DTVManager.setSysLang interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSysLang: function (...args) { - console.warn("DTVManager.getSysLang interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var subtitleComponentArray = new Array(); - subtitleComponentArray.push(SubtitleComponent); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - setScreenBlueEnable: function (...args) { - console.warn("DTVManager.setScreenBlueEnable interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getScreenBlueEnable: function (...args) { - console.warn("DTVManager.getScreenBlueEnable interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setDtvSystem: function (...args) { - console.warn("DTVManager.setDtvSystem interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getDtvSystem: function (...args) { - console.warn("DTVManager.getDtvSystem interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, DtvSystems); - } else { - return new Promise((resolve, reject) => { - resolve(DtvSystems); - }) - } - }, - setFeFakeMode: function (...args) { - console.warn("DTVManager.setFeFakeMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getJavaAPIVersion: function (...args) { - console.warn("DTVManager.getJavaAPIVersion interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - } - } - const ClosedCaptionManager = { - getUsedCCLists: function (...args) { - console.warn("ClosedCaptionManager.getUsedCCLists interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var closedCaptionListArray = new Array(); - closedCaptionListArray.push(ClosedCaptionList); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, closedCaptionListArray); - } else { - return new Promise((resolve, reject) => { - resolve(closedCaptionListArray); - }) - } - }, - getCurrentCC: function (...args) { - console.warn("ClosedCaptionManager.getCurrentCC interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ClosedCaptionComponent); - } else { - return new Promise((resolve, reject) => { - resolve(ClosedCaptionComponent); - }) - } - }, - isCCVisible: function (...args) { - console.warn("ClosedCaptionManager.isCCVisible interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - showCC: function (...args) { - console.warn("ClosedCaptionManager.showCC interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - showCC: function (...args) { - console.warn("ClosedCaptionManager.showCC interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isCCShow: function (...args) { - console.warn("ClosedCaptionManager.isCCShow interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setAnalogSelector: function (...args) { - console.warn("ClosedCaptionManager.setAnalogSelector interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAnalogSelector: function (...args) { - console.warn("ClosedCaptionManager.setAnalogSelector interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, CCAnalogSelectors); - } else { - return new Promise((resolve, reject) => { - resolve(CCAnalogSelectors); - }) - } - }, - setDigitalSelector: function (...args) { - console.warn("ClosedCaptionManager.setDigitalSelector interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getDigitalSelector: function (...args) { - console.warn("ClosedCaptionManager.getDigitalSelector interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, CCDigitalSelectors); - } else { - return new Promise((resolve, reject) => { - resolve(CCDigitalSelectors); - }) - } - }, - setFontSize: function (...args) { - console.warn("ClosedCaptionManager.setFontSize interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getFontSize: function (...args) { - console.warn("ClosedCaptionManager.getFontSize interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, FontSizes); - } else { - return new Promise((resolve, reject) => { - resolve(FontSizes); - }) - } - }, - setFontStyle: function (...args) { - console.warn("ClosedCaptionManager.setFontStyle interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getFontStyle: function (...args) { - console.warn("ClosedCaptionManager.getFontStyle interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, FontStyles); - } else { - return new Promise((resolve, reject) => { - resolve(FontStyles); - }) - } - }, - setFontColor: function (...args) { - console.warn("ClosedCaptionManager.setFontColor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getFontColor: function (...args) { - console.warn("ClosedCaptionManager.getFontColor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Colors); - } else { - return new Promise((resolve, reject) => { - resolve(Colors); - }) - } - }, - setFontOpacity: function (...args) { - console.warn("ClosedCaptionManager.setFontOpacity interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getFontOpacity: function (...args) { - console.warn("ClosedCaptionManager.getFontOpacity interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Opacities); - } else { - return new Promise((resolve, reject) => { - resolve(Opacities); - }) - } - }, - setBackgroundColor: function (...args) { - console.warn("ClosedCaptionManager.setBackgroundColor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getBackgroundColor: function (...args) { - console.warn("ClosedCaptionManager.getBackgroundColor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Colors); - } else { - return new Promise((resolve, reject) => { - resolve(Colors); - }) - } - }, - setBackgroundOpacity: function (...args) { - console.warn("ClosedCaptionManager.setBackgroundOpacity interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getBackgroundOpacity: function (...args) { - console.warn("ClosedCaptionManager.getBackgroundOpacity interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Opacities); - } else { - return new Promise((resolve, reject) => { - resolve(Opacities); - }) - } - }, - setFontEdgeEffect: function (...args) { - console.warn("ClosedCaptionManager.setFontEdgeEffect interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getFontEdgeEffect: function (...args) { - console.warn("ClosedCaptionManager.getFontEdgeEffect interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, FontEdgeEffects); - } else { - return new Promise((resolve, reject) => { - resolve(FontEdgeEffects); - }) - } - }, - setFontEdgeColor: function (...args) { - console.warn("ClosedCaptionManager.setFontEdgeColor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getFontEdgeColor: function (...args) { - console.warn("ClosedCaptionManager.getFontEdgeColor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Colors); - } else { - return new Promise((resolve, reject) => { - resolve(Colors); - }) - } - } - } - const DtvEventManager = { - on: function (...args) { - console.warn("DtvEventManager.on interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - off: function (...args) { - console.warn("DtvEventManager.off interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - } - } - return result; + } + return result; } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/emitter.js b/runtime/main/extend/systemplugin/napi/emitter.js index 981c9a0f..ccc47fcf 100644 --- a/runtime/main/extend/systemplugin/napi/emitter.js +++ b/runtime/main/extend/systemplugin/napi/emitter.js @@ -1,34 +1,49 @@ -import {paramMock} from "../utils" +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "../utils" export function mockEmitter() { - const EventDataMock = { - data: '[PC preview] unknow data', - }; - const emitter = { - on: function (...args) { - console.warn("emitter.on interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, EventDataMock); - } - }, - once: function (...args) { - console.warn("emitter.once interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, EventDataMock); - } - }, - off: function (...args) { - console.warn("emitter.off interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - }, - emit: function (...args) { - console.warn("emitter.emit interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - }, - } - return emitter + const EventDataMock = { + data: '[PC preview] unknow data', + }; + const emitter = { + on: function (...args) { + console.warn("emitter.on interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, EventDataMock); + } + }, + once: function (...args) { + console.warn("emitter.once interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, EventDataMock); + } + }, + off: function (...args) { + console.warn("emitter.off interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + }, + emit: function (...args) { + console.warn("emitter.emit interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + }, + } + return emitter } diff --git a/runtime/main/extend/systemplugin/napi/environment.js b/runtime/main/extend/systemplugin/napi/environment.js new file mode 100644 index 00000000..e2671a3f --- /dev/null +++ b/runtime/main/extend/systemplugin/napi/environment.js @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "../utils" + +export function mockEnvironment() { + const environment = { + getStorageDataDir: function (...args) { + console.warn("environment.getStorageDataDir interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock) + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } + }, + getUserDataDir: function (...args) { + console.warn("environment.getUserDataDir interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock) + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } + } + } + return environment; +} diff --git a/runtime/main/extend/systemplugin/napi/fileio.js b/runtime/main/extend/systemplugin/napi/fileio.js index 8bc27d06..840163b0 100644 --- a/runtime/main/extend/systemplugin/napi/fileio.js +++ b/runtime/main/extend/systemplugin/napi/fileio.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" export function mockFileio() { @@ -200,7 +215,6 @@ export function mockFileio() { stop: function () { console.warn("Watcher.stop interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") - return } }; const fileioMock = { @@ -241,7 +255,6 @@ export function mockFileio() { chmodSync: function (...args) { console.warn("fileio.chmodSync interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") - return }, chown: function (...args) { console.warn("fileio.chown interface mocked in the Previewer. How this interface works on the Previewer may" + @@ -258,7 +271,6 @@ export function mockFileio() { chownSync: function (...args) { console.warn("fileio.chownSync interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") - return }, close: function (...args) { console.warn("fileio.close interface mocked in the Previewer. How this interface works on the Previewer may" + @@ -275,7 +287,6 @@ export function mockFileio() { closeSync: function (...args) { console.warn("fileio.closeSync interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") - return }, copyFile: function (...args) { console.warn("fileio.copyFile interface mocked in the Previewer. How this interface works on the Previewer may" + @@ -335,7 +346,6 @@ export function mockFileio() { fchmodSync: function (...args) { console.warn("fileio.fchmodSync interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") - return }, fchown: function (...args) { console.warn("fileio.fchown interface mocked in the Previewer. How this interface works on the Previewer may" + @@ -352,7 +362,6 @@ export function mockFileio() { fchownSync: function (...args) { console.warn("fileio.fchownSync interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") - return }, fdatasync: function (...args) { console.warn("fileio.fdatasync interface mocked in the Previewer. How this interface works on the Previewer may" + @@ -369,7 +378,6 @@ export function mockFileio() { fdatasyncSync: function (...args) { console.warn("fileio.fdatasyncSync interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") - return }, fdopenStream: function (...args) { console.warn("fileio.fdopenStream interface mocked in the Previewer. How this interface works on the Previewer may be" + @@ -420,7 +428,6 @@ export function mockFileio() { fsyncSync: function (...args) { console.warn("fileio.fsyncSync interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") - return }, ftruncate: function (...args) { console.warn("fileio.ftruncate interface mocked in the Previewer. How this interface works on the Previewer may" + @@ -437,7 +444,6 @@ export function mockFileio() { ftruncateSync: function (...args) { console.warn("fileio.ftruncateSync interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") - return }, hash: function (...args) { console.warn("fileio.hash interface mocked in the Previewer. How this interface works on the Previewer may be" + @@ -466,7 +472,6 @@ export function mockFileio() { lchownSync: function (...args) { console.warn("fileio.lchownSync interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") - return }, lstat: function (...args) { console.warn("fileio.lstat interface mocked in the Previewer. How this interface works on the Previewer may be" + @@ -601,7 +606,6 @@ export function mockFileio() { renameSync: function (...args) { console.warn("fileio.renameSync interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") - return }, rmdir: function (...args) { console.warn("fileio.rmdir interface mocked in the Previewer. How this interface works on the Previewer may" + @@ -651,7 +655,6 @@ export function mockFileio() { symlinkSync: function (...args) { console.warn("fileio.symlinkSync interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") - return }, truncate: function (...args) { console.warn("fileio.truncate interface mocked in the Previewer. How this interface works on the Previewer may" + @@ -668,7 +671,6 @@ export function mockFileio() { truncateSync: function (...args) { console.warn("fileio.truncateSync interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") - return }, unlink: function (...args) { console.warn("fileio.unlink interface mocked in the Previewer. How this interface works on the Previewer may" + diff --git a/runtime/main/extend/systemplugin/napi/filemanager.js b/runtime/main/extend/systemplugin/napi/filemanager.js new file mode 100644 index 00000000..c7ed4b92 --- /dev/null +++ b/runtime/main/extend/systemplugin/napi/filemanager.js @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "../utils" + +export function mockFileManager() { + const filemanager = { + getRoot: function (...args) { + console.warn("filemanager.getRoot interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramArrayMock) + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramArrayMock); + }) + } + }, + listFile: function (...args) { + console.warn("filemanager.listFile interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramArrayMock) + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramArrayMock); + }) + } + }, + createFile: function (...args) { + console.warn("filemanager.createFile interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock) + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } + }, + } + return filemanager; +} diff --git a/runtime/main/extend/systemplugin/napi/hiAppEvent.js b/runtime/main/extend/systemplugin/napi/hiAppEvent.js index ab212de2..1a69d7bc 100644 --- a/runtime/main/extend/systemplugin/napi/hiAppEvent.js +++ b/runtime/main/extend/systemplugin/napi/hiAppEvent.js @@ -1,47 +1,62 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" function buildMockInfo(interfaceName) { - return interfaceName + " interface mocked in the Previewer. How this interface works on the Previewer" + + return interfaceName + " interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device." } export function mockHiAppEvent() { - const EventTypeMock = { - FAULT: paramMock.paramNumberMock, - STATISTIC: paramMock.paramNumberMock, - SECURITY: paramMock.paramNumberMock, - BEHAVIOR: paramMock.paramNumberMock - } - const EventMock = { - USER_LOGIN: paramMock.paramStringMock, - USER_LOGOUT: paramMock.paramStringMock, - DISTRIBUTED_SERVICE_START: paramMock.paramStringMock - } - const ParamMock = { - USER_ID: paramMock.paramStringMock, - DISTRIBUTED_SERVICE_NAME: paramMock.paramStringMock, - DISTRIBUTED_SERVICE_INSTANCE_ID: paramMock.paramStringMock - } + const EventTypeMock = { + FAULT: paramMock.paramNumberMock, + STATISTIC: paramMock.paramNumberMock, + SECURITY: paramMock.paramNumberMock, + BEHAVIOR: paramMock.paramNumberMock + } + const EventMock = { + USER_LOGIN: paramMock.paramStringMock, + USER_LOGOUT: paramMock.paramStringMock, + DISTRIBUTED_SERVICE_START: paramMock.paramStringMock + } + const ParamMock = { + USER_ID: paramMock.paramStringMock, + DISTRIBUTED_SERVICE_NAME: paramMock.paramStringMock, + DISTRIBUTED_SERVICE_INSTANCE_ID: paramMock.paramStringMock + } - const hiAppEvent = { - EventType: EventTypeMock, - Event: EventMock, - Param: ParamMock, - write: function (...args) { - console.warn(buildMockInfo("hiAppEvent.write")) - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - configure: function (...args) { - console.warn(buildMockInfo("hiAppEvent.configure")); - return paramMock.paramBooleanMock - } + const hiAppEvent = { + EventType: EventTypeMock, + Event: EventMock, + Param: ParamMock, + write: function (...args) { + console.warn(buildMockInfo("hiAppEvent.write")) + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }) + } + }, + configure: function (...args) { + console.warn(buildMockInfo("hiAppEvent.configure")); + return paramMock.paramBooleanMock } - return hiAppEvent + } + return hiAppEvent } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/hilog.js b/runtime/main/extend/systemplugin/napi/hilog.js index f1358295..c497b7e5 100644 --- a/runtime/main/extend/systemplugin/napi/hilog.js +++ b/runtime/main/extend/systemplugin/napi/hilog.js @@ -1,4 +1,19 @@ -import {paramMock} from "../utils" +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "../utils" export function mockHilog() { const hilog = { diff --git a/runtime/main/extend/systemplugin/napi/index.js b/runtime/main/extend/systemplugin/napi/index.js index 6b5aa4ca..cc963153 100644 --- a/runtime/main/extend/systemplugin/napi/index.js +++ b/runtime/main/extend/systemplugin/napi/index.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { mockSystemParameter } from './systemParameter' import { mockAbility } from './applicationAbility' import { mockFormExtension } from './applicationFormExtension' @@ -25,6 +40,7 @@ import { mockDtv } from './dtv' import { mockDistributedAccount } from './distributedAccount' import { mockEmitter } from './emitter' import { mockDistributedData } from './distributedData' +import { mockDistributedObject } from './distributedDataObject' import { mockDataAbility } from './dataAbility' import { mockStorage } from './storage' import { mockRdb } from './rdb' @@ -39,6 +55,8 @@ import { mockUri } from './uri' import { mockXml } from './xml' import { mockConvertXml } from './convertxml' import { mockStatfs } from './statfs' +import { mockFileManager } from "./filemanager" +import { mockEnvironment } from "./environment" import { mockSettings } from './settings' import { mockAbilityAccessCtrl } from './abilityAccessCtrl' @@ -99,6 +117,8 @@ export function mockRequireNapiFun() { return mockEmitter(); case "data.distributedData": return mockDistributedData(); + case "data.distributedDataObject": + return mockDistributedObject(); case "data.rdb": return mockRdb(); case "data.storage": @@ -127,6 +147,10 @@ export function mockRequireNapiFun() { return mockConvertXml(); case "statfs": return mockStatfs(); + case "filemanager": + return mockFileManager(); + case "environment": + return mockEnvironment(); case "settings": return mockSettings(); case "abilityAccessCtrl": diff --git a/runtime/main/extend/systemplugin/napi/inputDevice.js b/runtime/main/extend/systemplugin/napi/inputDevice.js index 02c21259..3da2c785 100644 --- a/runtime/main/extend/systemplugin/napi/inputDevice.js +++ b/runtime/main/extend/systemplugin/napi/inputDevice.js @@ -1,21 +1,36 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" export function mockInputDevice() { const AxisRange = { - source: '[PC preview] unknow source', - axis : '[PC preview] unknow axis', - max : '[PC preview] unknow max', - min: '[PC preview] unknow min' + source: '[PC preview] unknow source', + axis: '[PC preview] unknow axis', + max: '[PC preview] unknow max', + min: '[PC preview] unknow min' } const InputDeviceData = { - id: '[PC preview] unknow id', - name: '[PC preview] unknow name', - sources : ['[PC preview] unknow sources'], - axisRanges : [AxisRange] + id: '[PC preview] unknow id', + name: '[PC preview] unknow name', + sources: ['[PC preview] unknow sources'], + axisRanges: [AxisRange] } const EventType = ['add', 'remove', 'update'] - const DeviceIds = [-1,0,1,2,3,4,5,6,7] + const DeviceIds = [-1, 0, 1, 2, 3, 4, 5, 6, 7] const inputDevice = { on: function (...args) { console.warn("inputDevice.on interface mocked in the Previewer. How this interface works on the" + @@ -36,7 +51,7 @@ export function mockInputDevice() { console.warn("inputDevice.off interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") const len = args.length; - if (len < 1 || len >2) { + if (len < 1 || len > 2) { console.warn("the number of parameter must be one or two") } else if (len === 1) { if (EventType.indexOf(args[0]) === -1) { diff --git a/runtime/main/extend/systemplugin/napi/intl.js b/runtime/main/extend/systemplugin/napi/intl.js index 90f7c670..53b2bd68 100644 --- a/runtime/main/extend/systemplugin/napi/intl.js +++ b/runtime/main/extend/systemplugin/napi/intl.js @@ -1,193 +1,208 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" export function mockIntl() { - const result = { - DateTimeFormat: function(...args) { - console.warn("Intl.DateTimeFormat interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return DateTimeFormatMock; - }, - NumberFormat: function(...args) { - console.warn("Intl.NumberFormat interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return NumberFormatMock; - }, - Locale: function(locale) { - console.warn("Intl.Locale interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return LocaleMock; - }, - Collator: function(...args) { - console.warn("Intl.Collator interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return CollatorMock; - }, - PluralRules: function(...args) { - console.warn("Intl.PluralRules interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return PluralRulesMock; - }, - RelativeTimeFormat: function(...args) { - console.warn("Intl.RelativeTimeFormat interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return RelativeTimeFormatMock; - } + const result = { + DateTimeFormat: function (...args) { + console.warn("Intl.DateTimeFormat interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return DateTimeFormatMock; + }, + NumberFormat: function (...args) { + console.warn("Intl.NumberFormat interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return NumberFormatMock; + }, + Locale: function (locale) { + console.warn("Intl.Locale interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return LocaleMock; + }, + Collator: function (...args) { + console.warn("Intl.Collator interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return CollatorMock; + }, + PluralRules: function (...args) { + console.warn("Intl.PluralRules interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return PluralRulesMock; + }, + RelativeTimeFormat: function (...args) { + console.warn("Intl.RelativeTimeFormat interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return RelativeTimeFormatMock; } - const DateTimeFormatMock = { - format: function(date) { - console.warn("Intl.DateTimeFormat.format interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return paramMock.paramStringMock; - }, - formatRange: function(startDate, endDate) { - console.warn("Intl.DateTimeFormat.format interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return paramMock.paramStringMock; - }, - resolvedOptions: function() { - console.warn("Intl.DateTimeFormat.resolvedOptions interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return DateTimeOptionsMock; - } + } + const DateTimeFormatMock = { + format: function (date) { + console.warn("Intl.DateTimeFormat.format interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + return paramMock.paramStringMock; + }, + formatRange: function (startDate, endDate) { + console.warn("Intl.DateTimeFormat.format interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + return paramMock.paramStringMock; + }, + resolvedOptions: function () { + console.warn("Intl.DateTimeFormat.resolvedOptions interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + return DateTimeOptionsMock; } - const NumberFormatMock = { - format: function(number) { - console.warn("Intl.NumberFormat.format interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return paramMock.paramStringMock; - }, - resolvedOptions: function() { - console.warn("Intl.NumberFormat.resolvedOptions interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return NumberOptionsMock; - } + } + const NumberFormatMock = { + format: function (number) { + console.warn("Intl.NumberFormat.format interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + return paramMock.paramStringMock; + }, + resolvedOptions: function () { + console.warn("Intl.NumberFormat.resolvedOptions interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + return NumberOptionsMock; } - const LocaleMock = { - language: '[PC preview] unknow language', - script: '[PC preview] unknow script', - region: '[PC preview] unknow region', - baseName: '[PC preview] unknow baseName', - caseFirst: '[PC preview] unknow caseFirst', - calendar: '[PC preview] unknow calendar', - collation: '[PC preview] unknow collation', - hourCycle: '[PC preview] unknow hourCycle', - numberingSystem: '[PC preview] unknow numberingSystem', - numeric: '[PC preview] unknow numeric', - toString: function() { - console.warn("Intl.Locale.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; - }, - maximize: function() { - console.warn("Intl.Locale.maximize interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return LocaleMock; - }, - minimize: function() { - console.warn("Intl.Locale.minimize interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return LocaleMock; - } + } + const LocaleMock = { + language: '[PC preview] unknow language', + script: '[PC preview] unknow script', + region: '[PC preview] unknow region', + baseName: '[PC preview] unknow baseName', + caseFirst: '[PC preview] unknow caseFirst', + calendar: '[PC preview] unknow calendar', + collation: '[PC preview] unknow collation', + hourCycle: '[PC preview] unknow hourCycle', + numberingSystem: '[PC preview] unknow numberingSystem', + numeric: '[PC preview] unknow numeric', + toString: function () { + console.warn("Intl.Locale.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; + }, + maximize: function () { + console.warn("Intl.Locale.maximize interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + return LocaleMock; + }, + minimize: function () { + console.warn("Intl.Locale.minimize interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + return LocaleMock; } - const CollatorMock = { - compare: function(firstString, secondString) { - console.warn("Intl.Collator.compare interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return paramMock.paramNumberMock; - }, - resolvedOptions: function() { - console.warn("Intl.Collator.resolvedOptions interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return CollatorOptionsMock; - } + } + const CollatorMock = { + compare: function (firstString, secondString) { + console.warn("Intl.Collator.compare interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + return paramMock.paramNumberMock; + }, + resolvedOptions: function () { + console.warn("Intl.Collator.resolvedOptions interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + return CollatorOptionsMock; } - const PluralRulesMock = { - select: function(number) { - console.warn("Intl.PluralRules.select 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 PluralRulesMock = { + select: function (number) { + console.warn("Intl.PluralRules.select 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 RelativeTimeFormatMock = { - format: function(value, unit) { - console.warn("Intl.RelativeTimeFormat.format interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return paramMock.paramStringMock; - }, - formatToParts: function(value, unit) { - console.warn("Intl.RelativeTimeFormat.formatToParts interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return paramMock.paramArrayMock; - }, - resolvedOptions: function() { - console.warn("Intl.RelativeTimeFormat.resolvedOptions interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return RelativeTimeFormatResolvedOptionsMock; - } + } + const RelativeTimeFormatMock = { + format: function (value, unit) { + console.warn("Intl.RelativeTimeFormat.format interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + return paramMock.paramStringMock; + }, + formatToParts: function (value, unit) { + console.warn("Intl.RelativeTimeFormat.formatToParts interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + return paramMock.paramArrayMock; + }, + resolvedOptions: function () { + console.warn("Intl.RelativeTimeFormat.resolvedOptions interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + return RelativeTimeFormatResolvedOptionsMock; } - const DateTimeOptionsMock = { - locale: '[PC preview] unknow locale', - dateStyle: '[PC preview] unknow dateStyle', - timeStyle: '[PC preview] unknow timeStyle', - hourCycle: '[PC preview] unknow hourCycle', - timeZone: '[PC preview] unknow timeZone', - numberingSystem: '[PC preview] unknow numberingSystem', - hour12: '[PC preview] unknow hour12', - weekday: '[PC preview] unknow weekday', - era: '[PC preview] unknow era', - year: '[PC preview] unknow year', - month: '[PC preview] unknow month', - day: '[PC preview] unknow day', - hour: '[PC preview] unknow hour', - minute: '[PC preview] unknow minute', - second: '[PC preview] unknow second', - timeZoneName: '[PC preview] unknow timeZoneName', - dayPeriod: '[PC preview] unknow dayPeriod', - localeMatcher: '[PC preview] unknow localeMatcher', - formatMatcher: '[PC preview] unknow formatMatcher', - } - const NumberOptionsMock = { - locale: '[PC preview] unknow locale', - currency: '[PC preview] unknow currency', - currencySign: '[PC preview] unknow currencySign', - currencyDisplay: '[PC preview] unknow currencyDisplay', - unit: '[PC preview] unknow unit', - unitDisplay: '[PC preview] unknow unitDisplay', - signDisplay: '[PC preview] unknow signDisplay', - compactDisplay: '[PC preview] unknow compactDisplay', - notation: '[PC preview] unknow notation', - localeMatcher: '[PC preview] unknow localeMatcher', - style: '[PC preview] unknow style', - numberingSystem: '[PC preview] unknow numberingSystem', - useGrouping: '[PC preview] unknow useGrouping', - minimumIntegerDigits: '[PC preview] unknow minimumIntegerDigits', - minimumFractionDigits: '[PC preview] unknow minimumFractionDigits', - maximumFractionDigits: '[PC preview] unknow maximumFractionDigits', - minimumSignificantDigits: '[PC preview] unknow minimumSignificantDigits', - maximumSignificantDigits: '[PC preview] unknow maximumSignificantDigits', - } - const CollatorOptionsMock = { - localeMatcher: '[PC preview] unknow localeMatcher', - usage: '[PC preview] unknow usage', - sensitivity: '[PC preview] unknow sensitivity', - ignorePunctuation: '[PC preview] unknow ignorePunctuation', - collation: '[PC preview] unknow collation', - numeric: '[PC preview] unknow numeric', - caseFirst: '[PC preview] unknow caseFirst', - } - const PluralRulesOptionsMock = { - localeMatcher: '[PC preview] unknow localeMatcher', - type: '[PC preview] unknow type', - minimumIntegerDigits: '[PC preview] unknow minimumIntegerDigits', - minimumFractionDigits: '[PC preview] unknow minimumFractionDigits', - maximumFractionDigits: '[PC preview] unknow maximumFractionDigits', - minimumSignificantDigits: '[PC preview] unknow minimumSignificantDigits', - maximumSignificantDigits: '[PC preview] unknow maximumSignificantDigits', - } - const RelativeTimeFormatResolvedOptionsMock = { - localeMatcher: '[PC preview] unknow localeMatcher', - numeric: '[PC preview] unknow numeric', - style: '[PC preview] unknow style', - } - return result; + } + const DateTimeOptionsMock = { + locale: '[PC preview] unknow locale', + dateStyle: '[PC preview] unknow dateStyle', + timeStyle: '[PC preview] unknow timeStyle', + hourCycle: '[PC preview] unknow hourCycle', + timeZone: '[PC preview] unknow timeZone', + numberingSystem: '[PC preview] unknow numberingSystem', + hour12: '[PC preview] unknow hour12', + weekday: '[PC preview] unknow weekday', + era: '[PC preview] unknow era', + year: '[PC preview] unknow year', + month: '[PC preview] unknow month', + day: '[PC preview] unknow day', + hour: '[PC preview] unknow hour', + minute: '[PC preview] unknow minute', + second: '[PC preview] unknow second', + timeZoneName: '[PC preview] unknow timeZoneName', + dayPeriod: '[PC preview] unknow dayPeriod', + localeMatcher: '[PC preview] unknow localeMatcher', + formatMatcher: '[PC preview] unknow formatMatcher', + } + const NumberOptionsMock = { + locale: '[PC preview] unknow locale', + currency: '[PC preview] unknow currency', + currencySign: '[PC preview] unknow currencySign', + currencyDisplay: '[PC preview] unknow currencyDisplay', + unit: '[PC preview] unknow unit', + unitDisplay: '[PC preview] unknow unitDisplay', + signDisplay: '[PC preview] unknow signDisplay', + compactDisplay: '[PC preview] unknow compactDisplay', + notation: '[PC preview] unknow notation', + localeMatcher: '[PC preview] unknow localeMatcher', + style: '[PC preview] unknow style', + numberingSystem: '[PC preview] unknow numberingSystem', + useGrouping: '[PC preview] unknow useGrouping', + minimumIntegerDigits: '[PC preview] unknow minimumIntegerDigits', + minimumFractionDigits: '[PC preview] unknow minimumFractionDigits', + maximumFractionDigits: '[PC preview] unknow maximumFractionDigits', + minimumSignificantDigits: '[PC preview] unknow minimumSignificantDigits', + maximumSignificantDigits: '[PC preview] unknow maximumSignificantDigits', + } + const CollatorOptionsMock = { + localeMatcher: '[PC preview] unknow localeMatcher', + usage: '[PC preview] unknow usage', + sensitivity: '[PC preview] unknow sensitivity', + ignorePunctuation: '[PC preview] unknow ignorePunctuation', + collation: '[PC preview] unknow collation', + numeric: '[PC preview] unknow numeric', + caseFirst: '[PC preview] unknow caseFirst', + } + const PluralRulesOptionsMock = { + localeMatcher: '[PC preview] unknow localeMatcher', + type: '[PC preview] unknow type', + minimumIntegerDigits: '[PC preview] unknow minimumIntegerDigits', + minimumFractionDigits: '[PC preview] unknow minimumFractionDigits', + maximumFractionDigits: '[PC preview] unknow maximumFractionDigits', + minimumSignificantDigits: '[PC preview] unknow minimumSignificantDigits', + maximumSignificantDigits: '[PC preview] unknow maximumSignificantDigits', + } + const RelativeTimeFormatResolvedOptionsMock = { + localeMatcher: '[PC preview] unknow localeMatcher', + numeric: '[PC preview] unknow numeric', + style: '[PC preview] unknow style', + } + return result; } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/mediaquery.js b/runtime/main/extend/systemplugin/napi/mediaquery.js index 4ca7ad48..2045071f 100644 --- a/runtime/main/extend/systemplugin/napi/mediaquery.js +++ b/runtime/main/extend/systemplugin/napi/mediaquery.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + export function mockMediaQuery() { const mediaquery = { matchMediaSync: function (...args) { @@ -12,8 +27,8 @@ export function mockMediaQuery() { console.warn("listener.off interface mocked in the Previewer." + " How this interface works on the Previewer may be different from that on a real device.") }, - matches:false, - media:String + matches: false, + media: String }; if (args.length === 1 && typeof args[0] === 'string') { listener.media = args[0]; diff --git a/runtime/main/extend/systemplugin/napi/notification.js b/runtime/main/extend/systemplugin/napi/notification.js index 819af57b..1a00f795 100644 --- a/runtime/main/extend/systemplugin/napi/notification.js +++ b/runtime/main/extend/systemplugin/napi/notification.js @@ -1,225 +1,240 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" export function mockNotification() { const DateMock = { toString: function () { console.warn("Date.toString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramStringMock }, toDateString: function () { console.warn("Date.toDateString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramStringMock }, toTimeString: function () { console.warn("Date.toTimeString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramStringMock }, toLocaleString: function () { console.warn("Date.toLocaleString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramStringMock }, toLocaleDateString: function () { console.warn("Date.toLocaleDateString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramStringMock }, toLocaleTimeString: function () { console.warn("Date.toLocaleTimeString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramStringMock }, valueOf: function () { console.warn("Date.valueOf interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, getTime: function () { console.warn("Date.getTime interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, getFullYear: function () { console.warn("Date.getFullYear interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, getUTCFullYear: function () { console.warn("Date.getUTCFullYear interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, getMonth: function () { console.warn("Date.getMonth interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, getUTCMonth: function () { console.warn("Date.getUTCMonth interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, getDate: function () { console.warn("Date.getDate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, getUTCDate: function () { console.warn("Date.getUTCDate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, getDay: function () { console.warn("Date.getDay interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, getUTCDay: function () { console.warn("Date.getUTCDay interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, getHours: function () { console.warn("Date.getHours interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, getUTCHours: function () { console.warn("Date.getUTCHours interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, getMinutes: function () { console.warn("Date.getMinutes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, getUTCMinutes: function () { console.warn("Date.getUTCMinutes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, getSeconds: function () { console.warn("Date.getSeconds interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, getUTCSeconds: function () { console.warn("Date.getUTCSeconds interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, getMilliseconds: function () { console.warn("Date.getMilliseconds interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, getUTCMilliseconds: function () { console.warn("Date.getUTCMilliseconds interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, getTimezoneOffset: function () { console.warn("Date.getTimezoneOffset interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, setTime: function (...args) { console.warn("Date.setTime interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, setMilliseconds: function (...args) { console.warn("Date.setMilliseconds interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, setUTCMilliseconds: function (...args) { console.warn("Date.setUTCMilliseconds interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, setSeconds: function (...args) { console.warn("Date.setSeconds interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, setUTCSeconds: function (...args) { console.warn("Date.setUTCSeconds interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, setMinutes: function (...args) { console.warn("Date.setMinutes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, setUTCMinutes: function (...args) { console.warn("Date.setUTCMinutes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, setHours: function (...args) { console.warn("Date.setHours interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, setUTCHours: function (...args) { console.warn("Date.setUTCHours interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, setDate: function (...args) { console.warn("Date.setDate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, setUTCDate: function (...args) { console.warn("Date.setUTCDate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, setMonth: function (...args) { console.warn("Date.setMonth interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, setUTCMonth: function (...args) { console.warn("Date.setUTCMonth interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, setFullYear: function (...args) { console.warn("Date.setFullYear interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, setUTCFullYear: function (...args) { console.warn("Date.setUTCFullYear interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramNumberMock }, toUTCString: function () { console.warn("Date.toUTCString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramStringMock }, toISOString: function () { console.warn("Date.toISOString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramStringMock }, toJSON: function (...args) { console.warn("Date.toJSON interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") + " may be different from that on a real device.") return paramMock.paramStringMock }, } const DoNotDisturbDateMock = { - DoNotDisturbTypeMock:'[PC preview] unknow DoNotDisturbTypeMock', + DoNotDisturbTypeMock: '[PC preview] unknow DoNotDisturbTypeMock', begin: DateMock, end: DateMock } @@ -277,7 +292,7 @@ export function mockNotification() { }; const notification = { SlotType: { - UNKNOWN_TYPE : 0, + UNKNOWN_TYPE: 0, SOCIAL_COMMUNICATION: 1, SERVICE_INFORMATION: 2, CONTENT_INFORMATION: 3, @@ -290,7 +305,7 @@ export function mockNotification() { NOTIFICATION_CONTENT_CONVERSATION: 3, NOTIFICATION_CONTENT_MULTILINE: 4, }, - publish: function(...args) { + publish: function (...args) { console.warn('notification.publish interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -302,7 +317,7 @@ export function mockNotification() { }); } }, - cancel: function(...args) { + cancel: function (...args) { console.warn('notification.cancel interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -314,7 +329,7 @@ export function mockNotification() { }); } }, - cancelAll: function(...args) { + cancelAll: function (...args) { console.warn('notification.cancelAll interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -326,7 +341,7 @@ export function mockNotification() { }); } }, - addSlot: function(...args) { + addSlot: function (...args) { console.warn('notification.addSlot interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -338,7 +353,7 @@ export function mockNotification() { }); } }, - addSlots: function(...args) { + addSlots: function (...args) { console.warn('notification.addSlots interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -350,7 +365,7 @@ export function mockNotification() { }); } }, - getSlot: function(...args) { + getSlot: function (...args) { console.warn('notification.getSlot interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -362,7 +377,7 @@ export function mockNotification() { }); } }, - getSlots: function(...args) { + getSlots: function (...args) { console.warn('notification.getSlots interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -374,7 +389,7 @@ export function mockNotification() { }); } }, - removeSlot: function(...args) { + removeSlot: function (...args) { console.warn('notification.removeSlot interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -386,7 +401,7 @@ export function mockNotification() { }); } }, - removeAllSlots: function(...args) { + removeAllSlots: function (...args) { console.warn('notification.removeAllSlots interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -398,7 +413,7 @@ export function mockNotification() { }); } }, - subscribe: function(...args) { + subscribe: function (...args) { console.warn('notification.subscribe interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -410,7 +425,7 @@ export function mockNotification() { }); } }, - unsubscribe: function(...args) { + unsubscribe: function (...args) { console.warn('notification.unsubscribe interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -422,7 +437,7 @@ export function mockNotification() { }); } }, - enableNotification: function(...args) { + enableNotification: function (...args) { console.warn('notification.enableNotification interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -434,7 +449,7 @@ export function mockNotification() { }); } }, - isNotificationEnabled: function(...args) { + isNotificationEnabled: function (...args) { console.warn('notification.isNotificationEnabled interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -446,7 +461,7 @@ export function mockNotification() { }); } }, - displayBadge: function(...args) { + displayBadge: function (...args) { console.warn('notification.displayBadge interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -458,7 +473,7 @@ export function mockNotification() { }); } }, - isBadgeDisplayed: function(...args) { + isBadgeDisplayed: function (...args) { console.warn('notification.isBadgeDisplayed interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -470,7 +485,7 @@ export function mockNotification() { }); } }, - setSlotByBundle: function(...args) { + setSlotByBundle: function (...args) { console.warn('notification.setSlotByBundle interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -482,7 +497,7 @@ export function mockNotification() { }); } }, - getSlotsByBundle: function(...args) { + getSlotsByBundle: function (...args) { console.warn('notification.getSlotsByBundle interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -494,7 +509,7 @@ export function mockNotification() { }); } }, - getSlotNumByBundle: function(...args) { + getSlotNumByBundle: function (...args) { console.warn('notification.getSlotNumByBundle interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -506,7 +521,7 @@ export function mockNotification() { }); } }, - remove: function(...args) { + remove: function (...args) { console.warn('notification.remove interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -518,7 +533,7 @@ export function mockNotification() { }); } }, - removeAll: function(...args) { + removeAll: function (...args) { console.warn('notification.removeAll interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -530,7 +545,7 @@ export function mockNotification() { }); } }, - getAllActiveNotifications: function(...args) { + getAllActiveNotifications: function (...args) { console.warn('notification.getAllActiveNotifications interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -542,7 +557,7 @@ export function mockNotification() { }); } }, - getActiveNotificationCount: function(...args) { + getActiveNotificationCount: function (...args) { console.warn('notification.getActiveNotificationCount interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -554,7 +569,7 @@ export function mockNotification() { }); } }, - getActiveNotifications: function(...args) { + getActiveNotifications: function (...args) { console.warn('notification.getActiveNotifications interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); const len = args.length; @@ -604,14 +619,14 @@ export function mockNotification() { }, getDoNotDisturbDate: function (...args) { console.warn("notification.getDoNotDisturbDate interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") + " How this interface works on the Previewer may be different from that on a real device.") const len = args.length if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, DoNotDisturbDateMock); + args[len - 1].call(this, paramMock.businessErrorMock, DoNotDisturbDateMock); } else { - return new Promise((resolve, reject) => { - resolve(DoNotDisturbDateMock); - }) + return new Promise((resolve, reject) => { + resolve(DoNotDisturbDateMock); + }) } }, supportDoNotDisturbMode: function (...args) { diff --git a/runtime/main/extend/systemplugin/napi/power.js b/runtime/main/extend/systemplugin/napi/power.js index d0261e10..14f72487 100644 --- a/runtime/main/extend/systemplugin/napi/power.js +++ b/runtime/main/extend/systemplugin/napi/power.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" export function mockPower() { diff --git a/runtime/main/extend/systemplugin/napi/process.js b/runtime/main/extend/systemplugin/napi/process.js index 5652a8d3..6438c629 100644 --- a/runtime/main/extend/systemplugin/napi/process.js +++ b/runtime/main/extend/systemplugin/napi/process.js @@ -1,144 +1,159 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" export function mockProcess() { - const result = { - runCmd: function(...args) { - console.warn("process.runCmd interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return ChildProcessMock; - }, - abort: function(...args) { - console.warn("process.abort interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - on: function(...args) { - console.warn("process.on interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - off: function(...args) { - console.warn("process.off interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - exit: function(...args) { - console.warn("process.exit interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - cwd: function(...args) { - console.warn("process.cwd interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - chdir: function(...args) { - console.warn("process.chdir interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - uptime: function(...args) { - console.warn("process.uptime interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - kill: function(...args) { - console.warn("process.kill interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - 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 result = { + runCmd: function (...args) { + console.warn("process.runCmd interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return ChildProcessMock; + }, + abort: function (...args) { + console.warn("process.abort interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }, + on: function (...args) { + console.warn("process.on interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }, + off: function (...args) { + console.warn("process.off interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + exit: function (...args) { + console.warn("process.exit interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }, + cwd: function (...args) { + console.warn("process.cwd interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramStringMock; + }, + chdir: function (...args) { + console.warn("process.chdir interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }, + uptime: function (...args) { + console.warn("process.uptime interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + kill: function (...args) { + console.warn("process.kill interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + 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', - exitCode: '[PC preview] unknow exitCode', - killed: '[PC preview] unknow killed', - wait: function(...args) { - console.warn("ChildProcess.wait 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.paramNumberMock); - }) - }, - getOutput: function(...args) { - console.warn("ChildProcess.getOutput 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); - }) - }, - getErrorOutput: function(...args) { - console.warn("ChildProcess.getErrorOutput 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); - }) - }, - close: function (...args) { - console.warn("ChildProcess.close interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - kill: function (...args) { - console.warn("ChildProcess.kill interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - } + const ChildProcessMock = { + pid: '[PC preview] unknow pid', + ppid: '[PC preview] unknow ppid', + exitCode: '[PC preview] unknow exitCode', + killed: '[PC preview] unknow killed', + wait: function (...args) { + console.warn("ChildProcess.wait 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.paramNumberMock); + }) + }, + getOutput: function (...args) { + console.warn("ChildProcess.getOutput 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); + }) + }, + getErrorOutput: function (...args) { + console.warn("ChildProcess.getErrorOutput 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); + }) + }, + close: function (...args) { + console.warn("ChildProcess.close interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + }, + kill: function (...args) { + console.warn("ChildProcess.kill interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") } - return result; + } + return result; } diff --git a/runtime/main/extend/systemplugin/napi/rdb.js b/runtime/main/extend/systemplugin/napi/rdb.js index ab3be2e5..32569f62 100644 --- a/runtime/main/extend/systemplugin/napi/rdb.js +++ b/runtime/main/extend/systemplugin/napi/rdb.js @@ -1,4 +1,19 @@ -import {paramMock} from "../utils" +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "../utils" export const RdbPredicatesClass = class RdbPredicates { constructor(...args) { @@ -307,6 +322,18 @@ export function mockRdb() { }) } }, + querySql: function (...args) { + console.warn("RdbStore.querySql interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, resultSetMock); + } else { + return new Promise((resolve, reject) => { + resolve(resultSetMock); + }) + } + }, executeSql: function (...args) { console.warn("RdbStore.executeSql interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") diff --git a/runtime/main/extend/systemplugin/napi/rpc.js b/runtime/main/extend/systemplugin/napi/rpc.js index 39af462f..11ec9675 100644 --- a/runtime/main/extend/systemplugin/napi/rpc.js +++ b/runtime/main/extend/systemplugin/napi/rpc.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" export const MessageParcelClass = class MessageParcel { @@ -78,11 +93,11 @@ export const MessageParcelClass = class MessageParcel { " Previewer may be different from that on a real device.") return paramMock.paramBooleanMock }; - this.writeNoException = function() { + this.writeNoException = function () { console.warn("MessageParcel.writeNoException interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") }; - this.readException = function() { + this.readException = function () { console.warn("MessageParcel.readException interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") }; @@ -377,16 +392,16 @@ export const MessageParcelClass = class MessageParcel { }; } }; -MessageParcelClass.create = function() { +MessageParcelClass.create = function () { console.warn("MessageParcel.create interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") return new MessageParcelClass() }; -MessageParcelClass.closeFileDescriptor = function(...args) { +MessageParcelClass.closeFileDescriptor = function (...args) { console.warn("MessageParcel.closeFileDescriptor interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") }; -MessageParcelClass.dupFileDescriptor = function(...args) { +MessageParcelClass.dupFileDescriptor = function (...args) { console.warn("MessageParcel.dupFileDescriptor interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") return paramMock.paramNumberMock @@ -395,21 +410,21 @@ export const MessageOptionClass = class MessageOption { constructor(...args) { console.warn('rpc.MessageOption constructor interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.') - this.getFlags = function() { + this.getFlags = function () { console.warn("MessageOption.getFlags interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") return paramMock.paramNumberMock }; - this.setFlags = function(...args) { + this.setFlags = function (...args) { console.warn("MessageOption.setFlags interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") }; - this.getWaitTime = function() { + this.getWaitTime = function () { console.warn("MessageOption.getWaitTime interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") return paramMock.paramNumberMock }; - this.setWaitTime = function(...args) { + this.setWaitTime = function (...args) { console.warn("MessageOption.setWaitTime interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") }; @@ -423,57 +438,57 @@ export const AshmemClass = class Ashmem { constructor() { console.warn('rpc.Ashmem constructor interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.') - this.closeAshmem = function() { + this.closeAshmem = function () { console.warn('Ashmem.closeAshmem interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.') }; - this.unmapAshmem = function() { + this.unmapAshmem = function () { console.warn('Ashmem.unmapAshmem interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.') }; - this.getAshmemSize = function() { + this.getAshmemSize = function () { console.warn('Ashmem.getAshmemSize interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.') return paramMock.paramNumberMock }; - this.mapAshmem = function(...args) { + this.mapAshmem = function (...args) { console.warn('Ashmem.mapAshmem interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.') return paramMock.paramBooleanMock }; - this.mapReadAndWriteAshmem = function() { + this.mapReadAndWriteAshmem = function () { console.warn('Ashmem.mapReadAndWriteAshmem interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.') return paramMock.paramBooleanMock }; - this.mapReadOnlyAshmem = function() { + this.mapReadOnlyAshmem = function () { console.warn('Ashmem.mapReadOnlyAshmem interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.') return paramMock.paramBooleanMock }; - this.setProtection = function(...args) { + this.setProtection = function (...args) { console.warn('Ashmem.setProtection interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.') return paramMock.paramBooleanMock }; - this.writeToAshmem = function(...args) { + this.writeToAshmem = function (...args) { console.warn('Ashmem.writeToAshmem interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.') return paramMock.paramBooleanMock }; - this.readFromAshmem = function(...args) { + this.readFromAshmem = function (...args) { console.warn('Ashmem.readFromAshmem interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.') return paramMock.paramArrayMock }; } }; -AshmemClass.createAshmem = function(...args) { +AshmemClass.createAshmem = function (...args) { console.warn('Ashmem.createAshmem interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.') return new AshmemClass() }; -AshmemClass.createAshmemFromExisting = function(...args) { +AshmemClass.createAshmemFromExisting = function (...args) { console.warn('Ashmem.createAshmemFromExisting interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.') return new AshmemClass() @@ -486,22 +501,22 @@ export const RemoteObjectClass = class RemoteObject { constructor(...args) { console.warn("rpc.RemoteObject constructor interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") - this.queryLocalInterface = function(...args) { + this.queryLocalInterface = function (...args) { console.warn("RemoteObject.queryLocalInterface interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") return IRemoteBrokerMock }; - this.getInterfaceDescriptor = function() { + this.getInterfaceDescriptor = function () { console.warn("RemoteObject.getInterfaceDescriptor interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") return paramMock.paramStringMock }; - this.onRemoteRequest = function(...args) { + this.onRemoteRequest = function (...args) { console.warn("RemoteObject.onRemoteRequest interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") return paramMock.paramBooleanMock }; - this.sendRequest = function(...args) { + this.sendRequest = function (...args) { console.warn("RemoteObject.sendRequest interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") const len = args.length @@ -513,17 +528,17 @@ export const RemoteObjectClass = class RemoteObject { }) } }; - this.getCallingPid = function() { + 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.") return paramMock.paramNumberMock }; - this.getCallingUid = function() { + this.getCallingUid = function () { console.warn("RemoteObject.getCallingUid interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") return paramMock.paramNumberMock }; - this.attachLocalInterface = function(...args) { + this.attachLocalInterface = function (...args) { console.warn("RemoteObject.attachLocalInterface interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") }; @@ -548,12 +563,12 @@ export const RemoteProxyClass = class RemoteProxy { constructor() { console.warn("rpc.RemoteProxy constructor interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") - this.queryLocalInterface = function(...args) { + this.queryLocalInterface = function (...args) { console.warn("RemoteProxy.queryLocalInterface interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") return IRemoteBrokerMock }; - this.getInterfaceDescriptor = function() { + this.getInterfaceDescriptor = function () { console.warn("RemoteProxy.getInterfaceDescriptor interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") return paramMock.paramStringMock @@ -573,7 +588,7 @@ export const RemoteProxyClass = class RemoteProxy { " Previewer may be different from that on a real device.") return paramMock.paramBooleanMock }; - this.sendRequest = function(...args) { + this.sendRequest = function (...args) { console.warn("RemoteProxy.sendRequest mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") const len = args.length @@ -645,20 +660,20 @@ export const SendRequestResultMock = { reply: "[PC Preview]: unknow reply", }; export const SequenceableMock = { - marshalling: function(...args) { + marshalling: function (...args) { console.warn("Sequenceable.marshalling interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") return paramMock.paramBooleanMock }, - unmarshalling: function(...args) { + unmarshalling: function (...args) { console.warn("Sequenceable.unmarshalling interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") return paramMock.paramBooleanMock } }; export const DeathRecipientMock = { - onRemoteDied: function() { + onRemoteDied: function () { console.warn("DeathRecipient.onRemoteDied interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") } diff --git a/runtime/main/extend/systemplugin/napi/runningLock.js b/runtime/main/extend/systemplugin/napi/runningLock.js index 6494a1ec..c5bccce1 100644 --- a/runtime/main/extend/systemplugin/napi/runningLock.js +++ b/runtime/main/extend/systemplugin/napi/runningLock.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" export function mockRunningLock() { @@ -17,8 +32,8 @@ export function mockRunningLock() { } }; const RunningLockType = { - BACKGROUND : '[PC Preview] unknow BACKGROUND', - PROXIMITY_SCREEN_CONTROL : '[PC Preview] unknow PROXIMITY_SCREEN_CONTROL' + BACKGROUND: '[PC Preview] unknow BACKGROUND', + PROXIMITY_SCREEN_CONTROL: '[PC Preview] unknow PROXIMITY_SCREEN_CONTROL' }; const runningLock = { RunningLockType, diff --git a/runtime/main/extend/systemplugin/napi/settings.js b/runtime/main/extend/systemplugin/napi/settings.js index 8c00c530..72d3a7b2 100644 --- a/runtime/main/extend/systemplugin/napi/settings.js +++ b/runtime/main/extend/systemplugin/napi/settings.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" export function mockSettings() { diff --git a/runtime/main/extend/systemplugin/napi/statfs.js b/runtime/main/extend/systemplugin/napi/statfs.js index 11eb4cfd..21d5ca6f 100644 --- a/runtime/main/extend/systemplugin/napi/statfs.js +++ b/runtime/main/extend/systemplugin/napi/statfs.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" export function mockStatfs() { diff --git a/runtime/main/extend/systemplugin/napi/storage.js b/runtime/main/extend/systemplugin/napi/storage.js index 2ff0358c..c58d7f51 100644 --- a/runtime/main/extend/systemplugin/napi/storage.js +++ b/runtime/main/extend/systemplugin/napi/storage.js @@ -1,170 +1,185 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" export function mockStorage() { - const storageMock = { - getStorageSync: function (...args) { - console.warn("Storage.getStorageSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return storage; - }, - getStorage: function (...args) { - console.warn("Storage.getStorage interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, storage); - } else { - return new Promise((resolve, reject) => { - resolve(storage); - }) - } - }, - deleteStorageSync: function (...args) { - console.warn("Storage.deleteStorageSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - deleteStorage: function (...args) { - console.warn("Storage.deleteStorage interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - removeStorageFromCacheSync: function (...args) { - console.warn("Storage.removeStorageFromCacheSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - removeStorageFromCache: function (...args) { - console.warn("Storage.removeStorageFromCache interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - }; - const storageObserver = { - key: "[PC Preview] unknown key", - }; - const storage = { - getSync: function (...args) { - console.warn("Storage.getSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - get: function (...args) { - console.warn("Storage.get interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - hasSync: function (...args) { - console.warn("Storage.hasSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - has: function (...args) { - console.warn("Storage.has interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - putSync: function (...args) { - console.warn("Storage.putSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - put: function (...args) { - console.warn("Storage.put interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - deleteSync: function (...args) { - console.warn("Storage.deleteSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - delete: function (...args) { - console.warn("Storage.delete interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - clearSync: function (...args) { - console.warn("Storage.clearSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - clear: function (...args) { - console.warn("Storage.clear interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - flushSync: function (...args) { - console.warn("Storage.flushSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - flush: function (...args) { - console.warn("Storage.flush interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - on: function (...args) { - console.warn("Storage.on interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return storageObserver; - }, - off: function (...args) { - console.warn("Storage.off interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return storageObserver; - }, - }; - return storageMock; + const storageMock = { + getStorageSync: function (...args) { + console.warn("Storage.getStorageSync interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return storage; + }, + getStorage: function (...args) { + console.warn("Storage.getStorage interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, storage); + } else { + return new Promise((resolve, reject) => { + resolve(storage); + }) + } + }, + deleteStorageSync: function (...args) { + console.warn("Storage.deleteStorageSync interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + deleteStorage: function (...args) { + console.warn("Storage.deleteStorage interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + removeStorageFromCacheSync: function (...args) { + console.warn("Storage.removeStorageFromCacheSync interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + removeStorageFromCache: function (...args) { + console.warn("Storage.removeStorageFromCache interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + }; + const storageObserver = { + key: "[PC Preview] unknown key", + }; + const storage = { + getSync: function (...args) { + console.warn("Storage.getSync interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + get: function (...args) { + console.warn("Storage.get interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + hasSync: function (...args) { + console.warn("Storage.hasSync interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + has: function (...args) { + console.warn("Storage.has interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + putSync: function (...args) { + console.warn("Storage.putSync interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + put: function (...args) { + console.warn("Storage.put interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + deleteSync: function (...args) { + console.warn("Storage.deleteSync interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + delete: function (...args) { + console.warn("Storage.delete interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + clearSync: function (...args) { + console.warn("Storage.clearSync interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + clear: function (...args) { + console.warn("Storage.clear interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + flushSync: function (...args) { + console.warn("Storage.flushSync interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + flush: function (...args) { + console.warn("Storage.flush interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + on: function (...args) { + console.warn("Storage.on interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return storageObserver; + }, + off: function (...args) { + console.warn("Storage.off interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return storageObserver; + }, + }; + return storageMock; } diff --git a/runtime/main/extend/systemplugin/napi/systemParameter.js b/runtime/main/extend/systemplugin/napi/systemParameter.js index 297d939b..7991d6e8 100644 --- a/runtime/main/extend/systemplugin/napi/systemParameter.js +++ b/runtime/main/extend/systemplugin/napi/systemParameter.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" export function mockSystemParameter() { diff --git a/runtime/main/extend/systemplugin/napi/tv.js b/runtime/main/extend/systemplugin/napi/tv.js index 7eaff4f6..9f123479 100644 --- a/runtime/main/extend/systemplugin/napi/tv.js +++ b/runtime/main/extend/systemplugin/napi/tv.js @@ -1,2479 +1,2494 @@ -import {paramMock} from "../utils" +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "../utils" export function mockTv() { - const SoundStereos = { - STEREO_STEREO: "[PC Preview] unknow STEREO_STEREO", - STEREO_MONO: "[PC Preview] unknow STEREO_MONO", - STEREO_DOUBLE_LEFT: "[PC Preview] unknow STEREO_DOUBLE_LEFT", - STEREO_DOUBLE_RIGHT: "[PC Preview] unknow STEREO_DOUBLE_RIGHT", - STEREO_EXCHANGE: "[PC Preview] unknow STEREO_EXCHANGE", - STEREO_ONLY_RIGHT: "[PC Preview] unknow STEREO_ONLY_RIGHT", - STEREO_ONLY_LEFT: "[PC Preview] unknow STEREO_ONLY_LEFT", - STEREO_MUTED: "[PC Preview] unknow STEREO_MUTED" + const SoundStereos = { + STEREO_STEREO: "[PC Preview] unknow STEREO_STEREO", + STEREO_MONO: "[PC Preview] unknow STEREO_MONO", + STEREO_DOUBLE_LEFT: "[PC Preview] unknow STEREO_DOUBLE_LEFT", + STEREO_DOUBLE_RIGHT: "[PC Preview] unknow STEREO_DOUBLE_RIGHT", + STEREO_EXCHANGE: "[PC Preview] unknow STEREO_EXCHANGE", + STEREO_ONLY_RIGHT: "[PC Preview] unknow STEREO_ONLY_RIGHT", + STEREO_ONLY_LEFT: "[PC Preview] unknow STEREO_ONLY_LEFT", + STEREO_MUTED: "[PC Preview] unknow STEREO_MUTED" + } + const SoundSpdifs = { + SPDIF_PCM: "[PC Preview] unknow SPDIF_PCM", + SPDIF_RAW: "[PC Preview] unknow SPDIF_RAW", + SPDIF_AUTO: "[PC Preview] unknow SPDIF_AUTO" + } + const SoundArcModes = { + ARC_AUDIO_MODE_LPCM: "[PC Preview] unknow ARC_AUDIO_MODE_LPCM", + ARC_AUDIO_MODE_RAW: "[PC Preview] unknow ARC_AUDIO_MODE_RAW", + ARC_AUDIO_MODE_LEGACY: "[PC Preview] unknow ARC_AUDIO_MODE_LEGACY", + ARC_AUDIO_MODE_AUTO: "[PC Preview] unknow ARC_AUDIO_MODE_AUTO" + } + const AudioStreamInfo = { + type: "[PC Preview] unknow type", + value: "[PC Preview] unknow value" + } + const AudioGainAttr = { + isLinearMode: "[PC Preview] unknow isLinearMode", + gain: "[PC Preview] unknow gain" + } + const HistenSoundModes = { + HISTEN_SNDMODE_MUSIC: "[PC Preview] unknow HISTEN_SNDMODE_MUSIC", + HISTEN_SNDMODE_MOVIE: "[PC Preview] unknow HISTEN_SNDMODE_MOVIE", + HISTEN_SNDMODE_STANDARD: "[PC Preview] unknow HISTEN_SNDMODE_STANDARD", + HISTEN_SNDMODE_SPORTS: "[PC Preview] unknow HISTEN_SNDMODE_SPORTS", + HISTEN_SNDMODE_NEWS: "[PC Preview] unknow HISTEN_SNDMODE_NEWS", + HISTEN_SNDMODE_GAME: "[PC Preview] unknow HISTEN_SNDMODE_GAME", + HISTEN_SNDMODE_AUTO: "[PC Preview] unknow HISTEN_SNDMODE_AUTO", + HISTEN_SNDMODE_DEVIALET: "[PC Preview] unknow HISTEN_SNDMODE_DEVIALET", + HISTEN_SNDMODE_USER: "[PC Preview] unknow HISTEN_SNDMODE_USER" + } + const SoundFields = { + SNDFIELD_DESKTOP: "[PC Preview] unknow SNDFIELD_DESKTOP", + SNDFIELD_HANG: "[PC Preview] unknow SNDFIELD_HANG" + } + const AudioOutDevices = { + DEVICE_NONE: "[PC Preview] unknow DEVICE_NONE", + DEVICE_OUT_SPEAKER: "[PC Preview] unknow DEVICE_OUT_SPEAKER", + DEVICE_OUT_SPDIF: "[PC Preview] unknow DEVICE_OUT_SPDIF", + DEVICE_OUT_HDMI_ARC: "[PC Preview] unknow DEVICE_OUT_HDMI_ARC", + DEVICE_OUT_BLUETOOTH_A2DP: "[PC Preview] unknow DEVICE_OUT_BLUETOOTH_A2DP", + DEVICE_OUT_USB_DEVICE: "[PC Preview] unknow DEVICE_OUT_USB_DEVICE", + DEVICE_OUT_WIFI_SPEAKER: "[PC Preview] unknow DEVICE_OUT_WIFI_SPEAKER" + } + const SourceIndices = { + SOURCE_ATV: "[PC Preview] unknow SOURCE_ATV", + SOURCE_DVBC: "[PC Preview] unknow SOURCE_DVBC", + SOURCE_DTMB: "[PC Preview] unknow SOURCE_DTMB", + SOURCE_CVBS1: "[PC Preview] unknow SOURCE_CVBS1", + SOURCE_CVBS2: "[PC Preview] unknow SOURCE_CVBS2", + SOURCE_CVBS3: "[PC Preview] unknow SOURCE_CVBS3", + SOURCE_VGA: "[PC Preview] unknow SOURCE_VGA", + SOURCE_YPBPR1: "[PC Preview] unknow SOURCE_YPBPR1", + SOURCE_YPBPR2: "[PC Preview] unknow SOURCE_YPBPR2", + SOURCE_HDMI1: "[PC Preview] unknow SOURCE_HDMI1", + SOURCE_HDMI2: "[PC Preview] unknow SOURCE_HDMI2", + SOURCE_HDMI3: "[PC Preview] unknow SOURCE_HDMI3", + SOURCE_HDMI4: "[PC Preview] unknow SOURCE_HDMI4", + SOURCE_MEDIA: "[PC Preview] unknow SOURCE_MEDIA", + SOURCE_MEDIA2: "[PC Preview] unknow SOURCE_MEDIA2", + SOURCE_SCART1: "[PC Preview] unknow SOURCE_SCART1", + SOURCE_SCART2: "[PC Preview] unknow SOURCE_SCART2", + SOURCE_AUTO: "[PC Preview] unknow SOURCE_AUTO", + SOURCE_DVBT: "[PC Preview] unknow SOURCE_DVBT", + SOURCE_ATSC: "[PC Preview] unknow SOURCE_ATSC", + SOURCE_DVBS: "[PC Preview] unknow SOURCE_DVBS", + SOURCE_ISDBT: "[PC Preview] unknow SOURCE_ISDBT", + SOURCE_BUTT: "[PC Preview] unknow SOURCE_BUTT" + } + const TimingInfo = { + width: "[PC Preview] unknow width", + height: "[PC Preview] unknow height", + frame: "[PC Preview] unknow frame", + isInterlace: "[PC Preview] unknow isInterlace", + hdmiFmt: "[PC Preview] unknow hdmiFmt", + threeDimFmt: "[PC Preview] unknow threeDimFmt", + colorSpace: "[PC Preview] unknow colorSpace", + isMhl: "[PC Preview] unknow isMhl" + } + const HdmiCecDeviceInfo = { + hdmiDevPort: "[PC Preview] unknow hdmiDevPort", + logicAddr: "[PC Preview] unknow logicAddr", + devVendId: "[PC Preview] unknow devVendId", + osdName: "[PC Preview] unknow osdName" + } + const PictureClrtmps = { + CLRTMP_NATURE: "[PC Preview] unknow CLRTMP_NATURE", + CLRTMP_COOL: "[PC Preview] unknow CLRTMP_COOL", + CLRTMP_WARM: "[PC Preview] unknow CLRTMP_WARM", + CLRTMP_USER: "[PC Preview] unknow CLRTMP_USER", + CLRTMP_TOCOOL: "[PC Preview] unknow CLRTMP_TOCOOL", + CLRTMP_TOWARM: "[PC Preview] unknow CLRTMP_TOWARM", + CLRTMP_BUTT: "[PC Preview] unknow CLRTMP_BUTT" + } + const PictureLevels = { + LEVEL_OFF: "[PC Preview] unknow LEVEL_OFF", + LEVEL_LOW: "[PC Preview] unknow LEVEL_LOW", + LEVEL_MIDDLE: "[PC Preview] unknow LEVEL_MIDDLE", + LEVEL_HIGH: "[PC Preview] unknow LEVEL_HIGH", + LEVEL_AUTO: "[PC Preview] unknow LEVEL_AUTO" + } + const PictureAspects = { + ASPECT_16_9: "[PC Preview] unknow ASPECT_16_9", + ASPECT_14_9: "[PC Preview] unknow ASPECT_14_9", + ASPECT_4_3: "[PC Preview] unknow ASPECT_4_3", + ASPECT_FULL: "[PC Preview] unknow ASPECT_FULL", + ASPECT_POINT2POINT: "[PC Preview] unknow ASPECT_POINT2POINT", + ASPECT_AUTO: "[PC Preview] unknow ASPECT_AUTO", + ASPECT_SUBTITLE: "[PC Preview] unknow ASPECT_SUBTITLE", + ASPECT_PERSON: "[PC Preview] unknow ASPECT_PERSON", + ASPECT_CINEMA: "[PC Preview] unknow ASPECT_CINEMA", + ASPECT_PANORAMA: "[PC Preview] unknow ASPECT_PANORAMA", + ASPECT_ZOOM: "[PC Preview] unknow ASPECT_ZOOM", + ASPECT_ZOOM1: "[PC Preview] unknow ASPECT_ZOOM1", + ASPECT_ZOOM2: "[PC Preview] unknow ASPECT_ZOOM2", + ASPECT_TRUTH: "[PC Preview] unknow ASPECT_TRUTH", + ASPECT_21_9: "[PC Preview] unknow ASPECT_21_9" + } + const PictureModes = { + PICMODE_VIVID: "[PC Preview] unknow PICMODE_VIVID", + PICMODE_STANDARD: "[PC Preview] unknow PICMODE_STANDARD", + PICMODE_SOFTNESS: "[PC Preview] unknow PICMODE_SOFTNESS", + PICMODE_MOVIE: "[PC Preview] unknow PICMODE_MOVIE", + PICMODE_SPORTS: "[PC Preview] unknow PICMODE_SPORTS", + PICMODE_KID: "[PC Preview] unknow PICMODE_KID", + PICMODE_GAME: "[PC Preview] unknow PICMODE_GAME", + PICMODE_PICTURE: "[PC Preview] unknow PICMODE_PICTURE", + PICMODE_USER: "[PC Preview] unknow PICMODE_USER", + PICMODE_AUTO: "[PC Preview] unknow PICMODE_AUTO", + PICMODE_NATURAL: "[PC Preview] unknow PICMODE_NATURAL", + PICMODE_MASTER: "[PC Preview] unknow PICMODE_MASTER", + PICMODE_DYNAMIC: "[PC Preview] unknow PICMODE_DYNAMIC" + } + const HdmiRanges = { + HDMI_RANGE_AUTO: "[PC Preview] unknow HDMI_RANGE_AUTO", + HDMI_RANGE_COMPLETE: "[PC Preview] unknow HDMI_RANGE_COMPLETE", + HDMI_RANGE_LIMIT: "[PC Preview] unknow HDMI_RANGE_LIMIT" + } + const ColorGamuts = { + COLOR_GAMUT_AUTO: "[PC Preview] unknow COLOR_GAMUT_AUTO", + COLOR_GAMUT_BT2020: "[PC Preview] unknow COLOR_GAMUT_BT2020", + COLOR_GAMUT_P3: "[PC Preview] unknow COLOR_GAMUT_P3", + COLOR_GAMUT_ADOBERGB: "[PC Preview] unknow COLOR_GAMUT_ADOBERGB", + COLOR_GAMUT_BT709: "[PC Preview] unknow COLOR_GAMUT_BT709", + COLOR_GAMUT_BT601_EBU: "[PC Preview] unknow COLOR_GAMUT_BT601_EBU", + COLOR_GAMUT_BT601_SMPTE: "[PC Preview] unknow COLOR_GAMUT_BT601_SMPTE", + COLOR_GAMUT_NATIVE: "[PC Preview] unknow COLOR_GAMUT_NATIVE" + } + const WhitePoints = { + WHITE_POINT_AUTO: "[PC Preview] unknow WHITE_POINT_AUTO", + WHITE_POINT_D50: "[PC Preview] unknow WHITE_POINT_D50", + WHITE_POINT_D60: "[PC Preview] unknow WHITE_POINT_D60", + WHITE_POINT_D63: "[PC Preview] unknow WHITE_POINT_D63", + WHITE_POINT_D65: "[PC Preview] unknow WHITE_POINT_D65", + WHITE_POINT_D93: "[PC Preview] unknow WHITE_POINT_D93", + WHITE_POINT_NATIVE: "[PC Preview] unknow WHITE_POINT_NATIVE" + } + const Oetfs = { + OETF_AUTO: "[PC Preview] unknow OETF_AUTO", + OETF_BT709: "[PC Preview] unknow OETF_BT709", + OETF_SRGB: "[PC Preview] unknow OETF_SRGB", + OETF_22: "[PC Preview] unknow OETF_22", + OETF_24: "[PC Preview] unknow OETF_24", + OETF_26: "[PC Preview] unknow OETF_26", + OETF_BT2084: "[PC Preview] unknow OETF_BT2084", + OETF_HLG: "[PC Preview] unknow OETF_HLG", + OETF_NATIVE: "[PC Preview] unknow OETF_NATIVE" + } + const ColorManagerModes = { + COLOR_MANAGER_AUTO: "[PC Preview] unknow COLOR_MANAGER_AUTO", + COLOR_MANAGER_HDR10: "[PC Preview] unknow COLOR_MANAGER_HDR10", + COLOR_MANAGER_HLG: "[PC Preview] unknow COLOR_MANAGER_HLG", + COLOR_MANAGER_HDTV: "[PC Preview] unknow COLOR_MANAGER_HDTV", + COLOR_MANAGER_SRGB: "[PC Preview] unknow COLOR_MANAGER_SRGB", + COLOR_MANAGER_P3_DCI: "[PC Preview] unknow COLOR_MANAGER_P3_DCI", + COLOR_MANAGER_P3_D65: "[PC Preview] unknow COLOR_MANAGER_P3_D65", + COLOR_MANAGER_P3_D50: "[PC Preview] unknow COLOR_MANAGER_P3_D50", + COLOR_MANAGER_ADOBERGB: "[PC Preview] unknow COLOR_MANAGER_ADOBERGB", + COLOR_MANAGER_EBU: "[PC Preview] unknow COLOR_MANAGER_EBU", + COLOR_MANAGER_SMPTE_C: "[PC Preview] unknow COLOR_MANAGER_SMPTE_C", + COLOR_MANAGER_USER1: "[PC Preview] unknow COLOR_MANAGER_USER1", + COLOR_MANAGER_USER2: "[PC Preview] unknow COLOR_MANAGER_USER2", + COLOR_MANAGER_P3_PG: "[PC Preview] unknow COLOR_MANAGER_P3_PG", + COLOR_MANAGER_CUVA: "[PC Preview] unknow COLOR_MANAGER_CUVA" + } + const PictureUserHdrTypes = { + USER_HDR_TYPE_AUTO: "[PC Preview] unknow USER_HDR_TYPE_AUTO", + USER_HDR_TYPE_CUVA: "[PC Preview] unknow USER_HDR_TYPE_CUVA", + USER_HDR_TYPE_HDR10: "[PC Preview] unknow USER_HDR_TYPE_HDR10", + USER_HDR_TYPE_HLG: "[PC Preview] unknow USER_HDR_TYPE_HLG", + USER_HDR_TYPE_OFF: "[PC Preview] unknow USER_HDR_TYPE_OFF", + USER_HDR_TYPE_BUTT: "[PC Preview] unknow USER_HDR_TYPE_BUTT" + } + const CommonLevels = { + HI_MW_LEVEL_OFF: "[PC Preview] unknow HI_MW_LEVEL_OFF", + HI_MW_LEVEL_LOW: "[PC Preview] unknow HI_MW_LEVEL_LOW", + HI_MW_LEVEL_MID: "[PC Preview] unknow HI_MW_LEVEL_MID", + HI_MW_LEVEL_HIGH: "[PC Preview] unknow HI_MW_LEVEL_HIGH", + HI_MW_LEVEL_AUTO: "[PC Preview] unknow HI_MW_LEVEL_AUTO" + } + const PictureColorTempModes = { + COLOR_TEMP_DEFAULT: "[PC Preview] unknow COLOR_TEMP_DEFAULT", + COLOR_TEMP_NATURAL_TONE: "[PC Preview] unknow COLOR_TEMP_NATURAL_TONE", + COLOR_TEMP_EYE_PROTECT: "[PC Preview] unknow COLOR_TEMP_EYE_PROTECT" + } + const RectInfo = { + x: "[PC Preview] unknow x", + y: "[PC Preview] unknow y", + w: "[PC Preview] unknow w", + h: "[PC Preview] unknow h" + } + const SignalStates = { + SIGSTAT_SUPPORT: "[PC Preview] unknow SIGSTAT_SUPPORT", + SIGSTAT_NOSIGNAL: "[PC Preview] unknow SIGSTAT_NOSIGNAL", + SIGSTAT_UNSUPPORT: "[PC Preview] unknow SIGSTAT_UNSUPPORT", + SIGSTAT_UNSTABLE: "[PC Preview] unknow SIGSTAT_UNSTABLE" + } + const HdmirxEdidTypes = { + HDMIRX_EDID_TYPE_2_0: "[PC Preview] unknow HDMIRX_EDID_TYPE_2_0", + HDMIRX_EDID_TYPE_1_4: "[PC Preview] unknow HDMIRX_EDID_TYPE_1_4", + HDMIRX_EDID_TYPE_AUTO: "[PC Preview] unknow HDMIRX_EDID_TYPE_AUTO" + } + const Wakeup = { + mode: "[PC Preview] unknow mode", + src: "[PC Preview] unknow src", + value: "[PC Preview] unknow value" + } + const result = { + getAudioManager: function () { + console.warn("tv.getAudioManager interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return AudioManager; + }, + getEventManager: function () { + console.warn("tv.getEventManager interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return EventManager; + }, + getHdmiCecManager: function () { + console.warn("tv.getHdmiCecManager interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return HdmiCecManager; + }, + getPictureManager: function () { + console.warn("tv.getPictureManager interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return PictureManager; + }, + getSourceManager: function () { + console.warn("tv.getSourceManager interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return SourceManager; + }, + getSystemSetting: function () { + console.warn("tv.getSystemSetting interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return SystemSetting; } - const SoundSpdifs = { - SPDIF_PCM: "[PC Preview] unknow SPDIF_PCM", - SPDIF_RAW: "[PC Preview] unknow SPDIF_RAW", - SPDIF_AUTO: "[PC Preview] unknow SPDIF_AUTO" + } + const AudioManager = { + getMute: function (...args) { + console.warn("AudioManager.getMute interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setMute: function (...args) { + console.warn("AudioManager.setMute interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setUsrAudioMute: function (...args) { + console.warn("AudioManager.setUsrAudioMute interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getStereoMode: function (...args) { + console.warn("AudioManager.getStereoMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, SoundStereos); + } else { + return new Promise((resolve, reject) => { + resolve(SoundStereos); + }) + } + }, + setStereoMode: function (...args) { + console.warn("AudioManager.setStereoMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + enableSpdif: function (...args) { + console.warn("AudioManager.enableSpdif interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isSpdifEnabled: function (...args) { + console.warn("AudioManager.enableSpdif interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setSpdifMode: function (...args) { + console.warn("AudioManager.enableSpdif interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getSpdifMode: function (...args) { + console.warn("AudioManager.getSpdifMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, SoundSpdifs); + } else { + return new Promise((resolve, reject) => { + resolve(SoundSpdifs); + }) + } + }, + enableArc: function (...args) { + console.warn("AudioManager.enableArc interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isArcEnabled: function (...args) { + console.warn("AudioManager.isArcEnabled interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setArcMode: function (...args) { + console.warn("AudioManager.setArcMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getArcMode: function (...args) { + console.warn("AudioManager.getArcMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, SoundArcModes); + } else { + return new Promise((resolve, reject) => { + resolve(SoundArcModes); + }) + } + }, + isArcSupported: function (...args) { + console.warn("AudioManager.isArcSupported interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setAdvancedEffectParameter: function (...args) { + console.warn("AudioManager.setAdvancedEffectParameter interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getAdvancedEffectParameter: function (...args) { + console.warn("AudioManager.getAdvancedEffectParameter interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getAudioStreamInfo: function (...args) { + console.warn("AudioManager.getAudioStreamInfo interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, AudioStreamInfo); + } else { + return new Promise((resolve, reject) => { + resolve(AudioStreamInfo); + }) + } + }, + setTrackWeight: function (...args) { + console.warn("AudioManager.getAdvancedEffectParameter interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getTrackWeight: function (...args) { + console.warn("AudioManager.getTrackWeight interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, AudioGainAttr); + } else { + return new Promise((resolve, reject) => { + resolve(AudioGainAttr); + }) + } + }, + getSoundModeList: function (...args) { + console.warn("AudioManager.getSoundModeList interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var histenSoundModesArray = new Array(); + histenSoundModesArray.push(HistenSoundModes); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, histenSoundModesArray); + } else { + return new Promise((resolve, reject) => { + resolve(histenSoundModesArray); + }) + } + }, + setNightMode: function (...args) { + console.warn("AudioManager.setNightMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isNightModeEnabled: function (...args) { + console.warn("AudioManager.isNightModeEnabled interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + isNightModeSupported: function (...args) { + console.warn("AudioManager.isNightModeSupported interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + soundModeling: function (...args) { + console.warn("AudioManager.soundModeling interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setModelType: function (...args) { + console.warn("AudioManager.setModelType interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getModelType: function (...args) { + console.warn("AudioManager.getModelType interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, SoundFields); + } else { + return new Promise((resolve, reject) => { + resolve(SoundFields); + }) + } + }, + startMicRecorder: function (...args) { + console.warn("AudioManager.startMicRecorder interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + stopMicRecorder: function (...args) { + console.warn("AudioManager.stopMicRecorder interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + hasSoundCustomized: function (...args) { + console.warn("AudioManager.stopMicRecorder interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setOutDevice: function (...args) { + console.warn("AudioManager.setOutDevice interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getOutDevice: function (...args) { + console.warn("AudioManager.getOutDevice interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, AudioOutDevices); + } else { + return new Promise((resolve, reject) => { + resolve(AudioOutDevices); + }) + } + }, + getHangMode: function (...args) { + console.warn("AudioManager.getHangMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, SoundFields); + } else { + return new Promise((resolve, reject) => { + resolve(SoundFields); + }) + } + }, + setHangMode: function (...args) { + console.warn("AudioManager.setHangMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isMicDamaged: function (...args) { + console.warn("AudioManager.isMicDamaged interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + isVolAdjustSupported: function (...args) { + console.warn("AudioManager.isVolAdjustSupported interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + recoveryOutDevice: function (...args) { + console.warn("AudioManager.recoveryOutDevice interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setVolumeByPid: function (...args) { + console.warn("AudioManager.setVolumeByPid interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getHistenGeqGains: function (...args) { + console.warn("AudioManager.getHistenGeqGains interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var numberArray = new Array(); + numberArray.push(paramMock.paramNumberMock); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, numberArray); + } else { + return new Promise((resolve, reject) => { + resolve(numberArray); + }) + } + }, + setHistenGeqGain: function (...args) { + console.warn("AudioManager.setHistenGeqGain interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getHistenVocGain: function (...args) { + console.warn("AudioManager.getHistenVocGain interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setHistenVocGain: function (...args) { + console.warn("AudioManager.setHistenVocGain interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getHistenVertSurroundGain: function (...args) { + console.warn("AudioManager.getHistenVertSurroundGain interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setHistenVertSurroundGain: function (...args) { + console.warn("AudioManager.setHistenVertSurroundGain interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getHistenHorzSurroundGain: function (...args) { + console.warn("AudioManager.getHistenHorzSurroundGain interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setHistenHorzSurroundGain: function (...args) { + console.warn("AudioManager.setHistenHorzSurroundGain interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getHistenCustomMode: function (...args) { + console.warn("AudioManager.getHistenCustomMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setHistenCustomMode: function (...args) { + console.warn("AudioManager.setHistenCustomMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + resetHistenCustomMode: function (...args) { + console.warn("AudioManager.resetHistenCustomMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getHistenCustomModeList: function (...args) { + console.warn("AudioManager.getHistenCustomModeList interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var numberArray = new Array(); + numberArray.push(paramMock.paramNumberMock); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, numberArray); + } else { + return new Promise((resolve, reject) => { + resolve(numberArray); + }) + } + }, + enableHistenVoip: function (...args) { + console.warn("AudioManager.enableHistenVoip interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isHistenVoipEnabled: function (...args) { + console.warn("AudioManager.isHistenVoipEnabled interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } } - const SoundArcModes = { - ARC_AUDIO_MODE_LPCM: "[PC Preview] unknow ARC_AUDIO_MODE_LPCM", - ARC_AUDIO_MODE_RAW: "[PC Preview] unknow ARC_AUDIO_MODE_RAW", - ARC_AUDIO_MODE_LEGACY: "[PC Preview] unknow ARC_AUDIO_MODE_LEGACY", - ARC_AUDIO_MODE_AUTO: "[PC Preview] unknow ARC_AUDIO_MODE_AUTO" + } + const EventManager = { + on: function (...args) { + console.warn("EventManager.on interface mocked in the Previewer. How this interface works on the Previewer may" + + " be different from that on a real device.") + }, + off: function (...args) { + console.warn("EventManager.off interface mocked in the Previewer. How this interface works on the Previewer may" + + " be different from that on a real device.") } - const AudioStreamInfo = { - type: "[PC Preview] unknow type", - value: "[PC Preview] unknow value" + } + const HdmiCecManager = { + getUiStatus: function (...args) { + console.warn("HdmiCecManager.getUiStatus interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setUiStatus: function (...args) { + console.warn("HdmiCecManager.setUiStatus interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getDeviceList: function (...args) { + console.warn("HdmiCecManager.getDeviceList interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, HdmiCecDeviceInfo); + } else { + return new Promise((resolve, reject) => { + resolve(HdmiCecDeviceInfo); + }) + } + }, + changeSourceToTv: function (...args) { + console.warn("HdmiCecManager.changeSourceToTv interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + sendMenuCommand: function (...args) { + console.warn("HdmiCecManager.sendMenuCommand interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } } - const AudioGainAttr = { - isLinearMode: "[PC Preview] unknow isLinearMode", - gain: "[PC Preview] unknow gain" + } + const PictureManager = { + enableAutoPictureMode: function (...args) { + console.warn("PictureManager.enableAutoPictureMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setPictureMode: function (...args) { + console.warn("PictureManager.setPictureMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setBrightness: function (...args) { + console.warn("PictureManager.setBrightness interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getBrightness: function (...args) { + console.warn("PictureManager.getBrightness interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setContrast: function (...args) { + console.warn("PictureManager.setContrast interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getContrast: function (...args) { + console.warn("PictureManager.getContrast interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setSaturation: function (...args) { + console.warn("PictureManager.setSaturation interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getSaturation: function (...args) { + console.warn("PictureManager.getSaturation interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setSharpness: function (...args) { + console.warn("PictureManager.setSharpness interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getSharpness: function (...args) { + console.warn("PictureManager.getSharpness interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setHue: function (...args) { + console.warn("PictureManager.setHue interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getHue: function (...args) { + console.warn("PictureManager.getHue interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setBacklight: function (...args) { + console.warn("PictureManager.setBacklight interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getBacklight: function (...args) { + console.warn("PictureManager.getBacklight interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setBacklightThreshold: function (...args) { + console.warn("PictureManager.setBacklightThreshold interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getBacklightThreshold: function (...args) { + console.warn("PictureManager.getBacklightThreshold interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setColorTemp: function (...args) { + console.warn("PictureManager.setColorTemp interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getColorTemp: function (...args) { + console.warn("PictureManager.getColorTemp interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, PictureClrtmps); + } else { + return new Promise((resolve, reject) => { + resolve(PictureClrtmps); + }) + } + }, + setNr: function (...args) { + console.warn("PictureManager.setNr interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getNr: function (...args) { + console.warn("PictureManager.getNr interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, PictureLevels); + } else { + return new Promise((resolve, reject) => { + resolve(PictureLevels); + }) + } + }, + setMemcLevel: function (...args) { + console.warn("PictureManager.setMemcLevel interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getMemcLevel: function (...args) { + console.warn("PictureManager.getMemcLevel interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + enableDci: function (...args) { + console.warn("PictureManager.enableDci interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isDciEnabled: function (...args) { + console.warn("PictureManager.isDciEnabled interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + enableDynamicBl: function (...args) { + console.warn("PictureManager.enableDynamicBl interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isDynamicBlEnabled: function (...args) { + console.warn("PictureManager.isDynamicBlEnabled interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setAspect: function (...args) { + console.warn("PictureManager.setAspect interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getAspect: function (...args) { + console.warn("PictureManager.getAspect interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, PictureAspects); + } else { + return new Promise((resolve, reject) => { + resolve(PictureAspects); + }) + } + }, + enableLocalDimming: function (...args) { + console.warn("PictureManager.enableLocalDimming interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isLocalDimmingEnabled: function (...args) { + console.warn("PictureManager.isLocalDimmingEnabled interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + isLocalDimmingSupported: function (...args) { + console.warn("PictureManager.isLocalDimmingSupported interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setEyeProtectMode: function (...args) { + console.warn("PictureManager.setEyeProtectMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getEyeProtectMode: function (...args) { + console.warn("PictureManager.getEyeProtectMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setVideoInfoStart: function (...args) { + console.warn("PictureManager.setVideoInfoStart interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setVideoInfoStop: function (...args) { + console.warn("PictureManager.setVideoInfoStop interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getPictureModeList: function (...args) { + console.warn("PictureManager.getPictureModeList interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var pictureModesArray = new Array(); + pictureModesArray.push(PictureModes); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, pictureModesArray); + } else { + return new Promise((resolve, reject) => { + resolve(pictureModesArray); + }) + } + }, + setAutoBlEnable: function (...args) { + console.warn("PictureManager.setAutoBlEnable interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isAutoBacklightEnabled: function (...args) { + console.warn("PictureManager.isAutoBacklightEnabled interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setActivityUi: function (...args) { + console.warn("PictureManager.setActivityUi interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setDciType: function (...args) { + console.warn("PictureManager.setDciType interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getDciType: function (...args) { + console.warn("PictureManager.getDciType interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setDciGainLevel: function (...args) { + console.warn("PictureManager.setDciGainLevel interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getDciGainLevel: function (...args) { + console.warn("PictureManager.getDciGainLevel interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setUploadBacklight: function (...args) { + console.warn("PictureManager.setUploadBacklight interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getPictureMode: function (...args) { + console.warn("PictureManager.getPictureMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, PictureModes); + } else { + return new Promise((resolve, reject) => { + resolve(PictureModes); + }) + } + }, + enableBacklight: function (...args) { + console.warn("PictureManager.enableBacklight interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isBacklightEnabled: function (...args) { + console.warn("PictureManager.isBacklightEnabled interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setHdmiRange: function (...args) { + console.warn("PictureManager.setHdmiRange interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getHdmiRange: function (...args) { + console.warn("PictureManager.getHdmiRange interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, HdmiRanges); + } else { + return new Promise((resolve, reject) => { + resolve(HdmiRanges); + }) + } + }, + setColorGamut: function (...args) { + console.warn("PictureManager.setColorGamut interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getColorGamut: function (...args) { + console.warn("PictureManager.getColorGamut interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ColorGamuts); + } else { + return new Promise((resolve, reject) => { + resolve(ColorGamuts); + }) + } + }, + setWhitePoint: function (...args) { + console.warn("PictureManager.setWhitePoint interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getWhitePoint: function (...args) { + console.warn("PictureManager.getWhitePoint interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, WhitePoints); + } else { + return new Promise((resolve, reject) => { + resolve(WhitePoints); + }) + } + }, + setOetf: function (...args) { + console.warn("PictureManager.setOetf interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getOetf: function (...args) { + console.warn("PictureManager.getOetf interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Oetfs); + } else { + return new Promise((resolve, reject) => { + resolve(Oetfs); + }) + } + }, + setTwoPointColorTemp: function (...args) { + console.warn("PictureManager.setTwoPointColorTemp interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getTwoPointColorTemp: function (...args) { + console.warn("PictureManager.getTwoPointColorTemp interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramArrayMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramArrayMock); + }) + } + }, + setTenGamma: function (...args) { + console.warn("PictureManager.setTenGamma interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getTenGamma: function (...args) { + console.warn("PictureManager.getTenGamma interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramArrayMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramArrayMock); + }) + } + }, + enableCreatorMode: function (...args) { + console.warn("PictureManager.enableCreatorMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isCreatorModeEnabled: function (...args) { + console.warn("PictureManager.isCreatorModeEnabled interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setColorManagerMode: function (...args) { + console.warn("PictureManager.setColorManagerMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getColorManagerMode: function (...args) { + console.warn("PictureManager.getColorManagerMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ColorManagerModes); + } else { + return new Promise((resolve, reject) => { + resolve(ColorManagerModes); + }) + } + }, + restoreCalibration: function (...args) { + console.warn("PictureManager.restoreCalibration interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + restoreMasterSetting: function (...args) { + console.warn("PictureManager.restoreMasterSetting interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setStandbyLedEnable: function (...args) { + console.warn("PictureManager.setStandbyLedEnable interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isStandbyLedEnabled: function (...args) { + console.warn("PictureManager.isStandbyLedEnabled interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + getHdrType: function (...args) { + console.warn("PictureManager.getHdrType interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, PictureUserHdrTypes); + } else { + return new Promise((resolve, reject) => { + resolve(PictureUserHdrTypes); + }) + } + }, + setUserHdrType: function (...args) { + console.warn("PictureManager.setUserHdrType interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getUserHdrType: function (...args) { + console.warn("PictureManager.getUserHdrType interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, PictureUserHdrTypes); + } else { + return new Promise((resolve, reject) => { + resolve(PictureUserHdrTypes); + }) + } + }, + setMpegNr: function (...args) { + console.warn("PictureManager.setMpegNr interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getMpegNr: function (...args) { + console.warn("PictureManager.getMpegNr interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, CommonLevels); + } else { + return new Promise((resolve, reject) => { + resolve(CommonLevels); + }) + } + }, + setBoostPeakLevel: function (...args) { + console.warn("PictureManager.setBoostPeakLevel interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getBoostPeakLevel: function (...args) { + console.warn("PictureManager.getBoostPeakLevel interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, CommonLevels); + } else { + return new Promise((resolve, reject) => { + resolve(CommonLevels); + }) + } + }, + enableNaturalTone: function (...args) { + console.warn("PictureManager.enableNaturalTone interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isNaturalToneEnabled: function (...args) { + console.warn("PictureManager.isNaturalToneEnabled interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setClearMotionLevel: function (...args) { + console.warn("PictureManager.setClearMotionLevel interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getClearMotionLevel: function (...args) { + console.warn("PictureManager.getClearMotionLevel interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, CommonLevels); + } else { + return new Promise((resolve, reject) => { + resolve(CommonLevels); + }) + } + }, + restoreCurrentPictureMode: function (...args) { + console.warn("PictureManager.restoreCurrentPictureMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setEyeProtectStep: function (...args) { + console.warn("PictureManager.setEyeProtectStep interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getEyeProtectStep: function (...args) { + console.warn("PictureManager.getEyeProtectStep interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setColorTempMode: function (...args) { + console.warn("PictureManager.setColorTempMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getColorTempMode: function (...args) { + console.warn("PictureManager.getColorTempMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, PictureColorTempModes); + } else { + return new Promise((resolve, reject) => { + resolve(PictureColorTempModes); + }) + } + }, + setColorTempStep: function (...args) { + console.warn("PictureManager.setColorTempStep interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getColorTempStep: function (...args) { + console.warn("PictureManager.getColorTempStep interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getNormalColorManagerMode: function (...args) { + console.warn("PictureManager.getNormalColorManagerMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ColorManagerModes); + } else { + return new Promise((resolve, reject) => { + resolve(ColorManagerModes); + }) + } + }, + isPdParamSupported: function (...args) { + console.warn("PictureManager.isPdParamSupported interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + isCuvaDeviceSupported: function (...args) { + console.warn("PictureManager.isCuvaDeviceSupported interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } } - const HistenSoundModes = { - HISTEN_SNDMODE_MUSIC: "[PC Preview] unknow HISTEN_SNDMODE_MUSIC", - HISTEN_SNDMODE_MOVIE: "[PC Preview] unknow HISTEN_SNDMODE_MOVIE", - HISTEN_SNDMODE_STANDARD: "[PC Preview] unknow HISTEN_SNDMODE_STANDARD", - HISTEN_SNDMODE_SPORTS: "[PC Preview] unknow HISTEN_SNDMODE_SPORTS", - HISTEN_SNDMODE_NEWS: "[PC Preview] unknow HISTEN_SNDMODE_NEWS", - HISTEN_SNDMODE_GAME: "[PC Preview] unknow HISTEN_SNDMODE_GAME", - HISTEN_SNDMODE_AUTO: "[PC Preview] unknow HISTEN_SNDMODE_AUTO", - HISTEN_SNDMODE_DEVIALET: "[PC Preview] unknow HISTEN_SNDMODE_DEVIALET", - HISTEN_SNDMODE_USER: "[PC Preview] unknow HISTEN_SNDMODE_USER" + } + const SourceManager = { + selectSource: function (...args) { + console.warn("SourceManager.selectSource interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getCurSourceId: function (...args) { + console.warn("SourceManager.getCurSourceId interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, SourceIndices); + } else { + return new Promise((resolve, reject) => { + resolve(SourceIndices); + }) + } + }, + deselectSource: function (...args) { + console.warn("SourceManager.deselectSource interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getAvailSourceList: function (...args) { + console.warn("SourceManager.getAvailSourceList interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var sourceIndicesArray = new Array(); + sourceIndicesArray.push(SourceIndices); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, sourceIndicesArray); + } else { + return new Promise((resolve, reject) => { + resolve(sourceIndicesArray); + }) + } + }, + getTimingInfo: function (...args) { + console.warn("SourceManager.getTimingInfo interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, TimingInfo); + } else { + return new Promise((resolve, reject) => { + resolve(TimingInfo); + }) + } + }, + getSignalStatus: function (...args) { + console.warn("SourceManager.getSignalStatus interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, SignalStates); + } else { + return new Promise((resolve, reject) => { + resolve(SignalStates); + }) + } + }, + setWindowRect: function (...args) { + console.warn("SourceManager.setWindowRect interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getWindowRect: function (...args) { + console.warn("SourceManager.getWindowRect interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, RectInfo); + } else { + return new Promise((resolve, reject) => { + resolve(RectInfo); + }) + } + }, + setVideoDisplay: function (...args) { + console.warn("SourceManager.setVideoDisplay interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + clearVideoDisplay: function (...args) { + console.warn("SourceManager.clearVideoDisplay interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getSupportSourceList: function (...args) { + console.warn("SourceManager.getSupportSourceList interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, sourceIndicesArray); + } else { + return new Promise((resolve, reject) => { + resolve(sourceIndicesArray); + }) + } + }, + getSelectSourceId: function (...args) { + console.warn("SourceManager.getSelectSourceId interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramArrayMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramArrayMock); + }) + } + }, + getSourcePlayingState: function (...args) { + console.warn("SourceManager.getSourcePlayingState interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var sourceIndicesArray = new Array(); + sourceIndicesArray.push(SourceIndices); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, sourceIndicesArray); + } else { + return new Promise((resolve, reject) => { + resolve(sourceIndicesArray); + }) + } + }, + connectDistributeService: function (...args) { + console.warn("SourceManager.connectDistributeService interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } } - const SoundFields = { - SNDFIELD_DESKTOP: "[PC Preview] unknow SNDFIELD_DESKTOP", - SNDFIELD_HANG: "[PC Preview] unknow SNDFIELD_HANG" + } + const SystemSetting = { + restoreDefault: function (...args) { + console.warn("SystemSetting.restoreDefault interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setHdmirxEdidType: function (...args) { + console.warn("SystemSetting.setHdmirxEdidType interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getHdmirxEdidType: function (...args) { + console.warn("SystemSetting.getHdmirxEdidType interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, HdmirxEdidTypes); + } else { + return new Promise((resolve, reject) => { + resolve(HdmirxEdidTypes); + }) + } + }, + isPowerOnPanelEnabled: function (...args) { + console.warn("SystemSetting.isPowerOnPanelEnabled interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + enablePowerOnPanel: function (...args) { + console.warn("SystemSetting.enablePowerOnPanel interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + restorePic: function (...args) { + console.warn("SystemSetting.restorePic interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + setPowerSaveMode: function (...args) { + console.warn("SystemSetting.setPowerSaveMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getPowerSaveMode: function (...args) { + console.warn("SystemSetting.getPowerSaveMode interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getWakeup: function (...args) { + console.warn("SystemSetting.getWakeup interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, Wakeup); + } else { + return new Promise((resolve, reject) => { + resolve(Wakeup); + }) + } + }, + enableLock: function (...args) { + console.warn("SystemSetting.enableLock interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isLockEnabled: function (...args) { + console.warn("SystemSetting.isLockEnabled interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + var sourceIndicesArray = new Array(); + sourceIndicesArray.push(SourceIndices); + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setParentLock: function (...args) { + console.warn("SystemSetting.setParentLock interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getParentLock: function (...args) { + console.warn("SystemSetting.getParentLock interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + enableSrcLock: function (...args) { + console.warn("SystemSetting.enableSrcLock interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isSrcLockEnabled: function (...args) { + console.warn("SystemSetting.isSrcLockEnabled interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + isCurrentLocked: function (...args) { + console.warn("SystemSetting.isCurrentLocked interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + enableDtvLock: function (...args) { + console.warn("SystemSetting.enableDtvLock interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isDtvLockEnabled: function (...args) { + console.warn("SystemSetting.isDtvLockEnabled interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setDtvLockDefaultStatus: function (...args) { + console.warn("SystemSetting.setDtvLockDefaultStatus interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + enableTemperatureCtrl: function (...args) { + console.warn("SystemSetting.enableTemperatureCtrl interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isTemperatureCtrlEnabled: function (...args) { + console.warn("SystemSetting.isTemperatureCtrlEnabled interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + isTemperatureCtrlSupported: function (...args) { + console.warn("SystemSetting.isTemperatureCtrlSupported interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + isLampEffectSupported: function (...args) { + console.warn("SystemSetting.isLampEffectSupported interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } } - const AudioOutDevices = { - DEVICE_NONE: "[PC Preview] unknow DEVICE_NONE", - DEVICE_OUT_SPEAKER: "[PC Preview] unknow DEVICE_OUT_SPEAKER", - DEVICE_OUT_SPDIF: "[PC Preview] unknow DEVICE_OUT_SPDIF", - DEVICE_OUT_HDMI_ARC: "[PC Preview] unknow DEVICE_OUT_HDMI_ARC", - DEVICE_OUT_BLUETOOTH_A2DP: "[PC Preview] unknow DEVICE_OUT_BLUETOOTH_A2DP", - DEVICE_OUT_USB_DEVICE: "[PC Preview] unknow DEVICE_OUT_USB_DEVICE", - DEVICE_OUT_WIFI_SPEAKER: "[PC Preview] unknow DEVICE_OUT_WIFI_SPEAKER" - } - const SourceIndices = { - SOURCE_ATV: "[PC Preview] unknow SOURCE_ATV", - SOURCE_DVBC: "[PC Preview] unknow SOURCE_DVBC", - SOURCE_DTMB: "[PC Preview] unknow SOURCE_DTMB", - SOURCE_CVBS1: "[PC Preview] unknow SOURCE_CVBS1", - SOURCE_CVBS2: "[PC Preview] unknow SOURCE_CVBS2", - SOURCE_CVBS3: "[PC Preview] unknow SOURCE_CVBS3", - SOURCE_VGA: "[PC Preview] unknow SOURCE_VGA", - SOURCE_YPBPR1: "[PC Preview] unknow SOURCE_YPBPR1", - SOURCE_YPBPR2: "[PC Preview] unknow SOURCE_YPBPR2", - SOURCE_HDMI1: "[PC Preview] unknow SOURCE_HDMI1", - SOURCE_HDMI2: "[PC Preview] unknow SOURCE_HDMI2", - SOURCE_HDMI3: "[PC Preview] unknow SOURCE_HDMI3", - SOURCE_HDMI4: "[PC Preview] unknow SOURCE_HDMI4", - SOURCE_MEDIA: "[PC Preview] unknow SOURCE_MEDIA", - SOURCE_MEDIA2: "[PC Preview] unknow SOURCE_MEDIA2", - SOURCE_SCART1: "[PC Preview] unknow SOURCE_SCART1", - SOURCE_SCART2: "[PC Preview] unknow SOURCE_SCART2", - SOURCE_AUTO: "[PC Preview] unknow SOURCE_AUTO", - SOURCE_DVBT: "[PC Preview] unknow SOURCE_DVBT", - SOURCE_ATSC: "[PC Preview] unknow SOURCE_ATSC", - SOURCE_DVBS: "[PC Preview] unknow SOURCE_DVBS", - SOURCE_ISDBT: "[PC Preview] unknow SOURCE_ISDBT", - SOURCE_BUTT: "[PC Preview] unknow SOURCE_BUTT" - } - const TimingInfo = { - width: "[PC Preview] unknow width", - height: "[PC Preview] unknow height", - frame: "[PC Preview] unknow frame", - isInterlace: "[PC Preview] unknow isInterlace", - hdmiFmt: "[PC Preview] unknow hdmiFmt", - threeDimFmt: "[PC Preview] unknow threeDimFmt", - colorSpace: "[PC Preview] unknow colorSpace", - isMhl: "[PC Preview] unknow isMhl" - } - const HdmiCecDeviceInfo = { - hdmiDevPort: "[PC Preview] unknow hdmiDevPort", - logicAddr: "[PC Preview] unknow logicAddr", - devVendId: "[PC Preview] unknow devVendId", - osdName: "[PC Preview] unknow osdName" - } - const PictureClrtmps = { - CLRTMP_NATURE: "[PC Preview] unknow CLRTMP_NATURE", - CLRTMP_COOL: "[PC Preview] unknow CLRTMP_COOL", - CLRTMP_WARM: "[PC Preview] unknow CLRTMP_WARM", - CLRTMP_USER: "[PC Preview] unknow CLRTMP_USER", - CLRTMP_TOCOOL: "[PC Preview] unknow CLRTMP_TOCOOL", - CLRTMP_TOWARM: "[PC Preview] unknow CLRTMP_TOWARM", - CLRTMP_BUTT: "[PC Preview] unknow CLRTMP_BUTT" - } - const PictureLevels = { - LEVEL_OFF: "[PC Preview] unknow LEVEL_OFF", - LEVEL_LOW: "[PC Preview] unknow LEVEL_LOW", - LEVEL_MIDDLE: "[PC Preview] unknow LEVEL_MIDDLE", - LEVEL_HIGH: "[PC Preview] unknow LEVEL_HIGH", - LEVEL_AUTO: "[PC Preview] unknow LEVEL_AUTO" - } - const PictureAspects = { - ASPECT_16_9: "[PC Preview] unknow ASPECT_16_9", - ASPECT_14_9: "[PC Preview] unknow ASPECT_14_9", - ASPECT_4_3: "[PC Preview] unknow ASPECT_4_3", - ASPECT_FULL: "[PC Preview] unknow ASPECT_FULL", - ASPECT_POINT2POINT: "[PC Preview] unknow ASPECT_POINT2POINT", - ASPECT_AUTO: "[PC Preview] unknow ASPECT_AUTO", - ASPECT_SUBTITLE: "[PC Preview] unknow ASPECT_SUBTITLE", - ASPECT_PERSON: "[PC Preview] unknow ASPECT_PERSON", - ASPECT_CINEMA: "[PC Preview] unknow ASPECT_CINEMA", - ASPECT_PANORAMA: "[PC Preview] unknow ASPECT_PANORAMA", - ASPECT_ZOOM: "[PC Preview] unknow ASPECT_ZOOM", - ASPECT_ZOOM1: "[PC Preview] unknow ASPECT_ZOOM1", - ASPECT_ZOOM2: "[PC Preview] unknow ASPECT_ZOOM2", - ASPECT_TRUTH: "[PC Preview] unknow ASPECT_TRUTH", - ASPECT_21_9: "[PC Preview] unknow ASPECT_21_9" - } - const PictureModes = { - PICMODE_VIVID: "[PC Preview] unknow PICMODE_VIVID", - PICMODE_STANDARD: "[PC Preview] unknow PICMODE_STANDARD", - PICMODE_SOFTNESS: "[PC Preview] unknow PICMODE_SOFTNESS", - PICMODE_MOVIE: "[PC Preview] unknow PICMODE_MOVIE", - PICMODE_SPORTS: "[PC Preview] unknow PICMODE_SPORTS", - PICMODE_KID: "[PC Preview] unknow PICMODE_KID", - PICMODE_GAME: "[PC Preview] unknow PICMODE_GAME", - PICMODE_PICTURE: "[PC Preview] unknow PICMODE_PICTURE", - PICMODE_USER: "[PC Preview] unknow PICMODE_USER", - PICMODE_AUTO: "[PC Preview] unknow PICMODE_AUTO", - PICMODE_NATURAL: "[PC Preview] unknow PICMODE_NATURAL", - PICMODE_MASTER: "[PC Preview] unknow PICMODE_MASTER", - PICMODE_DYNAMIC: "[PC Preview] unknow PICMODE_DYNAMIC" - } - const HdmiRanges = { - HDMI_RANGE_AUTO: "[PC Preview] unknow HDMI_RANGE_AUTO", - HDMI_RANGE_COMPLETE: "[PC Preview] unknow HDMI_RANGE_COMPLETE", - HDMI_RANGE_LIMIT: "[PC Preview] unknow HDMI_RANGE_LIMIT" - } - const ColorGamuts = { - COLOR_GAMUT_AUTO: "[PC Preview] unknow COLOR_GAMUT_AUTO", - COLOR_GAMUT_BT2020: "[PC Preview] unknow COLOR_GAMUT_BT2020", - COLOR_GAMUT_P3: "[PC Preview] unknow COLOR_GAMUT_P3", - COLOR_GAMUT_ADOBERGB: "[PC Preview] unknow COLOR_GAMUT_ADOBERGB", - COLOR_GAMUT_BT709: "[PC Preview] unknow COLOR_GAMUT_BT709", - COLOR_GAMUT_BT601_EBU: "[PC Preview] unknow COLOR_GAMUT_BT601_EBU", - COLOR_GAMUT_BT601_SMPTE: "[PC Preview] unknow COLOR_GAMUT_BT601_SMPTE", - COLOR_GAMUT_NATIVE: "[PC Preview] unknow COLOR_GAMUT_NATIVE" - } - const WhitePoints = { - WHITE_POINT_AUTO: "[PC Preview] unknow WHITE_POINT_AUTO", - WHITE_POINT_D50: "[PC Preview] unknow WHITE_POINT_D50", - WHITE_POINT_D60: "[PC Preview] unknow WHITE_POINT_D60", - WHITE_POINT_D63: "[PC Preview] unknow WHITE_POINT_D63", - WHITE_POINT_D65: "[PC Preview] unknow WHITE_POINT_D65", - WHITE_POINT_D93: "[PC Preview] unknow WHITE_POINT_D93", - WHITE_POINT_NATIVE: "[PC Preview] unknow WHITE_POINT_NATIVE" - } - const Oetfs = { - OETF_AUTO: "[PC Preview] unknow OETF_AUTO", - OETF_BT709: "[PC Preview] unknow OETF_BT709", - OETF_SRGB: "[PC Preview] unknow OETF_SRGB", - OETF_22: "[PC Preview] unknow OETF_22", - OETF_24: "[PC Preview] unknow OETF_24", - OETF_26: "[PC Preview] unknow OETF_26", - OETF_BT2084: "[PC Preview] unknow OETF_BT2084", - OETF_HLG: "[PC Preview] unknow OETF_HLG", - OETF_NATIVE: "[PC Preview] unknow OETF_NATIVE" - } - const ColorManagerModes = { - COLOR_MANAGER_AUTO: "[PC Preview] unknow COLOR_MANAGER_AUTO", - COLOR_MANAGER_HDR10: "[PC Preview] unknow COLOR_MANAGER_HDR10", - COLOR_MANAGER_HLG: "[PC Preview] unknow COLOR_MANAGER_HLG", - COLOR_MANAGER_HDTV: "[PC Preview] unknow COLOR_MANAGER_HDTV", - COLOR_MANAGER_SRGB: "[PC Preview] unknow COLOR_MANAGER_SRGB", - COLOR_MANAGER_P3_DCI: "[PC Preview] unknow COLOR_MANAGER_P3_DCI", - COLOR_MANAGER_P3_D65: "[PC Preview] unknow COLOR_MANAGER_P3_D65", - COLOR_MANAGER_P3_D50: "[PC Preview] unknow COLOR_MANAGER_P3_D50", - COLOR_MANAGER_ADOBERGB: "[PC Preview] unknow COLOR_MANAGER_ADOBERGB", - COLOR_MANAGER_EBU: "[PC Preview] unknow COLOR_MANAGER_EBU", - COLOR_MANAGER_SMPTE_C: "[PC Preview] unknow COLOR_MANAGER_SMPTE_C", - COLOR_MANAGER_USER1: "[PC Preview] unknow COLOR_MANAGER_USER1", - COLOR_MANAGER_USER2: "[PC Preview] unknow COLOR_MANAGER_USER2", - COLOR_MANAGER_P3_PG: "[PC Preview] unknow COLOR_MANAGER_P3_PG", - COLOR_MANAGER_CUVA: "[PC Preview] unknow COLOR_MANAGER_CUVA" - } - const PictureUserHdrTypes = { - USER_HDR_TYPE_AUTO: "[PC Preview] unknow USER_HDR_TYPE_AUTO", - USER_HDR_TYPE_CUVA: "[PC Preview] unknow USER_HDR_TYPE_CUVA", - USER_HDR_TYPE_HDR10: "[PC Preview] unknow USER_HDR_TYPE_HDR10", - USER_HDR_TYPE_HLG: "[PC Preview] unknow USER_HDR_TYPE_HLG", - USER_HDR_TYPE_OFF: "[PC Preview] unknow USER_HDR_TYPE_OFF", - USER_HDR_TYPE_BUTT: "[PC Preview] unknow USER_HDR_TYPE_BUTT" - } - const CommonLevels = { - HI_MW_LEVEL_OFF: "[PC Preview] unknow HI_MW_LEVEL_OFF", - HI_MW_LEVEL_LOW: "[PC Preview] unknow HI_MW_LEVEL_LOW", - HI_MW_LEVEL_MID: "[PC Preview] unknow HI_MW_LEVEL_MID", - HI_MW_LEVEL_HIGH: "[PC Preview] unknow HI_MW_LEVEL_HIGH", - HI_MW_LEVEL_AUTO: "[PC Preview] unknow HI_MW_LEVEL_AUTO" - } - const PictureColorTempModes = { - COLOR_TEMP_DEFAULT: "[PC Preview] unknow COLOR_TEMP_DEFAULT", - COLOR_TEMP_NATURAL_TONE: "[PC Preview] unknow COLOR_TEMP_NATURAL_TONE", - COLOR_TEMP_EYE_PROTECT: "[PC Preview] unknow COLOR_TEMP_EYE_PROTECT" - } - const RectInfo = { - x: "[PC Preview] unknow x", - y: "[PC Preview] unknow y", - w: "[PC Preview] unknow w", - h: "[PC Preview] unknow h" - } - const SignalStates = { - SIGSTAT_SUPPORT: "[PC Preview] unknow SIGSTAT_SUPPORT", - SIGSTAT_NOSIGNAL: "[PC Preview] unknow SIGSTAT_NOSIGNAL", - SIGSTAT_UNSUPPORT: "[PC Preview] unknow SIGSTAT_UNSUPPORT", - SIGSTAT_UNSTABLE: "[PC Preview] unknow SIGSTAT_UNSTABLE" - } - const HdmirxEdidTypes = { - HDMIRX_EDID_TYPE_2_0: "[PC Preview] unknow HDMIRX_EDID_TYPE_2_0", - HDMIRX_EDID_TYPE_1_4: "[PC Preview] unknow HDMIRX_EDID_TYPE_1_4", - HDMIRX_EDID_TYPE_AUTO: "[PC Preview] unknow HDMIRX_EDID_TYPE_AUTO" - } - const Wakeup = { - mode: "[PC Preview] unknow mode", - src: "[PC Preview] unknow src", - value: "[PC Preview] unknow value" - } - const result = { - getAudioManager: function () { - console.warn("tv.getAudioManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return AudioManager; - }, - getEventManager: function () { - console.warn("tv.getEventManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return EventManager; - }, - getHdmiCecManager: function () { - console.warn("tv.getHdmiCecManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return HdmiCecManager; - }, - getPictureManager: function () { - console.warn("tv.getPictureManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return PictureManager; - }, - getSourceManager: function () { - console.warn("tv.getSourceManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return SourceManager; - }, - getSystemSetting: function () { - console.warn("tv.getSystemSetting interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return SystemSetting; - } - } - const AudioManager = { - getMute: function (...args) { - console.warn("AudioManager.getMute interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setMute: function (...args) { - console.warn("AudioManager.setMute interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setUsrAudioMute: function (...args) { - console.warn("AudioManager.setUsrAudioMute interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getStereoMode: function (...args) { - console.warn("AudioManager.getStereoMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, SoundStereos); - } else { - return new Promise((resolve, reject) => { - resolve(SoundStereos); - }) - } - }, - setStereoMode: function (...args) { - console.warn("AudioManager.setStereoMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - enableSpdif: function (...args) { - console.warn("AudioManager.enableSpdif interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isSpdifEnabled: function (...args) { - console.warn("AudioManager.enableSpdif interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setSpdifMode: function (...args) { - console.warn("AudioManager.enableSpdif interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSpdifMode: function (...args) { - console.warn("AudioManager.getSpdifMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, SoundSpdifs); - } else { - return new Promise((resolve, reject) => { - resolve(SoundSpdifs); - }) - } - }, - enableArc: function (...args) { - console.warn("AudioManager.enableArc interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isArcEnabled: function (...args) { - console.warn("AudioManager.isArcEnabled interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setArcMode: function (...args) { - console.warn("AudioManager.setArcMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getArcMode: function (...args) { - console.warn("AudioManager.getArcMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, SoundArcModes); - } else { - return new Promise((resolve, reject) => { - resolve(SoundArcModes); - }) - } - }, - isArcSupported: function (...args) { - console.warn("AudioManager.isArcSupported interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setAdvancedEffectParameter: function (...args) { - console.warn("AudioManager.setAdvancedEffectParameter interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAdvancedEffectParameter: function (...args) { - console.warn("AudioManager.getAdvancedEffectParameter interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAudioStreamInfo: function (...args) { - console.warn("AudioManager.getAudioStreamInfo interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, AudioStreamInfo); - } else { - return new Promise((resolve, reject) => { - resolve(AudioStreamInfo); - }) - } - }, - setTrackWeight: function (...args) { - console.warn("AudioManager.getAdvancedEffectParameter interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTrackWeight: function (...args) { - console.warn("AudioManager.getTrackWeight interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, AudioGainAttr); - } else { - return new Promise((resolve, reject) => { - resolve(AudioGainAttr); - }) - } - }, - getSoundModeList: function (...args) { - console.warn("AudioManager.getSoundModeList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var histenSoundModesArray = new Array(); - histenSoundModesArray.push(HistenSoundModes); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, histenSoundModesArray); - } else { - return new Promise((resolve, reject) => { - resolve(histenSoundModesArray); - }) - } - }, - setNightMode: function (...args) { - console.warn("AudioManager.setNightMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isNightModeEnabled: function (...args) { - console.warn("AudioManager.isNightModeEnabled interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isNightModeSupported: function (...args) { - console.warn("AudioManager.isNightModeSupported interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - soundModeling: function (...args) { - console.warn("AudioManager.soundModeling interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setModelType: function (...args) { - console.warn("AudioManager.setModelType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getModelType: function (...args) { - console.warn("AudioManager.getModelType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, SoundFields); - } else { - return new Promise((resolve, reject) => { - resolve(SoundFields); - }) - } - }, - startMicRecorder: function (...args) { - console.warn("AudioManager.startMicRecorder interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - stopMicRecorder: function (...args) { - console.warn("AudioManager.stopMicRecorder interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - hasSoundCustomized: function (...args) { - console.warn("AudioManager.stopMicRecorder interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setOutDevice: function (...args) { - console.warn("AudioManager.setOutDevice interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getOutDevice: function (...args) { - console.warn("AudioManager.getOutDevice interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, AudioOutDevices); - } else { - return new Promise((resolve, reject) => { - resolve(AudioOutDevices); - }) - } - }, - getHangMode: function (...args) { - console.warn("AudioManager.getHangMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, SoundFields); - } else { - return new Promise((resolve, reject) => { - resolve(SoundFields); - }) - } - }, - setHangMode: function (...args) { - console.warn("AudioManager.setHangMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isMicDamaged: function (...args) { - console.warn("AudioManager.isMicDamaged interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isVolAdjustSupported: function (...args) { - console.warn("AudioManager.isVolAdjustSupported interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - recoveryOutDevice: function (...args) { - console.warn("AudioManager.recoveryOutDevice interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setVolumeByPid: function (...args) { - console.warn("AudioManager.setVolumeByPid interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getHistenGeqGains: function (...args) { - console.warn("AudioManager.getHistenGeqGains interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var numberArray = new Array(); - numberArray.push(paramMock.paramNumberMock); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, numberArray); - } else { - return new Promise((resolve, reject) => { - resolve(numberArray); - }) - } - }, - setHistenGeqGain: function (...args) { - console.warn("AudioManager.setHistenGeqGain interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getHistenVocGain: function (...args) { - console.warn("AudioManager.getHistenVocGain interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setHistenVocGain: function (...args) { - console.warn("AudioManager.setHistenVocGain interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getHistenVertSurroundGain: function (...args) { - console.warn("AudioManager.getHistenVertSurroundGain interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setHistenVertSurroundGain: function (...args) { - console.warn("AudioManager.setHistenVertSurroundGain interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getHistenHorzSurroundGain: function (...args) { - console.warn("AudioManager.getHistenHorzSurroundGain interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setHistenHorzSurroundGain: function (...args) { - console.warn("AudioManager.setHistenHorzSurroundGain interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getHistenCustomMode: function (...args) { - console.warn("AudioManager.getHistenCustomMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setHistenCustomMode: function (...args) { - console.warn("AudioManager.setHistenCustomMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - resetHistenCustomMode: function (...args) { - console.warn("AudioManager.resetHistenCustomMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getHistenCustomModeList: function (...args) { - console.warn("AudioManager.getHistenCustomModeList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var numberArray = new Array(); - numberArray.push(paramMock.paramNumberMock); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, numberArray); - } else { - return new Promise((resolve, reject) => { - resolve(numberArray); - }) - } - }, - enableHistenVoip: function (...args) { - console.warn("AudioManager.enableHistenVoip interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isHistenVoipEnabled: function (...args) { - console.warn("AudioManager.isHistenVoipEnabled interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - } - } - const EventManager = { - on: function (...args) { - console.warn("EventManager.on interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - off: function (...args) { - console.warn("EventManager.off interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - } - } - const HdmiCecManager = { - getUiStatus: function (...args) { - console.warn("HdmiCecManager.getUiStatus interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setUiStatus: function (...args) { - console.warn("HdmiCecManager.setUiStatus interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getDeviceList: function (...args) { - console.warn("HdmiCecManager.getDeviceList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, HdmiCecDeviceInfo); - } else { - return new Promise((resolve, reject) => { - resolve(HdmiCecDeviceInfo); - }) - } - }, - changeSourceToTv: function (...args) { - console.warn("HdmiCecManager.changeSourceToTv interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - sendMenuCommand: function (...args) { - console.warn("HdmiCecManager.sendMenuCommand interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } - } - const PictureManager = { - enableAutoPictureMode: function (...args) { - console.warn("PictureManager.enableAutoPictureMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setPictureMode: function (...args) { - console.warn("PictureManager.setPictureMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setBrightness: function (...args) { - console.warn("PictureManager.setBrightness interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getBrightness: function (...args) { - console.warn("PictureManager.getBrightness interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setContrast: function (...args) { - console.warn("PictureManager.setContrast interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getContrast: function (...args) { - console.warn("PictureManager.getContrast interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setSaturation: function (...args) { - console.warn("PictureManager.setSaturation interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSaturation: function (...args) { - console.warn("PictureManager.getSaturation interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setSharpness: function (...args) { - console.warn("PictureManager.setSharpness interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSharpness: function (...args) { - console.warn("PictureManager.getSharpness interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setHue: function (...args) { - console.warn("PictureManager.setHue interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getHue: function (...args) { - console.warn("PictureManager.getHue interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setBacklight: function (...args) { - console.warn("PictureManager.setBacklight interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getBacklight: function (...args) { - console.warn("PictureManager.getBacklight interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setBacklightThreshold: function (...args) { - console.warn("PictureManager.setBacklightThreshold interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getBacklightThreshold: function (...args) { - console.warn("PictureManager.getBacklightThreshold interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setColorTemp: function (...args) { - console.warn("PictureManager.setColorTemp interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getColorTemp: function (...args) { - console.warn("PictureManager.getColorTemp interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, PictureClrtmps); - } else { - return new Promise((resolve, reject) => { - resolve(PictureClrtmps); - }) - } - }, - setNr: function (...args) { - console.warn("PictureManager.setNr interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getNr: function (...args) { - console.warn("PictureManager.getNr interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, PictureLevels); - } else { - return new Promise((resolve, reject) => { - resolve(PictureLevels); - }) - } - }, - setMemcLevel: function (...args) { - console.warn("PictureManager.setMemcLevel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getMemcLevel: function (...args) { - console.warn("PictureManager.getMemcLevel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - enableDci: function (...args) { - console.warn("PictureManager.enableDci interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isDciEnabled: function (...args) { - console.warn("PictureManager.isDciEnabled interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - enableDynamicBl: function (...args) { - console.warn("PictureManager.enableDynamicBl interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isDynamicBlEnabled: function (...args) { - console.warn("PictureManager.isDynamicBlEnabled interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setAspect: function (...args) { - console.warn("PictureManager.setAspect interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAspect: function (...args) { - console.warn("PictureManager.getAspect interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, PictureAspects); - } else { - return new Promise((resolve, reject) => { - resolve(PictureAspects); - }) - } - }, - enableLocalDimming: function (...args) { - console.warn("PictureManager.enableLocalDimming interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isLocalDimmingEnabled: function (...args) { - console.warn("PictureManager.isLocalDimmingEnabled interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isLocalDimmingSupported: function (...args) { - console.warn("PictureManager.isLocalDimmingSupported interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setEyeProtectMode: function (...args) { - console.warn("PictureManager.setEyeProtectMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getEyeProtectMode: function (...args) { - console.warn("PictureManager.getEyeProtectMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setVideoInfoStart: function (...args) { - console.warn("PictureManager.setVideoInfoStart interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setVideoInfoStop: function (...args) { - console.warn("PictureManager.setVideoInfoStop interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getPictureModeList: function (...args) { - console.warn("PictureManager.getPictureModeList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var pictureModesArray = new Array(); - pictureModesArray.push(PictureModes); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, pictureModesArray); - } else { - return new Promise((resolve, reject) => { - resolve(pictureModesArray); - }) - } - }, - setAutoBlEnable: function (...args) { - console.warn("PictureManager.setAutoBlEnable interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isAutoBacklightEnabled: function (...args) { - console.warn("PictureManager.isAutoBacklightEnabled interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setActivityUi: function (...args) { - console.warn("PictureManager.setActivityUi interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setDciType: function (...args) { - console.warn("PictureManager.setDciType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getDciType: function (...args) { - console.warn("PictureManager.getDciType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setDciGainLevel: function (...args) { - console.warn("PictureManager.setDciGainLevel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getDciGainLevel: function (...args) { - console.warn("PictureManager.getDciGainLevel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setUploadBacklight: function (...args) { - console.warn("PictureManager.setUploadBacklight interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getPictureMode: function (...args) { - console.warn("PictureManager.getPictureMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, PictureModes); - } else { - return new Promise((resolve, reject) => { - resolve(PictureModes); - }) - } - }, - enableBacklight: function (...args) { - console.warn("PictureManager.enableBacklight interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isBacklightEnabled: function (...args) { - console.warn("PictureManager.isBacklightEnabled interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setHdmiRange: function (...args) { - console.warn("PictureManager.setHdmiRange interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getHdmiRange: function (...args) { - console.warn("PictureManager.getHdmiRange interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, HdmiRanges); - } else { - return new Promise((resolve, reject) => { - resolve(HdmiRanges); - }) - } - }, - setColorGamut: function (...args) { - console.warn("PictureManager.setColorGamut interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getColorGamut: function (...args) { - console.warn("PictureManager.getColorGamut interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ColorGamuts); - } else { - return new Promise((resolve, reject) => { - resolve(ColorGamuts); - }) - } - }, - setWhitePoint: function (...args) { - console.warn("PictureManager.setWhitePoint interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getWhitePoint: function (...args) { - console.warn("PictureManager.getWhitePoint interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, WhitePoints); - } else { - return new Promise((resolve, reject) => { - resolve(WhitePoints); - }) - } - }, - setOetf: function (...args) { - console.warn("PictureManager.setOetf interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getOetf: function (...args) { - console.warn("PictureManager.getOetf interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Oetfs); - } else { - return new Promise((resolve, reject) => { - resolve(Oetfs); - }) - } - }, - setTwoPointColorTemp: function (...args) { - console.warn("PictureManager.setTwoPointColorTemp interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTwoPointColorTemp: function (...args) { - console.warn("PictureManager.getTwoPointColorTemp interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - setTenGamma: function (...args) { - console.warn("PictureManager.setTenGamma interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTenGamma: function (...args) { - console.warn("PictureManager.getTenGamma interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - enableCreatorMode: function (...args) { - console.warn("PictureManager.enableCreatorMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isCreatorModeEnabled: function (...args) { - console.warn("PictureManager.isCreatorModeEnabled interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setColorManagerMode: function (...args) { - console.warn("PictureManager.setColorManagerMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getColorManagerMode: function (...args) { - console.warn("PictureManager.getColorManagerMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ColorManagerModes); - } else { - return new Promise((resolve, reject) => { - resolve(ColorManagerModes); - }) - } - }, - restoreCalibration: function (...args) { - console.warn("PictureManager.restoreCalibration interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - restoreMasterSetting: function (...args) { - console.warn("PictureManager.restoreMasterSetting interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setStandbyLedEnable: function (...args) { - console.warn("PictureManager.setStandbyLedEnable interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isStandbyLedEnabled: function (...args) { - console.warn("PictureManager.isStandbyLedEnabled interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getHdrType: function (...args) { - console.warn("PictureManager.getHdrType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, PictureUserHdrTypes); - } else { - return new Promise((resolve, reject) => { - resolve(PictureUserHdrTypes); - }) - } - }, - setUserHdrType: function (...args) { - console.warn("PictureManager.setUserHdrType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getUserHdrType: function (...args) { - console.warn("PictureManager.getUserHdrType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, PictureUserHdrTypes); - } else { - return new Promise((resolve, reject) => { - resolve(PictureUserHdrTypes); - }) - } - }, - setMpegNr: function (...args) { - console.warn("PictureManager.setMpegNr interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getMpegNr: function (...args) { - console.warn("PictureManager.getMpegNr interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, CommonLevels); - } else { - return new Promise((resolve, reject) => { - resolve(CommonLevels); - }) - } - }, - setBoostPeakLevel: function (...args) { - console.warn("PictureManager.setBoostPeakLevel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getBoostPeakLevel: function (...args) { - console.warn("PictureManager.getBoostPeakLevel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, CommonLevels); - } else { - return new Promise((resolve, reject) => { - resolve(CommonLevels); - }) - } - }, - enableNaturalTone: function (...args) { - console.warn("PictureManager.enableNaturalTone interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isNaturalToneEnabled: function (...args) { - console.warn("PictureManager.isNaturalToneEnabled interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setClearMotionLevel: function (...args) { - console.warn("PictureManager.setClearMotionLevel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getClearMotionLevel: function (...args) { - console.warn("PictureManager.getClearMotionLevel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, CommonLevels); - } else { - return new Promise((resolve, reject) => { - resolve(CommonLevels); - }) - } - }, - restoreCurrentPictureMode: function (...args) { - console.warn("PictureManager.restoreCurrentPictureMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setEyeProtectStep: function (...args) { - console.warn("PictureManager.setEyeProtectStep interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getEyeProtectStep: function (...args) { - console.warn("PictureManager.getEyeProtectStep interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setColorTempMode: function (...args) { - console.warn("PictureManager.setColorTempMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getColorTempMode: function (...args) { - console.warn("PictureManager.getColorTempMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, PictureColorTempModes); - } else { - return new Promise((resolve, reject) => { - resolve(PictureColorTempModes); - }) - } - }, - setColorTempStep: function (...args) { - console.warn("PictureManager.setColorTempStep interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getColorTempStep: function (...args) { - console.warn("PictureManager.getColorTempStep interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getNormalColorManagerMode: function (...args) { - console.warn("PictureManager.getNormalColorManagerMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ColorManagerModes); - } else { - return new Promise((resolve, reject) => { - resolve(ColorManagerModes); - }) - } - }, - isPdParamSupported: function (...args) { - console.warn("PictureManager.isPdParamSupported interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isCuvaDeviceSupported: function (...args) { - console.warn("PictureManager.isCuvaDeviceSupported interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - } - } - const SourceManager = { - selectSource: function (...args) { - console.warn("SourceManager.selectSource interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getCurSourceId: function (...args) { - console.warn("SourceManager.getCurSourceId interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, SourceIndices); - } else { - return new Promise((resolve, reject) => { - resolve(SourceIndices); - }) - } - }, - deselectSource: function (...args) { - console.warn("SourceManager.deselectSource interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAvailSourceList: function (...args) { - console.warn("SourceManager.getAvailSourceList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var sourceIndicesArray = new Array(); - sourceIndicesArray.push(SourceIndices); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, sourceIndicesArray); - } else { - return new Promise((resolve, reject) => { - resolve(sourceIndicesArray); - }) - } - }, - getTimingInfo: function (...args) { - console.warn("SourceManager.getTimingInfo interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, TimingInfo); - } else { - return new Promise((resolve, reject) => { - resolve(TimingInfo); - }) - } - }, - getSignalStatus: function (...args) { - console.warn("SourceManager.getSignalStatus interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, SignalStates); - } else { - return new Promise((resolve, reject) => { - resolve(SignalStates); - }) - } - }, - setWindowRect: function (...args) { - console.warn("SourceManager.setWindowRect interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getWindowRect: function (...args) { - console.warn("SourceManager.getWindowRect interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, RectInfo); - } else { - return new Promise((resolve, reject) => { - resolve(RectInfo); - }) - } - }, - setVideoDisplay: function (...args) { - console.warn("SourceManager.setVideoDisplay interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - clearVideoDisplay: function (...args) { - console.warn("SourceManager.clearVideoDisplay interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSupportSourceList: function (...args) { - console.warn("SourceManager.getSupportSourceList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, sourceIndicesArray); - } else { - return new Promise((resolve, reject) => { - resolve(sourceIndicesArray); - }) - } - }, - getSelectSourceId: function (...args) { - console.warn("SourceManager.getSelectSourceId interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - getSourcePlayingState: function (...args) { - console.warn("SourceManager.getSourcePlayingState interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var sourceIndicesArray = new Array(); - sourceIndicesArray.push(SourceIndices); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, sourceIndicesArray); - } else { - return new Promise((resolve, reject) => { - resolve(sourceIndicesArray); - }) - } - }, - connectDistributeService: function (...args) { - console.warn("SourceManager.connectDistributeService interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } - } - const SystemSetting = { - restoreDefault: function (...args) { - console.warn("SystemSetting.restoreDefault interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setHdmirxEdidType: function (...args) { - console.warn("SystemSetting.setHdmirxEdidType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getHdmirxEdidType: function (...args) { - console.warn("SystemSetting.getHdmirxEdidType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, HdmirxEdidTypes); - } else { - return new Promise((resolve, reject) => { - resolve(HdmirxEdidTypes); - }) - } - }, - isPowerOnPanelEnabled: function (...args) { - console.warn("SystemSetting.isPowerOnPanelEnabled interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - enablePowerOnPanel: function (...args) { - console.warn("SystemSetting.enablePowerOnPanel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - restorePic: function (...args) { - console.warn("SystemSetting.restorePic interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setPowerSaveMode: function (...args) { - console.warn("SystemSetting.setPowerSaveMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getPowerSaveMode: function (...args) { - console.warn("SystemSetting.getPowerSaveMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getWakeup: function (...args) { - console.warn("SystemSetting.getWakeup interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Wakeup); - } else { - return new Promise((resolve, reject) => { - resolve(Wakeup); - }) - } - }, - enableLock: function (...args) { - console.warn("SystemSetting.enableLock interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isLockEnabled: function (...args) { - console.warn("SystemSetting.isLockEnabled interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var sourceIndicesArray = new Array(); - sourceIndicesArray.push(SourceIndices); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setParentLock: function (...args) { - console.warn("SystemSetting.setParentLock interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getParentLock: function (...args) { - console.warn("SystemSetting.getParentLock interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - enableSrcLock: function (...args) { - console.warn("SystemSetting.enableSrcLock interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isSrcLockEnabled: function (...args) { - console.warn("SystemSetting.isSrcLockEnabled interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isCurrentLocked: function (...args) { - console.warn("SystemSetting.isCurrentLocked interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - enableDtvLock: function (...args) { - console.warn("SystemSetting.enableDtvLock interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isDtvLockEnabled: function (...args) { - console.warn("SystemSetting.isDtvLockEnabled interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setDtvLockDefaultStatus: function (...args) { - console.warn("SystemSetting.setDtvLockDefaultStatus interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - enableTemperatureCtrl: function (...args) { - console.warn("SystemSetting.enableTemperatureCtrl interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isTemperatureCtrlEnabled: function (...args) { - console.warn("SystemSetting.isTemperatureCtrlEnabled interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isTemperatureCtrlSupported: function (...args) { - console.warn("SystemSetting.isTemperatureCtrlSupported interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isLampEffectSupported: function (...args) { - console.warn("SystemSetting.isLampEffectSupported interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - } - } - return result; + } + 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 index 3c5d2dfa..a4577161 100644 --- a/runtime/main/extend/systemplugin/napi/uri.js +++ b/runtime/main/extend/systemplugin/napi/uri.js @@ -1,43 +1,58 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + 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 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; + } + 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/url.js b/runtime/main/extend/systemplugin/napi/url.js index 296e509d..a29acc3c 100644 --- a/runtime/main/extend/systemplugin/napi/url.js +++ b/runtime/main/extend/systemplugin/napi/url.js @@ -1,4 +1,19 @@ -import {paramMock} from '../utils'; +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from '../utils'; export function mockUrl() { const URLSearchParamsClass = class URLSearchParams { @@ -6,20 +21,20 @@ export function mockUrl() { console.warn('url.URLSearchParams.constructor interface mocked in the Previewer. How this interface works on' + ' the Previewer' + ' may be different from that on a real device.'); - this.append = function(...args) { + this.append = function (...args) { console.warn('url.URLSearchParams.append interface mocked in the Previewer. How this interface works on the Previewer' + ' may be different from that on a real device.'); }; - this.delete = function(...args) { + this.delete = function (...args) { console.warn('url.URLSearchParams.delete interface mocked in the Previewer. How this interface works on the Previewer' + ' may be different from that on a real device.'); }; - this.getAll = function(...args) { + this.getAll = function (...args) { console.warn('url.URLSearchParams.getAll interface mocked in the Previewer. How this interface works on the Previewer' + ' may be different from that on a real device.'); return [paramMock.paramStringMock]; }; - this.entries = function(...args) { + this.entries = function (...args) { console.warn('url.URLSearchParams.entries interface mocked in the Previewer. How this interface works on the Previewer' + ' may be different from that on a real device.'); const IteratorTwoStringMock = { @@ -29,29 +44,29 @@ export function mockUrl() { }; return IteratorTwoStringMock; }; - this.forEach = function(...args) { + this.forEach = function (...args) { console.warn('url.URLSearchParams.forEach interface mocked in the Previewer. How this interface works on the Previewer' + ' may be different from that on a real device.'); }; - this.get = function(...args) { + this.get = function (...args) { console.warn('url.URLSearchParams.get interface mocked in the Previewer. How this interface works on the Previewer' + ' may be different from that on a real device.'); return paramMock.paramStringMock; }; - this.has = function(...args) { + this.has = function (...args) { console.warn('url.URLSearchParams.has interface mocked in the Previewer. How this interface works on the Previewer' + ' may be different from that on a real device.'); return paramMock.paramBooleanMock; }; - this.set = function(...args) { + this.set = function (...args) { console.warn('url.URLSearchParams.set interface mocked in the Previewer. How this interface works on the Previewer' + ' may be different from that on a real device.'); }; - this.sort = function(...args) { + this.sort = function (...args) { console.warn('url.URLSearchParams.sort interface mocked in the Previewer. How this interface works on the Previewer' + ' may be different from that on a real device.'); }; - this.keys = function(...args) { + this.keys = function (...args) { console.warn('url.URLSearchParams.keys interface mocked in the Previewer. How this interface works on the Previewer' + ' may be different from that on a real device.'); const IteratorStringMock = { @@ -61,7 +76,7 @@ export function mockUrl() { }; return IteratorStringMock; }; - this.values = function(...args) { + this.values = function (...args) { console.warn('url.URLSearchParams.values interface mocked in the Previewer. How this interface works on the Previewer' + ' may be different from that on a real device.'); const IteratorStringMock = { @@ -71,7 +86,7 @@ export function mockUrl() { }; return IteratorStringMock; }; - this.toString = function(...args) { + this.toString = function (...args) { console.warn('url.URLSearchParams.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; @@ -104,12 +119,12 @@ export function mockUrl() { constructor(...args) { console.warn('url.URL.constructor interface mocked in the Previewer. How this interface works on the Previewer' + ' may be different from that on a real device.'); - this.toString = function(...args) { + this.toString = function (...args) { console.warn('URL.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; }; - this.toJSON = function(...args) { + this.toJSON = function (...args) { console.warn('URL.toJSON interface mocked in the Previewer. How this interface works on the Previewer' + ' may be different from that on a real device.'); return paramMock.paramStringMock; diff --git a/runtime/main/extend/systemplugin/napi/usb.js b/runtime/main/extend/systemplugin/napi/usb.js index c53187db..98954003 100644 --- a/runtime/main/extend/systemplugin/napi/usb.js +++ b/runtime/main/extend/systemplugin/napi/usb.js @@ -1,271 +1,286 @@ -import {paramMock} from '../utils'; +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from '../utils'; export function mockUsb() { - const USBDevice = { - busNum: '[PC Preview] unknow busNum', - devAddress: '[PC Preview] unknow devAddress', - serial: '[PC Preview] unknow serial', - name: '[PC Preview] unknow name', - manufacturerName: '[PC Preview] unknow maunfactureName', - productName: '[PC Preview] unknow productName', - version: '[PC Preview] unknow version', - vendorId: '[PC Preview] unknow vendorId', - productId: '[PC Preview] unknow productId', - clazz: '[PC Preview] unknow clazz', - subClass: '[PC Preview] unknow subClass', - protocol: '[PC Preview] unknow protocol', - configs: '[PC Preview] unknow configs', - }; + const USBDevice = { + busNum: '[PC Preview] unknow busNum', + devAddress: '[PC Preview] unknow devAddress', + serial: '[PC Preview] unknow serial', + name: '[PC Preview] unknow name', + manufacturerName: '[PC Preview] unknow maunfactureName', + productName: '[PC Preview] unknow productName', + version: '[PC Preview] unknow version', + vendorId: '[PC Preview] unknow vendorId', + productId: '[PC Preview] unknow productId', + clazz: '[PC Preview] unknow clazz', + subClass: '[PC Preview] unknow subClass', + protocol: '[PC Preview] unknow protocol', + configs: '[PC Preview] unknow configs', + }; - const USBConfig = { - id: '[PC Preview] unknow id', - attributes: '[PC Preview] unknow attributes', - maxPower: '[PC Preview] unknow maxPower', - name: '[PC Preview] unknow name', - isRemoteWakeup: '[PC Preview] unknow isRemoteWakeup', - isSelfPowered: '[PC Preview] unknow isSelfPowered', - interfaces: '[PC Preview] unknow interfaces', - }; + const USBConfig = { + id: '[PC Preview] unknow id', + attributes: '[PC Preview] unknow attributes', + maxPower: '[PC Preview] unknow maxPower', + name: '[PC Preview] unknow name', + isRemoteWakeup: '[PC Preview] unknow isRemoteWakeup', + isSelfPowered: '[PC Preview] unknow isSelfPowered', + interfaces: '[PC Preview] unknow interfaces', + }; - const USBInterface = { - id: '[PC Preview] unknow id', - protocol: '[PC Preview] unknow protocol', - clazz: '[PC Preview] unknow clazz', - subClass: '[PC Preview] unknow subClass', - alternateSetting: '[PC Preview] unknow alternateSetting', - name: '[PC Preview] unknow name', - endpoints: '[PC Preview] unknow endpoints', - }; + const USBInterface = { + id: '[PC Preview] unknow id', + protocol: '[PC Preview] unknow protocol', + clazz: '[PC Preview] unknow clazz', + subClass: '[PC Preview] unknow subClass', + alternateSetting: '[PC Preview] unknow alternateSetting', + name: '[PC Preview] unknow name', + endpoints: '[PC Preview] unknow endpoints', + }; - const USBEndpoint = { - address: '[PC Preview] unknow address', - attributes: '[PC Preview] unknow attributes', - interval: '[PC Preview] unknow interval', - maxPacketSize: '[PC Preview] unknow maxPacketSize', - direction: '[PC Preview] unknow direction', - number: '[PC Preview] unknow number', - type: '[PC Preview] unknow type', - interfaceId: '[PC Preview] unknow interfaceId', - }; + const USBEndpoint = { + address: '[PC Preview] unknow address', + attributes: '[PC Preview] unknow attributes', + interval: '[PC Preview] unknow interval', + maxPacketSize: '[PC Preview] unknow maxPacketSize', + direction: '[PC Preview] unknow direction', + number: '[PC Preview] unknow number', + type: '[PC Preview] unknow type', + interfaceId: '[PC Preview] unknow interfaceId', + }; - const USBDevicePipe = { - busNum: '[PC Preview] unknow busNum', - devAddress: '[PC Preview] unknow devAddress', - }; + const USBDevicePipe = { + busNum: '[PC Preview] unknow busNum', + devAddress: '[PC Preview] unknow devAddress', + }; - const PowerRoleType = { - NONE: '[PC Preview] unknow NONE', - SOURCE: '[PC Preview] unknow SOURCE', - SINK: '[PC Preview] unknow SINK', - }; + const PowerRoleType = { + NONE: '[PC Preview] unknow NONE', + SOURCE: '[PC Preview] unknow SOURCE', + SINK: '[PC Preview] unknow SINK', + }; - const DataRoleType = { - NONE: '[PC Preview] unknow NONE', - HOST: '[PC Preview] unknow HOST', - DEVICE: '[PC Preview] unknow DEVICE', - }; + const DataRoleType = { + NONE: '[PC Preview] unknow NONE', + HOST: '[PC Preview] unknow HOST', + DEVICE: '[PC Preview] unknow DEVICE', + }; - const USBPort = { - id: '[PC Preview] unknow id', - supportedModes: '[PC Preview] unknow supportedModes', - status: '[PC Preview] unknow status', - }; + const USBPort = { + id: '[PC Preview] unknow id', + supportedModes: '[PC Preview] unknow supportedModes', + status: '[PC Preview] unknow status', + }; - const PortModeType = { - NONE: '[PC Preview] unknow NONE', - DFP: '[PC Preview] unknow DFP', - UFP: '[PC Preview] unknow UFP', - }; + const PortModeType = { + NONE: '[PC Preview] unknow NONE', + DFP: '[PC Preview] unknow DFP', + UFP: '[PC Preview] unknow UFP', + }; - const USBPortStatus = { - currentMode: '[PC Preview] unknow currentMode', - currentPowerRole: '[PC Preview] unknow currentPowerRole', - currentDataRole: '[PC Preview] unknow currentDataRole', - }; + const USBPortStatus = { + currentMode: '[PC Preview] unknow currentMode', + currentPowerRole: '[PC Preview] unknow currentPowerRole', + currentDataRole: '[PC Preview] unknow currentDataRole', + }; - const USBControlParams = { - request: '[PC Preview] unknow request', - target: '[PC Preview] unknow target', - reqType: '[PC Preview] unknow reqType', - direction: '[PC Preview] unknow direction', - value: '[PC Preview] unknow value', - index: '[PC Preview] unknow index', - data: '[PC Preview] unknow data', - }; + const USBControlParams = { + request: '[PC Preview] unknow request', + target: '[PC Preview] unknow target', + reqType: '[PC Preview] unknow reqType', + direction: '[PC Preview] unknow direction', + value: '[PC Preview] unknow value', + index: '[PC Preview] unknow index', + data: '[PC Preview] unknow data', + }; - const USBRequestTargetType = { - USB_REQUEST_TARGET_DEVICE: '[PC Preview] unknow USB_REQUEST_TARGET_DEVICE', - USB_REQUEST_TARGET_INTERFACE: '[PC Preview] unknow USB_REQUEST_TARGET_INTERFACE', - USB_REQUEST_TARGET_ENDPOINT: '[PC Preview] unknow USB_REQUEST_TARGET_ENDPOINT', - USB_REQUEST_TARGET_OTHER: '[PC Preview] unknow USB_REQUEST_TARGET_OTHER', - }; + const USBRequestTargetType = { + USB_REQUEST_TARGET_DEVICE: '[PC Preview] unknow USB_REQUEST_TARGET_DEVICE', + USB_REQUEST_TARGET_INTERFACE: '[PC Preview] unknow USB_REQUEST_TARGET_INTERFACE', + USB_REQUEST_TARGET_ENDPOINT: '[PC Preview] unknow USB_REQUEST_TARGET_ENDPOINT', + USB_REQUEST_TARGET_OTHER: '[PC Preview] unknow USB_REQUEST_TARGET_OTHER', + }; - const USBControlRequestType = { - USB_REQUEST_TYPE_STANDARD: '[PC Preview] unknow USB_REQUEST_TYPE_STANDARD', - USB_REQUEST_TYPE_CLASS: '[PC Preview] unknow USB_REQUEST_TYPE_CLASS', - USB_REQUEST_TYPE_VENDOR: '[PC Preview] unknow USB_REQUEST_TYPE_VENDOR', - }; + const USBControlRequestType = { + USB_REQUEST_TYPE_STANDARD: '[PC Preview] unknow USB_REQUEST_TYPE_STANDARD', + USB_REQUEST_TYPE_CLASS: '[PC Preview] unknow USB_REQUEST_TYPE_CLASS', + USB_REQUEST_TYPE_VENDOR: '[PC Preview] unknow USB_REQUEST_TYPE_VENDOR', + }; - const USBRequestDirection = { - USB_REQUEST_DIR_TO_DEVICE: '[PC Preview] unknow USB_REQUEST_DIR_TO_DEVICE', - USB_REQUEST_DIR_FROM_DEVICE: '[PC Preview] unknow USB_REQUEST_DIR_FROM_DEVICE', - }; + const USBRequestDirection = { + USB_REQUEST_DIR_TO_DEVICE: '[PC Preview] unknow USB_REQUEST_DIR_TO_DEVICE', + USB_REQUEST_DIR_FROM_DEVICE: '[PC Preview] unknow USB_REQUEST_DIR_FROM_DEVICE', + }; - const FunctionType = { - NONE: '[PC Preview] unknow NONE', - ACM: '[PC Preview] unknow ACM', - ECM: '[PC Preview] unknow ECM', - HDC: '[PC Preview] unknow HDC', - MTP: '[PC Preview] unknow MTP', - PTP: '[PC Preview] unknow PTP', - RNDIS: '[PC Preview] unknow RNDIS', - MIDI: '[PC Preview] unknow MIDI', - AUDIO_SOURCE: '[PC Preview] unknow AUDIO_SOURCE', - NCM: '[PC Preview] unknow NCM', - }; + const FunctionType = { + NONE: '[PC Preview] unknow NONE', + ACM: '[PC Preview] unknow ACM', + ECM: '[PC Preview] unknow ECM', + HDC: '[PC Preview] unknow HDC', + MTP: '[PC Preview] unknow MTP', + PTP: '[PC Preview] unknow PTP', + RNDIS: '[PC Preview] unknow RNDIS', + MIDI: '[PC Preview] unknow MIDI', + AUDIO_SOURCE: '[PC Preview] unknow AUDIO_SOURCE', + NCM: '[PC Preview] unknow NCM', + }; - const usb = { - getVersion: function (...args) { - console.warn('usb.getVersion interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return paramMock.paramStringMock; - }, - getDevices: function (...args) { - console.warn('usb.getDevices interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return [USBDevice]; - }, - connectDevice: function (...args) { - console.warn('usb.connectDevice interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return USBDevicePipe; - }, - getPorts: function (...args) { - console.warn('usb.getPorts interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return [USBPort]; - }, - getSupportedModes: function (...args) { - console.warn('usb.getSupportedModes interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return PortModeType; - }, - requestRight: function (...args) { - console.warn('usb.requestRight interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - const len = args.length; - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }); - } - }, - getCurrentFunctions: function (...args) { - console.warn('usb.getCurrentFunctions interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return FunctionType; - }, - setCurrentFunctions: function (...args) { - console.warn('usb.setCurrentFunctions interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - const len = args.length; - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }); - } - }, - hasRight: function (...args) { - console.warn('usb.hasRight interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return paramMock.paramBooleanMock; - }, - setPortRoles: function (...args) { - console.warn('usb.setPortRoles interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - const len = args.length; - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }); - } - }, - getRawDescriptor: function (...args) { - console.warn('usb.getRawDescriptor interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return paramMock.paramArrayMock; - }, - closePipe: function (...args) { - console.warn('usb.closePipe interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return paramMock.paramNumberMock; - }, - claimInterface: function (...args) { - console.warn('usb.claimInterface interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return paramMock.paramNumberMock; - }, - releaseInterface: function (...args) { - console.warn('usb.releaseInterface interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return paramMock.paramNumberMock; - }, - setInterface: function (...args) { - console.warn('usb.setInterface interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return paramMock.paramNumberMock; - }, - getFileDescriptor: function (...args) { - console.warn('usb.getFileDescriptor interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return paramMock.paramNumberMock; - }, - usbFunctionsFromString: function (...args) { - console.warn('usb.usbFunctionsFromString interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return paramMock.paramNumberMock; - }, - usbFunctionsToString: function (...args) { - console.warn('usb.usbFunctionsToString interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return paramMock.paramStringMock; - }, - controlTransfer: function (...args) { - console.warn('usb.controlTransfer interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - const len = args.length; - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - setConfiguration: function (...args) { - console.warn('usb.setConfiguration interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return paramMock.paramNumberMock; - }, - bulkTransfer: function (...args) { - console.warn('usb.bulkTransfer interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - const len = args.length; - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - }; - return usb; + const usb = { + getVersion: function (...args) { + console.warn('usb.getVersion interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + return paramMock.paramStringMock; + }, + getDevices: function (...args) { + console.warn('usb.getDevices interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + return [USBDevice]; + }, + connectDevice: function (...args) { + console.warn('usb.connectDevice interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + return USBDevicePipe; + }, + getPorts: function (...args) { + console.warn('usb.getPorts interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + return [USBPort]; + }, + getSupportedModes: function (...args) { + console.warn('usb.getSupportedModes interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + return PortModeType; + }, + requestRight: function (...args) { + console.warn('usb.requestRight interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + const len = args.length; + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }); + } + }, + getCurrentFunctions: function (...args) { + console.warn('usb.getCurrentFunctions interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + return FunctionType; + }, + setCurrentFunctions: function (...args) { + console.warn('usb.setCurrentFunctions interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + const len = args.length; + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }); + } + }, + hasRight: function (...args) { + console.warn('usb.hasRight interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + return paramMock.paramBooleanMock; + }, + setPortRoles: function (...args) { + console.warn('usb.setPortRoles interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + const len = args.length; + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }); + } + }, + getRawDescriptor: function (...args) { + console.warn('usb.getRawDescriptor interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + return paramMock.paramArrayMock; + }, + closePipe: function (...args) { + console.warn('usb.closePipe interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + return paramMock.paramNumberMock; + }, + claimInterface: function (...args) { + console.warn('usb.claimInterface interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + return paramMock.paramNumberMock; + }, + releaseInterface: function (...args) { + console.warn('usb.releaseInterface interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + return paramMock.paramNumberMock; + }, + setInterface: function (...args) { + console.warn('usb.setInterface interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + return paramMock.paramNumberMock; + }, + getFileDescriptor: function (...args) { + console.warn('usb.getFileDescriptor interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + return paramMock.paramNumberMock; + }, + usbFunctionsFromString: function (...args) { + console.warn('usb.usbFunctionsFromString interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + return paramMock.paramNumberMock; + }, + usbFunctionsToString: function (...args) { + console.warn('usb.usbFunctionsToString interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + return paramMock.paramStringMock; + }, + controlTransfer: function (...args) { + console.warn('usb.controlTransfer interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + const len = args.length; + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }); + } + }, + setConfiguration: function (...args) { + console.warn('usb.setConfiguration interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + return paramMock.paramNumberMock; + }, + bulkTransfer: function (...args) { + console.warn('usb.bulkTransfer interface mocked in the Previewer. How this interface works on the' + + ' Previewer may be different from that on a real device.'); + const len = args.length; + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }); + } + }, + }; + return usb; } diff --git a/runtime/main/extend/systemplugin/napi/util.js b/runtime/main/extend/systemplugin/napi/util.js index 146b205e..1f205b14 100644 --- a/runtime/main/extend/systemplugin/napi/util.js +++ b/runtime/main/extend/systemplugin/napi/util.js @@ -1,538 +1,553 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + 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.") - }, - 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 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; } - 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 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 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 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 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; - } + } + 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; + } + return result; } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/webgl.js b/runtime/main/extend/systemplugin/napi/webgl.js index e7bda451..62372732 100644 --- a/runtime/main/extend/systemplugin/napi/webgl.js +++ b/runtime/main/extend/systemplugin/napi/webgl.js @@ -1,734 +1,749 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" export function mockwebgl() { - const WebGLContextAttributes ={ - brightness: '[PC preview] unknow brightness', - alpha: '[PC preview] unknow alpha', - depth: '[PC preview] unknow depth', - stencil: '[PC preview] unknow stencil', - antialias: '[PC preview] unknow antialias', - premultipliedAlpha: '[PC preview] unknow premultipliedAlpha', - preserveDrawingBuffer: '[PC preview] unknow preserveDrawingBuffer', - powerPreference: '[PC preview] unknow powerPreference', - failIfMajorPerformanceCaveat: '[PC preview] unknow failIfMajorPerformanceCaveat', - desynchronized: '[PC preview] unknow desynchronized' + const WebGLContextAttributes = { + brightness: '[PC preview] unknow brightness', + alpha: '[PC preview] unknow alpha', + depth: '[PC preview] unknow depth', + stencil: '[PC preview] unknow stencil', + antialias: '[PC preview] unknow antialias', + premultipliedAlpha: '[PC preview] unknow premultipliedAlpha', + preserveDrawingBuffer: '[PC preview] unknow preserveDrawingBuffer', + powerPreference: '[PC preview] unknow powerPreference', + failIfMajorPerformanceCaveat: '[PC preview] unknow failIfMajorPerformanceCaveat', + desynchronized: '[PC preview] unknow desynchronized' + } + const float32ArrayWith2val = [ + paramMock.paramNumberMock, paramMock.paramNumberMock + ] + + const float32ArrayWith4val = [ + paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock + ] + const int32ArrayWith2ele = [ + paramMock.paramNumberMock, paramMock.paramNumberMock + ] + const int32ArrayWith4ele = [ + paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock + ] + const WebGLShaderArray = [ + WebGLShader, WebGLShader, WebGLShader + ] + const WebGLBuffer = { + } + const WebGLFramebuffer = { + } + const WebGLProgram = { + } + const WebGLRenderbuffer = { + } + const WebGLShader = { + } + const WebGLTexture = { + } + const WebGLUniformLocation = { + } + const WebGLActiveInfo = { + size: '[PC preview] unknow size', + type: '[PC preview] unknow type', + name: '[PC preview] unknow name' + } + const WebGLShaderPrecisionFormat = { + rangeMin: '[PC preview] unknow rangeMin', + rangeMax: '[PC preview] unknow rangeMax', + precision: '[PC preview] unknow precision' + } + const glParamMock = { + paramDoubleMock: '[PC Preview] unknow double', + paramAnyMock: '[PC Preview] unknow any', + stringArray: '[PC preview] unknow stringArray', + uint32Array: '[PC preview] unknow uint32Array', + glBooleanArray: '[PC preview] unknow glBooleanArray', + WebGLShaderArray: '[PC preview] unknow WebGLShaderArray', + } + const webglmock = { + getContextAttributes: function (...args) { + console.warn("webgl.getContextAttributes interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return WebGLContextAttributes + }, + isContextLost: function (...args) { + console.warn("webgl.isContextLost interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock + }, + getSupportedExtensions: function (...args) { + console.warn("webgl.getSupportedExtensions interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return glParamMock.stringArray + }, + getExtension: function (...args) { + console.warn("webgl.getExtension interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return glParamMock.paramAnyMock + }, + activeTexture: function (...args) { + console.warn("webgl.activeTexture interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + attachShader: function (...args) { + console.warn("webgl.attachShader interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + bindAttribLocation: function (...args) { + console.warn("webgl.bindAttribLocation interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + bindBuffer: function (...args) { + console.warn("webgl.bindBuffer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + bindFramebuffer: function (...args) { + console.warn("webgl.bindFramebuffer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + bindRenderbuffer: function (...args) { + console.warn("webgl.bindRenderbuffer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + bindTexture: function (...args) { + console.warn("webgl.bindTexture interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + blendColor: function (...args) { + console.warn("webgl.blendColor interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + blendEquation: function (...args) { + console.warn("webgl.blendEquation interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + blendEquationSeparate: function (...args) { + console.warn("webgl.blendEquationSeparate interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + blendFunc: function (...args) { + console.warn("webgl.blendFunc interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + + blendFuncSeparate: function (...args) { + console.warn("webgl.blendFuncSeparate interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + checkFramebufferStatus: function (...args) { + console.warn("webgl.checkFramebufferStatus interface mocked 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("webgl.clear interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + clearColor: function (...args) { + console.warn("webgl.clearColor interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + clearDepth: function (...args) { + console.warn("webgl.clearDepth interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + clearStencil: function (...args) { + console.warn("webgl.clearStencil interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + colorMask: function (...args) { + console.warn("webgl.colorMask interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + compileShader: function (...args) { + console.warn("webgl.compileShader interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + copyTexImage2D: function (...args) { + console.warn("webgl.copyTexImage2D interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + copyTexSubImage2D: function (...args) { + console.warn("webgl.copyTexSubImage2D interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + createBuffer: function (...args) { + console.warn("webgl.createBuffer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return WebGLBuffer; + }, + createFramebuffer: function (...args) { + console.warn("webgl.createFramebuffer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return WebGLFramebuffer; + }, + createProgram: function (...args) { + console.warn("webgl.createProgram interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return WebGLProgram; + }, + createRenderbuffer: function (...args) { + console.warn("webgl.createRenderbuffer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return WebGLRenderbuffer; + }, + createShader: function (...args) { + console.warn("webgl.createShader interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return WebGLShader; + }, + createTexture: function (...args) { + console.warn("webgl.createTexture interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return WebGLTexture; + }, + cullFace: function (...args) { + console.warn("webgl.cullFace interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + deleteBuffer: function (...args) { + console.warn("webgl.deleteBuffer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + deleteFramebuffer: function (...args) { + console.warn("webgl.deleteFramebuffer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + deleteProgram: function (...args) { + console.warn("webgl.deleteProgram interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + + deleteRenderbuffer: function (...args) { + console.warn("webgl.deleteRenderbuffer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + deleteShader: function (...args) { + console.warn("webgl.deleteRenderbuffer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + deleteTexture: function (...args) { + console.warn("webgl.deleteRenderbuffer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + depthFunc: function (...args) { + console.warn("webgl.deleteRenderbuffer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + depthMask: function (...args) { + console.warn("webgl.deleteRenderbuffer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + + depthRange: function (...args) { + console.warn("webgl.depthRange interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + detachShader: function (...args) { + console.warn("webgl.detachShader interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + disable: function (...args) { + console.warn("webgl.disable interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + disableVertexAttribArray: function (...args) { + console.warn("webgl.disableVertexAttribArray interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + drawArrays: function (...args) { + console.warn("webgl.drawArrays interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + + drawElements: function (...args) { + console.warn("webgl.drawElements interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + enable: function (...args) { + console.warn("webgl.enable interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + enableVertexAttribArray: function (...args) { + console.warn("webgl.enableVertexAttribArray interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + finish: function (...args) { + console.warn("webgl.finish interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + flush: function (...args) { + console.warn("webgl.flush interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + + framebufferRenderbuffer: function (...args) { + console.warn("webgl.framebufferRenderbuffer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + framebufferTexture2D: function (...args) { + console.warn("webgl.framebufferTexture2D interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + frontFace: function (...args) { + console.warn("webgl.frontFace interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + generateMipmap: function (...args) { + console.warn("webgl.generateMipmap interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + getActiveAttrib: function (...args) { + console.warn("webgl.getActiveAttrib interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return WebGLActiveInfo; + }, + getActiveUniform: function (...args) { + console.warn("webgl.getActiveAttrib interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return WebGLActiveInfo; + }, + getAttachedShaders: function (...args) { + console.warn("webgl.getActiveAttrib interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return glParamMock.WebGLShaderArray; + }, + getAttribLocation: function (...args) { + console.warn("webgl.getActiveAttrib interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + getBufferParameter: function (...args) { + console.warn("webgl.getActiveAttrib interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + getParameter: function (...args) { + console.warn("webgl.getActiveAttrib interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + if (args[0] == 0x0B73 || args[0] == 0x0B21 || + args[0] == 0x8038 || args[0] == 0x2A00 || + args[0] == 0x80AA) { + return paramMock.paramNumberMock; + } else if (args[0] == 0x8069 || args[0] == 0x8514) { + return WebGLTexture; + } else if (args[0] == 0x1F01 || args[0] == 0x8B8C || + args[0] == 0x1F00 || args[0] == 0x1F02) { + return glParamMock.stringArray; + } else if (args[0] == 0x8894 || args[0] == 0x8895) { + return WebGLBuffer; + } else if (args[0] == 0x8CA6) { + return WebGLFramebuffer; + } else if (args[0] == 0x8B8D) { + return WebGLProgram; + } else if (args[0] == 0x8CA7) { + return WebGLRenderbuffer; + } else if (args[0] == 0x846E || args[0] == 0x846D || + args[0] == 0x0B70) { + return float32ArrayWith2val; + } else if (args[0] == 0x0C22 || args[0] == 0x8005) { + return float32ArrayWith4val; + } else if (args[0] == 0x86A3) { + return glParamMock.uint32Array; + } else if (args[0] == 0x0D3A) { + return int32ArrayWith2ele; + } else if (args[0] == 0x0C10) { + return int32ArrayWith4ele; + } else if (args[0] == 0x0BE2 || args[0] == 0x0B44 || args[0] == 0x0B71 || + args[0] == 0x0B72 || args[0] == 0x0BD0 || args[0] == 0x8037 || + args[0] == 0x809E || args[0] == 0x80A0 || + args[0] == 0x80AB || args[0] == 0x0C11 || args[0] == 0x0B90 || + args[0] == 0x9240 || + args[0] == 0x9241) { + return paramMock.paramBooleanMock; + } else if (args[0] == 0x0C23) { + return glParamMock.glBooleanArray; + } else { + return paramMock.paramNumberMock; + } + }, + getError: function (...args) { + console.warn("webgl.getError interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + getFramebufferAttachmentParameter: function (...args) { + console.warn("webgl.getFramebufferAttachmentParameter interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + if (args[2] == 0x8CD0 || + args[2] == 0x8CD2 || + args[2] == 0x8CD3 || + args[2] == 0x8215 || + args[2] == 0x8214 || + args[2] == 0x8210 || + args[2] == 0x8211 || + args[2] == 0x8216 || + args[2] == 0x8213 || + args[2] == 0x8212 || + args[2] == 0x8217 || + args[2] == 0x8CD4) { + return paramMock.paramNumberMock; + } else if (args[2] == 0x8CD1) { + return paramMock.paramObjectMock; + } + }, + getProgramParameter: function (...args) { + console.warn("webgl.getProgramParameter interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + if (args[1] == 0x8B80 || args[1] == 0x8B82 || args[1] == 0x8B83) { + return paramMock.paramBooleanMock; + } else { + return paramMock.paramNumberMock; + } + }, + getProgramInfoLog: function (...args) { + console.warn("webgl.getProgramInfoLog interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramStringMock; + }, + getRenderbufferParameter: function (...args) { + console.warn("webgl.getRenderbufferParameter interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + + getShaderParameter: function (...args) { + console.warn("webgl.getShaderParameter interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + if (args[1] == 0x8B4F) { + return paramMock.paramNumberMock; + } else { + return paramMock.paramBooleanMock; + } + }, + getShaderPrecisionFormat: function (...args) { + console.warn("webgl.getShaderPrecisionFormat interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return WebGLShaderPrecisionFormat; + }, + getShaderInfoLog: function (...args) { + console.warn("webgl.getShaderInfoLog interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramStringMock; + }, + getShaderSource: function (...args) { + console.warn("webgl.getShaderSource interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramStringMock; + }, + getTexParameter: function (...args) { + console.warn("webgl.getTexParameter interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + if (args[1] == 0x84FE) { + return glParamMock.paramDoubleMock; + } else { + return paramMock.paramNumberMock; + } + }, + getUniform: function (...args) { + console.warn("webgl.getUniform interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return glParamMock.paramAnyMock; + }, + getUniformLocation: function (...args) { + console.warn("webgl.getUniformLocation interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return WebGLUniformLocation; + }, + getVertexAttrib: function (...args) { + console.warn("webgl.getVertexAttrib interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + getVertexAttribOffset: function (...args) { + console.warn("webgl.getVertexAttribOffset interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + hint: function (...args) { + console.warn("webgl.hint interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + + isBuffer: function (...args) { + console.warn("webgl.isBuffer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isEnabled: function (...args) { + console.warn("webgl.isEnabled interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isFramebuffer: function (...args) { + console.warn("webgl.isFramebuffer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isProgram: function (...args) { + console.warn("webgl.isProgram interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isRenderbuffer: function (...args) { + console.warn("webgl.isRenderbuffer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + + isShader: function (...args) { + console.warn("webgl.isShader interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + isTexture: function (...args) { + console.warn("webgl.isTexture interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + lineWidth: function (...args) { + console.warn("webgl.lineWidth interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + linkProgram: function (...args) { + console.warn("webgl.linkProgram interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + pixelStorei: function (...args) { + console.warn("webgl.pixelStorei interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + + polygonOffset: function (...args) { + console.warn("webgl.polygonOffset interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + renderbufferStorage: function (...args) { + console.warn("webgl.renderbufferStorage interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + sampleCoverage: function (...args) { + console.warn("webgl.sampleCoverage interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + scissor: function (...args) { + console.warn("webgl.scissor interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + shaderSource: function (...args) { + console.warn("webgl.shaderSource interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + + stencilFunc: function (...args) { + console.warn("webgl.stencilFunc interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + stencilFuncSeparate: function (...args) { + console.warn("webgl.stencilFuncSeparate interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + stencilMask: function (...args) { + console.warn("webgl.stencilMask interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + stencilMaskSeparate: function (...args) { + console.warn("webgl.stencilMaskSeparate interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + stencilOp: function (...args) { + console.warn("webgl.stencilOp interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + + stencilOpSeparate: function (...args) { + console.warn("webgl.stencilOpSeparate interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + texParameterf: function (...args) { + console.warn("webgl.texParameterf interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + texParameteri: function (...args) { + console.warn("webgl.texParameteri interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform1f: function (...args) { + console.warn("webgl.uniform1f interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform2f: function (...args) { + console.warn("webgl.uniform2f interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + + uniform3f: function (...args) { + console.warn("webgl.uniform3f interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform4f: function (...args) { + console.warn("webgl.uniform4f interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform1i: function (...args) { + console.warn("webgl.uniform1i interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform2i: function (...args) { + console.warn("webgl.uniform2i interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform3i: function (...args) { + console.warn("webgl.uniform3i interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + + uniform4i: function (...args) { + console.warn("webgl.uniform4i interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + useProgram: function (...args) { + console.warn("webgl.useProgram interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + validateProgram: function (...args) { + console.warn("webgl.validateProgram interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + vertexAttrib1f: function (...args) { + console.warn("webgl.vertexAttrib1f interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + vertexAttrib2f: function (...args) { + console.warn("webgl.vertexAttrib2f interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + + vertexAttrib3f: function (...args) { + console.warn("webgl.vertexAttrib3f interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + vertexAttrib4f: function (...args) { + console.warn("webgl.vertexAttrib4f interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + vertexAttrib1fv: function (...args) { + console.warn("webgl.vertexAttrib1fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + vertexAttrib2fv: function (...args) { + console.warn("webgl.vertexAttrib2fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + vertexAttrib3fv: function (...args) { + console.warn("webgl.vertexAttrib3fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + + vertexAttrib4fv: function (...args) { + console.warn("webgl.vertexAttrib4fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + vertexAttribPointer: function (...args) { + console.warn("webgl.vertexAttribPointer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + viewport: function (...args) { + console.warn("webgl.vertexAttrib3fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + + bufferData: function (...args) { + console.warn("webgl.bufferData interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + bufferSubData: function (...args) { + console.warn("webgl.bufferSubData interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + compressedTexImage2D: function (...args) { + console.warn("webgl.compressedTexImage2D interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + compressedTexSubImage2D: function (...args) { + console.warn("webgl.compressedTexSubImage2D interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + readPixels: function (...args) { + console.warn("webgl.readPixels interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + + texImage2D: function (...args) { + console.warn("webgl.texImage2D interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + texSubImage2D: function (...args) { + console.warn("webgl.texSubImage2D interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform1fv: function (...args) { + console.warn("webgl.uniform1fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform2fv: function (...args) { + console.warn("webgl.uniform2fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform3fv: function (...args) { + console.warn("webgl.uniform3fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + + uniform4fv: function (...args) { + console.warn("webgl.uniform4fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform1iv: function (...args) { + console.warn("webgl.uniform1iv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform2iv: function (...args) { + console.warn("webgl.uniform2iv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform3iv: function (...args) { + console.warn("webgl.uniform3iv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform4iv: function (...args) { + console.warn("webgl.uniform4iv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + + uniformMatrix2fv: function (...args) { + console.warn("webgl.uniformMatrix2fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniformMatrix3fv: function (...args) { + console.warn("webgl.uniformMatrix3fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniformMatrix4fv: function (...args) { + console.warn("webgl.uniformMatrix4fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") } - const float32ArrayWith2val = [ - paramMock.paramNumberMock,paramMock.paramNumberMock - ] - - const float32ArrayWith4val = [ - paramMock.paramNumberMock,paramMock.paramNumberMock,paramMock.paramNumberMock,paramMock.paramNumberMock - ] - const int32ArrayWith2ele = [ - paramMock.paramNumberMock,paramMock.paramNumberMock - ] - const int32ArrayWith4ele = [ - paramMock.paramNumberMock,paramMock.paramNumberMock,paramMock.paramNumberMock,paramMock.paramNumberMock - ] - const WebGLShaderArray = [ - WebGLShader,WebGLShader,WebGLShader - ] - const WebGLBuffer = { - } - const WebGLFramebuffer = { - } - const WebGLProgram = { - } - const WebGLRenderbuffer = { - } - const WebGLShader = { - } - const WebGLTexture = { - } - const WebGLUniformLocation = { - } - const WebGLActiveInfo = { - size: '[PC preview] unknow size', - type: '[PC preview] unknow type', - name: '[PC preview] unknow name' - } - const WebGLShaderPrecisionFormat = { - rangeMin: '[PC preview] unknow rangeMin', - rangeMax: '[PC preview] unknow rangeMax', - precision: '[PC preview] unknow precision' - } - const glParamMock = { - paramDoubleMock: '[PC Preview] unknow double', - paramAnyMock: '[PC Preview] unknow any', - stringArray: '[PC preview] unknow stringArray', - uint32Array: '[PC preview] unknow uint32Array', - glBooleanArray: '[PC preview] unknow glBooleanArray', - WebGLShaderArray: '[PC preview] unknow WebGLShaderArray', - } - const webglmock = { - getContextAttributes: function (...args) { - console.warn("webgl.getContextAttributes interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLContextAttributes - }, - isContextLost: function (...args) { - console.warn("webgl.isContextLost interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - getSupportedExtensions: function (...args) { - console.warn("webgl.getSupportedExtensions interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return glParamMock.stringArray - }, - getExtension: function (...args) { - console.warn("webgl.getExtension interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return glParamMock.paramAnyMock - }, - activeTexture: function (...args) { - console.warn("webgl.activeTexture interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - attachShader: function (...args) { - console.warn("webgl.attachShader interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - bindAttribLocation: function (...args) { - console.warn("webgl.bindAttribLocation interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - bindBuffer: function (...args) { - console.warn("webgl.bindBuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - bindFramebuffer: function (...args) { - console.warn("webgl.bindFramebuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - bindRenderbuffer: function (...args) { - console.warn("webgl.bindRenderbuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - bindTexture: function (...args) { - console.warn("webgl.bindTexture interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - blendColor: function (...args) { - console.warn("webgl.blendColor interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - blendEquation: function (...args) { - console.warn("webgl.blendEquation interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - blendEquationSeparate: function (...args) { - console.warn("webgl.blendEquationSeparate interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - blendFunc: function (...args) { - console.warn("webgl.blendFunc interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - blendFuncSeparate: function (...args) { - console.warn("webgl.blendFuncSeparate interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - checkFramebufferStatus: function (...args) { - console.warn("webgl.checkFramebufferStatus interface mocked 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("webgl.clear interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - clearColor: function (...args) { - console.warn("webgl.clearColor interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - clearDepth: function (...args) { - console.warn("webgl.clearDepth interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - clearStencil: function (...args) { - console.warn("webgl.clearStencil interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - colorMask: function (...args) { - console.warn("webgl.colorMask interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - compileShader: function (...args) { - console.warn("webgl.compileShader interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - copyTexImage2D: function (...args) { - console.warn("webgl.copyTexImage2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - copyTexSubImage2D: function (...args) { - console.warn("webgl.copyTexSubImage2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - createBuffer: function (...args) { - console.warn("webgl.createBuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLBuffer; - }, - createFramebuffer: function (...args) { - console.warn("webgl.createFramebuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLFramebuffer; - }, - createProgram: function (...args) { - console.warn("webgl.createProgram interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLProgram; - }, - createRenderbuffer: function (...args) { - console.warn("webgl.createRenderbuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLRenderbuffer; - }, - createShader: function (...args) { - console.warn("webgl.createShader interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLShader; - }, - createTexture: function (...args) { - console.warn("webgl.createTexture interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLTexture; - }, - cullFace: function (...args) { - console.warn("webgl.cullFace interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - deleteBuffer: function (...args) { - console.warn("webgl.deleteBuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - deleteFramebuffer: function (...args) { - console.warn("webgl.deleteFramebuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - deleteProgram: function (...args) { - console.warn("webgl.deleteProgram interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - deleteRenderbuffer: function (...args) { - console.warn("webgl.deleteRenderbuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - deleteShader: function (...args) { - console.warn("webgl.deleteRenderbuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - deleteTexture: function (...args) { - console.warn("webgl.deleteRenderbuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - depthFunc: function (...args) { - console.warn("webgl.deleteRenderbuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - depthMask: function (...args) { - console.warn("webgl.deleteRenderbuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - depthRange: function (...args) { - console.warn("webgl.depthRange interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - detachShader: function (...args) { - console.warn("webgl.detachShader interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - disable: function (...args) { - console.warn("webgl.disable interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - disableVertexAttribArray: function (...args) { - console.warn("webgl.disableVertexAttribArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - drawArrays: function (...args) { - console.warn("webgl.drawArrays interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - drawElements: function (...args) { - console.warn("webgl.drawElements interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - enable: function (...args) { - console.warn("webgl.enable interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - enableVertexAttribArray: function (...args) { - console.warn("webgl.enableVertexAttribArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - finish: function (...args) { - console.warn("webgl.finish interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - flush: function (...args) { - console.warn("webgl.flush interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - framebufferRenderbuffer: function (...args) { - console.warn("webgl.framebufferRenderbuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - framebufferTexture2D: function (...args) { - console.warn("webgl.framebufferTexture2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - frontFace: function (...args) { - console.warn("webgl.frontFace interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - generateMipmap: function (...args) { - console.warn("webgl.generateMipmap interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getActiveAttrib: function (...args) { - console.warn("webgl.getActiveAttrib interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLActiveInfo; - }, - getActiveUniform: function (...args) { - console.warn("webgl.getActiveAttrib interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLActiveInfo; - }, - getAttachedShaders: function (...args) { - console.warn("webgl.getActiveAttrib interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return glParamMock.WebGLShaderArray; - }, - getAttribLocation: function (...args) { - console.warn("webgl.getActiveAttrib interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getBufferParameter: function (...args) { - console.warn("webgl.getActiveAttrib interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getParameter: function (...args) { - console.warn("webgl.getActiveAttrib interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (args[0] == 0x0B73 || args[0] == 0x0B21 || - args[0] == 0x8038 || args[0] == 0x2A00 || - args[0] == 0x80AA) { - return paramMock.paramNumberMock;; - } else if (args[0] == 0x8069 || args[0] == 0x8514) { - return WebGLTexture; - } else if (args[0] == 0x1F01 || args[0] == 0x8B8C || - args[0] == 0x1F00 || args[0] == 0x1F02) { - return glParamMock.stringArray; - } else if (args[0] == 0x8894 || args[0] == 0x8895) { - return WebGLBuffer; - } else if (args[0] == 0x8CA6) { - return WebGLFramebuffer; - } else if (args[0] == 0x8B8D) { - return WebGLProgram; - } else if (args[0] == 0x8CA7) { - return WebGLRenderbuffer; - } else if (args[0] == 0x846E || args[0] == 0x846D || - args[0] == 0x0B70) { - return float32ArrayWith2val; - } else if (args[0] == 0x0C22 || args[0] == 0x8005) { - return float32ArrayWith4val; - } else if (args[0] == 0x86A3) { - return glParamMock.uint32Array; - } else if (args[0] == 0x0D3A) { - return int32ArrayWith2ele; - } else if (args[0] == 0x0C10) { - return int32ArrayWith4ele; - } else if (args[0] == 0x0BE2 || args[0] == 0x0B44 || args[0] == 0x0B71 || - args[0] == 0x0B72 || args[0] == 0x0BD0 || args[0] == 0x8037 || - args[0] == 0x809E || args[0] == 0x80A0 || - args[0] == 0x80AB || args[0] == 0x0C11 || args[0] == 0x0B90 || - args[0] == 0x9240 || - args[0] == 0x9241) { - return paramMock.paramBooleanMock; - } else if (args[0] == 0x0C23) { - return glParamMock.glBooleanArray; - } else { - return paramMock.paramNumberMock;; - } - }, - getError: function (...args) { - console.warn("webgl.getError interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getFramebufferAttachmentParameter: function (...args) { - console.warn("webgl.getFramebufferAttachmentParameter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (args[2] == 0x8CD0 || - args[2] == 0x8CD2 || - args[2] == 0x8CD3 || - args[2] == 0x8215 || - args[2] == 0x8214 || - args[2] == 0x8210 || - args[2] == 0x8211 || - args[2] == 0x8216 || - args[2] == 0x8213 || - args[2] == 0x8212 || - args[2] == 0x8217 || - args[2] == 0x8CD4) { - return paramMock.paramNumberMock; - } else if (args[2] == 0x8CD1) { - return paramMock.paramObjectMock; - } - }, - getProgramParameter: function (...args) { - console.warn("webgl.getProgramParameter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (args[1] == 0x8B80 || args[1] == 0x8B82 || args[1] == 0x8B83) { - return paramMock.paramBooleanMock; - } else { - return paramMock.paramNumberMock; - } - }, - getProgramInfoLog: function (...args) { - console.warn("webgl.getProgramInfoLog interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock; - }, - getRenderbufferParameter: function (...args) { - console.warn("webgl.getRenderbufferParameter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - - getShaderParameter: function (...args) { - console.warn("webgl.getShaderParameter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (args[1] == 0x8B4F) { - return paramMock.paramNumberMock; - } else { - return paramMock.paramBooleanMock; - } - }, - getShaderPrecisionFormat: function (...args) { - console.warn("webgl.getShaderPrecisionFormat interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLShaderPrecisionFormat; - }, - getShaderInfoLog: function (...args) { - console.warn("webgl.getShaderInfoLog interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock; - }, - getShaderSource: function (...args) { - console.warn("webgl.getShaderSource interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock; - }, - getTexParameter: function (...args) { - console.warn("webgl.getTexParameter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (args[1] == 0x84FE) { - return glParamMock.paramDoubleMock; - } else { - return paramMock.paramNumberMock; - } - }, - getUniform: function (...args) { - console.warn("webgl.getUniform interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return glParamMock.paramAnyMock; - }, - getUniformLocation: function (...args) { - console.warn("webgl.getUniformLocation interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLUniformLocation; - }, - getVertexAttrib: function (...args) { - console.warn("webgl.getVertexAttrib interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getVertexAttribOffset: function (...args) { - console.warn("webgl.getVertexAttribOffset interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - hint: function (...args) { - console.warn("webgl.hint interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - isBuffer: function (...args) { - console.warn("webgl.isBuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - isEnabled: function (...args) { - console.warn("webgl.isEnabled interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - isFramebuffer: function (...args) { - console.warn("webgl.isFramebuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - isProgram: function (...args) { - console.warn("webgl.isProgram interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - isRenderbuffer: function (...args) { - console.warn("webgl.isRenderbuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - isShader: function (...args) { - console.warn("webgl.isShader interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - isTexture: function (...args) { - console.warn("webgl.isTexture interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - lineWidth: function (...args) { - console.warn("webgl.lineWidth interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - linkProgram: function (...args) { - console.warn("webgl.linkProgram interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - pixelStorei: function (...args) { - console.warn("webgl.pixelStorei interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - polygonOffset: function (...args) { - console.warn("webgl.polygonOffset interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - renderbufferStorage: function (...args) { - console.warn("webgl.renderbufferStorage interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - sampleCoverage: function (...args) { - console.warn("webgl.sampleCoverage interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - scissor: function (...args) { - console.warn("webgl.scissor interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - shaderSource: function (...args) { - console.warn("webgl.shaderSource interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - stencilFunc: function (...args) { - console.warn("webgl.stencilFunc interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - stencilFuncSeparate: function (...args) { - console.warn("webgl.stencilFuncSeparate interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - stencilMask: function (...args) { - console.warn("webgl.stencilMask interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - stencilMaskSeparate: function (...args) { - console.warn("webgl.stencilMaskSeparate interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - stencilOp: function (...args) { - console.warn("webgl.stencilOp interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - stencilOpSeparate: function (...args) { - console.warn("webgl.stencilOpSeparate interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - texParameterf: function (...args) { - console.warn("webgl.texParameterf interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - texParameteri: function (...args) { - console.warn("webgl.texParameteri interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform1f: function (...args) { - console.warn("webgl.uniform1f interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform2f: function (...args) { - console.warn("webgl.uniform2f interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - uniform3f: function (...args) { - console.warn("webgl.uniform3f interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform4f: function (...args) { - console.warn("webgl.uniform4f interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform1i: function (...args) { - console.warn("webgl.uniform1i interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform2i: function (...args) { - console.warn("webgl.uniform2i interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform3i: function (...args) { - console.warn("webgl.uniform3i interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - uniform4i: function (...args) { - console.warn("webgl.uniform4i interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - useProgram: function (...args) { - console.warn("webgl.useProgram interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - validateProgram: function (...args) { - console.warn("webgl.validateProgram interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttrib1f: function (...args) { - console.warn("webgl.vertexAttrib1f interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttrib2f: function (...args) { - console.warn("webgl.vertexAttrib2f interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - vertexAttrib3f: function (...args) { - console.warn("webgl.vertexAttrib3f interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttrib4f: function (...args) { - console.warn("webgl.vertexAttrib4f interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttrib1fv: function (...args) { - console.warn("webgl.vertexAttrib1fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttrib2fv: function (...args) { - console.warn("webgl.vertexAttrib2fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttrib3fv: function (...args) { - console.warn("webgl.vertexAttrib3fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - vertexAttrib4fv: function (...args) { - console.warn("webgl.vertexAttrib4fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttribPointer: function (...args) { - console.warn("webgl.vertexAttribPointer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - viewport: function (...args) { - console.warn("webgl.vertexAttrib3fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - bufferData: function (...args) { - console.warn("webgl.bufferData interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - bufferSubData: function (...args) { - console.warn("webgl.bufferSubData interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - compressedTexImage2D: function (...args) { - console.warn("webgl.compressedTexImage2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - compressedTexSubImage2D: function (...args) { - console.warn("webgl.compressedTexSubImage2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - readPixels: function (...args) { - console.warn("webgl.readPixels interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - texImage2D: function (...args) { - console.warn("webgl.texImage2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - texSubImage2D: function (...args) { - console.warn("webgl.texSubImage2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform1fv: function (...args) { - console.warn("webgl.uniform1fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform2fv: function (...args) { - console.warn("webgl.uniform2fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform3fv: function (...args) { - console.warn("webgl.uniform3fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - uniform4fv: function (...args) { - console.warn("webgl.uniform4fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform1iv: function (...args) { - console.warn("webgl.uniform1iv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform2iv: function (...args) { - console.warn("webgl.uniform2iv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform3iv: function (...args) { - console.warn("webgl.uniform3iv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform4iv: function (...args) { - console.warn("webgl.uniform4iv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - uniformMatrix2fv: function (...args) { - console.warn("webgl.uniformMatrix2fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniformMatrix3fv: function (...args) { - console.warn("webgl.uniformMatrix3fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniformMatrix4fv: function (...args) { - console.warn("webgl.uniformMatrix4fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - } - } - return webglmock + } + return webglmock } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/webgl2.js b/runtime/main/extend/systemplugin/napi/webgl2.js index 4b3cd2a9..4888c98d 100644 --- a/runtime/main/extend/systemplugin/napi/webgl2.js +++ b/runtime/main/extend/systemplugin/napi/webgl2.js @@ -1,496 +1,511 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" export function mockwebgl2() { - const WebGLQuery = { - } - const WebGLSampler = { - } - const WebGLSync = { - } - const WebGLTransformFeedback = { - } - const WebGLVertexArrayObject = { - } - const WebGLActiveInfo = { - size: '[PC preview] unknow size', - type: '[PC preview] unknow type', - name: '[PC preview] unknow name' - } - const glParamMock = { - paramDoubleMock: '[PC Preview] unknow double', - paramAnyMock: '[PC Preview] unknow any', - stringArray: '[PC preview] unknow stringArray', - uint32Array: '[PC preview] unknow uint32Array', - glBooleanArray: '[PC preview] unknow glBooleanArray', - int32Array: '[PC preview] unknow int32Array', - uintArray: '[PC preview] unknow uintArray' - } - const GL_SAMPLES = 0x80A9; - const GL_QUERY_RESULT = 0x8866; - const GL_QUERY_RESULT_AVAILABLE = 0x8867; - const GL_TEXTURE_MAX_LOD = 0x813B; - const GL_TEXTURE_MIN_LOD = 0x813A; - const webgl2Mock = { - copyBufferSubData: function (...args) { - console.warn("webgl.copyBufferSubData interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getBufferSubData: function (...args) { - console.warn("webgl.getBufferSubData interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - blitFramebuffer: function (...args) { - console.warn("webgl.blitFramebuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - framebufferTextureLayer: function (...args) { - console.warn("webgl.framebufferTextureLayer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - invalidateFramebuffer: function (...args) { - console.warn("webgl.invalidateFramebuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - invalidateSubFramebuffer: function (...args) { - console.warn("webgl.invalidateFramebuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - readBuffer: function (...args) { - console.warn("webgl.readBuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getInternalformatParameter: function (...args) { - console.warn("webgl.getInternalformatParameter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (args[2] == GL_SAMPLES) { - return glParamMock.int32Array - } - }, - renderbufferStorageMultisample: function (...args) { - console.warn("webgl.renderbufferStorageMultisample interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - texStorage2D: function (...args) { - console.warn("webgl.texStorage2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - texStorage3D: function (...args) { - console.warn("webgl.texStorage3D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - texImage3D: function (...args) { - console.warn("webgl.texImage3D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - texSubImage3D: function (...args) { - console.warn("webgl.texSubImage3D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - copyTexSubImage3D: function (...args) { - console.warn("webgl.copyTexSubImage3D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - compressedTexImage3D: function (...args) { - console.warn("webgl.compressedTexImage3D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - compressedTexSubImage3D: function (...args) { - console.warn("webgl.compressedTexSubImage3D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getFragDataLocation: function (...args) { - console.warn("webgl.getFragDataLocation interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - uniform1ui: function (...args) { - console.warn("webgl.uniform1ui interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform2ui: function (...args) { - console.warn("webgl.uniform2ui interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform3ui: function (...args) { - console.warn("webgl.uniform3ui interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform4ui: function (...args) { - console.warn("webgl.uniform4ui interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform1uiv: function (...args) { - console.warn("webgl.uniform1uiv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform2uiv: function (...args) { - console.warn("webgl.uniform2uiv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform3uiv: function (...args) { - console.warn("webgl.uniform3uiv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform4uiv: function (...args) { - console.warn("webgl.uniform4uiv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniformMatrix3x2fv: function (...args) { - console.warn("webgl.uniformMatrix3x2fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniformMatrix4x2fv: function (...args) { - console.warn("webgl.uniformMatrix4x2fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniformMatrix2x3fv: function (...args) { - console.warn("webgl.uniformMatrix2x3fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniformMatrix4x3fv: function (...args) { - console.warn("webgl.uniformMatrix4x3fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniformMatrix2x4fv: function (...args) { - console.warn("webgl.uniformMatrix2x4fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniformMatrix3x4fv: function (...args) { - console.warn("webgl.uniformMatrix3x4fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttribI4i: function (...args) { - console.warn("webgl.vertexAttribI4i interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttribI4iv: function (...args) { - console.warn("webgl.vertexAttribI4iv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttribI4ui: function (...args) { - console.warn("webgl.vertexAttribI4ui interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttribI4uiv: function (...args) { - console.warn("webgl.vertexAttribI4uiv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttribIPointer: function (...args) { - console.warn("webgl.vertexAttribIPointer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttribDivisor: function (...args) { - console.warn("webgl.vertexAttribDivisor interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - drawArraysInstanced: function (...args) { - console.warn("webgl.drawArraysInstanced interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - drawElementsInstanced: function (...args) { - console.warn("webgl.drawElementsInstanced interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - drawRangeElements: function (...args) { - console.warn("webgl.drawRangeElements interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - drawBuffers: function (...args) { - console.warn("webgl.drawBuffers interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - clearBufferfv: function (...args) { - console.warn("webgl.clearBufferfv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - clearBufferiv: function (...args) { - console.warn("webgl.clearBufferiv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - clearBufferuiv: function (...args) { - console.warn("webgl.clearBufferuiv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - clearBufferfi: function (...args) { - console.warn("webgl.clearBufferfi interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - createQuery: function (...args) { - console.warn("webgl.createQuery interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLQuery; - }, - deleteQuery: function (...args) { - console.warn("webgl.deleteQuery interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - isQuery: function (...args) { - console.warn("webgl.isQuery interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - beginQuery: function (...args) { - console.warn("webgl.beginQuery interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - endQuery: function (...args) { - console.warn("webgl.endQuery interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getQuery: function (...args) { - console.warn("webgl2.getQuery interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLQuery; - }, - getQueryParameter: function (...args) { - console.warn("webgl2.getQueryParameter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (args[1] == GL_QUERY_RESULT) { - return paramMock.paramNumberMock; - } else if (args[1] == GL_QUERY_RESULT_AVAILABLE) { - return paramMock.paramBooleanMock; - } - }, - createSampler: function (...args) { - console.warn("webgl2.createSampler interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLSampler; - }, - deleteSampler: function (...args) { - console.warn("webgl2.deleteSampler interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - isSampler: function (...args) { - console.warn("webgl2.isSampler interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, + const WebGLQuery = { + } + const WebGLSampler = { + } + const WebGLSync = { + } + const WebGLTransformFeedback = { + } + const WebGLVertexArrayObject = { + } + const WebGLActiveInfo = { + size: '[PC preview] unknow size', + type: '[PC preview] unknow type', + name: '[PC preview] unknow name' + } + const glParamMock = { + paramDoubleMock: '[PC Preview] unknow double', + paramAnyMock: '[PC Preview] unknow any', + stringArray: '[PC preview] unknow stringArray', + uint32Array: '[PC preview] unknow uint32Array', + glBooleanArray: '[PC preview] unknow glBooleanArray', + int32Array: '[PC preview] unknow int32Array', + uintArray: '[PC preview] unknow uintArray' + } + const GL_SAMPLES = 0x80A9; + const GL_QUERY_RESULT = 0x8866; + const GL_QUERY_RESULT_AVAILABLE = 0x8867; + const GL_TEXTURE_MAX_LOD = 0x813B; + const GL_TEXTURE_MIN_LOD = 0x813A; + const webgl2Mock = { + copyBufferSubData: function (...args) { + console.warn("webgl.copyBufferSubData interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + getBufferSubData: function (...args) { + console.warn("webgl.getBufferSubData interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + blitFramebuffer: function (...args) { + console.warn("webgl.blitFramebuffer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + framebufferTextureLayer: function (...args) { + console.warn("webgl.framebufferTextureLayer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + invalidateFramebuffer: function (...args) { + console.warn("webgl.invalidateFramebuffer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + invalidateSubFramebuffer: function (...args) { + console.warn("webgl.invalidateFramebuffer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + readBuffer: function (...args) { + console.warn("webgl.readBuffer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + getInternalformatParameter: function (...args) { + console.warn("webgl.getInternalformatParameter interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + if (args[2] == GL_SAMPLES) { + return glParamMock.int32Array + } + }, + renderbufferStorageMultisample: function (...args) { + console.warn("webgl.renderbufferStorageMultisample interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + texStorage2D: function (...args) { + console.warn("webgl.texStorage2D interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + texStorage3D: function (...args) { + console.warn("webgl.texStorage3D interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + texImage3D: function (...args) { + console.warn("webgl.texImage3D interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + texSubImage3D: function (...args) { + console.warn("webgl.texSubImage3D interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + copyTexSubImage3D: function (...args) { + console.warn("webgl.copyTexSubImage3D interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + compressedTexImage3D: function (...args) { + console.warn("webgl.compressedTexImage3D interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + compressedTexSubImage3D: function (...args) { + console.warn("webgl.compressedTexSubImage3D interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + getFragDataLocation: function (...args) { + console.warn("webgl.getFragDataLocation interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + uniform1ui: function (...args) { + console.warn("webgl.uniform1ui interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform2ui: function (...args) { + console.warn("webgl.uniform2ui interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform3ui: function (...args) { + console.warn("webgl.uniform3ui interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform4ui: function (...args) { + console.warn("webgl.uniform4ui interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform1uiv: function (...args) { + console.warn("webgl.uniform1uiv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform2uiv: function (...args) { + console.warn("webgl.uniform2uiv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform3uiv: function (...args) { + console.warn("webgl.uniform3uiv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform4uiv: function (...args) { + console.warn("webgl.uniform4uiv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniformMatrix3x2fv: function (...args) { + console.warn("webgl.uniformMatrix3x2fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniformMatrix4x2fv: function (...args) { + console.warn("webgl.uniformMatrix4x2fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniformMatrix2x3fv: function (...args) { + console.warn("webgl.uniformMatrix2x3fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniformMatrix4x3fv: function (...args) { + console.warn("webgl.uniformMatrix4x3fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniformMatrix2x4fv: function (...args) { + console.warn("webgl.uniformMatrix2x4fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniformMatrix3x4fv: function (...args) { + console.warn("webgl.uniformMatrix3x4fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + vertexAttribI4i: function (...args) { + console.warn("webgl.vertexAttribI4i interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + vertexAttribI4iv: function (...args) { + console.warn("webgl.vertexAttribI4iv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + vertexAttribI4ui: function (...args) { + console.warn("webgl.vertexAttribI4ui interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + vertexAttribI4uiv: function (...args) { + console.warn("webgl.vertexAttribI4uiv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + vertexAttribIPointer: function (...args) { + console.warn("webgl.vertexAttribIPointer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + vertexAttribDivisor: function (...args) { + console.warn("webgl.vertexAttribDivisor interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + drawArraysInstanced: function (...args) { + console.warn("webgl.drawArraysInstanced interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + drawElementsInstanced: function (...args) { + console.warn("webgl.drawElementsInstanced interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + drawRangeElements: function (...args) { + console.warn("webgl.drawRangeElements interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + drawBuffers: function (...args) { + console.warn("webgl.drawBuffers interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + clearBufferfv: function (...args) { + console.warn("webgl.clearBufferfv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + clearBufferiv: function (...args) { + console.warn("webgl.clearBufferiv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + clearBufferuiv: function (...args) { + console.warn("webgl.clearBufferuiv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + clearBufferfi: function (...args) { + console.warn("webgl.clearBufferfi interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + createQuery: function (...args) { + console.warn("webgl.createQuery interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return WebGLQuery; + }, + deleteQuery: function (...args) { + console.warn("webgl.deleteQuery interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + isQuery: function (...args) { + console.warn("webgl.isQuery interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + beginQuery: function (...args) { + console.warn("webgl.beginQuery interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + endQuery: function (...args) { + console.warn("webgl.endQuery interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + getQuery: function (...args) { + console.warn("webgl2.getQuery interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return WebGLQuery; + }, + getQueryParameter: function (...args) { + console.warn("webgl2.getQueryParameter interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + if (args[1] == GL_QUERY_RESULT) { + return paramMock.paramNumberMock; + } else if (args[1] == GL_QUERY_RESULT_AVAILABLE) { + return paramMock.paramBooleanMock; + } + }, + createSampler: function (...args) { + console.warn("webgl2.createSampler interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return WebGLSampler; + }, + deleteSampler: function (...args) { + console.warn("webgl2.deleteSampler interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + isSampler: function (...args) { + console.warn("webgl2.isSampler interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, - bindSampler: function (...args) { - console.warn("webgl2.bindSampler interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - samplerParameteri: function (...args) { - console.warn("webgl2.samplerParameteri interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - samplerParameterf: function (...args) { - console.warn("webgl2.samplerParameterf interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getSamplerParameter: function (...args) { - console.warn("webgl2.getSamplerParameter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (args[1] == GL_TEXTURE_MAX_LOD || args[1] == GL_TEXTURE_MIN_LOD) { - return glParamMock.paramDoubleMock; - } else { - return paramMock.paramNumberMock; - } - }, - fenceSync: function (...args) { - console.warn("webgl2.fenceSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLSync; - }, - isSync: function (...args) { - console.warn("webgl2.isSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - deleteSync: function (...args) { - console.warn("webgl2.deleteSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - clientWaitSync: function (...args) { - console.warn("webgl2.clientWaitSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - waitSync: function (...args) { - console.warn("webgl2.waitSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getSyncParameter: function (...args) { - console.warn("webgl2.getSyncParameter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return glParamMock.paramAnyMock; - }, - createTransformFeedback: function (...args) { - console.warn("webgl2.createTransformFeedback interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLTransformFeedback; - }, - deleteTransformFeedback: function (...args) { - console.warn("webgl2.deleteTransformFeedback interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - isTransformFeedback: function (...args) { - console.warn("webgl2.isTransformFeedback interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - bindTransformFeedback: function (...args) { - console.warn("webgl2.bindTransformFeedback interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - beginTransformFeedback: function (...args) { - console.warn("webgl2.beginTransformFeedback interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - endTransformFeedback: function (...args) { - console.warn("webgl2.endTransformFeedback interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - transformFeedbackVaryings: function (...args) { - console.warn("webgl2.transformFeedbackVaryings interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getTransformFeedbackVarying: function (...args) { - console.warn("webgl2.getTransformFeedbackVarying interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLActiveInfo; - }, - pauseTransformFeedback: function (...args) { - console.warn("webgl2.pauseTransformFeedback interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - resumeTransformFeedback: function (...args) { - console.warn("webgl2.resumeTransformFeedback interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - bindBufferBase: function (...args) { - console.warn("webgl2.bindBufferBase interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - bindBufferRange: function (...args) { - console.warn("webgl2.bindBufferRange interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getIndexedParameter: function (...args) { - console.warn("webgl2.getIndexedParameter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return glParamMock.paramAnyMock; - }, - getUniformIndices: function (...args) { - console.warn("webgl2.getUniformIndices interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return glParamMock.uintArray; - }, - getActiveUniforms: function (...args) { - console.warn("webgl2.getActiveUniforms interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return glParamMock.paramAnyMock; - }, - getUniformBlockIndex: function (...args) { - console.warn("webgl2.getUniformBlockIndex interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getActiveUniformBlockParameter: function (...args) { - console.warn("webgl2.getActiveUniformBlockParameter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return glParamMock.paramAnyMock; - }, - getActiveUniformBlockName: function (...args) { - console.warn("webgl2.getActiveUniformBlockName interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock; - }, - uniformBlockBinding: function (...args) { - console.warn("webgl2.uniformBlockBinding interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - createVertexArray: function (...args) { - console.warn("webgl2.createVertexArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLVertexArrayObject; - }, - deleteVertexArray: function (...args) { - console.warn("webgl2.deleteVertexArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - isVertexArray: function (...args) { - console.warn("webgl2.isVertexArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - bindVertexArray: function (...args) { - console.warn("webgl2.bindVertexArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - bufferData: function (...args) { - console.warn("webgl2.bufferData interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - bufferSubData: function (...args) { - console.warn("webgl2.bufferSubData interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - texImage2D: function (...args) { - console.warn("webgl2.texImage2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - texSubImage2D: function (...args) { - console.warn("webgl2.texSubImage2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - compressedTexImage2D: function (...args) { - console.warn("webgl2.compressedTexImage2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - compressedTexSubImage2D: function (...args) { - console.warn("webgl2.compressedTexSubImage2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform1fv: function (...args) { - console.warn("webgl2.uniform1fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform2fv: function (...args) { - console.warn("webgl2.uniform2fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform3fv: function (...args) { - console.warn("webgl2.uniform3fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform4fv: function (...args) { - console.warn("webgl2.uniform4fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform1iv: function (...args) { - console.warn("webgl2.uniform1iv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform2iv: function (...args) { - console.warn("webgl2.uniform2iv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform3iv: function (...args) { - console.warn("webgl2.uniform3iv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform4iv: function (...args) { - console.warn("webgl2.uniform4iv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniformMatrix2fv: function (...args) { - console.warn("webgl2.uniformMatrix2fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniformMatrix3fv: function (...args) { - console.warn("webgl2.uniformMatrix3fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniformMatrix4fv: function (...args) { - console.warn("webgl2.uniformMatrix4fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - readPixels: function (...args) { - console.warn("webgl2.readPixels interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - } + bindSampler: function (...args) { + console.warn("webgl2.bindSampler interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + samplerParameteri: function (...args) { + console.warn("webgl2.samplerParameteri interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + samplerParameterf: function (...args) { + console.warn("webgl2.samplerParameterf interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + getSamplerParameter: function (...args) { + console.warn("webgl2.getSamplerParameter interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + if (args[1] == GL_TEXTURE_MAX_LOD || args[1] == GL_TEXTURE_MIN_LOD) { + return glParamMock.paramDoubleMock; + } else { + return paramMock.paramNumberMock; + } + }, + fenceSync: function (...args) { + console.warn("webgl2.fenceSync interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return WebGLSync; + }, + isSync: function (...args) { + console.warn("webgl2.isSync interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + deleteSync: function (...args) { + console.warn("webgl2.deleteSync interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + clientWaitSync: function (...args) { + console.warn("webgl2.clientWaitSync interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + waitSync: function (...args) { + console.warn("webgl2.waitSync interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + getSyncParameter: function (...args) { + console.warn("webgl2.getSyncParameter interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return glParamMock.paramAnyMock; + }, + createTransformFeedback: function (...args) { + console.warn("webgl2.createTransformFeedback interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return WebGLTransformFeedback; + }, + deleteTransformFeedback: function (...args) { + console.warn("webgl2.deleteTransformFeedback interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + isTransformFeedback: function (...args) { + console.warn("webgl2.isTransformFeedback interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + bindTransformFeedback: function (...args) { + console.warn("webgl2.bindTransformFeedback interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + beginTransformFeedback: function (...args) { + console.warn("webgl2.beginTransformFeedback interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + endTransformFeedback: function (...args) { + console.warn("webgl2.endTransformFeedback interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + transformFeedbackVaryings: function (...args) { + console.warn("webgl2.transformFeedbackVaryings interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + getTransformFeedbackVarying: function (...args) { + console.warn("webgl2.getTransformFeedbackVarying interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return WebGLActiveInfo; + }, + pauseTransformFeedback: function (...args) { + console.warn("webgl2.pauseTransformFeedback interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + resumeTransformFeedback: function (...args) { + console.warn("webgl2.resumeTransformFeedback interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + bindBufferBase: function (...args) { + console.warn("webgl2.bindBufferBase interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + bindBufferRange: function (...args) { + console.warn("webgl2.bindBufferRange interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + getIndexedParameter: function (...args) { + console.warn("webgl2.getIndexedParameter interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return glParamMock.paramAnyMock; + }, + getUniformIndices: function (...args) { + console.warn("webgl2.getUniformIndices interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return glParamMock.uintArray; + }, + getActiveUniforms: function (...args) { + console.warn("webgl2.getActiveUniforms interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return glParamMock.paramAnyMock; + }, + getUniformBlockIndex: function (...args) { + console.warn("webgl2.getUniformBlockIndex interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + getActiveUniformBlockParameter: function (...args) { + console.warn("webgl2.getActiveUniformBlockParameter interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return glParamMock.paramAnyMock; + }, + getActiveUniformBlockName: function (...args) { + console.warn("webgl2.getActiveUniformBlockName interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramStringMock; + }, + uniformBlockBinding: function (...args) { + console.warn("webgl2.uniformBlockBinding interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + createVertexArray: function (...args) { + console.warn("webgl2.createVertexArray interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return WebGLVertexArrayObject; + }, + deleteVertexArray: function (...args) { + console.warn("webgl2.deleteVertexArray interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + isVertexArray: function (...args) { + console.warn("webgl2.isVertexArray interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + bindVertexArray: function (...args) { + console.warn("webgl2.bindVertexArray interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + bufferData: function (...args) { + console.warn("webgl2.bufferData interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + bufferSubData: function (...args) { + console.warn("webgl2.bufferSubData interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + texImage2D: function (...args) { + console.warn("webgl2.texImage2D interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + texSubImage2D: function (...args) { + console.warn("webgl2.texSubImage2D interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + compressedTexImage2D: function (...args) { + console.warn("webgl2.compressedTexImage2D interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + compressedTexSubImage2D: function (...args) { + console.warn("webgl2.compressedTexSubImage2D interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform1fv: function (...args) { + console.warn("webgl2.uniform1fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform2fv: function (...args) { + console.warn("webgl2.uniform2fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform3fv: function (...args) { + console.warn("webgl2.uniform3fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform4fv: function (...args) { + console.warn("webgl2.uniform4fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform1iv: function (...args) { + console.warn("webgl2.uniform1iv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform2iv: function (...args) { + console.warn("webgl2.uniform2iv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform3iv: function (...args) { + console.warn("webgl2.uniform3iv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniform4iv: function (...args) { + console.warn("webgl2.uniform4iv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniformMatrix2fv: function (...args) { + console.warn("webgl2.uniformMatrix2fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniformMatrix3fv: function (...args) { + console.warn("webgl2.uniformMatrix3fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + uniformMatrix4fv: function (...args) { + console.warn("webgl2.uniformMatrix4fv interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + readPixels: function (...args) { + console.warn("webgl2.readPixels interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") } - return webgl2Mock; + } + return webgl2Mock; } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/wifi.js b/runtime/main/extend/systemplugin/napi/wifi.js index feb98068..707e9106 100755 --- a/runtime/main/extend/systemplugin/napi/wifi.js +++ b/runtime/main/extend/systemplugin/napi/wifi.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" export function mockWifi() { @@ -61,94 +76,79 @@ export function mockWifi() { ipAddress: '[PC preview] unknow ipAddress', } - const EventListenerClass = class EventListener { - constructor() { - this.on = function (...args) { - console.warn("wifi.on interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return; - } - this.off = function (...args) { - console.warn("wifi.off interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return; - } - } - } - const wifi = { enableWifi: function (...args) { console.warn("wifi.enableWifi 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 paramMock.paramBooleanMock; }, disableWifi: function (...args) { console.warn("wifi.disableWifi 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 paramMock.paramBooleanMock; }, isWifiActive: function (...args) { console.warn("wifi.isWifiActive 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 paramMock.paramBooleanMock; }, scan: function (...args) { console.warn("wifi.scan 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 paramMock.paramBooleanMock; }, getScanInfos: function (...args) { console.warn("wifi.getScanInfos interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, [wifiScanInfoMock]) - } else { - return new Promise((resolve) => { - resolve([wifiScanInfoMock]) - }) - } + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, [wifiScanInfoMock]) + } else { + return new Promise((resolve) => { + resolve([wifiScanInfoMock]) + }) + } }, addDeviceConfig: function (...args) { console.warn("wifi.addDeviceConfig interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } + " How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramNumberMock) + }) + } }, connectToNetwork: function (...args) { console.warn("wifi.connectToNetwork 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 paramMock.paramBooleanMock; }, connectToDevice: function (...args) { console.warn("wifi.connectToDevice 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 paramMock.paramBooleanMock; }, disconnect: function (...args) { console.warn("wifi.disconnect 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 paramMock.paramBooleanMock; }, getSignalLevel: function (...args) { console.warn("wifi.getSignalLevel interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") - return paramMock.paramNumberMock; + return paramMock.paramNumberMock; }, getLinkedInfo: function (...args) { @@ -167,118 +167,126 @@ export function mockWifi() { isConnected: function (...args) { console.warn("wifi.isConnected 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 paramMock.paramBooleanMock; }, getSupportedFeatures: function (...args) { console.warn("wifi.getSupportedFeatures interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; + " How this interface works on the Previewer may be different from that on a real device.") + return paramMock.paramNumberMock; }, isFeatureSupported: function (...args) { console.warn("wifi.isFeatureSupported interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; + " How this interface works on the Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; }, getDeviceMacAddress: function (...args) { console.warn("wifi.getDeviceMacAddress interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return [paramMock.paramArrayMock]; + " How this interface works on the Previewer may be different from that on a real device.") + return [paramMock.paramArrayMock]; }, getIpInfo: function (...args) { console.warn("wifi.getIpInfo interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") - return ipInfoMock; + return ipInfoMock; }, getCountryCode: function (...args) { console.warn("wifi.getCountryCode interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") - return paramMock.paramStringMock; + return paramMock.paramStringMock; }, reassociate: function (...args) { console.warn("wifi.reassociate interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; + " How this interface works on the Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; }, reconnect: function (...args) { console.warn("wifi.reconnect interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; + " How this interface works on the Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; }, getDeviceConfigs: function (...args) { console.warn("wifi.getDeviceConfigs interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return [wifiDeviceConfigMock]; + " How this interface works on the Previewer may be different from that on a real device.") + return [wifiDeviceConfigMock]; }, updateNetwork: function (...args) { console.warn("wifi.updateNetwork interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; + " How this interface works on the Previewer may be different from that on a real device.") + return paramMock.paramNumberMock; }, disableNetwork: function (...args) { console.warn("wifi.disableNetwork interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; + " How this interface works on the Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; }, removeAllNetwork: function (...args) { console.warn("wifi.removeAllNetwork interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; + " How this interface works on the Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; }, removeDevice: function (...args) { console.warn("wifi.removeDevice interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; + " How this interface works on the Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; }, enableHotspot: function (...args) { console.warn("wifi.enableHotspot interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; + " How this interface works on the Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; }, disableHotspot: function (...args) { console.warn("wifi.disableHotspot interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; + " How this interface works on the Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; }, isHotspotActive: function (...args) { console.warn("wifi.isHotspotActive interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; + " How this interface works on the Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; }, setHotspotConfig: function (...args) { console.warn("wifi.setHotspotConfig interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; + " How this interface works on the Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; }, getHotspotConfig: function (...args) { console.warn("wifi.getHotspotConfig interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return wifiHotspotConfigMock; + " How this interface works on the Previewer may be different from that on a real device.") + return wifiHotspotConfigMock; }, getStations: function (...args) { console.warn("wifi.getStations interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return [wifiStationInfoMock]; + " How this interface works on the Previewer may be different from that on a real device.") + return [wifiStationInfoMock]; }, - EventListener: EventListenerClass + on: function (...args) { + console.warn("wifi.on interface mocked in the Previewer." + + " How this interface works on the Previewer may be different from that on a real device.") + }, + + off: function (...args) { + console.warn("wifi.off interface mocked in the Previewer." + + " How this interface works on the Previewer may be different from that on a real device.") + }, } return wifi; } diff --git a/runtime/main/extend/systemplugin/napi/worker.js b/runtime/main/extend/systemplugin/napi/worker.js index 154fcc79..c522bd73 100644 --- a/runtime/main/extend/systemplugin/napi/worker.js +++ b/runtime/main/extend/systemplugin/napi/worker.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" export function mockWorker() { diff --git a/runtime/main/extend/systemplugin/napi/xml.js b/runtime/main/extend/systemplugin/napi/xml.js index c24ce281..531e9964 100644 --- a/runtime/main/extend/systemplugin/napi/xml.js +++ b/runtime/main/extend/systemplugin/napi/xml.js @@ -1,65 +1,80 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + 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; - } + 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; } - 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 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 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.") } - return result; + } + return result; } diff --git a/runtime/main/extend/systemplugin/napi/zlib.js b/runtime/main/extend/systemplugin/napi/zlib.js index 407c40bf..fcb683f8 100644 --- a/runtime/main/extend/systemplugin/napi/zlib.js +++ b/runtime/main/extend/systemplugin/napi/zlib.js @@ -1,18 +1,33 @@ -export function mockZlib(){ - const zlib = { - zipFile(...args) { - console.warn("zlib.zipFile 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() - }) - }, +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ - unzipFile(...args){ - console.warn("zlib.unzipFile 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() - }) - } +export function mockZlib() { + const zlib = { + zipFile(...args) { + console.warn("zlib.zipFile 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() + }) + }, + + unzipFile(...args) { + console.warn("zlib.unzipFile 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() + }) } - global.ohosplugin.zlib = zlib + } + global.ohosplugin.zlib = zlib } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/net.js b/runtime/main/extend/systemplugin/net.js index 3e75be63..eeb048fa 100644 --- a/runtime/main/extend/systemplugin/net.js +++ b/runtime/main/extend/systemplugin/net.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "./utils" export function mockWebSocket() { diff --git a/runtime/main/extend/systemplugin/network.js b/runtime/main/extend/systemplugin/network.js index 92e7ea3a..ca4815f4 100644 --- a/runtime/main/extend/systemplugin/network.js +++ b/runtime/main/extend/systemplugin/network.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + export function mockNetwork() { const data = { metered: true, diff --git a/runtime/main/extend/systemplugin/nfc.js b/runtime/main/extend/systemplugin/nfc.js index f807e84a..9b776dee 100644 --- a/runtime/main/extend/systemplugin/nfc.js +++ b/runtime/main/extend/systemplugin/nfc.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "./utils" export function mockNfcCardEmulation() { diff --git a/runtime/main/extend/systemplugin/notification.js b/runtime/main/extend/systemplugin/notification.js index 90b78cdb..10a0cde7 100644 --- a/runtime/main/extend/systemplugin/notification.js +++ b/runtime/main/extend/systemplugin/notification.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + export function mockNotification() { global.systemplugin.notification = { show: function () { diff --git a/runtime/main/extend/systemplugin/ohos/app.js b/runtime/main/extend/systemplugin/ohos/app.js index 611fb6f7..c392e529 100644 --- a/runtime/main/extend/systemplugin/ohos/app.js +++ b/runtime/main/extend/systemplugin/ohos/app.js @@ -1,287 +1,302 @@ -import {paramMock} from "../utils" -import {PixelMapMock} from "../multimedia" +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "../utils" +import { PixelMapMock } from "../multimedia" export function mockAppAbilityManager() { - global.ohosplugin.app = {} - const ActiveProcessInfoMock = { - pid: "[PC Preview] unknow pid", - uid: "[PC Preview] unknow uid", - processName: "[PC Preview] unknow processName", - bundleNames: ["[PC Preview] unknow bundleNames", "[PC Preview] unknow bundleNames"] - } - const ElementNameMock = { - deviceId: "[PC Preview] unknow deviceId", - bundleName: "[PC Preview] unknow bundleName", - abilityName: "[PC Preview] unknow abilityName", - uri: "[PC Preview] unknow uri", - shortName: "[PC Preview] unknow shortName", - } - const AbilityMissionInfoMock = { - missionId: "[PC Preview] unknow missionId", - bottomAbility: { - abilityName: ElementNameMock.abilityName, - bundleName: ElementNameMock.bundleName, - deviceId: ElementNameMock.deviceId - }, - topAbility: { - abilityName: ElementNameMock.abilityName, - bundleName: ElementNameMock.bundleName, - deviceId: ElementNameMock.deviceId - }, - windowMode: "[PC Preview] unknow windowMode" - } + global.ohosplugin.app = {} + const ActiveProcessInfoMock = { + pid: "[PC Preview] unknow pid", + uid: "[PC Preview] unknow uid", + processName: "[PC Preview] unknow processName", + bundleNames: ["[PC Preview] unknow bundleNames", "[PC Preview] unknow bundleNames"] + } + const ElementNameMock = { + deviceId: "[PC Preview] unknow deviceId", + bundleName: "[PC Preview] unknow bundleName", + abilityName: "[PC Preview] unknow abilityName", + uri: "[PC Preview] unknow uri", + shortName: "[PC Preview] unknow shortName", + } + const AbilityMissionInfoMock = { + missionId: "[PC Preview] unknow missionId", + bottomAbility: { + abilityName: ElementNameMock.abilityName, + bundleName: ElementNameMock.bundleName, + deviceId: ElementNameMock.deviceId + }, + topAbility: { + abilityName: ElementNameMock.abilityName, + bundleName: ElementNameMock.bundleName, + deviceId: ElementNameMock.deviceId + }, + windowMode: "[PC Preview] unknow windowMode" + } - const ActiveServiceAbilityInfoMock = { - pid: "[PC Preview] unknow pid", - uid: "[PC Preview] unknow uid", - processName: "[PC Preview] unknow processName", - serviceAbility: { - abilityName: ElementNameMock.abilityName, - bundleName: ElementNameMock.bundleName, - deviceId: ElementNameMock.deviceId - } + const ActiveServiceAbilityInfoMock = { + pid: "[PC Preview] unknow pid", + uid: "[PC Preview] unknow uid", + processName: "[PC Preview] unknow processName", + serviceAbility: { + abilityName: ElementNameMock.abilityName, + bundleName: ElementNameMock.bundleName, + deviceId: ElementNameMock.deviceId } + } - const ProcessErrorInfoMock = { - errStatus: "[PC Preview] unknow errStatus", - processName: "[PC Preview] unknow processName", - pid: "[PC Preview] unknow pid", - uid: "[PC Preview] unknow uid", - abilityName: "[PC Preview] unknow abilityName", - errMsg: "[PC Preview] unknow errMsg", - backTrace: "[PC Preview] unknow backTrace" - } - const SystemMemoryAttrMock = { - availSysMem: "[PC Preview] unknow availSysMem", - totalSysMem: "[PC Preview] unknow totalSysMem", - threshold: "[PC Preview] unknow threshold", - isSysInlowMem: "[PC Preview] unknow isSysInlowMem" - } - const MissionSnapshotMock = { - topAbility: { - abilityName: ElementNameMock.abilityName, - bundleName: ElementNameMock.bundleName, - deviceId: ElementNameMock.deviceId - }, - snapshot: PixelMapMock - } - const MemoryMapInfoMock = { - vmPss: "[PC Preview] unknow vmPss", - vmPrivateDirty: "[PC Preview] unknow vmPrivateDirty", - vmSharedDirty: "[PC Preview] unknow vmSharedDirty", - nativePss: "[PC Preview] unknow nativePss", - nativePrivateDirty: "[PC Preview] unknow nativePrivateDirty", - nativeSharedDirty: "[PC Preview] unknow nativeSharedDirty", - otherPss: "[PC Preview] unknow otherPss", - otherPrivateDirty: "[PC Preview] unknow otherPrivateDirty", - otherSharedDirty: "[PC Preview] unknow otherSharedDirty" - } + const ProcessErrorInfoMock = { + errStatus: "[PC Preview] unknow errStatus", + processName: "[PC Preview] unknow processName", + pid: "[PC Preview] unknow pid", + uid: "[PC Preview] unknow uid", + abilityName: "[PC Preview] unknow abilityName", + errMsg: "[PC Preview] unknow errMsg", + backTrace: "[PC Preview] unknow backTrace" + } + const SystemMemoryAttrMock = { + availSysMem: "[PC Preview] unknow availSysMem", + totalSysMem: "[PC Preview] unknow totalSysMem", + threshold: "[PC Preview] unknow threshold", + isSysInlowMem: "[PC Preview] unknow isSysInlowMem" + } + const MissionSnapshotMock = { + topAbility: { + abilityName: ElementNameMock.abilityName, + bundleName: ElementNameMock.bundleName, + deviceId: ElementNameMock.deviceId + }, + snapshot: PixelMapMock + } + const MemoryMapInfoMock = { + vmPss: "[PC Preview] unknow vmPss", + vmPrivateDirty: "[PC Preview] unknow vmPrivateDirty", + vmSharedDirty: "[PC Preview] unknow vmSharedDirty", + nativePss: "[PC Preview] unknow nativePss", + nativePrivateDirty: "[PC Preview] unknow nativePrivateDirty", + nativeSharedDirty: "[PC Preview] unknow nativeSharedDirty", + otherPss: "[PC Preview] unknow otherPss", + otherPrivateDirty: "[PC Preview] unknow otherPrivateDirty", + otherSharedDirty: "[PC Preview] unknow otherSharedDirty" + } - global.ohosplugin.app.abilityManager = { - getCurrentUserId: function (...args) { - console.warn("app.abilityManager.getCurrentUserId interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } - }, - getActiveProcessInfos: function (...args) { - console.warn("app.abilityManager.getActiveProcessInfos interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, [ActiveProcessInfoMock]) - } else { - return new Promise((resolve) => { - resolve([ActiveProcessInfoMock]) - }) - } - }, - getActiveAbilityMissionInfos: function (...args) { - console.warn("app.abilityManager.getActiveAbilityMissionInfos interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, [AbilityMissionInfoMock]) - } else { - return new Promise((resolve) => { - resolve([AbilityMissionInfoMock]) - }) - } - }, - getPreviousAbilityMissionInfos: function (...args) { - console.warn("app.abilityManager.getPreviousAbilityMissionInfos interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, [AbilityMissionInfoMock]) - } else { - return new Promise((resolve) => { - resolve([AbilityMissionInfoMock]) - }) - } - }, - deleteMissions: function (...args) { - console.warn("app.abilityManager.deleteMissions interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - isUserATestUser: function (...args) { - console.warn("app.abilityManager.isUserATestUser interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }) - } - }, - getActiveServiceAbilityInfos: function (...args) { - console.warn("app.abilityManager.getActiveServiceAbilityInfos interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, [ActiveServiceAbilityInfoMock]) - } else { - return new Promise((resolve) => { - resolve([ActiveServiceAbilityInfoMock]) - }) - } - }, - getHomeScreenIconDenseness: function (...args) { - console.warn("app.abilityManager.getHomeScreenIconDenseness interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } - }, - getHomeScreenIconSize: function (...args) { - console.warn("app.abilityManager.getHomeScreenIconSize interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } - }, - isMultiWindowAllowed: function (...args) { - console.warn("app.abilityManager.isMultiWindowAllowed interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }) - } - }, - moveMissionToFirstSplitScreen: function (...args) { - console.warn("app.abilityManager.moveMissionToFirstSplitScreen interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - isRamConstrainedDevice: function (...args) { - console.warn("app.abilityManager.isRamConstrainedDevice interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }) - } - }, - getAppMemorySize: function (...args) { - console.warn("app.abilityManager.getAppMemorySize interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } - }, - getProcessMemoryMapInfos: function (...args) { - console.warn("app.abilityManager.getProcessMemoryMapInfos interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, [MemoryMapInfoMock]) - } else { - return new Promise((resolve) => { - resolve([MemoryMapInfoMock]) - }) - } - }, + global.ohosplugin.app.abilityManager = { + getCurrentUserId: function (...args) { + console.warn("app.abilityManager.getCurrentUserId interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramNumberMock) + }) + } + }, + getActiveProcessInfos: function (...args) { + console.warn("app.abilityManager.getActiveProcessInfos interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, [ActiveProcessInfoMock]) + } else { + return new Promise((resolve) => { + resolve([ActiveProcessInfoMock]) + }) + } + }, + getActiveAbilityMissionInfos: function (...args) { + console.warn("app.abilityManager.getActiveAbilityMissionInfos interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, [AbilityMissionInfoMock]) + } else { + return new Promise((resolve) => { + resolve([AbilityMissionInfoMock]) + }) + } + }, + getPreviousAbilityMissionInfos: function (...args) { + console.warn("app.abilityManager.getPreviousAbilityMissionInfos interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, [AbilityMissionInfoMock]) + } else { + return new Promise((resolve) => { + resolve([AbilityMissionInfoMock]) + }) + } + }, + deleteMissions: function (...args) { + console.warn("app.abilityManager.deleteMissions interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }) + } + }, + isUserATestUser: function (...args) { + console.warn("app.abilityManager.isUserATestUser interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock) + }) + } + }, + getActiveServiceAbilityInfos: function (...args) { + console.warn("app.abilityManager.getActiveServiceAbilityInfos interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, [ActiveServiceAbilityInfoMock]) + } else { + return new Promise((resolve) => { + resolve([ActiveServiceAbilityInfoMock]) + }) + } + }, + getHomeScreenIconDenseness: function (...args) { + console.warn("app.abilityManager.getHomeScreenIconDenseness interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramNumberMock) + }) + } + }, + getHomeScreenIconSize: function (...args) { + console.warn("app.abilityManager.getHomeScreenIconSize interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramNumberMock) + }) + } + }, + isMultiWindowAllowed: function (...args) { + console.warn("app.abilityManager.isMultiWindowAllowed interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock) + }) + } + }, + moveMissionToFirstSplitScreen: function (...args) { + console.warn("app.abilityManager.moveMissionToFirstSplitScreen interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }) + } + }, + isRamConstrainedDevice: function (...args) { + console.warn("app.abilityManager.isRamConstrainedDevice interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock) + }) + } + }, + getAppMemorySize: function (...args) { + console.warn("app.abilityManager.getAppMemorySize interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramNumberMock) + }) + } + }, + getProcessMemoryMapInfos: function (...args) { + console.warn("app.abilityManager.getProcessMemoryMapInfos interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, [MemoryMapInfoMock]) + } else { + return new Promise((resolve) => { + resolve([MemoryMapInfoMock]) + }) + } + }, - getSystemMemoryAttr: function (...args) { - console.warn("app.abilityManager.getSystemMemoryAttr interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, SystemMemoryAttrMock) - } else { - return new Promise((resolve) => { - resolve(SystemMemoryAttrMock) - }) - } - }, - getProcessErrorInfos: function (...args) { - console.warn("app.abilityManager.getProcessErrorInfos interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, [ProcessErrorInfoMock]) - } else { - return new Promise((resolve) => { - resolve([ProcessErrorInfoMock]) - }) - } - }, - getAbilityMissionSnapshot: function (...args) { - console.warn("app.abilityManager.getAbilityMissionSnapshot interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, MissionSnapshotMock) - } else { - return new Promise((resolve) => { - resolve(MissionSnapshotMock) - }) - } - } + getSystemMemoryAttr: function (...args) { + console.warn("app.abilityManager.getSystemMemoryAttr interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, SystemMemoryAttrMock) + } else { + return new Promise((resolve) => { + resolve(SystemMemoryAttrMock) + }) + } + }, + getProcessErrorInfos: function (...args) { + console.warn("app.abilityManager.getProcessErrorInfos interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, [ProcessErrorInfoMock]) + } else { + return new Promise((resolve) => { + resolve([ProcessErrorInfoMock]) + }) + } + }, + getAbilityMissionSnapshot: function (...args) { + console.warn("app.abilityManager.getAbilityMissionSnapshot interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, MissionSnapshotMock) + } else { + return new Promise((resolve) => { + resolve(MissionSnapshotMock) + }) + } } + } } diff --git a/runtime/main/extend/systemplugin/ohos/appAccount.js b/runtime/main/extend/systemplugin/ohos/appAccount.js index 1adef19a..c82a7f78 100644 --- a/runtime/main/extend/systemplugin/ohos/appAccount.js +++ b/runtime/main/extend/systemplugin/ohos/appAccount.js @@ -1,218 +1,438 @@ -import {paramMock} from "../utils" +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "../utils" export function mockAppAccount() { - const appAccountInfoMock = { - owner: "[PC Preview] unknown owner", - name: "[PC Preview] unknown name" - }; - const appAccountManagerMock = { - addAccount: function (...args) { - console.warn("AppAccountManager.addAccount interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - deleteAccount: function (...args) { - console.warn("AppAccountManager.deleteAccount interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - disableAppAccess: function (...args) { - console.warn("AppAccountManager.disableAppAccess interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - enableAppAccess: function (...args) { - console.warn("AppAccountManager.enableAppAccess interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - checkAppAccountSyncEnable: function (...args) { - console.warn("AppAccountManager.checkAppAccountSyncEnable interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setAccountCredential: function (...args) { - console.warn("AppAccountManager.setAccountCredential interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setAccountExtraInfo: function (...args) { - console.warn("AppAccountManager.setAccountExtraInfo interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setAppAccountSyncEnable: function (...args) { - console.warn("AppAccountManager.setAppAccountSyncEnable interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setAssociatedData: function (...args) { - console.warn("AppAccountManager.setAssociatedData interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getAllAccessibleAccounts: function (...args) { - console.warn("AppAccountManager.getAllAccessibleAccounts interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - var appAccountInfoArrayMock = new Array(); - appAccountInfoArrayMock.push(appAccountInfoMock); - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, appAccountInfoArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(appAccountInfoArrayMock); - }) - } - }, - getAllAccounts: function (...args) { - console.warn("AppAccountManager.getAllAccounts interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - var appAccountInfoArrayMock = new Array(); - appAccountInfoArrayMock.push(appAccountInfoMock); - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, appAccountInfoArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(appAccountInfoArrayMock); - }) - } - }, - getAccountCredential: function (...args) { - console.warn("AppAccountManager.getAccountCredential interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getAccountExtraInfo: function (...args) { - console.warn("AppAccountManager.getAccountExtraInfo interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getAssociatedData: function (...args) { - console.warn("AppAccountManager.getAssociatedData interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - on: function (...args) { - console.warn("AppAccountManager.on interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - var appAccountInfoArrayMock = new Array(); - appAccountInfoArrayMock.push(appAccountInfoMock); - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, appAccountInfoArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(appAccountInfoArrayMock); - }) - } - }, - off: function (...args) { - console.warn("AppAccountManager.off interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - var appAccountInfoArrayMock = new Array(); - appAccountInfoArrayMock.push(appAccountInfoMock); - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, appAccountInfoArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(appAccountInfoArrayMock); - }) - } - } + const appAccountInfoMock = { + owner: "[PC Preview] unknown owner", + name: "[PC Preview] unknown name" + }; + const OAuthTokenInfoMock = { + authType: "[PC preview] unknown authType", + token: "[PC preview] unknown token" + }; + const AuthenticatorInfoMock = { + owner: "[PC preview] unknown owner", + iconId: "[PC preview] unknown iconId", + labelId: "[PC preview] unknown labelId", + }; + + const appAccountManagerMock = { + addAccount: function (...args) { + console.warn("AppAccountManager.addAccount interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + addAccountImplicitly: function (...args) { + console.warn("AppAccountManager.addAccountImplicitly interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, AuthenticatorCallbackMock); + } + }, + deleteAccount: function (...args) { + console.warn("AppAccountManager.deleteAccount interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + disableAppAccess: function (...args) { + console.warn("AppAccountManager.disableAppAccess interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + enableAppAccess: function (...args) { + console.warn("AppAccountManager.enableAppAccess interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + checkAppAccountSyncEnable: function (...args) { + console.warn("AppAccountManager.checkAppAccountSyncEnable interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + setAccountCredential: function (...args) { + console.warn("AppAccountManager.setAccountCredential interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + setAccountExtraInfo: function (...args) { + console.warn("AppAccountManager.setAccountExtraInfo interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + setAppAccountSyncEnable: function (...args) { + console.warn("AppAccountManager.setAppAccountSyncEnable interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + setAssociatedData: function (...args) { + console.warn("AppAccountManager.setAssociatedData interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + getAllAccessibleAccounts: function (...args) { + console.warn("AppAccountManager.getAllAccessibleAccounts interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + var appAccountInfoArrayMock = new Array(); + appAccountInfoArrayMock.push(appAccountInfoMock); + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, appAccountInfoArrayMock); + } else { + return new Promise((resolve, reject) => { + resolve(appAccountInfoArrayMock); + }) + } + }, + getAllAccounts: function (...args) { + console.warn("AppAccountManager.getAllAccounts interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + var appAccountInfoArrayMock = new Array(); + appAccountInfoArrayMock.push(appAccountInfoMock); + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, appAccountInfoArrayMock); + } else { + return new Promise((resolve, reject) => { + resolve(appAccountInfoArrayMock); + }) + } + }, + getAccountCredential: function (...args) { + console.warn("AppAccountManager.getAccountCredential interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } + }, + getAccountExtraInfo: function (...args) { + console.warn("AppAccountManager.getAccountExtraInfo interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } + }, + getAssociatedData: function (...args) { + console.warn("AppAccountManager.getAssociatedData interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } + }, + on: function (...args) { + console.warn("AppAccountManager.on interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + var appAccountInfoArrayMock = new Array(); + appAccountInfoArrayMock.push(appAccountInfoMock); + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, appAccountInfoArrayMock); + } else { + return new Promise((resolve, reject) => { + resolve(appAccountInfoArrayMock); + }) + } + }, + off: function (...args) { + console.warn("AppAccountManager.off interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + var appAccountInfoArrayMock = new Array(); + appAccountInfoArrayMock.push(appAccountInfoMock); + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, appAccountInfoArrayMock); + } else { + return new Promise((resolve, reject) => { + resolve(appAccountInfoArrayMock); + }) + } + }, + authenticate: function (...args) { + console.warn("AppAccountManager.authenticate interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, AuthenticatorCallbackMock); + } + }, + getOAuthToken: function (...args) { + console.warn("AppAccountManager.getOAuthToken interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock) + }) + } + }, + setOAuthToken: function (...args) { + console.warn("AppAccountManager.setOAuthToken interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve() + }) + } + }, + deleteOAuthToken: function (...args) { + console.warn("AppAccountManager.deleteOAuthToken interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve() + }) + } + }, + setOAuthTokenVisibility: function (...args) { + console.warn("AppAccountManager.setOAuthTokenVisibility interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve() + }) + } + }, + checkOAuthTokenVisibility: function (...args) { + console.warn("AppAccountManager.checkOAuthTokenVisibility interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve() + }) + } + }, + getAllOAuthTokens: function (...args) { + console.warn("AppAccountManager.getAllOAuthTokens interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, new Array(OAuthTokenInfoMock)); + } else { + return new Promise((resolve, reject) => { + resolve(new Array(OAuthTokenInfoMock)) + }) + } + }, + getOAuthList: function (...args) { + console.warn("AppAccountManager.getOAuthList interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, new Array(paramMock.paramStringMock)); + } else { + return new Promise((resolve, reject) => { + resolve(new Array(paramMock.paramStringMock)) + }) + } + }, + getAuthenticatorCallback: function (...args) { + console.warn("AppAccountManager.getAuthenticatorCallback interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, AuthenticatorCallbackMock); + } else { + return new Promise((resolve, reject) => { + resolve(AuthenticatorCallbackMock) + }) + } + }, + getAuthenticatorInfo: function (...args) { + console.warn("AppAccountManager.getAuthenticatorInfo interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, AuthenticatorInfoMock); + } else { + return new Promise((resolve, reject) => { + resolve(AuthenticatorInfoMock) + }) + } } - global.ohosplugin.account = global.ohosplugin.account || {}; - global.ohosplugin.account.appAccount = { - createAppAccountManager : function (...args) { - console.warn("appAccount.createAppAccountManager interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return appAccountManagerMock; - } + }; + const AuthenticatorCallbackMock = { + onResult: function (...args) { + console.warn("AuthenticatorCallback.onResult interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + }, + onRequestRedirected: function (...args) { + console.warn("AuthenticatorCallback.onRequestRedirected interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") } + }; + const AuthenticatorClass = class Authenticator { + constructor() { + console.warn("appAccount.Authenticator constructor interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + this.addAccountImplicitly = function (...args) { + console.warn("Authenticator.addAccountImplicitly interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, AuthenticatorCallbackMock); + } + }; + this.authenticate = function (...args) { + console.warn("Authenticator.authenticate interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, AuthenticatorCallbackMock); + } + }; + } + }; + const ConstantsMock = { + ACTION_ADD_ACCOUNT_IMPLICITLY: '[PC preview] unknow string', + ACTION_AUTHENTICATE: '[PC preview] unknow string', + KEY_NAME: '[PC preview] unknow string', + KEY_OWNER: '[PC preview] unknow string', + KEY_TOKEN: '[PC preview] unknow string', + KEY_ACTION: '[PC preview] unknow string', + KEY_AUTH_TYPE: '[PC preview] unknow string', + KEY_SESSION_ID: '[PC preview] unknow string', + KEY_CALLER_PID: '[PC preview] unknow string', + KEY_CALLER_UID: '[PC preview] unknow string', + KEY_CALLER_BUNDLE_NAME: '[PC preview] unknow string' + }; + const ResultCodeMock = { + SUCCESS: '[PC preview] unknow resultCode', + ERROR_ACCOUNT_NOT_EXIST: '[PC preview] unknow resultCode', + ERROR_APP_ACCOUNT_SERVICE_EXCEPTION: '[PC preview] unknow resultCode', + ERROR_INVALID_PASSWORD: '[PC preview] unknow resultCode', + ERROR_INVALID_REQUEST: '[PC preview] unknow resultCode', + ERROR_INVALID_RESPONSE: '[PC preview] unknow resultCode', + ERROR_NETWORK_EXCEPTION: '[PC preview] unknow resultCode', + ERROR_OAUTH_AUTHENTICATOR_NOT_EXIST: '[PC preview] unknow resultCode', + ERROR_OAUTH_CANCELED: '[PC preview] unknow resultCode', + ERROR_OAUTH_LIST_TOO_LARGE: '[PC preview] unknow resultCode', + ERROR_OAUTH_SERVICE_BUSY: '[PC preview] unknow resultCode', + ERROR_OAUTH_SERVICE_EXCEPTION: '[PC preview] unknow resultCode', + ERROR_OAUTH_SESSION_NOT_EXIST: '[PC preview] unknow resultCode', + ERROR_OAUTH_TIMEOUT: '[PC preview] unknow resultCode', + ERROR_OAUTH_TOKEN_NOT_EXIST: '[PC preview] unknow resultCode', + ERROR_OAUTH_TOKEN_TOO_MANY: '[PC preview] unknow resultCode', + ERROR_OAUTH_UNSUPPORT_ACTION: '[PC preview] unknow resultCode', + ERROR_OAUTH_UNSUPPORT_AUTH_TYPE: '[PC preview] unknow resultCode', + ERROR_PERMISSION_DENIED: '[PC preview] unknow resultCode' + }; + + global.ohosplugin.account = global.ohosplugin.account || {}; + global.ohosplugin.account.appAccount = { + createAppAccountManager: function (...args) { + console.warn("appAccount.createAppAccountManager interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + return appAccountManagerMock; + }, + AuthenticatorCallback:AuthenticatorCallbackMock, + Authenticator:AuthenticatorClass, + Constants:ConstantsMock, + ResultCode:ResultCodeMock, + } } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/ohos/backgroundTaskManager.js b/runtime/main/extend/systemplugin/ohos/backgroundTaskManager.js index ac34645f..51d3f010 100644 --- a/runtime/main/extend/systemplugin/ohos/backgroundTaskManager.js +++ b/runtime/main/extend/systemplugin/ohos/backgroundTaskManager.js @@ -1,35 +1,50 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" -export function mockBackgroundTaskManager () { - const DelaySuspendInfoMock = { - requestId : '[PC preview] unknown requestId', - actualDelayTime: '[PC preview] unknown actualDelayTime', - } - global.ohosplugin.backgroundTaskManager = { - requestSuspendDelay: function (...args) { - console.warn("backgroundTaskManager.requestSuspendDelay interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - return DelaySuspendInfoMock; - } - }, - cancelSuspendDelay: function (...args) { - console.warn("backgroundTaskManager.cancelSuspendDelay interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getRemainingDelayTime: function (...args) { - console.warn("backgroundTaskManager.getRemainingDelayTime interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, DelaySuspendInfoMock.actualDelayTime) - } else { - return new Promise((resolve) => { - resolve(DelaySuspendInfoMock.actualDelayTime) - }); - } - } +export function mockBackgroundTaskManager() { + const DelaySuspendInfoMock = { + requestId: '[PC preview] unknown requestId', + actualDelayTime: '[PC preview] unknown actualDelayTime', + } + global.ohosplugin.backgroundTaskManager = { + requestSuspendDelay: function (...args) { + console.warn("backgroundTaskManager.requestSuspendDelay interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + return DelaySuspendInfoMock; + } + }, + cancelSuspendDelay: function (...args) { + console.warn("backgroundTaskManager.cancelSuspendDelay interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + getRemainingDelayTime: function (...args) { + console.warn("backgroundTaskManager.getRemainingDelayTime interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, DelaySuspendInfoMock.actualDelayTime) + } else { + return new Promise((resolve) => { + resolve(DelaySuspendInfoMock.actualDelayTime) + }); + } } + } } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/ohos/bluetooth.js b/runtime/main/extend/systemplugin/ohos/bluetooth.js index e7c438fc..be322110 100644 --- a/runtime/main/extend/systemplugin/ohos/bluetooth.js +++ b/runtime/main/extend/systemplugin/ohos/bluetooth.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" export function mockOhosBluetooth() { @@ -351,13 +366,13 @@ export function mockOhosBluetooth() { if (args[0] == 'bluetoothDeviceFind') { args[len - 1].call(this, ArrayStringMock); } else if (args[0] == 'bondStateChange') { - args[len - 1].call(this, paramMock.paramNumberMock); + args[len - 1].call(this, paramMock.paramNumberMock); } else if (args[0] == 'pinRequired') { - args[len - 1].call(this, pinRequiredParamMock); + args[len - 1].call(this, pinRequiredParamMock); } else if (args[0] == 'stateChange') { - args[len - 1].call(this, paramMock.paramNumberMock); + args[len - 1].call(this, paramMock.paramNumberMock); } else if (args[0] == 'sppRead') { - args[len - 1].call(this, sppReadMock.ArrayBuffer); + args[len - 1].call(this, sppReadMock.ArrayBuffer); } } }, @@ -369,13 +384,13 @@ export function mockOhosBluetooth() { if (args[0] == 'bluetoothDeviceFind') { args[len - 1].call(this, ArrayStringMock); } else if (args[0] == 'bondStateChange') { - args[len - 1].call(this, paramMock.paramNumberMock); + args[len - 1].call(this, paramMock.paramNumberMock); } else if (args[0] == 'pinRequired') { - args[len - 1].call(this, pinRequiredParamMock); + args[len - 1].call(this, pinRequiredParamMock); } else if (args[0] == 'stateChange') { - args[len - 1].call(this, paramMock.paramNumberMock); + args[len - 1].call(this, paramMock.paramNumberMock); } else if (args[0] == 'sppRead') { - args[len - 1].call(this, sppReadMock.ArrayBuffer); + args[len - 1].call(this, sppReadMock.ArrayBuffer); } } }, diff --git a/runtime/main/extend/systemplugin/ohos/bundleManager.js b/runtime/main/extend/systemplugin/ohos/bundleManager.js index 4396f8e7..6c07ee18 100644 --- a/runtime/main/extend/systemplugin/ohos/bundleManager.js +++ b/runtime/main/extend/systemplugin/ohos/bundleManager.js @@ -1,511 +1,32 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" import { PixelMapMock } from "../multimedia" export function mockBundleManager() { - const ArrayNumberMock = ["[PC preview] unknown array number"] - const ArrayStringMock = ["[PC preview] unknown array string"] - const LauncherAbilityInfosMock = [ - { - abilityInfo: { - bundleName: "[PC preview] unknown bundle name", - name: "[PC preview] unknown name", - label: "[PC preview] unknown label", - description: "[PC preview] unknown description", - icon: "[PC preview] unknown icon", - labelId: "[PC preview] unknown label id", - descriptionId: "[PC preview] unknown description id", - iconId: "[PC preview] unknown icon id", - moduleName: "[PC preview] unknown module name", - process: "[PC preview] unknown process", - targetAbility: "[PC preview] unknown target ability", - backgroundModes: "[PC preview] unknown background modes", - isVisible: "[PC preview] unknown is visible", - formEnabled: "[PC preview] unknown form enabled", - type: "[PC preview] unknown type", - subType: "[PC preview] unknown sub type", - orientation: "[PC preview] unknown orientation", - launchMode: "[PC preview] unknown launch mode", - permissions: ["[PC preview] unknown permission"], - deviceTypes: ["[PC preview] unknown device type"], - deviceCapabilities: ["[PC preview] unknown device capability"], - readPermission: "[PC preview] unknown read permission", - writePermission: "[PC preview] unknown write permission", - applicationInfo: { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - formEntity: "[PC preview] unknown form entity", - minFormHeight: "[PC preview] unknown min form height", - defaultFormHeight: "[PC preview] unknown default form height", - minFormWidth: "[PC preview] unknown min form width", - uri: "[PC preview] unknown uri", - customizeData: { - key: "[PC preview] unknown key", - value: [ - { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - }, - }, - { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - }, - } - ] - }, - }, - elementName: { - deviceId: "[PC preview] unknown device id", - bundleName: "[PC preview] unknown bundle name", - abilityName: "[PC preview] unknown ability name", - uri: "[PC preview] unknown uri", - shortName: "[PC preview] unknown short name", - }, - userId: "[PC preview] unknown user id", - installTime: "[PC preview] unknown install time", - }, - ] - const ModeleUsageRecordsMock = [ - { - bundleName: "[PC preview] unknown bundle name", - appLabelId: "[PC preview] unknown app label id", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - descriptionId: "[PC preview] unknown description id", - abilityName: "[PC preview] unknown ability name", - abilityLabelId: "[PC preview] unknown ability label id", - abilityDescriptionId: "[PC preview] unknown ability description id", - abilityIconId: "[PC preview] unknown ability icon id", - launchedCount: "[PC preview] unknown launched count", - lastLaunchTime: "[PC preview] unknown last launch time", - isRemoved: "[PC preview] unknown is removed", - installationFreeSupported: "[PC preview] unknown installation free supported", - }, - ] - const ShortcutInfosMock = [ - { - id: "[PC preview] unknown id", - bundleName: "[PC preview] unknown bundle name", - hostAbility: "[PC preview] unknown host ability", - icon: "[PC preview] unknown icon", - label: "[PC preview] unknown label", - disableMessage: "[PC preview] unknown disable message", - wants: [ - { - targetBundle: "[PC preview] unknown target bundle", - targetClass: "[PC preview] unknown target class", - }], - isStatic: "[PC preview] unknown is static", - isHomeShortcut: "[PC preview] unknown is home shortcut", - isEnabled: "[PC preview] unknown is enabled", - }, - ] - const WantMock = { - deviceId: "[PC preview] unknown device id", - bundleName: "[PC preview] unknown bundle name", - abilityName: "[PC preview] unknown ability name", - uri: "[PC preview] unknown uri", - type: "[PC preview] unknown type", - action: "[PC preview] unknown action", - entities: "[PC preview] unknown entities", - flags: "[PC preview] unknown flags", - } - const BundleInstallerMock = {} - const BundleInfoMock = { - name: "[PC preview] unknown name", - type: "[PC preview] unknown type", - appId: "[PC preview] unknown app id", - uid: "[PC preview] unknown uid", - installTime: "[PC preview] unknown install time", - updateTime: "[PC preview] unknown up date time", - appInfo: { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - abilityInfo: [ - { - bundleName: "[PC preview] unknown bundle name", - name: "[PC preview] unknown name", - label: "[PC preview] unknown label", - description: "[PC preview] unknown description", - icon: "[PC preview] unknown icon", - labelId: "[PC preview] unknown label id", - descriptionId: "[PC preview] unknown description id", - iconId: "[PC preview] unknown icon id", - moduleName: "[PC preview] unknown module name", - process: "[PC preview] unknown process", - targetAbility: "[PC preview] unknown target ability", - backgroundModes: "[PC preview] unknown background modes", - isVisible: "[PC preview] unknown is visible", - formEnabled: "[PC preview] unknown form enabled", - type: "[PC preview] unknown type", - subType: "[PC preview] unknown sub type", - orientation: "[PC preview] unknown orientation", - launchMode: "[PC preview] unknown launch mode", - permissions: ["[PC preview] unknown permission"], - deviceTypes: ["[PC preview] unknown device type"], - deviceCapabilities: ["[PC preview] unknown device capability"], - readPermission: "[PC preview] unknown read permission", - writePermission: "[PC preview] unknown write permission", - applicationInfo: { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - formEntity: "[PC preview] unknown form entity", - minFormHeight: "[PC preview] unknown min form height", - defaultFormHeight: "[PC preview] unknown default form height", - minFormWidth: "[PC preview] unknown min form width", - defaultFormWidth: "[PC preview] unknown default form width", - uri: "[PC preview] unknown uri", - customizeData: { - key: "[PC preview] unknown key", - value: [ - { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - }, - }, - { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - }, - } - ] - }, - } - ], - reqPermissions: ["[PC preview] unknown repermission"], - reqPermissionDetails: [ - { - name: "[PC preview] unknown name", - reason: "[PC preview] unknown reason", - usedScene: { - abilities: ["[PC preview] unknown ability"], - when: "[PC preview] unknown when", - } - } - ], - vendor: "[PC preview] unknown vendor", - versionCode: "[PC preview] unknown versionCode", - versionName: "[PC preview] unknown versionName", - compatibleVersion: "[PC preview] unknown compatibleVersion", - targetVersion: "[PC preview] unknown targetVersion", - isCompressNativeLibs: "[PC preview] unknown isCompressNativeLibs", - hapModuleInfo: [ - { - name: "[PC preview] unknown name", - description: "[PC preview] unknown desciption", - descriptionId: "[PC preview] unknown description id", - icon: "[PC preview] unknown icon", - label: "[PC preview] unknown label", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown iconid", - backgroundImg: "[PC preview] unknown back ground img", - supportedModes: "[PC preview] unknown supported modes", - reqCapabilities: ["[PC preview] unknown reqcapability"], - deviceTypes: ["[PC preview] unknown device type"], - abilityInfo: [ - { - bundleName: "[PC preview] unknown bundle name", - name: "[PC preview] unknown name", - label: "[PC preview] unknown label", - description: "[PC preview] unknown description", - icon: "[PC preview] unknown icon", - labelId: "[PC preview] unknown label id", - descriptionId: "[PC preview] unknown description id", - iconId: "[PC preview] unknown icon id", - moduleName: "[PC preview] unknown module name", - process: "[PC preview] unknown process", - targetAbility: "[PC preview] unknown target ability", - backgroundModes: "[PC preview] unknown back ground modes", - isVisible: "[PC preview] unknown is visible", - formEnabled: "[PC preview] unknown form enabled", - type: "[PC preview] unknown bundle.AbilityType", - subType: " [PC preview] unknown bundle.AbilitySubType", - orientation: "[PC preview] unknown bundle.DisplayOrientation", - launchMode: " [PC preview] unknown bundle.LaunchMode", - permissions: ["[PC preview] unknown permission"], - deviceTypes: ["[PC preview] unknown device type"], - deviceCapabilities: ["[PC preview] unknown device capability "], - readPermission: "[PC preview] unknown read permission", - writePermission: "[PC preview] unknown write permission", - applicationInfo: { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - formEntity: "[PC preview] unknown form entity", - minFormHeight: "[PC preview] unknown min form height", - defaultFormHeight: "[PC preview] unknown default form height", - minFormWidth: "[PC preview] unknown min form width", - defaultFormWidth: "[PC preview] unknown default form width", - uri: "[PC preview] unknown uri", - customizeData: { - key: "[PC preview] unknown key", - value: [ - { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - }, - }, - { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - }, - } - ] - }, - } - ], - moduleName: "[PC preview] unknown module name", - mainAbilityName: "[PC preview] unknown main ability name", - installationFree: "[PC preview] unknown installation free", - } - ], - entryModuleName: "[PC preview] unknown entry module name", - cpuAbi: "[PC preview] unknown cpu abi", - isSilentInstallation: "[PC preview] unknown is silent installation", - minCompatibleVersionCode: "[PC preview] unknown min compatible version code", - entryInstallationFree: "[PC preview] unknown entry installation free", - } - const PermissionDefMock = { - name: "[PC preview] unknown name", - permissionFlags: "[PC preview] unknown permission flags", - grantMode: "[PC preview] unknown grant mode", - availableScope: "[PC preview] unknown available scope", - labelRes: "[PC preview] unknown label res", - descriptionRes: "[PC preview] unknown description res", - group: "[PC preview] unknown group", - usageInfo: "[PC preview] unknown usage info", - reminderDesc: "[PC preview] unknown reminder desc", - reminderIcon: "[PC preview] unknown reminder icon" - } - const PermissionDefsMock = [ - { - name: "[PC preview] unknown name", - permissionFlags: "[PC preview] unknown permission flags", - grantMode: "[PC preview] unknown grant mode", - availableScope: "[PC preview] unknown available scope", - labelRes: "[PC preview] unknown label res", - descriptionRes: "[PC preview] unknown description res", - group: "[PC preview] unknown group", - usageInfo: "[PC preview] unknown usage info", - reminderDesc: "[PC preview] unknown reminder desc", - reminderIcon: "[PC preview] unknown reminder icon" - } - ] - const BundlePackInfoMock = { - packages: [ - { - deviceType: ["[PC preview] unknown device type"], - name: "[PC preview] unknown name", - moduleType: "[PC preview] unknown module type", - deliveryWithInstall: "[PC preview] unknown deliver with install", - } - ], - summary: { - app: { - bundleName: "[PC preview] unknown bundle name", - version: { - minCompatibleVersionCode: "[PC preview] unknown min compatible version code", - name: "[PC preview] unknown name", - code: " [PC preview] unknown code", - } - }, - modules: [ - { - apiVersion: { - releaseType: "[PC preview] unknown release type", - compatible: "[PC preview] unknown compatible", - target: "[PC preview] unknown target", - }, - deviceType: ["[PC preview] unknown device type"], - distro: { - deliveryWithInstall: "[PC preview] unknown deliver with install", - installationFree: "[PC preview] unknown installation free", - moduleName: "[PC preview] unknown module name", - moduleType: "[PC preview] unknown module type", - mainAbility: "[PC preview] unknown main ability", - }, - abilities: [ - { - name: "[PC preview] unknown name", - label: "[PC preview] unknown label", - visible: '[PC preview] unknown visible', - forms: [ - { - name: "[PC preview] unknown name", - type: "[PC preview] unknown type", - updateEnabled: "[PC preview] unknown update enabled", - scheduledUpateTime: "[PC preview] unknown scheduled updte time", - updateDuration: "[PC preview] unknown update duration", - supportDimensions: ["[PC preview] unknown support dimension"], - defaultDimension: "[PC preview] unknown default dimension", - } - ] - } - ] - } - ] - }, - } - const ApplicationInfosMock = [ - { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - ] - - const AbilityInfosMock = [ - { - bundleName: "[PC preview] unknown bundle name", - name: "[PC preview] unknown name", - label: "[PC preview] unknown label", - description: "[PC preview] unknown descrption", - icon: "[PC preview] unknown icon", - labelId: "[PC preview] unknown label id", - descriptionId: "[PC preview] unknown description id", - iconId: "[PC preview] unknown icon id", - moduleName: "[PC preview] unknown module name", - process: "[PC preview] unknown process", - targetAbility: "[PC preview] unknown target ability", - backgroundModes: "[PC preview] unknown background modes ", - isVisible: "[PC preview] unknown is visible", - formEnabled: "[PC preview] unknown form enabled", - type: "[PC preview] unknown bundle.AbilityType", - subType: "[PC preview] unknown bundle.AbilitySubType", - orientation: "[PC preview] unknown bundle.DisplayOrientation", - launchMode: "[PC preview] unknown bundle.LaunchMode", - permissions: ["[PC preview] unknown permission"], - deviceTypes: ["[PC preview] unknown device type"], - deviceCapabilities: ["[PC preview] unknown device capability"], - readPermission: "[PC preview] unknown read permission", - writePermission: "[PC preview] unknown write permission", - applicationInfo: { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - formEntity: "[PC preview] unknown form entitty", - minFormHeight: "[PC preview] unknown minForm Height", - defaultFormHeight: "[PC preview] unknown default Form Height", - minFormWidth: "[PC preview] unknown default min Form Width", - defaultFormWidth: "[PC preview] unknown default form width", - uri: "[PC preview] unknown uri", - customizeData: { - key: "[PC preview] unknown key", - value: [ - { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - }, - }, - { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - }, - } - ] - }, - } - ] - const AbilityInfoMock = { + const ArrayNumberMock = ["[PC preview] unknown array number"] + const ArrayStringMock = ["[PC preview] unknown array string"] + const LauncherAbilityInfosMock = [ + { + abilityInfo: { bundleName: "[PC preview] unknown bundle name", name: "[PC preview] unknown name", label: "[PC preview] unknown label", - description: "[PC preview] unknown descrption", + description: "[PC preview] unknown description", icon: "[PC preview] unknown icon", labelId: "[PC preview] unknown label id", descriptionId: "[PC preview] unknown description id", @@ -513,289 +34,241 @@ export function mockBundleManager() { moduleName: "[PC preview] unknown module name", process: "[PC preview] unknown process", targetAbility: "[PC preview] unknown target ability", - backgroundModes: "[PC preview] unknown background modes ", + backgroundModes: "[PC preview] unknown background modes", isVisible: "[PC preview] unknown is visible", formEnabled: "[PC preview] unknown form enabled", - type: "[PC preview] unknown bundle.AbilityType", - subType: "[PC preview] unknown bundle.AbilitySubType", - orientation: "[PC preview] unknown bundle.DisplayOrientation", - launchMode: "[PC preview] unknown bundle.LaunchMode", - permissions: ["[PC preview] unknown permission"], + type: "[PC preview] unknown type", + subType: "[PC preview] unknown sub type", + orientation: "[PC preview] unknown orientation", + launchMode: "[PC preview] unknown launch mode", + permissions: ["[PC preview] unknown permission"], deviceTypes: ["[PC preview] unknown device type"], deviceCapabilities: ["[PC preview] unknown device capability"], readPermission: "[PC preview] unknown read permission", writePermission: "[PC preview] unknown write permission", applicationInfo: { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } + packageName: "[PC preview] unknown package name", + className: "[PC preview] unknown class name", + name: "[PC preview] unknown name", + labelId: "[PC preview] unknown label id", + iconId: "[PC preview] unknown icon id", + sourceDir: "[PC preview] unknown source dir", + flags: "[PC preview] unknown flags", + customizeData: { + key: "[PC preview] unknown key", + value: { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + } } + } }, - formEntity: "[PC preview] unknown form entitty", - minFormHeight: "[PC preview] unknown minForm Height", - defaultFormHeight: "[PC preview] unknown default Form Height", - minFormWidth: "[PC preview] unknown default min Form Width", + formEntity: "[PC preview] unknown form entity", + minFormHeight: "[PC preview] unknown min form height", + defaultFormHeight: "[PC preview] unknown default form height", + minFormWidth: "[PC preview] unknown min form width", + uri: "[PC preview] unknown uri", + customizeData: { + key: "[PC preview] unknown key", + value: [ + { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + }, + }, + { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + }, + } + ] + }, + }, + elementName: { + deviceId: "[PC preview] unknown device id", + bundleName: "[PC preview] unknown bundle name", + abilityName: "[PC preview] unknown ability name", + uri: "[PC preview] unknown uri", + shortName: "[PC preview] unknown short name", + }, + userId: "[PC preview] unknown user id", + installTime: "[PC preview] unknown install time", + }, + ] + const ModeleUsageRecordsMock = [ + { + bundleName: "[PC preview] unknown bundle name", + appLabelId: "[PC preview] unknown app label id", + name: "[PC preview] unknown name", + labelId: "[PC preview] unknown label id", + descriptionId: "[PC preview] unknown description id", + abilityName: "[PC preview] unknown ability name", + abilityLabelId: "[PC preview] unknown ability label id", + abilityDescriptionId: "[PC preview] unknown ability description id", + abilityIconId: "[PC preview] unknown ability icon id", + launchedCount: "[PC preview] unknown launched count", + lastLaunchTime: "[PC preview] unknown last launch time", + isRemoved: "[PC preview] unknown is removed", + installationFreeSupported: "[PC preview] unknown installation free supported", + }, + ] + const ShortcutInfosMock = [ + { + id: "[PC preview] unknown id", + bundleName: "[PC preview] unknown bundle name", + hostAbility: "[PC preview] unknown host ability", + icon: "[PC preview] unknown icon", + label: "[PC preview] unknown label", + disableMessage: "[PC preview] unknown disable message", + wants: [ + { + targetBundle: "[PC preview] unknown target bundle", + targetClass: "[PC preview] unknown target class", + }], + isStatic: "[PC preview] unknown is static", + isHomeShortcut: "[PC preview] unknown is home shortcut", + isEnabled: "[PC preview] unknown is enabled", + }, + ] + const WantMock = { + deviceId: "[PC preview] unknown device id", + bundleName: "[PC preview] unknown bundle name", + abilityName: "[PC preview] unknown ability name", + uri: "[PC preview] unknown uri", + type: "[PC preview] unknown type", + action: "[PC preview] unknown action", + entities: "[PC preview] unknown entities", + flags: "[PC preview] unknown flags", + } + const BundleInstallerMock = {} + const BundleInfoMock = { + name: "[PC preview] unknown name", + type: "[PC preview] unknown type", + appId: "[PC preview] unknown app id", + uid: "[PC preview] unknown uid", + installTime: "[PC preview] unknown install time", + updateTime: "[PC preview] unknown up date time", + appInfo: { + packageName: "[PC preview] unknown package name", + className: "[PC preview] unknown class name", + name: "[PC preview] unknown name", + labelId: "[PC preview] unknown label id", + iconId: "[PC preview] unknown icon id", + sourceDir: "[PC preview] unknown source dir", + flags: "[PC preview] unknown flags", + customizeData: { + key: "[PC preview] unknown key", + value: { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + } + } + } + }, + abilityInfo: [ + { + bundleName: "[PC preview] unknown bundle name", + name: "[PC preview] unknown name", + label: "[PC preview] unknown label", + description: "[PC preview] unknown description", + icon: "[PC preview] unknown icon", + labelId: "[PC preview] unknown label id", + descriptionId: "[PC preview] unknown description id", + iconId: "[PC preview] unknown icon id", + moduleName: "[PC preview] unknown module name", + process: "[PC preview] unknown process", + targetAbility: "[PC preview] unknown target ability", + backgroundModes: "[PC preview] unknown background modes", + isVisible: "[PC preview] unknown is visible", + formEnabled: "[PC preview] unknown form enabled", + type: "[PC preview] unknown type", + subType: "[PC preview] unknown sub type", + orientation: "[PC preview] unknown orientation", + launchMode: "[PC preview] unknown launch mode", + permissions: ["[PC preview] unknown permission"], + deviceTypes: ["[PC preview] unknown device type"], + deviceCapabilities: ["[PC preview] unknown device capability"], + readPermission: "[PC preview] unknown read permission", + writePermission: "[PC preview] unknown write permission", + applicationInfo: { + packageName: "[PC preview] unknown package name", + className: "[PC preview] unknown class name", + name: "[PC preview] unknown name", + labelId: "[PC preview] unknown label id", + iconId: "[PC preview] unknown icon id", + sourceDir: "[PC preview] unknown source dir", + flags: "[PC preview] unknown flags", + customizeData: { + key: "[PC preview] unknown key", + value: { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + } + } + } + }, + formEntity: "[PC preview] unknown form entity", + minFormHeight: "[PC preview] unknown min form height", + defaultFormHeight: "[PC preview] unknown default form height", + minFormWidth: "[PC preview] unknown min form width", defaultFormWidth: "[PC preview] unknown default form width", uri: "[PC preview] unknown uri", customizeData: { - key: "[PC preview] unknown key", - value: [ - { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - }, - }, - { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - }, - } - ] - }, - } - const ApplicationInfoMock = { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - } - - const BundleInfosMock = [ - { - name: "[PC preview] unknown name", - type: "[PC preview] unknown type", - appId: "[PC preview] unknown app id", - uid: "[PC preview] unknown uid", - installTime: "[PC preview] unknown install time", - updateTime: "[PC preview] unknown up date time", - appInfo: { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", + key: "[PC preview] unknown key", + value: [ + { + CustomizeData: { name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } + value: "[PC preview] unknown value", + }, }, - abilityInfo: [ - { - bundleName: "[PC preview] unknown bundle name", - name: "[PC preview] unknown name", - label: "[PC preview] unknown label", - description: "[PC preview] unknown description", - icon: "[PC preview] unknown icon", - labelId: "[PC preview] unknown label id", - descriptionId: "[PC preview] unknown description id", - iconId: "[PC preview] unknown icon id", - moduleName: "[PC preview] unknown module name", - process: "[PC preview] unknown process", - targetAbility: "[PC preview] unknown target ability", - backgroundModes: "[PC preview] unknown background modes", - isVisible: "[PC preview] unknown is visible", - formEnabled: "[PC preview] unknown form enabled", - type: "[PC preview] unknown type", - subType: "[PC preview] unknown sub type", - orientation: "[PC preview] unknown orientation", - launchMode: "[PC preview] unknown launch mode", - permissions: ["[PC preview] unknown permission"], - deviceTypes: ["[PC preview] unknown device type"], - deviceCapabilities: ["[PC preview] unknown device capability"], - readPermission: "[PC preview] unknown read permission", - writePermission: "[PC preview] unknown write permission", - applicationInfo: { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - formEntity: "[PC preview] unknown form entity", - minFormHeight: "[PC preview] unknown min form height", - defaultFormHeight: "[PC preview] unknown default form height", - minFormWidth: "[PC preview] unknown min form width", - defaultFormWidth: "[PC preview] unknown default form width", - uri: "[PC preview] unknown uri", - customizeData: { - key: "[PC preview] unknown key", - value: [ - { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - }, - }, - { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - }, - } - ] - }, - } - ], - reqPermissions: ["[PC preview] unknown repermission"], - reqPermissionDetails: [ - { - name: "[PC preview] unknown name", - reason: "[PC preview] unknown reason", - usedScene: { - abilities: ["[PC preview] unknown ability"], - when: "[PC preview] unknown when", - } - } - ], - vendor: "[PC preview] unknown vendor", - versionCode: "[PC preview] unknown versionCode", - versionName: "[PC preview] unknown versionName", - compatibleVersion: "[PC preview] unknown compatibleVersion", - targetVersion: "[PC preview] unknown targetVersion", - isCompressNativeLibs: "[PC preview] unknown isCompressNativeLibs", - hapModuleInfo: [ - { - name: "[PC preview] unknown name", - description: "[PC preview] unknown desciption", - descriptionId: "[PC preview] unknown description id", - icon: "[PC preview] unknown icon", - label: "[PC preview] unknown label", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown iconid", - backgroundImg: "[PC preview] unknown back ground img", - supportedModes: "[PC preview] unknown supported modes", - reqCapabilities: ["[PC preview] unknown reqcapability"], - deviceTypes: ["[PC preview] unknown device type"], - abilityInfo: [ - { - bundleName: "[PC preview] unknown bundle name", - name: "[PC preview] unknown name", - label: "[PC preview] unknown label", - description: "[PC preview] unknown description", - icon: "[PC preview] unknown icon", - labelId: "[PC preview] unknown label id", - descriptionId: "[PC preview] unknown description id", - iconId: "[PC preview] unknown icon id", - moduleName: "[PC preview] unknown module name", - process: "[PC preview] unknown process", - targetAbility: "[PC preview] unknown target ability", - backgroundModes: "[PC preview] unknown back ground modes", - isVisible: "[PC preview] unknown is visible", - formEnabled: "[PC preview] unknown form enabled", - type: "[PC preview] unknown bundle.AbilityType", - subType: " [PC preview] unknown bundle.AbilitySubType", - orientation: "[PC preview] unknown bundle.DisplayOrientation", - launchMode: " [PC preview] unknown bundle.LaunchMode", - permissions: ["[PC preview] unknown permission"], - deviceTypes: ["[PC preview] unknown device type"], - deviceCapabilities: ["[PC preview] unknown device capability "], - readPermission: "[PC preview] unknown read permission", - writePermission: "[PC preview] unknown write permission", - applicationInfo: { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - formEntity: "[PC preview] unknown form entity", - minFormHeight: "[PC preview] unknown min form height", - defaultFormHeight: "[PC preview] unknown default form height", - minFormWidth: "[PC preview] unknown min form width", - defaultFormWidth: "[PC preview] unknown default form width", - uri: "[PC preview] unknown uri", - customizeData: { - key: "[PC preview] unknown key", - value: [ - { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - }, - }, - { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - }, - } - ] - }, - } - ], - moduleName: "[PC preview] unknown module name", - mainAbilityName: "[PC preview] unknown main ability name", - installationFree: "[PC preview] unknown installation free", - } - ], - entryModuleName: "[PC preview] unknown entry module name", - cpuAbi: "[PC preview] unknown cpu abi", - isSilentInstallation: "[PC preview] unknown is silent installation", - minCompatibleVersionCode: "[PC preview] unknown min compatible version code", - entryInstallationFree: "[PC preview] unknown entry installation free" + { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + }, + } + ] + }, + } + ], + reqPermissions: ["[PC preview] unknown repermission"], + reqPermissionDetails: [ + { + name: "[PC preview] unknown name", + reason: "[PC preview] unknown reason", + usedScene: { + abilities: ["[PC preview] unknown ability"], + when: "[PC preview] unknown when", } - ] - const BundleOptionsMock = { - userId: "[PC preview] unknown user id", - networkId: "[PC preview] unknown network id", - } - const LauncherAbilityInfoMock = { - abilityInfo: { + } + ], + vendor: "[PC preview] unknown vendor", + versionCode: "[PC preview] unknown versionCode", + versionName: "[PC preview] unknown versionName", + compatibleVersion: "[PC preview] unknown compatibleVersion", + targetVersion: "[PC preview] unknown targetVersion", + isCompressNativeLibs: "[PC preview] unknown isCompressNativeLibs", + hapModuleInfo: [ + { + name: "[PC preview] unknown name", + description: "[PC preview] unknown desciption", + descriptionId: "[PC preview] unknown description id", + icon: "[PC preview] unknown icon", + label: "[PC preview] unknown label", + labelId: "[PC preview] unknown label id", + iconId: "[PC preview] unknown iconid", + backgroundImg: "[PC preview] unknown back ground img", + supportedModes: "[PC preview] unknown supported modes", + reqCapabilities: ["[PC preview] unknown reqcapability"], + deviceTypes: ["[PC preview] unknown device type"], + abilityInfo: [ + { bundleName: "[PC preview] unknown bundle name", name: "[PC preview] unknown name", label: "[PC preview] unknown label", @@ -807,19 +280,477 @@ export function mockBundleManager() { moduleName: "[PC preview] unknown module name", process: "[PC preview] unknown process", targetAbility: "[PC preview] unknown target ability", - backgroundModes: "[PC preview] unknown background modes", + backgroundModes: "[PC preview] unknown back ground modes", isVisible: "[PC preview] unknown is visible", formEnabled: "[PC preview] unknown form enabled", - type: "[PC preview] unknown type", - subType: "[PC preview] unknown sub type", - orientation: "[PC preview] unknown orientation", - launchMode: "[PC preview] unknown launch mode", + type: "[PC preview] unknown bundle.AbilityType", + subType: " [PC preview] unknown bundle.AbilitySubType", + orientation: "[PC preview] unknown bundle.DisplayOrientation", + launchMode: " [PC preview] unknown bundle.LaunchMode", permissions: ["[PC preview] unknown permission"], deviceTypes: ["[PC preview] unknown device type"], - deviceCapabilities: ["[PC preview] unknown device capability"], + deviceCapabilities: ["[PC preview] unknown device capability "], readPermission: "[PC preview] unknown read permission", writePermission: "[PC preview] unknown write permission", applicationInfo: { + packageName: "[PC preview] unknown package name", + className: "[PC preview] unknown class name", + name: "[PC preview] unknown name", + labelId: "[PC preview] unknown label id", + iconId: "[PC preview] unknown icon id", + sourceDir: "[PC preview] unknown source dir", + flags: "[PC preview] unknown flags", + customizeData: { + key: "[PC preview] unknown key", + value: { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + } + } + } + }, + formEntity: "[PC preview] unknown form entity", + minFormHeight: "[PC preview] unknown min form height", + defaultFormHeight: "[PC preview] unknown default form height", + minFormWidth: "[PC preview] unknown min form width", + defaultFormWidth: "[PC preview] unknown default form width", + uri: "[PC preview] unknown uri", + customizeData: { + key: "[PC preview] unknown key", + value: [ + { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + }, + }, + { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + }, + } + ] + }, + } + ], + moduleName: "[PC preview] unknown module name", + mainAbilityName: "[PC preview] unknown main ability name", + installationFree: "[PC preview] unknown installation free", + } + ], + entryModuleName: "[PC preview] unknown entry module name", + cpuAbi: "[PC preview] unknown cpu abi", + isSilentInstallation: "[PC preview] unknown is silent installation", + minCompatibleVersionCode: "[PC preview] unknown min compatible version code", + entryInstallationFree: "[PC preview] unknown entry installation free", + } + const PermissionDefMock = { + name: "[PC preview] unknown name", + permissionFlags: "[PC preview] unknown permission flags", + grantMode: "[PC preview] unknown grant mode", + availableScope: "[PC preview] unknown available scope", + labelRes: "[PC preview] unknown label res", + descriptionRes: "[PC preview] unknown description res", + group: "[PC preview] unknown group", + usageInfo: "[PC preview] unknown usage info", + reminderDesc: "[PC preview] unknown reminder desc", + reminderIcon: "[PC preview] unknown reminder icon" + } + const PermissionDefsMock = [ + { + name: "[PC preview] unknown name", + permissionFlags: "[PC preview] unknown permission flags", + grantMode: "[PC preview] unknown grant mode", + availableScope: "[PC preview] unknown available scope", + labelRes: "[PC preview] unknown label res", + descriptionRes: "[PC preview] unknown description res", + group: "[PC preview] unknown group", + usageInfo: "[PC preview] unknown usage info", + reminderDesc: "[PC preview] unknown reminder desc", + reminderIcon: "[PC preview] unknown reminder icon" + } + ] + const BundlePackInfoMock = { + packages: [ + { + deviceType: ["[PC preview] unknown device type"], + name: "[PC preview] unknown name", + moduleType: "[PC preview] unknown module type", + deliveryWithInstall: "[PC preview] unknown deliver with install", + } + ], + summary: { + app: { + bundleName: "[PC preview] unknown bundle name", + version: { + minCompatibleVersionCode: "[PC preview] unknown min compatible version code", + name: "[PC preview] unknown name", + code: " [PC preview] unknown code", + } + }, + modules: [ + { + apiVersion: { + releaseType: "[PC preview] unknown release type", + compatible: "[PC preview] unknown compatible", + target: "[PC preview] unknown target", + }, + deviceType: ["[PC preview] unknown device type"], + distro: { + deliveryWithInstall: "[PC preview] unknown deliver with install", + installationFree: "[PC preview] unknown installation free", + moduleName: "[PC preview] unknown module name", + moduleType: "[PC preview] unknown module type", + mainAbility: "[PC preview] unknown main ability", + }, + abilities: [ + { + name: "[PC preview] unknown name", + label: "[PC preview] unknown label", + visible: '[PC preview] unknown visible', + forms: [ + { + name: "[PC preview] unknown name", + type: "[PC preview] unknown type", + updateEnabled: "[PC preview] unknown update enabled", + scheduledUpateTime: "[PC preview] unknown scheduled updte time", + updateDuration: "[PC preview] unknown update duration", + supportDimensions: ["[PC preview] unknown support dimension"], + defaultDimension: "[PC preview] unknown default dimension", + } + ] + } + ] + } + ] + }, + } + const ApplicationInfosMock = [ + { + packageName: "[PC preview] unknown package name", + className: "[PC preview] unknown class name", + name: "[PC preview] unknown name", + labelId: "[PC preview] unknown label id", + iconId: "[PC preview] unknown icon id", + sourceDir: "[PC preview] unknown source dir", + flags: "[PC preview] unknown flags", + customizeData: { + key: "[PC preview] unknown key", + value: { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + } + } + } + }, + ] + + const AbilityInfosMock = [ + { + bundleName: "[PC preview] unknown bundle name", + name: "[PC preview] unknown name", + label: "[PC preview] unknown label", + description: "[PC preview] unknown descrption", + icon: "[PC preview] unknown icon", + labelId: "[PC preview] unknown label id", + descriptionId: "[PC preview] unknown description id", + iconId: "[PC preview] unknown icon id", + moduleName: "[PC preview] unknown module name", + process: "[PC preview] unknown process", + targetAbility: "[PC preview] unknown target ability", + backgroundModes: "[PC preview] unknown background modes ", + isVisible: "[PC preview] unknown is visible", + formEnabled: "[PC preview] unknown form enabled", + type: "[PC preview] unknown bundle.AbilityType", + subType: "[PC preview] unknown bundle.AbilitySubType", + orientation: "[PC preview] unknown bundle.DisplayOrientation", + launchMode: "[PC preview] unknown bundle.LaunchMode", + permissions: ["[PC preview] unknown permission"], + deviceTypes: ["[PC preview] unknown device type"], + deviceCapabilities: ["[PC preview] unknown device capability"], + readPermission: "[PC preview] unknown read permission", + writePermission: "[PC preview] unknown write permission", + applicationInfo: { + packageName: "[PC preview] unknown package name", + className: "[PC preview] unknown class name", + name: "[PC preview] unknown name", + labelId: "[PC preview] unknown label id", + iconId: "[PC preview] unknown icon id", + sourceDir: "[PC preview] unknown source dir", + flags: "[PC preview] unknown flags", + customizeData: { + key: "[PC preview] unknown key", + value: { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + } + } + } + }, + formEntity: "[PC preview] unknown form entitty", + minFormHeight: "[PC preview] unknown minForm Height", + defaultFormHeight: "[PC preview] unknown default Form Height", + minFormWidth: "[PC preview] unknown default min Form Width", + defaultFormWidth: "[PC preview] unknown default form width", + uri: "[PC preview] unknown uri", + customizeData: { + key: "[PC preview] unknown key", + value: [ + { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + }, + }, + { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + }, + } + ] + }, + } + ] + const AbilityInfoMock = { + bundleName: "[PC preview] unknown bundle name", + name: "[PC preview] unknown name", + label: "[PC preview] unknown label", + description: "[PC preview] unknown descrption", + icon: "[PC preview] unknown icon", + labelId: "[PC preview] unknown label id", + descriptionId: "[PC preview] unknown description id", + iconId: "[PC preview] unknown icon id", + moduleName: "[PC preview] unknown module name", + process: "[PC preview] unknown process", + targetAbility: "[PC preview] unknown target ability", + backgroundModes: "[PC preview] unknown background modes ", + isVisible: "[PC preview] unknown is visible", + formEnabled: "[PC preview] unknown form enabled", + type: "[PC preview] unknown bundle.AbilityType", + subType: "[PC preview] unknown bundle.AbilitySubType", + orientation: "[PC preview] unknown bundle.DisplayOrientation", + launchMode: "[PC preview] unknown bundle.LaunchMode", + permissions: ["[PC preview] unknown permission"], + deviceTypes: ["[PC preview] unknown device type"], + deviceCapabilities: ["[PC preview] unknown device capability"], + readPermission: "[PC preview] unknown read permission", + writePermission: "[PC preview] unknown write permission", + applicationInfo: { + packageName: "[PC preview] unknown package name", + className: "[PC preview] unknown class name", + name: "[PC preview] unknown name", + labelId: "[PC preview] unknown label id", + iconId: "[PC preview] unknown icon id", + sourceDir: "[PC preview] unknown source dir", + flags: "[PC preview] unknown flags", + customizeData: { + key: "[PC preview] unknown key", + value: { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + } + } + } + }, + formEntity: "[PC preview] unknown form entitty", + minFormHeight: "[PC preview] unknown minForm Height", + defaultFormHeight: "[PC preview] unknown default Form Height", + minFormWidth: "[PC preview] unknown default min Form Width", + defaultFormWidth: "[PC preview] unknown default form width", + uri: "[PC preview] unknown uri", + customizeData: { + key: "[PC preview] unknown key", + value: [ + { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + }, + }, + { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + }, + } + ] + }, + } + const ApplicationInfoMock = { + packageName: "[PC preview] unknown package name", + className: "[PC preview] unknown class name", + name: "[PC preview] unknown name", + labelId: "[PC preview] unknown label id", + iconId: "[PC preview] unknown icon id", + sourceDir: "[PC preview] unknown source dir", + flags: "[PC preview] unknown flags", + customizeData: { + key: "[PC preview] unknown key", + value: { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + } + } + } + } + + const BundleInfosMock = [ + { + name: "[PC preview] unknown name", + type: "[PC preview] unknown type", + appId: "[PC preview] unknown app id", + uid: "[PC preview] unknown uid", + installTime: "[PC preview] unknown install time", + updateTime: "[PC preview] unknown up date time", + appInfo: { + packageName: "[PC preview] unknown package name", + className: "[PC preview] unknown class name", + name: "[PC preview] unknown name", + labelId: "[PC preview] unknown label id", + iconId: "[PC preview] unknown icon id", + sourceDir: "[PC preview] unknown source dir", + flags: "[PC preview] unknown flags", + customizeData: { + key: "[PC preview] unknown key", + value: { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + } + } + } + }, + abilityInfo: [ + { + bundleName: "[PC preview] unknown bundle name", + name: "[PC preview] unknown name", + label: "[PC preview] unknown label", + description: "[PC preview] unknown description", + icon: "[PC preview] unknown icon", + labelId: "[PC preview] unknown label id", + descriptionId: "[PC preview] unknown description id", + iconId: "[PC preview] unknown icon id", + moduleName: "[PC preview] unknown module name", + process: "[PC preview] unknown process", + targetAbility: "[PC preview] unknown target ability", + backgroundModes: "[PC preview] unknown background modes", + isVisible: "[PC preview] unknown is visible", + formEnabled: "[PC preview] unknown form enabled", + type: "[PC preview] unknown type", + subType: "[PC preview] unknown sub type", + orientation: "[PC preview] unknown orientation", + launchMode: "[PC preview] unknown launch mode", + permissions: ["[PC preview] unknown permission"], + deviceTypes: ["[PC preview] unknown device type"], + deviceCapabilities: ["[PC preview] unknown device capability"], + readPermission: "[PC preview] unknown read permission", + writePermission: "[PC preview] unknown write permission", + applicationInfo: { + packageName: "[PC preview] unknown package name", + className: "[PC preview] unknown class name", + name: "[PC preview] unknown name", + labelId: "[PC preview] unknown label id", + iconId: "[PC preview] unknown icon id", + sourceDir: "[PC preview] unknown source dir", + flags: "[PC preview] unknown flags", + customizeData: { + key: "[PC preview] unknown key", + value: { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + } + } + } + }, + formEntity: "[PC preview] unknown form entity", + minFormHeight: "[PC preview] unknown min form height", + defaultFormHeight: "[PC preview] unknown default form height", + minFormWidth: "[PC preview] unknown min form width", + defaultFormWidth: "[PC preview] unknown default form width", + uri: "[PC preview] unknown uri", + customizeData: { + key: "[PC preview] unknown key", + value: [ + { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + }, + }, + { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + }, + } + ] + }, + } + ], + reqPermissions: ["[PC preview] unknown repermission"], + reqPermissionDetails: [ + { + name: "[PC preview] unknown name", + reason: "[PC preview] unknown reason", + usedScene: { + abilities: ["[PC preview] unknown ability"], + when: "[PC preview] unknown when", + } + } + ], + vendor: "[PC preview] unknown vendor", + versionCode: "[PC preview] unknown versionCode", + versionName: "[PC preview] unknown versionName", + compatibleVersion: "[PC preview] unknown compatibleVersion", + targetVersion: "[PC preview] unknown targetVersion", + isCompressNativeLibs: "[PC preview] unknown isCompressNativeLibs", + hapModuleInfo: [ + { + name: "[PC preview] unknown name", + description: "[PC preview] unknown desciption", + descriptionId: "[PC preview] unknown description id", + icon: "[PC preview] unknown icon", + label: "[PC preview] unknown label", + labelId: "[PC preview] unknown label id", + iconId: "[PC preview] unknown iconid", + backgroundImg: "[PC preview] unknown back ground img", + supportedModes: "[PC preview] unknown supported modes", + reqCapabilities: ["[PC preview] unknown reqcapability"], + deviceTypes: ["[PC preview] unknown device type"], + abilityInfo: [ + { + bundleName: "[PC preview] unknown bundle name", + name: "[PC preview] unknown name", + label: "[PC preview] unknown label", + description: "[PC preview] unknown description", + icon: "[PC preview] unknown icon", + labelId: "[PC preview] unknown label id", + descriptionId: "[PC preview] unknown description id", + iconId: "[PC preview] unknown icon id", + moduleName: "[PC preview] unknown module name", + process: "[PC preview] unknown process", + targetAbility: "[PC preview] unknown target ability", + backgroundModes: "[PC preview] unknown back ground modes", + isVisible: "[PC preview] unknown is visible", + formEnabled: "[PC preview] unknown form enabled", + type: "[PC preview] unknown bundle.AbilityType", + subType: " [PC preview] unknown bundle.AbilitySubType", + orientation: "[PC preview] unknown bundle.DisplayOrientation", + launchMode: " [PC preview] unknown bundle.LaunchMode", + permissions: ["[PC preview] unknown permission"], + deviceTypes: ["[PC preview] unknown device type"], + deviceCapabilities: ["[PC preview] unknown device capability "], + readPermission: "[PC preview] unknown read permission", + writePermission: "[PC preview] unknown write permission", + applicationInfo: { packageName: "[PC preview] unknown package name", className: "[PC preview] unknown class name", name: "[PC preview] unknown name", @@ -828,671 +759,755 @@ export function mockBundleManager() { sourceDir: "[PC preview] unknown source dir", flags: "[PC preview] unknown flags", customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } + key: "[PC preview] unknown key", + value: { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", } + } } - }, - formEntity: "[PC preview] unknown form entity", - minFormHeight: "[PC preview] unknown min form height", - defaultFormHeight: "[PC preview] unknown default form height", - minFormWidth: "[PC preview] unknown min form width", - uri: "[PC preview] unknown uri", - customizeData: { + }, + formEntity: "[PC preview] unknown form entity", + minFormHeight: "[PC preview] unknown min form height", + defaultFormHeight: "[PC preview] unknown default form height", + minFormWidth: "[PC preview] unknown min form width", + defaultFormWidth: "[PC preview] unknown default form width", + uri: "[PC preview] unknown uri", + customizeData: { key: "[PC preview] unknown key", value: [ - { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - }, + { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", }, - { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - }, - } + }, + { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + }, + } ] + }, + } + ], + moduleName: "[PC preview] unknown module name", + mainAbilityName: "[PC preview] unknown main ability name", + installationFree: "[PC preview] unknown installation free", + } + ], + entryModuleName: "[PC preview] unknown entry module name", + cpuAbi: "[PC preview] unknown cpu abi", + isSilentInstallation: "[PC preview] unknown is silent installation", + minCompatibleVersionCode: "[PC preview] unknown min compatible version code", + entryInstallationFree: "[PC preview] unknown entry installation free" + } + ] + const BundleOptionsMock = { + userId: "[PC preview] unknown user id", + networkId: "[PC preview] unknown network id", + } + const LauncherAbilityInfoMock = { + abilityInfo: { + bundleName: "[PC preview] unknown bundle name", + name: "[PC preview] unknown name", + label: "[PC preview] unknown label", + description: "[PC preview] unknown description", + icon: "[PC preview] unknown icon", + labelId: "[PC preview] unknown label id", + descriptionId: "[PC preview] unknown description id", + iconId: "[PC preview] unknown icon id", + moduleName: "[PC preview] unknown module name", + process: "[PC preview] unknown process", + targetAbility: "[PC preview] unknown target ability", + backgroundModes: "[PC preview] unknown background modes", + isVisible: "[PC preview] unknown is visible", + formEnabled: "[PC preview] unknown form enabled", + type: "[PC preview] unknown type", + subType: "[PC preview] unknown sub type", + orientation: "[PC preview] unknown orientation", + launchMode: "[PC preview] unknown launch mode", + permissions: ["[PC preview] unknown permission"], + deviceTypes: ["[PC preview] unknown device type"], + deviceCapabilities: ["[PC preview] unknown device capability"], + readPermission: "[PC preview] unknown read permission", + writePermission: "[PC preview] unknown write permission", + applicationInfo: { + packageName: "[PC preview] unknown package name", + className: "[PC preview] unknown class name", + name: "[PC preview] unknown name", + labelId: "[PC preview] unknown label id", + iconId: "[PC preview] unknown icon id", + sourceDir: "[PC preview] unknown source dir", + flags: "[PC preview] unknown flags", + customizeData: { + key: "[PC preview] unknown key", + value: { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + } + } + } + }, + formEntity: "[PC preview] unknown form entity", + minFormHeight: "[PC preview] unknown min form height", + defaultFormHeight: "[PC preview] unknown default form height", + minFormWidth: "[PC preview] unknown min form width", + uri: "[PC preview] unknown uri", + customizeData: { + key: "[PC preview] unknown key", + value: [ + { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", }, - }, - elementName: { - deviceId: "[PC preview] unknown device id", - bundleName: "[PC preview] unknown bundle name", - abilityName: "[PC preview] unknown ability name", - uri: "[PC preview] unknown uri", - shortName: "[PC preview] unknown short name", - }, - userId: "[PC preview] unknown user id", - installTime: "[PC preview] unknown install time", - } + }, + { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + }, + } + ] + }, + }, + elementName: { + deviceId: "[PC preview] unknown device id", + bundleName: "[PC preview] unknown bundle name", + abilityName: "[PC preview] unknown ability name", + uri: "[PC preview] unknown uri", + shortName: "[PC preview] unknown short name", + }, + userId: "[PC preview] unknown user id", + installTime: "[PC preview] unknown install time", + } - const ModuleUpdateFlagMock = { - FLAG_MODULE_UPGRADE_CHECK: 0, - FLAG_MODULE_UPGRADE_INSTALL: 1, - FLAG_MODULE_UPGRADE_INSTALL_WITH_CONFIG_WINDOWS: 2, - } - const BundleFlagMock = { - GET_BUNDLE_DEFAULT: 0x00000000, - GET_BUNDLE_WITH_ABILITIES: 0x00000001, - GET_ABILITY_INFO_WITH_PERMISSION: 0x00000002, - GET_ABILITY_INFO_WITH_APPLICATION: 0x00000004, - GET_APPLICATION_INFO_WITH_PERMISSION: 0x00000008, - GET_BUNDLE_WITH_REQUESTED_PERMISSION: 0x00000010, - GET_ALL_APPLICATION_INFO: 0xFFFF0000, - } - const ColorModeMock = { - AUTO_MODE: -1, - DARK_MODE: 0, - LIGHT_MODE: 1, - } - const ModuleRemoveFlagMock = { - FLAG_MODULE_NOT_USED_BY_FORM: 0, - FLAG_MODULE_USED_BY_FORM: 1, - FLAG_MODULE_NOT_USED_BY_SHORTCUT: 2, - FLAG_MODULE_USED_BY_SHORTCUT: 3, - } - const SignatureCompareResultMock = { - SIGNATURE_MATCHED: 0, - SIGNATURE_NOT_MATCHED: 1, - SIGNATURE_UNKNOWN_BUNDLE: 2, - } - const ShortcutExistenceMock = { - SHORTCUT_EXISTENCE_EXISTS: 0, - SHORTCUT_EXISTENCE_NOT_EXISTS: 1, - SHORTCUT_EXISTENCE_UNKNOWN: 2, - } - const QueryShortCutFlagMock = { - QUERY_SHORYCUT_HOME: 0, - } - const GrantStatusMock = { - PERMISSION_DENIED: -1, - PERMISSION_GRANTED: 0, - } - const AbilityTypeMock = { - UNKNOWN: 0, - PAGE: 1, - SERVICE: 2, - DATA: 3 - } - const AbilitySubTypeMock = { - UNSPECIFIED: 0, - CA: 1, - } - const DisplayOrientationMock = { - UNSPECIFIED: 0, - LANDSCAPE: 1, - PORTRAIT: 2, - FOLLOW_RECENT: 3 - } - const LaunchModeMock = { - SINGLETON: 0, - STANDARD: 1, - } - const InstallErrorCodeMock = { - SUCCESS: 0, - STATUS_INSTALL_FAILURE: 1, - STATUS_INSTALL_FAILURE_ABORTED: 2, - STATUS_INSTALL_FAILURE_INVALID: 3, - STATUS_INSTALL_FAILURE_CONFLICT: 4, - STATUS_INSTALL_FAILURE_STORAGE: 5, - STATUS_INSTALL_FAILURE_INCOMPATIBLE: 6, - STATUS_UNINSTALL_FAILURE: 7, - STATUS_UNINSTALL_FAILURE_BLOCKE: 8, - STATUS_UNINSTALL_FAILURE_ABORTED: 9, - STATUS_UNINSTALL_FAILURE_CONFLICT: 10, - STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT: 0x0B, - STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED: 0x0C, - STATUS_ABILITY_NOT_FOUND: 0x40, - STATUS_BMS_SERVICE_ERROR: 0x41 - } - const BundleErrorMock = { - REMOTE_EXCEPTION: 0, - SECURITY_EXCEPTION: 1 - } + const ModuleUpdateFlagMock = { + FLAG_MODULE_UPGRADE_CHECK: 0, + FLAG_MODULE_UPGRADE_INSTALL: 1, + FLAG_MODULE_UPGRADE_INSTALL_WITH_CONFIG_WINDOWS: 2, + } + const BundleFlagMock = { + GET_BUNDLE_DEFAULT: 0x00000000, + GET_BUNDLE_WITH_ABILITIES: 0x00000001, + GET_ABILITY_INFO_WITH_PERMISSION: 0x00000002, + GET_ABILITY_INFO_WITH_APPLICATION: 0x00000004, + GET_APPLICATION_INFO_WITH_PERMISSION: 0x00000008, + GET_BUNDLE_WITH_REQUESTED_PERMISSION: 0x00000010, + GET_ALL_APPLICATION_INFO: 0xFFFF0000, + } + const ColorModeMock = { + AUTO_MODE: -1, + DARK_MODE: 0, + LIGHT_MODE: 1, + } + const ModuleRemoveFlagMock = { + FLAG_MODULE_NOT_USED_BY_FORM: 0, + FLAG_MODULE_USED_BY_FORM: 1, + FLAG_MODULE_NOT_USED_BY_SHORTCUT: 2, + FLAG_MODULE_USED_BY_SHORTCUT: 3, + } + const SignatureCompareResultMock = { + SIGNATURE_MATCHED: 0, + SIGNATURE_NOT_MATCHED: 1, + SIGNATURE_UNKNOWN_BUNDLE: 2, + } + const ShortcutExistenceMock = { + SHORTCUT_EXISTENCE_EXISTS: 0, + SHORTCUT_EXISTENCE_NOT_EXISTS: 1, + SHORTCUT_EXISTENCE_UNKNOWN: 2, + } + const QueryShortCutFlagMock = { + QUERY_SHORYCUT_HOME: 0, + } + const GrantStatusMock = { + PERMISSION_DENIED: -1, + PERMISSION_GRANTED: 0, + } + const AbilityTypeMock = { + UNKNOWN: 0, + PAGE: 1, + SERVICE: 2, + DATA: 3 + } + const AbilitySubTypeMock = { + UNSPECIFIED: 0, + CA: 1, + } + const DisplayOrientationMock = { + UNSPECIFIED: 0, + LANDSCAPE: 1, + PORTRAIT: 2, + FOLLOW_RECENT: 3 + } + const LaunchModeMock = { + SINGLETON: 0, + STANDARD: 1, + } + const InstallErrorCodeMock = { + SUCCESS: 0, + STATUS_INSTALL_FAILURE: 1, + STATUS_INSTALL_FAILURE_ABORTED: 2, + STATUS_INSTALL_FAILURE_INVALID: 3, + STATUS_INSTALL_FAILURE_CONFLICT: 4, + STATUS_INSTALL_FAILURE_STORAGE: 5, + STATUS_INSTALL_FAILURE_INCOMPATIBLE: 6, + STATUS_UNINSTALL_FAILURE: 7, + STATUS_UNINSTALL_FAILURE_BLOCKE: 8, + STATUS_UNINSTALL_FAILURE_ABORTED: 9, + STATUS_UNINSTALL_FAILURE_CONFLICT: 10, + STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT: 0x0B, + STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED: 0x0C, + STATUS_ABILITY_NOT_FOUND: 0x40, + STATUS_BMS_SERVICE_ERROR: 0x41 + } + const BundleErrorMock = { + REMOTE_EXCEPTION: 0, + SECURITY_EXCEPTION: 1 + } - global.ohosplugin.bundle = { - getBundleInfo: function (...args) { - console.warn("bundle.getBundleInfo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, BundleInfoMock) - } else { - return new Promise((resolve) => { - resolve(BundleInfoMock) - }); - } - }, - getBundleInstaller: function (...args) { - console.warn("bundle.getBundleInstaller interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, BundleInstallerMock) - } else { - return new Promise((resolve) => { - resolve(BundleInstallerMock) - }); - } - }, - getApplicationInfo: function (...args) { - console.warn("bundle.getApplicationInfo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ApplicationInfoMock) - } else { - return new Promise((resolve) => { - resolve(ApplicationInfoMock) - }); - } - }, - checkPermission: function (...args) { - console.warn("bundle.checkPermission interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, GrantStatusMock.PERMISSION_GRANTED) - } else { - return new Promise((resolve) => { - resolve(GrantStatusMock.PERMISSION_GRANTED) - }); - } - }, - queryAbilityByWant: function (...args) { - console.warn("bundle.queryAbilityByWant interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, AbilityInfosMock) - } else { - return new Promise((resolve) => { - resolve(AbilityInfosMock) - }); - } - }, - getAllBundleInfo: function (...args) { - console.warn("bundle.getAllBundleInfo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, BundleInfosMock) - } else { - return new Promise((resolve) => { - resolve(BundleInfosMock) - }); - } - }, - getBundlesForUid: function (...args) { - console.warn("bundle.getBundlesForUid interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ArrayStringMock) - } else { - return new Promise((resolve) => { - resolve(ArrayStringMock) - }); - } - }, - getAllApplicationInfo: function (...args) { - console.warn("bundle.getAllApplicationInfo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ApplicationInfosMock) - } else { - return new Promise((resolve) => { - resolve(ApplicationInfosMock) - }); - } - }, - getSystemAvailableCapabilities: function (...args) { - console.warn("bundle.getSystemAvailableCapabilities interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ArrayStringMock) - } else { - return new Promise((resolve) => { - resolve(ArrayStringMock) - }); - } - }, - hasSystemCapability: function (...args) { - console.warn("bundle.hasSystemCapability interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - } - }, - getBundleGids: function (...args) { - console.warn("bundle.getBundleGids interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ArrayNumberMock) - } else { - return new Promise((resolve) => { - resolve(ArrayNumberMock) - }); - } - }, - checkPublicKeys: function (...args) { - console.warn("bundle.checkPublicKeys interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, SignatureCompareResultMock.SIGNATURE_MATCHED) - } else { - return new Promise((resolve) => { - resolve(SignatureCompareResultMock.SIGNATURE_MATCHED) - }); - } - }, - getNameForUid: function (...args) { - console.warn("bundle.getNameForUid interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramStringMock) - }); - } - }, - getBundleArchiveInfo: function (...args) { - console.warn("bundle.getBundleArchiveInfo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, BundleInfoMock) - } else { - return new Promise((resolve) => { - resolve(BundleInfoMock) - }); - } - }, - isSafeMode: function (...args) { - console.warn("bundle.isSafeMode interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - } - }, - getLaunchWantForBundle: function (...args) { - console.warn("bundle.getLaunchWantForBundle interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, WantMock) - } else { - return new Promise((resolve) => { - resolve(WantMock) - }); - } - }, - setApplicationEnabled: function (...args) { - console.warn("bundle.setApplicationEnabled interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - setAbilityEnabled: function (...args) { - console.warn("bundle.setAbilityEnabled interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - isApplicationEnabled: function (...args) { - console.warn("bundle.isApplicationEnabled interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - } - }, - isAbilityEnabled: function (...args) { - console.warn("bundle.isAbilityEnabled interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - } - }, - getAllShortcutInfo: function (...args) { - console.warn("bundle.getAllShortcutInfo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ShortcutInfosMock) - } else { - return new Promise((resolve) => { - resolve(ShortcutInfosMock) - }); - } - }, - cleanBundleCacheFiles: function (...args) { - console.warn("bundle.cleanBundleCacheFiles interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - startShortcut: function (...args) { - console.warn("bundle.startShortcut interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - getAppType: function (...args) { - console.warn("bundle.getAppType interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramStringMock) - }); - } - }, - isShortcutExist: function (...args) { - console.warn("bundle.isShortcutExist interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ShortcutExistenceMock.SHORTCUT_EXISTENCE_EXISTS) - } else { - return new Promise((resolve) => { - resolve(ShortcutExistenceMock.SHORTCUT_EXISTENCE_EXISTS) - }); - } - }, - isHomeShortcutSupported: function (...args) { - console.warn("bundle.isHomeShortcutSupported interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - } - }, - addHomeShortcut: function (...args) { - console.warn("bundle.addHomeShortcut interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - updateShortcuts: function (...args) { - console.warn("bundle.updateShortcuts interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - disableHomeShortcuts: function (...args) { - console.warn("bundle.disableHomeShortcuts interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - enableHomeShortcuts: function (...args) { - console.warn("bundle.enableHomeShortcuts interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - getAllHomeShortcutInfo: function (...args) { - console.warn("bundle.getAllHomeShortcutInfo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ShortcutInfosMock) - } else { - return new Promise((resolve) => { - resolve(ShortcutInfosMock) - }); - } - }, - getAppsGrantedPermissions: function (...args) { - console.warn("bundle.getAppsGrantedPermissions interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ArrayStringMock) - } else { - return new Promise((resolve) => { - resolve(ArrayStringMock) - }); - } - }, - getAbilityIcon: function (...args) { - console.warn("bundle.getAbilityIcon interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, PixelMapMock) - } else { - return new Promise((resolve) => { - resolve(PixelMapMock) - }); - } - }, - getAbilityLabel: function (...args) { - console.warn("bundle.getAbilityLabel interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramStringMock) - }); - } - }, - getClearUserDataFlag: function (...args) { - console.warn("bundle.getClearUserDataFlag interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - } - }, - setClearUserDataFlag: function (...args) { - console.warn("bundle.setClearUserDataFlag interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - getBundlePackInfo: function (...args) { - console.warn("bundle.getBundlePackInfo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, BundlePackInfoMock) - } else { - return new Promise((resolve) => { - resolve(BundlePackInfoMock) - }); - } - }, - getAbilityList: function (...args) { - console.warn("bundle.getAbilityList interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, LauncherAbilityInfosMock) - } else { - return new Promise((resolve) => { - resolve(LauncherAbilityInfosMock) - }); - } - }, - getAbilityInfo: function (...args) { - console.warn("bundle.getAbilityInfo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[0] === 'string') { - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, AbilityInfoMock) - } else { - return new Promise((resolve) => { - resolve(AbilityInfoMock) - }); - } - } else if (typeof args[0] === 'object') { - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, LauncherAbilityInfoMock) - } else { - return new Promise((resolve) => { - resolve(LauncherAbilityInfoMock) - }); - } - } - }, - isBundleEnabled: function (...args) { - console.warn("bundle.isBundleEnabled interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - } - }, - getPermissionDef: function (...args) { - console.warn("bundle.getPermissionDef interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, PermissionDefMock) - } else { - return new Promise((resolve) => { - resolve(PermissionDefMock) - }); - } - }, - getPermissionGroupDef: function (...args) { - console.warn("bundle.getPermissionGroupDef interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, PermissionDefMock) - } else { - return new Promise((resolve) => { - resolve(PermissionDefMock) - }); - } - }, - getAllPermissionGroupDefs: function (...args) { - console.warn("bundle.getAllPermissionGroupDefs interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, PermissionDefsMock) - } else { - return new Promise((resolve) => { - resolve(PermissionDefsMock) - }); - } - }, - getPermissionDefByGroup: function (...args) { - console.warn("bundle.getPermissionDefByGroup interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, PermissionDefsMock) - } else { - return new Promise((resolve) => { - resolve(PermissionDefsMock) - }); - } - }, - } + global.ohosplugin.bundle = { + getBundleInfo: function (...args) { + console.warn("bundle.getBundleInfo interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, BundleInfoMock) + } else { + return new Promise((resolve) => { + resolve(BundleInfoMock) + }); + } + }, + getBundleInstaller: function (...args) { + console.warn("bundle.getBundleInstaller interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, BundleInstallerMock) + } else { + return new Promise((resolve) => { + resolve(BundleInstallerMock) + }); + } + }, + getApplicationInfo: function (...args) { + console.warn("bundle.getApplicationInfo interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ApplicationInfoMock) + } else { + return new Promise((resolve) => { + resolve(ApplicationInfoMock) + }); + } + }, + checkPermission: function (...args) { + console.warn("bundle.checkPermission interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, GrantStatusMock.PERMISSION_GRANTED) + } else { + return new Promise((resolve) => { + resolve(GrantStatusMock.PERMISSION_GRANTED) + }); + } + }, + queryAbilityByWant: function (...args) { + console.warn("bundle.queryAbilityByWant interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, AbilityInfosMock) + } else { + return new Promise((resolve) => { + resolve(AbilityInfosMock) + }); + } + }, + getAllBundleInfo: function (...args) { + console.warn("bundle.getAllBundleInfo interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, BundleInfosMock) + } else { + return new Promise((resolve) => { + resolve(BundleInfosMock) + }); + } + }, + getBundlesForUid: function (...args) { + console.warn("bundle.getBundlesForUid interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ArrayStringMock) + } else { + return new Promise((resolve) => { + resolve(ArrayStringMock) + }); + } + }, + getAllApplicationInfo: function (...args) { + console.warn("bundle.getAllApplicationInfo interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ApplicationInfosMock) + } else { + return new Promise((resolve) => { + resolve(ApplicationInfosMock) + }); + } + }, + getSystemAvailableCapabilities: function (...args) { + console.warn("bundle.getSystemAvailableCapabilities interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ArrayStringMock) + } else { + return new Promise((resolve) => { + resolve(ArrayStringMock) + }); + } + }, + hasSystemCapability: function (...args) { + console.warn("bundle.hasSystemCapability interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock) + }); + } + }, + getBundleGids: function (...args) { + console.warn("bundle.getBundleGids interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ArrayNumberMock) + } else { + return new Promise((resolve) => { + resolve(ArrayNumberMock) + }); + } + }, + checkPublicKeys: function (...args) { + console.warn("bundle.checkPublicKeys interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, SignatureCompareResultMock.SIGNATURE_MATCHED) + } else { + return new Promise((resolve) => { + resolve(SignatureCompareResultMock.SIGNATURE_MATCHED) + }); + } + }, + getNameForUid: function (...args) { + console.warn("bundle.getNameForUid interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramStringMock) + }); + } + }, + getBundleArchiveInfo: function (...args) { + console.warn("bundle.getBundleArchiveInfo interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, BundleInfoMock) + } else { + return new Promise((resolve) => { + resolve(BundleInfoMock) + }); + } + }, + isSafeMode: function (...args) { + console.warn("bundle.isSafeMode interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock) + }); + } + }, + getLaunchWantForBundle: function (...args) { + console.warn("bundle.getLaunchWantForBundle interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, WantMock) + } else { + return new Promise((resolve) => { + resolve(WantMock) + }); + } + }, + setApplicationEnabled: function (...args) { + console.warn("bundle.setApplicationEnabled interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }); + } + }, + setAbilityEnabled: function (...args) { + console.warn("bundle.setAbilityEnabled interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }); + } + }, + isApplicationEnabled: function (...args) { + console.warn("bundle.isApplicationEnabled interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock) + }); + } + }, + isAbilityEnabled: function (...args) { + console.warn("bundle.isAbilityEnabled interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock) + }); + } + }, + getAllShortcutInfo: function (...args) { + console.warn("bundle.getAllShortcutInfo interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ShortcutInfosMock) + } else { + return new Promise((resolve) => { + resolve(ShortcutInfosMock) + }); + } + }, + cleanBundleCacheFiles: function (...args) { + console.warn("bundle.cleanBundleCacheFiles interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }); + } + }, + startShortcut: function (...args) { + console.warn("bundle.startShortcut interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }); + } + }, + getAppType: function (...args) { + console.warn("bundle.getAppType interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramStringMock) + }); + } + }, + isShortcutExist: function (...args) { + console.warn("bundle.isShortcutExist interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ShortcutExistenceMock.SHORTCUT_EXISTENCE_EXISTS) + } else { + return new Promise((resolve) => { + resolve(ShortcutExistenceMock.SHORTCUT_EXISTENCE_EXISTS) + }); + } + }, + isHomeShortcutSupported: function (...args) { + console.warn("bundle.isHomeShortcutSupported interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock) + }); + } + }, + addHomeShortcut: function (...args) { + console.warn("bundle.addHomeShortcut interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }); + } + }, + updateShortcuts: function (...args) { + console.warn("bundle.updateShortcuts interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }); + } + }, + disableHomeShortcuts: function (...args) { + console.warn("bundle.disableHomeShortcuts interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }); + } + }, + enableHomeShortcuts: function (...args) { + console.warn("bundle.enableHomeShortcuts interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }); + } + }, + getAllHomeShortcutInfo: function (...args) { + console.warn("bundle.getAllHomeShortcutInfo interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ShortcutInfosMock) + } else { + return new Promise((resolve) => { + resolve(ShortcutInfosMock) + }); + } + }, + getAppsGrantedPermissions: function (...args) { + console.warn("bundle.getAppsGrantedPermissions interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ArrayStringMock) + } else { + return new Promise((resolve) => { + resolve(ArrayStringMock) + }); + } + }, + getAbilityIcon: function (...args) { + console.warn("bundle.getAbilityIcon interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, PixelMapMock) + } else { + return new Promise((resolve) => { + resolve(PixelMapMock) + }); + } + }, + getAbilityLabel: function (...args) { + console.warn("bundle.getAbilityLabel interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramStringMock) + }); + } + }, + getClearUserDataFlag: function (...args) { + console.warn("bundle.getClearUserDataFlag interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock) + }); + } + }, + setClearUserDataFlag: function (...args) { + console.warn("bundle.setClearUserDataFlag interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }); + } + }, + getBundlePackInfo: function (...args) { + console.warn("bundle.getBundlePackInfo interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, BundlePackInfoMock) + } else { + return new Promise((resolve) => { + resolve(BundlePackInfoMock) + }); + } + }, + getAbilityList: function (...args) { + console.warn("bundle.getAbilityList interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, LauncherAbilityInfosMock) + } else { + return new Promise((resolve) => { + resolve(LauncherAbilityInfosMock) + }); + } + }, + getAbilityInfo: function (...args) { + console.warn("bundle.getAbilityInfo interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[0] === 'string') { + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, AbilityInfoMock) + } else { + return new Promise((resolve) => { + resolve(AbilityInfoMock) + }); + } + } else if (typeof args[0] === 'object') { + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, LauncherAbilityInfoMock) + } else { + return new Promise((resolve) => { + resolve(LauncherAbilityInfoMock) + }); + } + } + }, + isBundleEnabled: function (...args) { + console.warn("bundle.isBundleEnabled interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock) + }); + } + }, + getPermissionDef: function (...args) { + console.warn("bundle.getPermissionDef interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, PermissionDefMock) + } else { + return new Promise((resolve) => { + resolve(PermissionDefMock) + }); + } + }, + getPermissionGroupDef: function (...args) { + console.warn("bundle.getPermissionGroupDef interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, PermissionDefMock) + } else { + return new Promise((resolve) => { + resolve(PermissionDefMock) + }); + } + }, + getAllPermissionGroupDefs: function (...args) { + console.warn("bundle.getAllPermissionGroupDefs interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, PermissionDefsMock) + } else { + return new Promise((resolve) => { + resolve(PermissionDefsMock) + }); + } + }, + getPermissionDefByGroup: function (...args) { + console.warn("bundle.getPermissionDefByGroup interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, PermissionDefsMock) + } else { + return new Promise((resolve) => { + resolve(PermissionDefsMock) + }); + } + }, + } } diff --git a/runtime/main/extend/systemplugin/ohos/bundleState.js b/runtime/main/extend/systemplugin/ohos/bundleState.js index 2ec3e0a7..bfe6c652 100644 --- a/runtime/main/extend/systemplugin/ohos/bundleState.js +++ b/runtime/main/extend/systemplugin/ohos/bundleState.js @@ -1,113 +1,128 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" -export function mockBundleState () { - const bundleStateInfomMock = [{ - abilityInFgTotalTime: '[PC preview] unknown abilityInFgTotalTime', - abilityPrevAccessTime: '[PC preview] unknown abilityPrevAccessTime', - abilityPrevSeenTime: '[PC preview] unknown abilityPrevSeenTime', - abilitySeenTotalTime: '[PC preview] unknown abilitySeenTotalTime', - bundleName: "[PC preview] unknown bundle name", - fgAbilityAccessTotalTime: '[PC preview] unknown fgAbilityAccessTotalTime', - fgAbilityPrevAccessTime: '[PC preview] unknown fgAbilityPrevAccessTime', - id: '[PC preview] unknown id', - infosBeginTime: '[PC preview] unknown infosBeginTime', - infosEndTime: '[PC preview] unknown infosEndTime', +export function mockBundleState() { + const bundleStateInfomMock = [{ + abilityInFgTotalTime: '[PC preview] unknown abilityInFgTotalTime', + abilityPrevAccessTime: '[PC preview] unknown abilityPrevAccessTime', + abilityPrevSeenTime: '[PC preview] unknown abilityPrevSeenTime', + abilitySeenTotalTime: '[PC preview] unknown abilitySeenTotalTime', + bundleName: "[PC preview] unknown bundle name", + fgAbilityAccessTotalTime: '[PC preview] unknown fgAbilityAccessTotalTime', + fgAbilityPrevAccessTime: '[PC preview] unknown fgAbilityPrevAccessTime', + id: '[PC preview] unknown id', + infosBeginTime: '[PC preview] unknown infosBeginTime', + infosEndTime: '[PC preview] unknown infosEndTime', - merge: function (...args) { - console.warn("bundleState.merge interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - }, - }] - const bundleActiveStateMock = [{ - appUsagePriorityGroup: '[PC preview] unknown appUsagePriorityGroup', - bundleName: '[PC preview] unknown bundleName', - indexOfLink: '[PC preview] unknown indexOfLink', - nameOfClass: '[PC preview] unknown nameOfClass', - stateOccurredTime: '[PC preview] unknown stateOccurredTime', - stateType: '[PC preview] unknown stateType', - }] - const bundleActiveInfoResponseMock = { - "key" : bundleStateInfomMock - } - const intervalTypeMock = { - BY_OPTIMIZED: 0, - BY_DAILY: 1, - BY_WEEKLY: 2, - BY_MONTHLY: 3, - BY_ANNUALLY:4 - } - global.ohosplugin.bundleState = { - isIdleState: function (...args) { - console.warn("bundleState.isIdleState interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if(typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - } - }, - queryAppUsagePriorityGroup: function (...args) { - console.warn("bundleState.queryAppUsagePriorityGroup interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if(typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }); - } - }, - queryBundleStateInfos: function (...args) { - console.warn("bundleState.queryBundleStateInfos interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if(typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, bundleActiveInfoResponseMock); - } else { - return new Promise((resolve) => { - resolve(bundleActiveInfoResponseMock) - }); - } - }, - queryBundleStateInfoByInterval: function (...args) { - console.warn("bundleState.queryBundleStateInfoByInterval interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if(typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, bundleStateInfomMock); - } else { - return new Promise((resolve) => { - resolve(bundleStateInfomMock) - }); - } - }, - queryBundleActiveStates: function (...args) { - console.warn("bundleState.queryBundleActiveStates interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if(typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, bundleActiveStateMock); - } else { - return new Promise((resolve) => { - resolve(bundleActiveStateMock) - }); - } - }, - queryCurrentBundleActiveStates: function (...args) { - console.warn("bundleState.queryCurrentBundleActiveStates interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if(typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, bundleActiveStateMock); - } else { - return new Promise((resolve) => { - resolve(bundleActiveStateMock) - }); - } - } + merge: function (...args) { + console.warn("bundleState.merge interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + }, + }] + const bundleActiveStateMock = [{ + appUsagePriorityGroup: '[PC preview] unknown appUsagePriorityGroup', + bundleName: '[PC preview] unknown bundleName', + indexOfLink: '[PC preview] unknown indexOfLink', + nameOfClass: '[PC preview] unknown nameOfClass', + stateOccurredTime: '[PC preview] unknown stateOccurredTime', + stateType: '[PC preview] unknown stateType', + }] + const bundleActiveInfoResponseMock = { + "key": bundleStateInfomMock + } + const intervalTypeMock = { + BY_OPTIMIZED: 0, + BY_DAILY: 1, + BY_WEEKLY: 2, + BY_MONTHLY: 3, + BY_ANNUALLY: 4 + } + global.ohosplugin.bundleState = { + isIdleState: function (...args) { + console.warn("bundleState.isIdleState interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock) + }); + } + }, + queryAppUsagePriorityGroup: function (...args) { + console.warn("bundleState.queryAppUsagePriorityGroup interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve) => { + resolve(paramMock.paramNumberMock) + }); + } + }, + queryBundleStateInfos: function (...args) { + console.warn("bundleState.queryBundleStateInfos interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, bundleActiveInfoResponseMock); + } else { + return new Promise((resolve) => { + resolve(bundleActiveInfoResponseMock) + }); + } + }, + queryBundleStateInfoByInterval: function (...args) { + console.warn("bundleState.queryBundleStateInfoByInterval interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, bundleStateInfomMock); + } else { + return new Promise((resolve) => { + resolve(bundleStateInfomMock) + }); + } + }, + queryBundleActiveStates: function (...args) { + console.warn("bundleState.queryBundleActiveStates interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, bundleActiveStateMock); + } else { + return new Promise((resolve) => { + resolve(bundleActiveStateMock) + }); + } + }, + queryCurrentBundleActiveStates: function (...args) { + console.warn("bundleState.queryCurrentBundleActiveStates interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, bundleActiveStateMock); + } else { + return new Promise((resolve) => { + resolve(bundleActiveStateMock) + }); + } } + } } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/ohos/commonEvent.js b/runtime/main/extend/systemplugin/ohos/commonEvent.js index 887d7ffe..097fc26b 100644 --- a/runtime/main/extend/systemplugin/ohos/commonEvent.js +++ b/runtime/main/extend/systemplugin/ohos/commonEvent.js @@ -1,191 +1,206 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" export function mockCommonEvent() { - const CommonEventSubscriberMock = { - getCode: function (...args) { - console.warn("CommonEventSubscriber.getCode interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - setCode: function (...args) { - console.warn("CommonEventSubscriber.setCode interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - getData: function (...args) { - console.warn("CommonEventSubscriber.getData interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramStringMock); - }); - } - }, - setData: function (...args) { - console.warn("CommonEventSubscriber.setData interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - setCodeAndData: function (...args) { - console.warn("CommonEventSubscriber.setCodeAndData interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - isOrderedCommonEvent: function (...args) { - console.warn("CommonEventSubscriber.isOrderedCommonEvent interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock); - }); - } - }, - isStickyCommonEvent: function (...args) { - console.warn("CommonEventSubscriber.isStickyCommonEvent interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock); - }); - } - }, - abortCommonEvent: function (...args) { - console.warn("CommonEventSubscriber.abortCommonEvent interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - clearAbortCommonEvent: function (...args) { - console.warn("CommonEventSubscriber.clearAbortCommonEvent interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - getAbortCommonEvent: function (...args) { - console.warn("CommonEventSubscriber.getAbortCommonEvent interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock); - }); - } - }, - getSubscribeInfo: function (...args) { - console.warn("CommonEventSubscriber.getSubscribeInfo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, CommonEventSubscribeInfoMock); - } else { - return new Promise((resolve) => { - resolve(CommonEventSubscribeInfoMock); - }); - } - } - } - const CommonEventDataMock = { - event: '[PC preview] unknow event', - bundleName: '[PC preview] unknow bundleName', - code: '[PC preview] unknow code', - data: '[PC preview] unknow data', - parameters: '[PC preview] unknow parameters', - } - const CommonEventSubscribeInfoMock = { - events: '[PC preview] unknow events', - publisherPermission: '[PC preview] unknow publisherPermission', - publisherDeviceId: '[PC preview] unknow publisherDeviceId', - userId: '[PC preview] unknow userId', - priority: '[PC preview] unknow priority', - } - global.ohosplugin.commonEvent = { - publish: function (...args) { - console.warn("commonEvent.publish interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } - }, - createSubscriber: function (...args) { - console.warn("commonEvent.createSubscriber interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, CommonEventSubscriberMock); - } else { - return new Promise((resolve) => { - resolve(CommonEventSubscriberMock); - }); - } - }, - subscribe: function (...args) { - console.warn("commonEvent.subscribe interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, CommonEventDataMock); - } - }, - unsubscribe: function (...args) { - console.warn("commonEvent.unsubscribe interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } - }, + const CommonEventSubscriberMock = { + getCode: function (...args) { + console.warn("CommonEventSubscriber.getCode interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve) => { + resolve(paramMock.paramNumberMock); + }); + } + }, + setCode: function (...args) { + console.warn("CommonEventSubscriber.setCode interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve) => { + resolve(); + }); + } + }, + getData: function (...args) { + console.warn("CommonEventSubscriber.getData interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve) => { + resolve(paramMock.paramStringMock); + }); + } + }, + setData: function (...args) { + console.warn("CommonEventSubscriber.setData interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve) => { + resolve(); + }); + } + }, + setCodeAndData: function (...args) { + console.warn("CommonEventSubscriber.setCodeAndData interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve) => { + resolve(); + }); + } + }, + isOrderedCommonEvent: function (...args) { + console.warn("CommonEventSubscriber.isOrderedCommonEvent interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock); + }); + } + }, + isStickyCommonEvent: function (...args) { + console.warn("CommonEventSubscriber.isStickyCommonEvent interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock); + }); + } + }, + abortCommonEvent: function (...args) { + console.warn("CommonEventSubscriber.abortCommonEvent interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve) => { + resolve(); + }); + } + }, + clearAbortCommonEvent: function (...args) { + console.warn("CommonEventSubscriber.clearAbortCommonEvent interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve) => { + resolve(); + }); + } + }, + getAbortCommonEvent: function (...args) { + console.warn("CommonEventSubscriber.getAbortCommonEvent interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock); + }); + } + }, + getSubscribeInfo: function (...args) { + console.warn("CommonEventSubscriber.getSubscribeInfo interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, CommonEventSubscribeInfoMock); + } else { + return new Promise((resolve) => { + resolve(CommonEventSubscribeInfoMock); + }); + } } + } + const CommonEventDataMock = { + event: '[PC preview] unknow event', + bundleName: '[PC preview] unknow bundleName', + code: '[PC preview] unknow code', + data: '[PC preview] unknow data', + parameters: '[PC preview] unknow parameters', + } + const CommonEventSubscribeInfoMock = { + events: '[PC preview] unknow events', + publisherPermission: '[PC preview] unknow publisherPermission', + publisherDeviceId: '[PC preview] unknow publisherDeviceId', + userId: '[PC preview] unknow userId', + priority: '[PC preview] unknow priority', + } + global.ohosplugin.commonEvent = { + publish: function (...args) { + console.warn("commonEvent.publish interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } + }, + createSubscriber: function (...args) { + console.warn("commonEvent.createSubscriber interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, CommonEventSubscriberMock); + } else { + return new Promise((resolve) => { + resolve(CommonEventSubscriberMock); + }); + } + }, + subscribe: function (...args) { + console.warn("commonEvent.subscribe interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, CommonEventDataMock); + } + }, + unsubscribe: function (...args) { + console.warn("commonEvent.unsubscribe interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } + }, + } } diff --git a/runtime/main/extend/systemplugin/ohos/geolocation.js b/runtime/main/extend/systemplugin/ohos/geolocation.js index f0ec3310..e7f92f5e 100644 --- a/runtime/main/extend/systemplugin/ohos/geolocation.js +++ b/runtime/main/extend/systemplugin/ohos/geolocation.js @@ -1,170 +1,185 @@ -import {paramMock} from "../utils" +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "../utils" export function mockOhosGeolocation() { - const LocationMock = { - latitude: '[PC preview] unknow latitude', - longitude: '[PC preview] unknow longitude', - altitude: '[PC preview] unknow altitude', - accuracy: '[PC preview] unknow accuracy', - speed: '[PC preview] unknow speed', - timeStamp: '[PC preview] unknow timeStamp', - direction: '[PC preview] unknow direction', - timeSinceBoot: '[PC preview] unknow timeSinceBoot', - additions: '[PC preview] unknow additions', - additionSize: '[PC preview] unknow additionSize', - } - const GeoAddressMock = { - latitude: '[PC preview] unknow latitude', - longitude: '[PC preview] unknow longitude', - locale: '[PC preview] unknow locale', - placeName: '[PC preview] unknow placeName', - countryCode: '[PC preview] unknow countryCode', - countryName: '[PC preview] unknow countryName', - administrativeArea: '[PC preview] unknow administrativeArea', - subAdministrativeArea: '[PC preview] unknow subAdministrativeArea', - locality: '[PC preview] unknow locality', - subLocality: '[PC preview] unknow subLocality', - roadName: '[PC preview] unknow roadName', - subRoadName: '[PC preview] unknow subRoadName', - premises: '[PC preview] unknow premises', - postalCode: '[PC preview] unknow postalCode', - phoneNumber: '[PC preview] unknow phoneNumber', - addressUrl: '[PC preview] unknow addressUrl', - descriptions: '[PC preview] unknow descriptions', - descriptionsSize: '[PC preview] unknow descriptionsSize', - } - global.ohosplugin.geolocation = { - on: function (...args) { - console.warn("geolocation.on interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - if (args[0] == 'locationChange') { - args[len - 1].call(this, LocationMock); - } else if (args[0] == 'locationServiceState') { - args[len - 1].call(this, paramMock.paramBooleanMock); - } - } - }, - off: function (...args) { - console.warn("geolocation.off interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - if (args[0] == 'locationChange') { - args[len - 1].call(this, LocationMock); - } else if (args[0] == 'locationServiceState') { - args[len - 1].call(this, paramMock.paramBooleanMock); - } - } - }, - getCurrentLocation: function (...args) { - console.warn("geolocation.getCurrentLocation interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, LocationMock); - } else { - return new Promise((resolve) => { - resolve(LocationMock); - }); - } - }, - getLastLocation: function (...args) { - console.warn("geolocation.getLastLocation interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, LocationMock); - } else { - return new Promise((resolve) => { - resolve(LocationMock); - }); - } - }, - isLocationEnabled: function (...args) { - console.warn("geolocation.isLocationEnabled interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock); - }); - } - }, - requestEnableLocation: function (...args) { - console.warn("geolocation.requestEnableLocation interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock); - }); - } - }, - enableLocation: function (...args) { - console.warn("geolocation.enableLocation interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock); - }); - } - }, - disableLocation: function (...args) { - console.warn("geolocation.disableLocation interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock); - }); - } - }, - getAddressesFromLocation: function (...args) { - console.warn("geolocation.getAddressesFromLocation interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, [GeoAddressMock]); - } else { - return new Promise((resolve) => { - resolve([GeoAddressMock]); - }); - } - }, - getAddressesFromLocationName: function (...args) { - console.warn("geolocation.getAddressesFromLocationName interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, [GeoAddressMock]); - } else { - return new Promise((resolve) => { - resolve([GeoAddressMock]); - }); - } - }, - isGeoServiceAvailable: function (...args) { - console.warn("geolocation.isGeoServiceAvailable interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock); - }); - } - }, - } + const LocationMock = { + latitude: '[PC preview] unknow latitude', + longitude: '[PC preview] unknow longitude', + altitude: '[PC preview] unknow altitude', + accuracy: '[PC preview] unknow accuracy', + speed: '[PC preview] unknow speed', + timeStamp: '[PC preview] unknow timeStamp', + direction: '[PC preview] unknow direction', + timeSinceBoot: '[PC preview] unknow timeSinceBoot', + additions: '[PC preview] unknow additions', + additionSize: '[PC preview] unknow additionSize', + } + const GeoAddressMock = { + latitude: '[PC preview] unknow latitude', + longitude: '[PC preview] unknow longitude', + locale: '[PC preview] unknow locale', + placeName: '[PC preview] unknow placeName', + countryCode: '[PC preview] unknow countryCode', + countryName: '[PC preview] unknow countryName', + administrativeArea: '[PC preview] unknow administrativeArea', + subAdministrativeArea: '[PC preview] unknow subAdministrativeArea', + locality: '[PC preview] unknow locality', + subLocality: '[PC preview] unknow subLocality', + roadName: '[PC preview] unknow roadName', + subRoadName: '[PC preview] unknow subRoadName', + premises: '[PC preview] unknow premises', + postalCode: '[PC preview] unknow postalCode', + phoneNumber: '[PC preview] unknow phoneNumber', + addressUrl: '[PC preview] unknow addressUrl', + descriptions: '[PC preview] unknow descriptions', + descriptionsSize: '[PC preview] unknow descriptionsSize', + } + global.ohosplugin.geolocation = { + on: function (...args) { + console.warn("geolocation.on interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + if (args[0] == 'locationChange') { + args[len - 1].call(this, LocationMock); + } else if (args[0] == 'locationServiceState') { + args[len - 1].call(this, paramMock.paramBooleanMock); + } + } + }, + off: function (...args) { + console.warn("geolocation.off interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + if (args[0] == 'locationChange') { + args[len - 1].call(this, LocationMock); + } else if (args[0] == 'locationServiceState') { + args[len - 1].call(this, paramMock.paramBooleanMock); + } + } + }, + getCurrentLocation: function (...args) { + console.warn("geolocation.getCurrentLocation interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, LocationMock); + } else { + return new Promise((resolve) => { + resolve(LocationMock); + }); + } + }, + getLastLocation: function (...args) { + console.warn("geolocation.getLastLocation interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, LocationMock); + } else { + return new Promise((resolve) => { + resolve(LocationMock); + }); + } + }, + isLocationEnabled: function (...args) { + console.warn("geolocation.isLocationEnabled interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock); + }); + } + }, + requestEnableLocation: function (...args) { + console.warn("geolocation.requestEnableLocation interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock); + }); + } + }, + enableLocation: function (...args) { + console.warn("geolocation.enableLocation interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock); + }); + } + }, + disableLocation: function (...args) { + console.warn("geolocation.disableLocation interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock); + }); + } + }, + getAddressesFromLocation: function (...args) { + console.warn("geolocation.getAddressesFromLocation interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, [GeoAddressMock]); + } else { + return new Promise((resolve) => { + resolve([GeoAddressMock]); + }); + } + }, + getAddressesFromLocationName: function (...args) { + console.warn("geolocation.getAddressesFromLocationName interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, [GeoAddressMock]); + } else { + return new Promise((resolve) => { + resolve([GeoAddressMock]); + }); + } + }, + isGeoServiceAvailable: function (...args) { + console.warn("geolocation.isGeoServiceAvailable interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock); + }); + } + }, + } } diff --git a/runtime/main/extend/systemplugin/ohos/inputMonitor.js b/runtime/main/extend/systemplugin/ohos/inputMonitor.js index 9b7915fe..531efb25 100644 --- a/runtime/main/extend/systemplugin/ohos/inputMonitor.js +++ b/runtime/main/extend/systemplugin/ohos/inputMonitor.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + export function mockInputMonitor() { const touches = [{ force: 1.67, @@ -17,7 +32,7 @@ export function mockInputMonitor() { }]; global.systemplugin.multimodalInput = {}; global.systemplugin.multimodalInput.inputMonitor = { - on: function(...args) { + on: function (...args) { console.warn('multimodalInput.inputMonitor.on interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); clearInterval(this.offInputMonitor); @@ -37,7 +52,7 @@ export function mockInputMonitor() { }, 1000); }, - off: function(...args) { + off: function (...args) { console.warn('multimodalInput.inputMonitor.off interface mocked in the Previewer. How this interface works on the' + ' Previewer may be different from that on a real device.'); clearInterval(this.offInputMonitor); diff --git a/runtime/main/extend/systemplugin/ohos/nfc.js b/runtime/main/extend/systemplugin/ohos/nfc.js index 680f5e9b..32da1a99 100644 --- a/runtime/main/extend/systemplugin/ohos/nfc.js +++ b/runtime/main/extend/systemplugin/ohos/nfc.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" export function mockOhosNfc() { @@ -38,14 +53,14 @@ export function mockOhosNfc() { sendData: function (...args) { console.warn("NfcATag.sendData interface mocked in the Previewer." + "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, [paramMock.paramNumberMock]); - } else { - return new Promise((resolve, reject) => { - resolve([paramMock.paramNumberMock]); - }) - } + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, [paramMock.paramNumberMock]); + } else { + return new Promise((resolve, reject) => { + resolve([paramMock.paramNumberMock]); + }) + } }, getMaxSendLength: function (...args) { console.warn("NfcATag.getMaxSendLength interface mocked in the Previewer." + @@ -96,14 +111,14 @@ export function mockOhosNfc() { sendData: function (...args) { console.warn("NfcBTag.sendData interface mocked in the Previewer." + "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, [paramMock.paramNumberMock]); - } else { - return new Promise((resolve, reject) => { - resolve([paramMock.paramNumberMock]); - }) - } + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, [paramMock.paramNumberMock]); + } else { + return new Promise((resolve, reject) => { + resolve([paramMock.paramNumberMock]); + }) + } }, getMaxSendLength: function (...args) { console.warn("NfcBTag.getMaxSendLength interface mocked in the Previewer." + @@ -154,14 +169,14 @@ export function mockOhosNfc() { sendData: function (...args) { console.warn("NfcFTag.sendData interface mocked in the Previewer." + "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, [paramMock.paramNumberMock]); - } else { - return new Promise((resolve, reject) => { - resolve([paramMock.paramNumberMock]); - }) - } + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, [paramMock.paramNumberMock]); + } else { + return new Promise((resolve, reject) => { + resolve([paramMock.paramNumberMock]); + }) + } }, getMaxSendLength: function (...args) { console.warn("NfcFTag.getMaxSendLength interface mocked in the Previewer." + @@ -212,14 +227,14 @@ export function mockOhosNfc() { sendData: function (...args) { console.warn("NfcVTag.sendData interface mocked in the Previewer." + "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, [paramMock.paramNumberMock]); - } else { - return new Promise((resolve, reject) => { - resolve([paramMock.paramNumberMock]); - }) - } + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, [paramMock.paramNumberMock]); + } else { + return new Promise((resolve, reject) => { + resolve([paramMock.paramNumberMock]); + }) + } }, getMaxSendLength: function (...args) { console.warn("NfcVTag.getMaxSendLength interface mocked in the Previewer." + @@ -248,7 +263,7 @@ export function mockOhosNfc() { isNfcAvailable: function (...args) { console.warn("nfc.controller.isNfcAvailable 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 paramMock.paramBooleanMock; }, isNfcOpen: function (...args) { console.warn("nfc.controller.isNfcOpen interface mocked in the Previewer." + @@ -258,12 +273,10 @@ export function mockOhosNfc() { on: function (...args) { console.warn("nfc.controller.on interface mocked in the Previewer." + "How this interface works on the Previewer may be different from that on a real device.") - return; }, off: function (...args) { console.warn("nfc.controller.off interface mocked in the Previewer." + "How this interface works on the Previewer may be different from that on a real device.") - return; }, getNfcState: function (...args) { console.warn("nfc.controller.getNfcState interface mocked in the Previewer." + diff --git a/runtime/main/extend/systemplugin/ohos/osAccount.js b/runtime/main/extend/systemplugin/ohos/osAccount.js index 6f4f8666..368e5340 100644 --- a/runtime/main/extend/systemplugin/ohos/osAccount.js +++ b/runtime/main/extend/systemplugin/ohos/osAccount.js @@ -1,317 +1,380 @@ -import {paramMock} from "../utils" +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "../utils" export function mockOsAccount() { - const osAccountInfoMock = { - localId: "[PC Preview] unknown id", - localName: "[PC Preview] unknown name", - type: "[PC Preview] unknown type", - constraints: "[PC Preview] unknown constraints", - distributedInfo: "[PC Preview] unknown distributedInfo" - }; - const osAccountTypeMock = "[PC Preview] unknown type"; - const accountManagerMock = { - activateOsAccount: function (...args) { - console.warn("AccountManager.activateOsAccount interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - isMultiOsAccountEnable: function (...args) { - console.warn("AccountManager.isMultiOsAccountEnable interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isOsAccountActived: function (...args) { - console.warn("AccountManager.isOsAccountActived interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isOsAccountConstraintEnable: function (...args) { - console.warn("AccountManager.isOsAccountConstraintEnable interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isTestOsAccount: function (...args) { - console.warn("AccountManager.isTestOsAccount interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isOsAccountVerified: function (...args) { - console.warn("AccountManager.isOsAccountVerified interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - removeOsAccount: function (...args) { - console.warn("AccountManager.removeOsAccount interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setOsAccountConstraints: function (...args) { - console.warn("AccountManager.setOsAccountConstraints interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setOsAccountName: function (...args) { - console.warn("AccountManager.setOsAccountName interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getCreatedOsAccountsCount: function (...args) { - console.warn("AccountManager.getCreatedOsAccountsCount interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getOsAccountLocalIdFromProcess: function (...args) { - console.warn("AccountManager.getOsAccountLocalIdFromProcess interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getOsAccountLocalIdFromUid: function (...args) { - console.warn("AccountManager.getOsAccountLocalIdFromUid interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - queryMaxOsAccountNumber: function (...args) { - console.warn("AccountManager.queryMaxOsAccountNumber interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getOsAccountAllConstraints: function (...args) { - console.warn("AccountManager.getOsAccountAllConstraints interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - queryAllCreatedOsAccounts: function (...args) { - console.warn("AccountManager.queryAllCreatedOsAccounts interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - var osAccountInfoArrayMock = new Array(); - osAccountInfoArrayMock.push(osAccountInfoMock); - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, osAccountInfoArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(osAccountInfoArrayMock); - }) - } - }, - createOsAccount: function (...args) { - console.warn("AccountManager.createOsAccount interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, osAccountInfoMock); - } else { - return new Promise((resolve, reject) => { - resolve(osAccountInfoMock); - }) - } - }, - queryCurrentOsAccount: function (...args) { - console.warn("AccountManager.queryCurrentOsAccount interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, osAccountInfoMock); - } else { - return new Promise((resolve, reject) => { - resolve(osAccountInfoMock); - }) - } - }, - queryOsAccountById: function (...args) { - console.warn("AccountManager.queryOsAccountById interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, osAccountInfoMock); - } else { - return new Promise((resolve, reject) => { - resolve(osAccountInfoMock); - }) - } - }, - getOsAccountTypeFromProcess: function (...args) { - console.warn("AccountManager.getOsAccountTypeFromProcess interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, osAccountTypeMock); - } else { - return new Promise((resolve, reject) => { - resolve(osAccountTypeMock); - }) - } - }, - getDistributedVirtualDeviceId: function (...args) { - console.warn("AccountManager.getDistributedVirtualDeviceId interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getOsAccountProfilePhoto: function (...args) { - console.warn("AccountManager.getOsAccountProfilePhoto interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - setOsAccountProfilePhoto: function (...args) { - console.warn("AccountManager.setOsAccountProfilePhoto interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - on: function (...args) { - console.warn("AccountManager.on interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - off: function (...args) { - console.warn("AccountManager.off interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } - }; - global.ohosplugin.account = global.ohosplugin.account || {}; - global.ohosplugin.account.osAccount = { - getAccountManager : function (...args) { - console.warn("osAccount.getAccountManager interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return accountManagerMock; - }, - OsAccountType : { - ADMIN: "[PC Preview] unknown ADMIN", - NORMAL: "[PC Preview] unknown NORMAL", - GUEST: "[PC Preview] unknown GUEST" - } - }; + const osAccountInfoMock = { + localId: "[PC Preview] unknown id", + localName: "[PC Preview] unknown name", + type: "[PC Preview] unknown type", + constraints: "[PC Preview] unknown constraints", + distributedInfo: "[PC Preview] unknown distributedInfo" + }; + const osAccountTypeMock = "[PC Preview] unknown type"; + const accountManagerMock = { + activateOsAccount: function (...args) { + console.warn("AccountManager.activateOsAccount interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + isMultiOsAccountEnable: function (...args) { + console.warn("AccountManager.isMultiOsAccountEnable interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + isOsAccountActived: function (...args) { + console.warn("AccountManager.isOsAccountActived interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + isOsAccountConstraintEnable: function (...args) { + console.warn("AccountManager.isOsAccountConstraintEnable interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + isTestOsAccount: function (...args) { + console.warn("AccountManager.isTestOsAccount interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + isOsAccountVerified: function (...args) { + console.warn("AccountManager.isOsAccountVerified interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + removeOsAccount: function (...args) { + console.warn("AccountManager.removeOsAccount interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + setOsAccountConstraints: function (...args) { + console.warn("AccountManager.setOsAccountConstraints interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + setOsAccountName: function (...args) { + console.warn("AccountManager.setOsAccountName interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + getCreatedOsAccountsCount: function (...args) { + console.warn("AccountManager.getCreatedOsAccountsCount interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getOsAccountLocalIdFromProcess: function (...args) { + console.warn("AccountManager.getOsAccountLocalIdFromProcess interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getOsAccountLocalIdFromUid: function (...args) { + console.warn("AccountManager.getOsAccountLocalIdFromUid interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getOsAccountLocalIdFromDomain: function (...args) { + console.warn("AccountManager.getOsAccountLocalIdFromDomain interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + queryMaxOsAccountNumber: function (...args) { + console.warn("AccountManager.queryMaxOsAccountNumber interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getOsAccountAllConstraints: function (...args) { + console.warn("AccountManager.getOsAccountAllConstraints interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } + }, + queryAllCreatedOsAccounts: function (...args) { + console.warn("AccountManager.queryAllCreatedOsAccounts interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + var osAccountInfoArrayMock = new Array(); + osAccountInfoArrayMock.push(osAccountInfoMock); + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, osAccountInfoArrayMock); + } else { + return new Promise((resolve, reject) => { + resolve(osAccountInfoArrayMock); + }) + } + }, + createOsAccount: function (...args) { + console.warn("AccountManager.createOsAccount interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, osAccountInfoMock); + } else { + return new Promise((resolve, reject) => { + resolve(osAccountInfoMock); + }) + } + }, + createOsAccountForDomain: function (...args) { + console.warn("AccountManager.createOsAccountForDomain interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, osAccountInfoMock); + } else { + return new Promise((resolve, reject) => { + resolve(osAccountInfoMock); + }) + } + }, + queryCurrentOsAccount: function (...args) { + console.warn("AccountManager.queryCurrentOsAccount interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, osAccountInfoMock); + } else { + return new Promise((resolve, reject) => { + resolve(osAccountInfoMock); + }) + } + }, + queryOsAccountById: function (...args) { + console.warn("AccountManager.queryOsAccountById interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, osAccountInfoMock); + } else { + return new Promise((resolve, reject) => { + resolve(osAccountInfoMock); + }) + } + }, + getOsAccountTypeFromProcess: function (...args) { + console.warn("AccountManager.getOsAccountTypeFromProcess interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, osAccountTypeMock); + } else { + return new Promise((resolve, reject) => { + resolve(osAccountTypeMock); + }) + } + }, + getDistributedVirtualDeviceId: function (...args) { + console.warn("AccountManager.getDistributedVirtualDeviceId interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } + }, + getOsAccountProfilePhoto: function (...args) { + console.warn("AccountManager.getOsAccountProfilePhoto interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } + }, + setOsAccountProfilePhoto: function (...args) { + console.warn("AccountManager.setOsAccountProfilePhoto interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + getOsAccountLocalIdBySerialNumber: function (...args) { + console.warn("AccountManager.getOsAccountLocalIdBySerialNumber interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + getSerialNumberByOsAccountLocalId: function (...args) { + console.warn("AccountManager.getSerialNumberByOsAccountLocalId interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + on: function (...args) { + console.warn("AccountManager.on interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + off: function (...args) { + console.warn("AccountManager.off interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + } + }; + global.ohosplugin.account = global.ohosplugin.account || {}; + global.ohosplugin.account.osAccount = { + getAccountManager: function (...args) { + console.warn("osAccount.getAccountManager interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + return accountManagerMock; + }, + OsAccountType: { + ADMIN: "[PC Preview] unknown ADMIN", + NORMAL: "[PC Preview] unknown NORMAL", + GUEST: "[PC Preview] unknown GUEST" + } + }; } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/ohos/packageManager.js b/runtime/main/extend/systemplugin/ohos/packageManager.js index 0e8d5ec3..1eafe6b6 100644 --- a/runtime/main/extend/systemplugin/ohos/packageManager.js +++ b/runtime/main/extend/systemplugin/ohos/packageManager.js @@ -1,37 +1,104 @@ -import {paramMock} from "../utils" +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "../utils" export function mockPackageManager() { - const PackageFlagMock = { - DEFAULT: 0x00000000, - GET_ACTIVITIES: 0x00000001, - GET_META_DATA: 0x00000080, - MATCH_UNINSTALLED_PACKAGES: 0x00002000, - MATCH_ALL: 0x00020000 - } - const PackageErrorMock = { - NAME_NOT_FOUND_EXCEPTION: 0 - } - const ApplicationInfosMock = [ - { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", + const PackageFlagMock = { + DEFAULT: 0x00000000, + GET_ACTIVITIES: 0x00000001, + GET_META_DATA: 0x00000080, + MATCH_UNINSTALLED_PACKAGES: 0x00002000, + MATCH_ALL: 0x00020000 + } + const PackageErrorMock = { + NAME_NOT_FOUND_EXCEPTION: 0 + } + const ApplicationInfosMock = [ + { + packageName: "[PC preview] unknown package name", + className: "[PC preview] unknown class name", + name: "[PC preview] unknown name", + labelId: "[PC preview] unknown label id", + iconId: "[PC preview] unknown icon id", + sourceDir: "[PC preview] unknown source dir", + flags: "[PC preview] unknown flags", + customizeData: { + key: "[PC preview] unknown key", + value: { + CustomizeData: { name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - ] - const ApplicationInfoMock = { + value: "[PC preview] unknown value", + } + } + } + }, + ] + const ApplicationInfoMock = { + packageName: "[PC preview] unknown package name", + className: "[PC preview] unknown class name", + name: "[PC preview] unknown name", + labelId: "[PC preview] unknown label id", + iconId: "[PC preview] unknown icon id", + sourceDir: "[PC preview] unknown source dir", + flags: "[PC preview] unknown flags", + customizeData: { + key: "[PC preview] unknown key", + value: { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + } + } + } + } + const ApplicationFlagMock = { + FLAG_SYSTEM: 0x0000000001, + FLAG_IS_DATA_ONLY: 0x1000000000, + } + const PackageInfoMock = { + packageName: "[PC preview] unknown package name", + name: "[PC preview] unknown name ", + lastUpdateTime: "[PC preview] unknown last update time", + versionCode: "[PC preview] unknown version code", + appInfo: { + packageName: "[PC preview] unknown package name", + className: "[PC preview] unknown class name", + name: "[PC preview] unknown name", + labelId: "[PC preview] unknown label id", + iconId: "[PC preview] unknown icon id", + sourceDir: "[PC preview] unknown source dir", + flags: "[PC preview] unknown flags", + customizeData: { + key: "[PC preview] unknown key", + value: { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + } + } + } + } + } + const PackageInfosMock = [ + { + packageName: "[PC preview] unknown package name", + name: "[PC preview] unknown name ", + lastUpdateTime: "[PC preview] unknown last update time", + versionCode: "[PC preview] unknown version code", + appInfo: { packageName: "[PC preview] unknown package name", className: "[PC preview] unknown class name", name: "[PC preview] unknown name", @@ -40,186 +107,134 @@ export function mockPackageManager() { sourceDir: "[PC preview] unknown source dir", flags: "[PC preview] unknown flags", customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } + key: "[PC preview] unknown key", + value: { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", } + } } - } - const ApplicationFlagMock = { - FLAG_SYSTEM: 0x0000000001, - FLAG_IS_DATA_ONLY: 0x1000000000, - } - const PackageInfoMock = { - packageName: "[PC preview] unknown package name", - name: "[PC preview] unknown name ", - lastUpdateTime: "[PC preview] unknown last update time", - versionCode: "[PC preview] unknown version code", - appInfo: { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - } - } - const PackageInfosMock = [ - { - packageName: "[PC preview] unknown package name", - name: "[PC preview] unknown name ", - lastUpdateTime: "[PC preview] unknown last update time", - versionCode: "[PC preview] unknown version code", - appInfo: { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - } - }, - ] + } + }, + ] - const CustomizeDataMock = { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - const BundleErrorMock = { - REMOTE_EXCEPTION: 0, - SECURITY_EXCEPTION: 1 - } - const ActivityInfoMock = { - packageName: "[PC preview] unknown package name", - name: "[PC preview] unknown name", - iconId: "[PC preview] unknown icon id", - labelId: "[PC preview] unknown label id", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } + const CustomizeDataMock = { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + } + const BundleErrorMock = { + REMOTE_EXCEPTION: 0, + SECURITY_EXCEPTION: 1 + } + const ActivityInfoMock = { + packageName: "[PC preview] unknown package name", + name: "[PC preview] unknown name", + iconId: "[PC preview] unknown icon id", + labelId: "[PC preview] unknown label id", + customizeData: { + key: "[PC preview] unknown key", + value: { + CustomizeData: { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", } + } } - const ActivityInfosMock = [ - { - packageName: "[PC preview] unknown package name", + } + const ActivityInfosMock = [ + { + packageName: "[PC preview] unknown package name", + name: "[PC preview] unknown name", + iconId: "[PC preview] unknown icon id", + labelId: "[PC preview] unknown label id", + customizeData: { + key: "[PC preview] unknown key", + value: { + CustomizeData: { name: "[PC preview] unknown name", - iconId: "[PC preview] unknown icon id", - labelId: "[PC preview] unknown label id", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - ] - const ComponentNameMock = { - package: "[PC preview] unknown package", - name: "[PC preview] unknown name", - } - global.ohosplugin.package = { - getApplicationInfo: function (...args) { - console.warn("PackageManger.getApplicationInfo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ApplicationInfoMock) - } else { - return new Promise((resolve) => { - resolve(ApplicationInfoMock) - }); - } - }, - getInstalledApplications: function (...args) { - console.warn("PackageManger.getInstalledApplications interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ApplicationInfosMock) - } else { - return new Promise((resolve) => { - resolve(ApplicationInfosMock) - }); - } - }, - getPackageInfo: function (...args) { - console.warn("PackageManger.getPackageInfo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, PackageInfoMock) - } else { - return new Promise((resolve) => { - resolve(PackageInfoMock) - }); - } - }, - getInstalledPackages: function (...args) { - console.warn("PackageManger.getInstalledPackages interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, PackageInfosMock) - } else { - return new Promise((resolve) => { - resolve(PackageInfosMock) - }); - } - }, - getActivityInfo: function (...args) { - console.warn("PackageManger.getActivityInfo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ActivityInfoMock) - } else { - return new Promise((resolve) => { - resolve(ActivityInfoMock) - }); - } - }, - getActivityList: function (...args) { - console.warn("PackageManger.getActivityList interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ActivityInfosMock) - } else { - return new Promise((resolve) => { - resolve(ActivityInfosMock) - }); - } - }, - } + value: "[PC preview] unknown value", + } + } + } + }, + ] + const ComponentNameMock = { + package: "[PC preview] unknown package", + name: "[PC preview] unknown name", + } + global.ohosplugin.package = { + getApplicationInfo: function (...args) { + console.warn("PackageManger.getApplicationInfo interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ApplicationInfoMock) + } else { + return new Promise((resolve) => { + resolve(ApplicationInfoMock) + }); + } + }, + getInstalledApplications: function (...args) { + console.warn("PackageManger.getInstalledApplications interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ApplicationInfosMock) + } else { + return new Promise((resolve) => { + resolve(ApplicationInfosMock) + }); + } + }, + getPackageInfo: function (...args) { + console.warn("PackageManger.getPackageInfo interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, PackageInfoMock) + } else { + return new Promise((resolve) => { + resolve(PackageInfoMock) + }); + } + }, + getInstalledPackages: function (...args) { + console.warn("PackageManger.getInstalledPackages interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, PackageInfosMock) + } else { + return new Promise((resolve) => { + resolve(PackageInfosMock) + }); + } + }, + getActivityInfo: function (...args) { + console.warn("PackageManger.getActivityInfo interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ActivityInfoMock) + } else { + return new Promise((resolve) => { + resolve(ActivityInfoMock) + }); + } + }, + getActivityList: function (...args) { + console.warn("PackageManger.getActivityList interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, ActivityInfosMock) + } else { + return new Promise((resolve) => { + resolve(ActivityInfosMock) + }); + } + }, + } } diff --git a/runtime/main/extend/systemplugin/ohos/pasteboard.js b/runtime/main/extend/systemplugin/ohos/pasteboard.js index e2bd9b04..92111e88 100644 --- a/runtime/main/extend/systemplugin/ohos/pasteboard.js +++ b/runtime/main/extend/systemplugin/ohos/pasteboard.js @@ -1,247 +1,257 @@ -import {paramMock} from "../utils"; +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "../utils"; export function mockPasteBoard() { - const PasteDataMock = { - getPrimaryText: function () { - console.warn("PasteData.getPrimaryText interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return "[PC Preview] unknow primarytext" - }, - addHtmlRecord: function () { - console.warn("PasteData.addHtmlRecord interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return; - }, - addWantRecord: function () { - console.warn("PasteData.addWantRecord interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return; - }, - addRecord: function () { - console.warn("PasteData.addRecord interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return; - }, - addTextRecord: function () { - console.warn("PasteData.addTextRecord interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return; - }, - addUriRecord: function () { - console.warn("PasteData.addUriRecord interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return; - }, - getMimeTypes: function () { - console.warn("PasteData.getMimeTypes interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - let mimeTypes = new Array(); - mimeTypes.push('[PC preview] unknow MIMETYPE_TEXT_HTML'); - mimeTypes.push('[PC preview] unknow MIMETYPE_TEXT_PLAIN'); - return mimeTypes; - }, - getPrimaryHtml: function () { - console.warn("PasteData.getPrimaryHtml interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return "[PC Preview] unknow getPrimaryHtml" - }, - getPrimaryWant: function () { - console.warn("PasteData.getPrimaryWant interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return "[PC Preview] unknow getPrimaryWant" - }, - getPrimaryMimeType: function () { - console.warn("PasteData.getPrimaryMimeType interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return "[PC Preview] unknow getPrimaryMimeType" - }, - getPrimaryUri: function () { - console.warn("PasteData.getPrimaryUri interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return "[PC Preview] unknow getPrimaryUri" - }, - getProperty: function () { - console.warn("PasteData.getProperty interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return PasteDataPropertyMock; - }, - getRecordAt: function () { - console.warn("PasteData.getRecordAt interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return PasteDataRecordMock; - }, - getRecordCount: function () { - console.warn("PasteData.getRecordCount interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return "[PC Preview] unknow getRecordCount" - }, - getTag: function () { - console.warn("PasteData.getTag interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return "[PC Preview] unknow getTag" - }, - hasMimeType: function () { - console.warn("PasteData.hasMimeType interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return "[PC Preview] unknow hasMimeType" - }, - removeRecordAt: function () { - console.warn("PasteData.removeRecordAt interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return "[PC Preview] unknow removeRecordAt" - }, - replaceRecordAt: function () { - console.warn("PasteData.replaceRecordAt interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return "[PC Preview] unknow replaceRecordAt" + const PasteDataMock = { + getPrimaryText: function () { + console.warn("PasteData.getPrimaryText interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return "[PC Preview] unknow primarytext" + }, + addHtmlRecord: function () { + console.warn("PasteData.addHtmlRecord interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + addWantRecord: function () { + console.warn("PasteData.addWantRecord interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + addRecord: function () { + console.warn("PasteData.addRecord interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + addTextRecord: function () { + console.warn("PasteData.addTextRecord interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + addUriRecord: function () { + console.warn("PasteData.addUriRecord interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + getMimeTypes: function () { + console.warn("PasteData.getMimeTypes interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + let mimeTypes = new Array(); + mimeTypes.push('[PC preview] unknow MIMETYPE_TEXT_HTML'); + mimeTypes.push('[PC preview] unknow MIMETYPE_TEXT_PLAIN'); + return mimeTypes; + }, + getPrimaryHtml: function () { + console.warn("PasteData.getPrimaryHtml interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return "[PC Preview] unknow getPrimaryHtml" + }, + getPrimaryWant: function () { + console.warn("PasteData.getPrimaryWant interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return "[PC Preview] unknow getPrimaryWant" + }, + getPrimaryMimeType: function () { + console.warn("PasteData.getPrimaryMimeType interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return "[PC Preview] unknow getPrimaryMimeType" + }, + getPrimaryUri: function () { + console.warn("PasteData.getPrimaryUri interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return "[PC Preview] unknow getPrimaryUri" + }, + getProperty: function () { + console.warn("PasteData.getProperty interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return PasteDataPropertyMock; + }, + getRecordAt: function () { + console.warn("PasteData.getRecordAt interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return PasteDataRecordMock; + }, + getRecordCount: function () { + console.warn("PasteData.getRecordCount interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return "[PC Preview] unknow getRecordCount" + }, + getTag: function () { + console.warn("PasteData.getTag interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return "[PC Preview] unknow getTag" + }, + hasMimeType: function () { + console.warn("PasteData.hasMimeType interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return "[PC Preview] unknow hasMimeType" + }, + removeRecordAt: function () { + console.warn("PasteData.removeRecordAt interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return "[PC Preview] unknow removeRecordAt" + }, + replaceRecordAt: function () { + console.warn("PasteData.replaceRecordAt interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return "[PC Preview] unknow replaceRecordAt" + } + } + const PasteDataRecordMock = { + htmlText: '[PC preview] unknow htmlText', + want: '[PC preview] unknow want', + mimeType: '[PC preview] unknow mimeType', + plainText: '[PC preview] unknow plainText', + uri: '[PC preview] unknow uri', + convertToText: function (...args) { + console.warn("PasteDataRecord.convertToText interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock) + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }) + } + } + } + const PasteDataPropertyMock = { + additions: '[PC preview] unknow additions', + mimeTypes: new Array('[PC preview] unknow MIMETYPE_TEXT_PLAIN'), + tag: '[PC preview] unknow tag', + timestamp: '[PC preview] unknow timestamp', + localOnly: '[PC preview] unknow localOnly', + } + const SystemPasteboardMock = { + on: function (...args) { + console.warn("SystemPasteboard.on interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length + if (typeof args[len - 1] === 'function') { + if (args[0] == 'update') { + args[len - 1].call(this); } - } - const PasteDataRecordMock = { - htmlText: '[PC preview] unknow htmlText', - want: '[PC preview] unknow want', - mimeType: '[PC preview] unknow mimeType', - plainText: '[PC preview] unknow plainText', - uri: '[PC preview] unknow uri', - convertToText: function (...args) { - console.warn("PasteDataRecord.convertToText interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } + } + }, + off: function (...args) { + console.warn("SystemPasteboard.off interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length + if (typeof args[len - 1] === 'function') { + if (args[0] == 'update') { + args[len - 1].call(this); } + } + }, + clear: function (...args) { + console.warn("SystemPasteboard.clear interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + hasPasteData: function (...args) { + console.warn("SystemPasteboard.hasPasteData interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + getPasteData: function (...args) { + console.warn("SystemPasteboard.getPasteData interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, PasteDataMock) + } else { + return new Promise((resolve, reject) => { + resolve(PasteDataMock); + }) + } + }, + setPasteData: function (...args) { + console.warn("SystemPasteboard.setPasteData interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } } - const PasteDataPropertyMock = { - additions: '[PC preview] unknow additions', - mimeTypes: new Array('[PC preview] unknow MIMETYPE_TEXT_PLAIN'), - tag: '[PC preview] unknow tag', - timestamp: '[PC preview] unknow timestamp', - localOnly: '[PC preview] unknow localOnly', - } - const SystemPasteboardMock = { - on: function (...args) { - console.warn("SystemPasteboard.on interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length - if (typeof args[len - 1] === 'function') { - if (args[0] == 'update') { - args[len - 1].call(this); - } - } - }, - off: function (...args) { - console.warn("SystemPasteboard.off interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length - if (typeof args[len - 1] === 'function') { - if (args[0] == 'update') { - args[len - 1].call(this); - } - } - }, - clear: function (...args) { - console.warn("SystemPasteboard.clear interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - hasPasteData: function (...args) { - console.warn("SystemPasteboard.hasPasteData interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getPasteData: function (...args) { - console.warn("SystemPasteboard.getPasteData interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, PasteDataMock) - } else { - return new Promise((resolve, reject) => { - resolve(PasteDataMock); - }) - } - }, - setPasteData: function (...args) { - console.warn("SystemPasteboard.setPasteData interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - } - global.ohosplugin.pasteboard = { - MAX_RECORD_NUM: '[PC preview] unknow MAX_RECORD_NUM', - MIMETYPE_TEXT_HTML: '[PC preview] unknow MIMETYPE_TEXT_HTML', - MIMETYPE_TEXT_WANT: '[PC preview] unknow MIMETYPE_TEXT_WANT', - MIMETYPE_TEXT_PLAIN: '[PC preview] unknow MIMETYPE_TEXT_PLAIN', - MIMETYPE_TEXT_URI: '[PC preview] unknow MIMETYPE_TEXT_URI', - createPlainTextData: function () { - console.warn("pasteboard.createPlainTextData interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return PasteDataMock; - }, - createHtmlData: function () { - console.warn("pasteboard.createHtmlData interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return PasteDataMock; - }, - createUriData: function () { - console.warn("pasteboard.createUriData interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return PasteDataMock; - }, - createWantData: function () { - console.warn("pasteboard.createWantData interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return PasteDataMock; - }, - createHtmlTextRecord: function () { - console.warn("pasteboard.createHtmlTextRecord interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return PasteDataRecordMock; - }, - createWantRecord: function () { - console.warn("pasteboard.createWantRecord interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return PasteDataRecordMock; - }, - createUriRecord: function () { - console.warn("pasteboard.createUriRecord interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return PasteDataRecordMock; - }, - createPlainTextRecord: function () { - console.warn("pasteboard.createPlainTextRecord interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return PasteDataRecordMock; - }, - getSystemPasteboard: function () { - console.warn("pasteboard.getSystemPasteboard interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return SystemPasteboardMock; - } + } + global.ohosplugin.pasteboard = { + MAX_RECORD_NUM: '[PC preview] unknow MAX_RECORD_NUM', + MIMETYPE_TEXT_HTML: '[PC preview] unknow MIMETYPE_TEXT_HTML', + MIMETYPE_TEXT_WANT: '[PC preview] unknow MIMETYPE_TEXT_WANT', + MIMETYPE_TEXT_PLAIN: '[PC preview] unknow MIMETYPE_TEXT_PLAIN', + MIMETYPE_TEXT_URI: '[PC preview] unknow MIMETYPE_TEXT_URI', + createPlainTextData: function () { + console.warn("pasteboard.createPlainTextData interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + return PasteDataMock; + }, + createHtmlData: function () { + console.warn("pasteboard.createHtmlData interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + return PasteDataMock; + }, + createUriData: function () { + console.warn("pasteboard.createUriData interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + return PasteDataMock; + }, + createWantData: function () { + console.warn("pasteboard.createWantData interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + return PasteDataMock; + }, + createHtmlTextRecord: function () { + console.warn("pasteboard.createHtmlTextRecord interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + return PasteDataRecordMock; + }, + createWantRecord: function () { + console.warn("pasteboard.createWantRecord interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + return PasteDataRecordMock; + }, + createUriRecord: function () { + console.warn("pasteboard.createUriRecord interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + return PasteDataRecordMock; + }, + createPlainTextRecord: function () { + console.warn("pasteboard.createPlainTextRecord interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + return PasteDataRecordMock; + }, + getSystemPasteboard: function () { + console.warn("pasteboard.getSystemPasteboard interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + return SystemPasteboardMock; } + } } diff --git a/runtime/main/extend/systemplugin/ohos/reminderAgent.js b/runtime/main/extend/systemplugin/ohos/reminderAgent.js index 33ac9557..8ab41d15 100644 --- a/runtime/main/extend/systemplugin/ohos/reminderAgent.js +++ b/runtime/main/extend/systemplugin/ohos/reminderAgent.js @@ -1,111 +1,126 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" export function mockReminderAgent() { - const infoMock = { - reminderId: 1, - info: "[PC preview] unknown info" - } - const reminderReq = { - reminderType: 1, - actionButton: [ - { - title: "[PC preview] unknown title", - type: 0 - } - ], - wantAgent: { - pkgName: "[PC preview] unknown pkg nam", - abilityName: "[PC preview] unknown ability name" - }, - maxScreenWantAgent: { - pkgName: "[PC preview] unknown pkg name", - abilityName: "[PC preview] unknown ability name" - }, - ringDuration: 1, - snoozeTimes: 1, - timeInterval: 1, + const infoMock = { + reminderId: 1, + info: "[PC preview] unknown info" + } + const reminderReq = { + reminderType: 1, + actionButton: [ + { title: "[PC preview] unknown title", - content: "[PC preview] unknown content", - expiredContent: "[PC preview] unknown expiredContent", - snoozeContent: "[PC preview] unknown snoozeContent", - notificationId: 1, - slotType: 3 - } - const reminderReqs = [ - reminderReq - ] - global.ohosplugin.reminderAgent = { - publishReminder: function (...args) { - console.warn("reminderAgent.publishReminder interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, infoMock.reminderId) - } else { - return new Promise((resolve) => { - resolve(infoMock.reminderId) - }); - } - }, - getValidReminders: function (...args) { - console.warn("reminderAgent.getValidReminders interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, reminderReqs) - } else { - return new Promise((resolve) => { - resolve(reminderReqs) - }); - } - }, - cancelReminder: function (...args) { - console.warn("reminderAgent.cancelReminder interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - cancelAllReminders: function (...args) { - console.warn("reminderAgent.cancelAllReminders interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - addNotificationSlot: function (...args) { - console.warn("reminderAgent.addNotificationSlot interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - removeNotificationSlot: function (...args) { - console.warn("reminderAgent.removeNotificationSlot interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }); - } - } + type: 0 + } + ], + wantAgent: { + pkgName: "[PC preview] unknown pkg nam", + abilityName: "[PC preview] unknown ability name" + }, + maxScreenWantAgent: { + pkgName: "[PC preview] unknown pkg name", + abilityName: "[PC preview] unknown ability name" + }, + ringDuration: 1, + snoozeTimes: 1, + timeInterval: 1, + title: "[PC preview] unknown title", + content: "[PC preview] unknown content", + expiredContent: "[PC preview] unknown expiredContent", + snoozeContent: "[PC preview] unknown snoozeContent", + notificationId: 1, + slotType: 3 + } + const reminderReqs = [ + reminderReq + ] + global.ohosplugin.reminderAgent = { + publishReminder: function (...args) { + console.warn("reminderAgent.publishReminder interface mocked in the Previewer." + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, infoMock.reminderId) + } else { + return new Promise((resolve) => { + resolve(infoMock.reminderId) + }); + } + }, + getValidReminders: function (...args) { + console.warn("reminderAgent.getValidReminders interface mocked in the Previewer." + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, reminderReqs) + } else { + return new Promise((resolve) => { + resolve(reminderReqs) + }); + } + }, + cancelReminder: function (...args) { + console.warn("reminderAgent.cancelReminder interface mocked in the Previewer." + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }); + } + }, + cancelAllReminders: function (...args) { + console.warn("reminderAgent.cancelAllReminders interface mocked in the Previewer." + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }); + } + }, + addNotificationSlot: function (...args) { + console.warn("reminderAgent.addNotificationSlot interface mocked in the Previewer." + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }); + } + }, + removeNotificationSlot: function (...args) { + console.warn("reminderAgent.removeNotificationSlot interface mocked in the Previewer." + + "How this interface works on the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }); + } } + } } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/ohos/request.js b/runtime/main/extend/systemplugin/ohos/request.js index 682bc6ee..f1f69503 100644 --- a/runtime/main/extend/systemplugin/ohos/request.js +++ b/runtime/main/extend/systemplugin/ohos/request.js @@ -1,4 +1,20 @@ -import {paramMock} from "../utils"; +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "../utils"; + const NOTIFY = "[PC Preview] unknow" const Properties = [ 'NETWORK_MOBILE', @@ -45,7 +61,7 @@ export function mockOhosRequest() { SESSION_PENDING: 1, SESSION_RUNNING: 2, SESSION_PAUSED: 4, - SESSION_SUCCESSFUL:8, + SESSION_SUCCESSFUL: 8, SESSION_FAILED: 16, } const downloadInfo = { @@ -62,35 +78,35 @@ export function mockOhosRequest() { downloadedBytes: 1 } const DownloadTaskMock = { - on: function(...args) { + on: function (...args) { console.warn("DownloadTask.on interface mocked in the Previewer. How this interface works on the Previewer may" + " be different from that on a real device.") const len = args.length if (typeof args[len - 1] === 'function') { - if (args[0] == 'progress') { - args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock); - } else if (args[0] == 'complete' || args[0] == 'pause' || args[0] == 'remove') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else if (args[0] == 'fail') { - args[len - 1].call(this, paramMock.businessErrorMock, ErrorMock); - } + if (args[0] == 'progress') { + args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock); + } else if (args[0] == 'complete' || args[0] == 'pause' || args[0] == 'remove') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else if (args[0] == 'fail') { + args[len - 1].call(this, paramMock.businessErrorMock, ErrorMock); + } } }, - off: function(...args) { + off: function (...args) { console.warn("DownloadTask.off interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") const len = args.length if (typeof args[len - 1] === 'function') { - if (args[0] == 'progress') { - args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock); - } else if (args[0] == 'complete' || args[0] == 'pause' || args[0] == 'remove') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else if (args[0] == 'fail') { - args[len - 1].call(this, paramMock.businessErrorMock, ErrorMock); - } + if (args[0] == 'progress') { + args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock); + } else if (args[0] == 'complete' || args[0] == 'pause' || args[0] == 'remove') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else if (args[0] == 'fail') { + args[len - 1].call(this, paramMock.businessErrorMock, ErrorMock); + } } }, - remove: function(...args) { + remove: function (...args) { console.warn("DownloadTask.remove interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") const len = args.length @@ -102,7 +118,7 @@ export function mockOhosRequest() { }) } }, - pause: function(...args) { + pause: function (...args) { console.warn("DownloadTask.pause interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") const len = args.length @@ -114,7 +130,7 @@ export function mockOhosRequest() { }) } }, - resume: function(...args) { + resume: function (...args) { console.warn("DownloadTask.resume interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") const len = args.length @@ -126,7 +142,7 @@ export function mockOhosRequest() { }) } }, - queryMimeType: function(...args) { + queryMimeType: function (...args) { console.warn("DownloadTask.queryMimeType interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") const len = args.length @@ -138,7 +154,7 @@ export function mockOhosRequest() { }) } }, - query: function(...args) { + query: function (...args) { console.warn("DownloadTask.query interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") const len = args.length @@ -152,31 +168,31 @@ export function mockOhosRequest() { } } const UploadTaskMock = { - on: function(...args) { + on: function (...args) { console.warn("UploadTask.on interface mocked in the Previewer. How this interface works on the Previewer may" + " be different from that on a real device.") const len = args.length if (typeof args[len - 1] === 'function') { - if (args[0] == 'progress') { - args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock); - } else if (args[0] == 'headerReceive') { - args[len - 1].call(this, paramMock.paramObjectMock); - } + if (args[0] == 'progress') { + args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock); + } else if (args[0] == 'headerReceive') { + args[len - 1].call(this, paramMock.paramObjectMock); + } } }, - off: function(...args) { + off: function (...args) { console.warn("UploadTask.off interface mocked in the Previewer. How this interface works on the Previewer may" + " be different from that on a real device.") const len = args.length if (typeof args[len - 1] === 'function') { - if (args[0] == 'progress') { - args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock); - } else if (args[0] == 'headerReceive') { - args[len - 1].call(this, paramMock.paramObjectMock); - } + if (args[0] == 'progress') { + args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock); + } else if (args[0] == 'headerReceive') { + args[len - 1].call(this, paramMock.paramObjectMock); + } } }, - remove: function(...args) { + remove: function (...args) { console.warn("UploadTask.remove interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") const len = args.length @@ -216,7 +232,7 @@ export function mockOhosRequest() { } } - for(let property of Properties) { + for (let property of Properties) { global.ohosplugin.request[property] = NOTIFY + " " + property } } diff --git a/runtime/main/extend/systemplugin/ohos/storageInfoManager.js b/runtime/main/extend/systemplugin/ohos/storageInfoManager.js index 6394e334..4268f844 100644 --- a/runtime/main/extend/systemplugin/ohos/storageInfoManager.js +++ b/runtime/main/extend/systemplugin/ohos/storageInfoManager.js @@ -1,63 +1,78 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" -export function mockStorageInfoManager () { - const infoMock = { - storageInfo: { - appSize: 472897, - cacheSize: 483, - dataSize: 32543 - }, - totalSize: 12800000, - freeSize: 23700000, - } - global.ohosplugin.storageInfoManager = { - queryInfoByPackageName: function (...args) { - console.warn("storageInfoManager.queryInfoByPackageName interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, infoMock.storageInfo); - } else { - return new Promise((resolve) => { - resolve(infoMock.storageInfo); - }) - } - }, - getTotalSize: function (...args) { - console.warn("storageInfoManager.getTotalSize interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, infoMock.totalSize); - } else { - return new Promise((resolve) => { - resolve(infoMock.totalSize); - }) - } - }, - getFreeSize: function (...args) { - console.warn("storageInfoManager.getFreeSize interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, infoMock.freeSize); - } else { - return new Promise((resolve) => { - resolve(infoMock.freeSize); - }) - } - }, - queryInfoByUid: function (...args) { - console.warn("storageInfoManager.queryInfoByUid interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, infoMock.storageInfo); - } else { - return new Promise((resolve) => { - resolve(infoMock.storageInfo); - }) - } - }, - } +export function mockStorageInfoManager() { + const infoMock = { + storageInfo: { + appSize: 472897, + cacheSize: 483, + dataSize: 32543 + }, + totalSize: 12800000, + freeSize: 23700000, + } + global.ohosplugin.storageInfoManager = { + queryInfoByPackageName: function (...args) { + console.warn("storageInfoManager.queryInfoByPackageName interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, infoMock.storageInfo); + } else { + return new Promise((resolve) => { + resolve(infoMock.storageInfo); + }) + } + }, + getTotalSize: function (...args) { + console.warn("storageInfoManager.getTotalSize interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, infoMock.totalSize); + } else { + return new Promise((resolve) => { + resolve(infoMock.totalSize); + }) + } + }, + getFreeSize: function (...args) { + console.warn("storageInfoManager.getFreeSize interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, infoMock.freeSize); + } else { + return new Promise((resolve) => { + resolve(infoMock.freeSize); + }) + } + }, + queryInfoByUid: function (...args) { + console.warn("storageInfoManager.queryInfoByUid interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, infoMock.storageInfo); + } else { + return new Promise((resolve) => { + resolve(infoMock.storageInfo); + }) + } + }, + } } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/ohos/systemTime.js b/runtime/main/extend/systemplugin/ohos/systemTime.js index 2af25f00..08ded396 100644 --- a/runtime/main/extend/systemplugin/ohos/systemTime.js +++ b/runtime/main/extend/systemplugin/ohos/systemTime.js @@ -1,138 +1,153 @@ -import {paramMock} from "../utils" +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "../utils" export function mockSystemTime() { - global.ohosplugin.systemTime = { - setTime: function (...args) { - console.warn('systemTime.setTime interface mocked in the Previewer. How this interface works on the' - + 'Previewer may be different from that on a real device.'); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }); - } - }, - getCurrentTime: function (...args) { - console.warn('systemTime.getCurrentTime interface mocked in the Previewer. How this interface works on the' - + 'Previewer may be different from that on a real device.'); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - getCurrentTimeNs: function (...args) { - console.warn('systemTime.getCurrentTimeNs interface mocked in the Previewer.' - + 'How this interface works on the Previewer may be different from that on a real device.'); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - getRealActiveTime: function (...args) { - console.warn('systemTime.getRealActiveTime interface mocked in the Previewer.' - + 'How this interface works on the Previewer may be different from that on a real device.'); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - getRealActiveTimeNs: function (...args) { - console.warn('systemTime.getRealActiveTimeNs interface mocked in the Previewer.' - + 'How this interface works on the Previewer may be different from that on a real device.'); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - getRealTime: function (...args) { - console.warn('systemTime.getRealTime interface mocked in the Previewer. How this interface works on the' - + 'Previewer may be different from that on a real device.'); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - getRealTimeNs: function (...args) { - console.warn('systemTime.getRealTimeNs interface mocked in the Previewer. How this interface works on the' - + 'Previewer may be different from that on a real device.'); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - setDate: function (...args) { - console.warn('systemTime.setDate interface mocked in the Previewer. How this interface works on the' - + 'Previewer may be different from that on a real device.'); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }); - } - }, - getDate: function (...args) { - console.warn('systemTime.getDate interface mocked in the Previewer. How this interface works on the' - + 'Previewer may be different from that on a real device.'); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramObjectMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramObjectMock); - }); - } - }, - setTimezone: function (...args) { - console.warn('systemTime.setTimezone interface mocked in the Previewer. How this interface works on the' - + 'Previewer may be different from that on a real device.'); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }); - } - }, - getTimeZone: function (...args) { - console.warn('systemTime.getTimeZone interface mocked in the Previewer. How this interface works on the' - + 'Previewer may be different from that on a real device.'); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }); - } - }, - }; + global.ohosplugin.systemTime = { + setTime: function (...args) { + console.warn('systemTime.setTime interface mocked in the Previewer. How this interface works on the' + + 'Previewer may be different from that on a real device.'); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }); + } + }, + getCurrentTime: function (...args) { + console.warn('systemTime.getCurrentTime interface mocked in the Previewer. How this interface works on the' + + 'Previewer may be different from that on a real device.'); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }); + } + }, + getCurrentTimeNs: function (...args) { + console.warn('systemTime.getCurrentTimeNs interface mocked in the Previewer.' + + 'How this interface works on the Previewer may be different from that on a real device.'); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }); + } + }, + getRealActiveTime: function (...args) { + console.warn('systemTime.getRealActiveTime interface mocked in the Previewer.' + + 'How this interface works on the Previewer may be different from that on a real device.'); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }); + } + }, + getRealActiveTimeNs: function (...args) { + console.warn('systemTime.getRealActiveTimeNs interface mocked in the Previewer.' + + 'How this interface works on the Previewer may be different from that on a real device.'); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }); + } + }, + getRealTime: function (...args) { + console.warn('systemTime.getRealTime interface mocked in the Previewer. How this interface works on the' + + 'Previewer may be different from that on a real device.'); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }); + } + }, + getRealTimeNs: function (...args) { + console.warn('systemTime.getRealTimeNs interface mocked in the Previewer. How this interface works on the' + + 'Previewer may be different from that on a real device.'); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }); + } + }, + setDate: function (...args) { + console.warn('systemTime.setDate interface mocked in the Previewer. How this interface works on the' + + 'Previewer may be different from that on a real device.'); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }); + } + }, + getDate: function (...args) { + console.warn('systemTime.getDate interface mocked in the Previewer. How this interface works on the' + + 'Previewer may be different from that on a real device.'); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramObjectMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramObjectMock); + }); + } + }, + setTimezone: function (...args) { + console.warn('systemTime.setTimezone interface mocked in the Previewer. How this interface works on the' + + 'Previewer may be different from that on a real device.'); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve, reject) => { + resolve(); + }); + } + }, + getTimeZone: function (...args) { + console.warn('systemTime.getTimeZone interface mocked in the Previewer. How this interface works on the' + + 'Previewer may be different from that on a real device.'); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramStringMock); + }); + } + }, + }; } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/ohos/systemTimer.js b/runtime/main/extend/systemplugin/ohos/systemTimer.js index 85a427f9..addd4d91 100644 --- a/runtime/main/extend/systemplugin/ohos/systemTimer.js +++ b/runtime/main/extend/systemplugin/ohos/systemTimer.js @@ -1,58 +1,73 @@ -import {paramMock} from "../utils" +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "../utils" export function mockSystemTimer() { - global.ohosplugin.systemTimer = { - TIMER_TYPE_REALTIME: '[PC preview] unknow TIMER_TYPE_REALTIME', - TIMER_TYPE_WAKEUP: '[PC preview] unknow TIMER_TYPE_WAKEUP', - TIMER_TYPE_EXACT: '[PC preview] unknow TIMER_TYPE_EXACT', - TIMER_TYPE_IDLE: '[PC preview] unknow TIMER_TYPE_IDLE', - createTimer: function (...args) { - console.warn("systemTimer.createTimer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - startTimer: function (...args) { - console.warn("systemTimer.startTimer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - stopTimer: function (...args) { - console.warn("systemTimer.stopTimer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - destroyTimer: function (...args) { - console.warn("systemTimer.destroyTimer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } + global.ohosplugin.systemTimer = { + TIMER_TYPE_REALTIME: '[PC preview] unknow TIMER_TYPE_REALTIME', + TIMER_TYPE_WAKEUP: '[PC preview] unknow TIMER_TYPE_WAKEUP', + TIMER_TYPE_EXACT: '[PC preview] unknow TIMER_TYPE_EXACT', + TIMER_TYPE_IDLE: '[PC preview] unknow TIMER_TYPE_IDLE', + createTimer: function (...args) { + console.warn("systemTimer.createTimer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + startTimer: function (...args) { + console.warn("systemTimer.startTimer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + stopTimer: function (...args) { + console.warn("systemTimer.stopTimer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + destroyTimer: function (...args) { + console.warn("systemTimer.destroyTimer interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } } + } } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/ohos/userIAMuserAuth.js b/runtime/main/extend/systemplugin/ohos/userIAMuserAuth.js index 1145495d..72eda57f 100644 --- a/runtime/main/extend/systemplugin/ohos/userIAMuserAuth.js +++ b/runtime/main/extend/systemplugin/ohos/userIAMuserAuth.js @@ -1,213 +1,228 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + export function mockUserIAMUserAuth() { - const AuthenticationResult = { - NO_SUPPORT : -1, - SUCCESS : 0, - COMPARE_FAILURE : 1, - CANCELED : 2, - TIMEOUT : 3, - CAMERA_FAIL : 4, - BUSY : 5, - INVALID_PARAMETERS : 6, - LOCKED : 7, - NOT_ENROLLED : 8, - GENERAL_ERROR : 100, + const AuthenticationResult = { + NO_SUPPORT: -1, + SUCCESS: 0, + COMPARE_FAILURE: 1, + CANCELED: 2, + TIMEOUT: 3, + CAMERA_FAIL: 4, + BUSY: 5, + INVALID_PARAMETERS: 6, + LOCKED: 7, + NOT_ENROLLED: 8, + GENERAL_ERROR: 100, + } + + const CheckAvailabilityResult = { + SUPPORTED: 0, + AUTH_TYPE_NOT_SUPPORT: 1, + SECURE_LEVEL_NOT_SUPPORT: 2, + DISTRIBUTED_AUTH_NOT_SUPPORT: 3, + NOT_ENROLLED: 4, + PARAM_NUM_ERROR: 5, + } + + const TipEvent = { + RESULT: 1, + CANCEL: 2, + ACQUIRE: 3, + BUSY: 4, + OUT_OF_MEM: 5, + FACE_ID: 6, + } + + const TipCode = { + FACE_AUTH_TIP_TOO_BRIGHT: 1, + FACE_AUTH_TIP_TOO_DARK: 2, + FACE_AUTH_TIP_TOO_CLOSE: 3, + FACE_AUTH_TIP_TOO_FAR: 4, + FACE_AUTH_TIP_TOO_HIGH: 5, + FACE_AUTH_TIP_TOO_LOW: 6, + FACE_AUTH_TIP_TOO_RIGHT: 7, + FACE_AUTH_TIP_TOO_LEFT: 8, + FACE_AUTH_TIP_TOO_MUCH_MOTION: 9, + FACE_AUTH_TIP_POOR_GAZE: 10, + FACE_AUTH_TIP_NOT_DETECTED: 11, + } + + const Result = { + SUCCESS: 0, + FAILED: 1, + } + + function checkAuthParam(authType, secureLevel) { + if ((typeof authType !== 'string') || (["ALL", "FACE_ONLY"].indexOf(authType) < 0)) { + console.error('invalid authType'); + return CheckAvailabilityResult.AUTH_TYPE_NOT_SUPPORT; } - const CheckAvailabilityResult = { - SUPPORTED : 0, - AUTH_TYPE_NOT_SUPPORT : 1, - SECURE_LEVEL_NOT_SUPPORT : 2, - DISTRIBUTED_AUTH_NOT_SUPPORT : 3, - NOT_ENROLLED : 4, - PARAM_NUM_ERROR : 5, + if ((typeof secureLevel !== 'string') || (["S1", "S2", "S3", "S4"].indexOf(secureLevel) < 0)) { + console.error('invalid secureLevel'); + return CheckAvailabilityResult.SECURE_LEVEL_NOT_SUPPORT; } - const TipEvent = { - RESULT : 1, - CANCEL : 2, - ACQUIRE : 3, - BUSY : 4, - OUT_OF_MEM : 5, - FACE_ID : 6, + return Result.SUCCESS; + } + + let Authenticator = class { + constructor() { } - const TipCode = { - FACE_AUTH_TIP_TOO_BRIGHT : 1, - FACE_AUTH_TIP_TOO_DARK : 2, - FACE_AUTH_TIP_TOO_CLOSE : 3, - FACE_AUTH_TIP_TOO_FAR : 4, - FACE_AUTH_TIP_TOO_HIGH : 5, - FACE_AUTH_TIP_TOO_LOW : 6, - FACE_AUTH_TIP_TOO_RIGHT : 7, - FACE_AUTH_TIP_TOO_LEFT : 8, - FACE_AUTH_TIP_TOO_MUCH_MOTION : 9, - FACE_AUTH_TIP_POOR_GAZE : 10, - FACE_AUTH_TIP_NOT_DETECTED : 11, + async execute(authType, secureLevel, callback) { + console.warn("Authenticator.execute interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + function handleCallback(callback, ret) { + if (typeof callback === 'function') { + callback(ret); + } else { + if (ret === 0) { + return ret; + } else { + throw ret; + } + } + } + + if (checkAuthParam(authType, secureLevel) != Result.SUCCESS) { + return handleCallback(callback, AuthenticationResult.INVALID_PARAMETERS); + } + + let successTip = { + "errorCode": Result.FAILED, + "tipEvent": TipEvent.RESULT, + "tipCode": AuthenticationResult.SUCCESS, + "tipInfo": "success", + }; + + for (let localCallback of userAuth.subscribeTipSet.values()) { + localCallback(successTip); + } + + // mock + return handleCallback(callback, AuthenticationResult.SUCCESS); } - const Result = { - SUCCESS: 0, - FAILED: 1, + checkAvailability(authType, secureLevel) { + console.warn("Authenticator.checkAvailability interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + let result = checkAuthParam(authType, secureLevel); + if (result != Result.SUCCESS) { + return result; + } + + // mock + return CheckAvailabilityResult.SUPPORTED; } - function checkAuthParam(authType, secureLevel) { - if ((typeof authType !== 'string') || (["ALL", "FACE_ONLY"].indexOf(authType) < 0)) { - console.error('invalid authType'); - return CheckAvailabilityResult.AUTH_TYPE_NOT_SUPPORT; - } + cancel() { + console.warn("Authenticator.cancel interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") - if ((typeof secureLevel !== 'string') || ([ "S1", "S2", "S3", "S4"].indexOf(secureLevel) < 0)) { - console.error('invalid secureLevel'); - return CheckAvailabilityResult.SECURE_LEVEL_NOT_SUPPORT; - } - - return Result.SUCCESS; + // mock + return Result.SUCCESS; } - let Authenticator = class { - constructor() { - } + async on(type, callback) { + console.warn("Authenticator.on interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + let errorTip = { + "errorCode": Result.FAILED, + "tipEvent": 0, + "tipCode": 0, + "tipInfo": "", + }; - async execute(authType, secureLevel, callback) { - console.warn("Authenticator.execute interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - function handleCallback(callback, ret) { - if (typeof callback === 'function') { - callback(ret); - } else { - if (ret === 0) { - return ret; - } else { - throw ret; - } - } - } + if (type !== 'tip') { + console.error('type is invalid') + callback(errorTip); + return; + } - if (checkAuthParam(authType, secureLevel) != Result.SUCCESS) { - return handleCallback(callback, AuthenticationResult.INVALID_PARAMETERS); - } + if (typeof callback !== 'function') { + console.error('callback parameter is invalid'); + callback(errorTip); + return; + } - let successTip = { - "errorCode" : Result.FAILED, - "tipEvent" : TipEvent.RESULT, - "tipCode" : AuthenticationResult.SUCCESS, - "tipInfo" : "success", - }; + userAuth.subscribeTipSet.add(callback); + if (userAuth.subscribeToTip) { + console.log('already subscribe to event'); + return; + } - for(let localCallback of userAuth.subscribeTipSet.values()) { - localCallback(successTip); - } - - // mock - return handleCallback(callback, AuthenticationResult.SUCCESS); - } - - checkAvailability(authType, secureLevel) { - console.warn("Authenticator.checkAvailability interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - let result = checkAuthParam(authType, secureLevel); - if (result != Result.SUCCESS) { - return result; - } - - // mock - return CheckAvailabilityResult.SUPPORTED; - } - - cancel() { - console.warn("Authenticator.cancel interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - - // mock - return Result.SUCCESS; - } - - async on(type, callback) { - console.warn("Authenticator.on interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - let errorTip = { - "errorCode" : Result.FAILED, - "tipEvent" : 0, - "tipCode" : 0, - "tipInfo" : "", - }; - - if (type !== 'tip') { - console.error('type is invalid') - callback(errorTip); - return; - } - - if (typeof callback !== 'function') { - console.error('callback parameter is invalid'); - callback(errorTip); - return; - } - - userAuth.subscribeTipSet.add(callback); - if (userAuth.subscribeToTip) { - console.log('already subscribe to event'); - return; - } - - // mock - userAuth.subscribeToTip = true; - console.info('subscribe success'); - } - - async off(type, optCallback) { - console.warn("Authenticator.off interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (type !== 'tip') { - console.error('type is invalid') - return; - } - - if (typeof optCallback === 'function') { - userAuth.subscribeTipSet.delete(optCallback); - } else { - userAuth.subscribeTipSet.clear(); - } - - if (!userAuth.subscribeToTip) { - console.info('not subscribing event, no need unsubscribe'); - return; - } - - if (userAuth.subscribeTipSet.size !== 0) { - console.info('subscriber is not 0, no need unsubscribe'); - return; - } - - // mock - userAuth.subscribeToTip = false; - console.info('unsubscribe success'); - } + // mock + userAuth.subscribeToTip = true; + console.info('subscribe success'); } - var userAuth = { - moduleGroup: null, - eventGroup: null, - authenticator: null, - subscribeToTip : false, - subscribeTipSet: new Set([]), - getAuthenticator : function getAuthenticator() { - console.warn("userAuth.getAuthenticator interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - if (this.authenticator == null) { - this.authenticator = new Authenticator() - } - return this.authenticator; - } - } + async off(type, optCallback) { + console.warn("Authenticator.off interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + if (type !== 'tip') { + console.error('type is invalid') + return; + } - global.systemplugin.userIAM = global.systemplugin.userIAM || {}; - global.systemplugin.userIAM.userAuth = { - getAuthenticator : userAuth.getAuthenticator, - AuthenticationResult : AuthenticationResult, - CheckAvailabilityResult : CheckAvailabilityResult, - TipEvent : TipEvent, - TipCode : TipCode, - Result : Result, - }; + if (typeof optCallback === 'function') { + userAuth.subscribeTipSet.delete(optCallback); + } else { + userAuth.subscribeTipSet.clear(); + } + + if (!userAuth.subscribeToTip) { + console.info('not subscribing event, no need unsubscribe'); + return; + } + + if (userAuth.subscribeTipSet.size !== 0) { + console.info('subscriber is not 0, no need unsubscribe'); + return; + } + + // mock + userAuth.subscribeToTip = false; + console.info('unsubscribe success'); + } + } + + var userAuth = { + moduleGroup: null, + eventGroup: null, + authenticator: null, + subscribeToTip: false, + subscribeTipSet: new Set([]), + getAuthenticator: function getAuthenticator() { + console.warn("userAuth.getAuthenticator interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + if (this.authenticator == null) { + this.authenticator = new Authenticator() + } + return this.authenticator; + } + } + + global.systemplugin.userIAM = global.systemplugin.userIAM || {}; + global.systemplugin.userIAM.userAuth = { + getAuthenticator: userAuth.getAuthenticator, + AuthenticationResult: AuthenticationResult, + CheckAvailabilityResult: CheckAvailabilityResult, + TipEvent: TipEvent, + TipCode: TipCode, + Result: Result, + }; } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/ohos/wallpaper.js b/runtime/main/extend/systemplugin/ohos/wallpaper.js index 9132782e..a291597a 100644 --- a/runtime/main/extend/systemplugin/ohos/wallpaper.js +++ b/runtime/main/extend/systemplugin/ohos/wallpaper.js @@ -1,163 +1,178 @@ -import {paramMock} from "../utils" -import {PixelMapMock} from "../multimedia" +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "../utils" +import { PixelMapMock } from "../multimedia" export function mockWallpaper() { - global.ohosplugin.wallpaper = { - WallpaperType: { - WALLPAPER_SYSTEM: '[PC preview] unknow WALLPAPER_SYSTEM', - WALLPAPER_LOCKSCREEN: '[PC preview] unknow WALLPAPER_LOCKSCREEN' - }, - getColors: function (...args) { - console.warn("wallpaper.getColors interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length; - let colors = new Array(); - colors.push(RgbaColorMock); - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, colors); - } else { - return new Promise((resolve, reject) => { - resolve(colors); - }) - } - }, - getId: function (...args) { - console.warn("wallpaper.getId interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getMinHeight: function (...args) { - console.warn("wallpaper.getMinHeight interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getMinWidth: function (...args) { - console.warn("wallpaper.getMinWidth interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isChangePermitted: function (...args) { - console.warn("wallpaper.isChangePermitted interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isOperationAllowed: function (...args) { - console.warn("wallpaper.isOperationAllowed interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - reset: function (...args) { - console.warn("wallpaper.reset interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setWallpaper: function (...args) { - console.warn("wallpaper.setWallpaper interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getPixelMap: function (...args) { - console.warn("wallpaper.getPixelMap interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, PixelMapMock) - } else { - return new Promise((resolve, reject) => { - resolve(PixelMapMock); - }) - } - }, - screenshotLiveWallpaper: function (...args) { - console.warn("wallpaper.screenshotLiveWallpaper interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, PixelMapMock) - } else { - return new Promise((resolve, reject) => { - resolve(PixelMapMock); - }) - } - }, - on: function (...args) { - console.warn("wallpaper.on interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length - if (typeof args[len - 1] === 'function') { - if (args[0] == 'colorChange') { - let colors = new Array(); - colors.push(RgbaColorMock); - args[len - 1].call(this, colors, global.ohosplugin.wallpaper.WallpaperType.WALLPAPER_SYSTEM); - } - } - }, - off: function (...args) { - console.warn("wallpaper.off interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - if (args[0] == 'colorChange') { - let colors = new Array(); - colors.push(RgbaColorMock); - args[len - 1].call(this, colors, global.ohosplugin.wallpaper.WallpaperType.WALLPAPER_SYSTEM); - } - } + global.ohosplugin.wallpaper = { + WallpaperType: { + WALLPAPER_SYSTEM: '[PC preview] unknow WALLPAPER_SYSTEM', + WALLPAPER_LOCKSCREEN: '[PC preview] unknow WALLPAPER_LOCKSCREEN' + }, + getColors: function (...args) { + console.warn("wallpaper.getColors interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length; + let colors = new Array(); + colors.push(RgbaColorMock); + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, colors); + } else { + return new Promise((resolve, reject) => { + resolve(colors); + }) + } + }, + getId: function (...args) { + console.warn("wallpaper.getId interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getMinHeight: function (...args) { + console.warn("wallpaper.getMinHeight interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + getMinWidth: function (...args) { + console.warn("wallpaper.getMinWidth interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramNumberMock); + }) + } + }, + isChangePermitted: function (...args) { + console.warn("wallpaper.isChangePermitted interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + isOperationAllowed: function (...args) { + console.warn("wallpaper.isOperationAllowed interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + reset: function (...args) { + console.warn("wallpaper.reset interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + setWallpaper: function (...args) { + console.warn("wallpaper.setWallpaper interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve, reject) => { + resolve(); + }) + } + }, + getPixelMap: function (...args) { + console.warn("wallpaper.getPixelMap interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, PixelMapMock) + } else { + return new Promise((resolve, reject) => { + resolve(PixelMapMock); + }) + } + }, + screenshotLiveWallpaper: function (...args) { + console.warn("wallpaper.screenshotLiveWallpaper interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, PixelMapMock) + } else { + return new Promise((resolve, reject) => { + resolve(PixelMapMock); + }) + } + }, + on: function (...args) { + console.warn("wallpaper.on interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length + if (typeof args[len - 1] === 'function') { + if (args[0] == 'colorChange') { + let colors = new Array(); + colors.push(RgbaColorMock); + args[len - 1].call(this, colors, global.ohosplugin.wallpaper.WallpaperType.WALLPAPER_SYSTEM); } + } + }, + off: function (...args) { + console.warn("wallpaper.off interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + if (args[0] == 'colorChange') { + let colors = new Array(); + colors.push(RgbaColorMock); + args[len - 1].call(this, colors, global.ohosplugin.wallpaper.WallpaperType.WALLPAPER_SYSTEM); + } + } } - const RgbaColorMock = { - red: '[PC preview] unknow red', - green: '[PC preview] unknow green', - blue: '[PC preview] unknow blue', - alpha: '[PC preview] unknow alpha' - } + } + const RgbaColorMock = { + red: '[PC preview] unknow red', + green: '[PC preview] unknow green', + blue: '[PC preview] unknow blue', + alpha: '[PC preview] unknow alpha' + } } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/ohos/wantAgent.js b/runtime/main/extend/systemplugin/ohos/wantAgent.js index c9ee234a..e3a9b6d0 100644 --- a/runtime/main/extend/systemplugin/ohos/wantAgent.js +++ b/runtime/main/extend/systemplugin/ohos/wantAgent.js @@ -1,125 +1,140 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" export function mockWantAgent() { - const WantMock = { - deviceId: '[PC preview] unknow deviceId', - bundleName: '[PC preview] unknow bundleName', - abilityName: '[PC preview] unknow abilityName', - uri: '[PC preview] unknow uri', - type: '[PC preview] unknow type', - flags: '[PC preview] unknow flags', - action: '[PC preview] unknow action', - parameters: '[PC preview] unknow parameters', - entities: '[PC preview] unknow entities', - } - const CompleteDataMock = { - info: '[PC preview] unknow info', - want: '[PC preview] unknow want', - finalCode: '[PC preview] unknow finalCode', - finalData: '[PC preview] unknow finalData', - extraInfo: '[PC preview] unknow extraInfo', - } - const WantAgentMock = {} - global.ohosplugin.wantAgent = { - OperationType: { - UNKNOWN_TYPE: 0, - START_ABILITY: 1, - START_ABILITIES: 2, - START_SERVICE: 3, - SEND_COMMON_EVENT: 4 - }, - WantAgentFlags: { - ONE_TIME_FLAG: 0, - NO_BUILD_FLAG: 1, - CANCEL_PRESENT_FLAG: 2, - UPDATE_PRESENT_FLAG: 3, - CONSTANT_FLAG: 4, - REPLACE_ELEMENT: 5, - REPLACE_ACTION: 6, - REPLACE_URI: 7, - REPLACE_ENTITIES: 8, - REPLACE_BUNDLE: 9 - }, - getBundleName: function (...args) { - console.warn("wantAgent.getBundleName interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramStringMock); - }); - } - }, - getUid: function (...args) { - console.warn("wantAgent.getUid interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - getWant: function (...args) { - console.warn("wantAgent.getWant interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, WantMock); - } else { - return new Promise((resolve) => { - resolve(WantMock); - }); - } - }, - cancel: function (...args) { - console.warn("wantAgent.cancel interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - trigger: function (...args) { - console.warn("wantAgent.trigger interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, CompleteDataMock); - } - }, - equal: function (...args) { - console.warn("wantAgent.equal interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock); - }); - } - }, - getWantAgent: function (...args) { - console.warn("wantAgent.getWantAgent interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, WantAgentMock); - } else { - return new Promise((resolve) => { - resolve(WantAgentMock); - }); - } - }, - } + const WantMock = { + deviceId: '[PC preview] unknow deviceId', + bundleName: '[PC preview] unknow bundleName', + abilityName: '[PC preview] unknow abilityName', + uri: '[PC preview] unknow uri', + type: '[PC preview] unknow type', + flags: '[PC preview] unknow flags', + action: '[PC preview] unknow action', + parameters: '[PC preview] unknow parameters', + entities: '[PC preview] unknow entities', + } + const CompleteDataMock = { + info: '[PC preview] unknow info', + want: '[PC preview] unknow want', + finalCode: '[PC preview] unknow finalCode', + finalData: '[PC preview] unknow finalData', + extraInfo: '[PC preview] unknow extraInfo', + } + const WantAgentMock = {} + global.ohosplugin.wantAgent = { + OperationType: { + UNKNOWN_TYPE: 0, + START_ABILITY: 1, + START_ABILITIES: 2, + START_SERVICE: 3, + SEND_COMMON_EVENT: 4 + }, + WantAgentFlags: { + ONE_TIME_FLAG: 0, + NO_BUILD_FLAG: 1, + CANCEL_PRESENT_FLAG: 2, + UPDATE_PRESENT_FLAG: 3, + CONSTANT_FLAG: 4, + REPLACE_ELEMENT: 5, + REPLACE_ACTION: 6, + REPLACE_URI: 7, + REPLACE_ENTITIES: 8, + REPLACE_BUNDLE: 9 + }, + getBundleName: function (...args) { + console.warn("wantAgent.getBundleName interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve) => { + resolve(paramMock.paramStringMock); + }); + } + }, + getUid: function (...args) { + console.warn("wantAgent.getUid interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + } else { + return new Promise((resolve) => { + resolve(paramMock.paramNumberMock); + }); + } + }, + getWant: function (...args) { + console.warn("wantAgent.getWant interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, WantMock); + } else { + return new Promise((resolve) => { + resolve(WantMock); + }); + } + }, + cancel: function (...args) { + console.warn("wantAgent.cancel interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock); + } else { + return new Promise((resolve) => { + resolve(); + }); + } + }, + trigger: function (...args) { + console.warn("wantAgent.trigger interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, CompleteDataMock); + } + }, + equal: function (...args) { + console.warn("wantAgent.equal interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock); + }); + } + }, + getWantAgent: function (...args) { + console.warn("wantAgent.getWantAgent interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, WantAgentMock); + } else { + return new Promise((resolve) => { + resolve(WantAgentMock); + }); + } + }, + } } diff --git a/runtime/main/extend/systemplugin/ohos/workScheduler.js b/runtime/main/extend/systemplugin/ohos/workScheduler.js index 0b75cbc2..f94d40e8 100644 --- a/runtime/main/extend/systemplugin/ohos/workScheduler.js +++ b/runtime/main/extend/systemplugin/ohos/workScheduler.js @@ -1,98 +1,113 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "../utils" -export function mockWorkScheduler () { - const workInfoMock = { - workId: '[PC preview] unknown workId', - networkType: '[PC preview] unknown networkType', - isDeepIdle: '[PC preview] unknown isDeepIdle', - idleWaitTime: '[PC preview] unknown idleWaitTime', - isCharging: '[PC preview] unknown isCharging', - chargerType: '[PC preview] unknown chargerType', - batteryLevel: '[PC preview] unknown batteryLevel', - batteryStatus: '[PC preview] unknown batteryStatus', - storageRequest: '[PC preview] unknown storageRequest', - isRepeat: '[PC preview] unknown isRepeat', - isPersisted: '[PC preview] unknown isPersisted', - repeatCycleTime: '[PC preview] unknown repeatCycleTime', - repeatCount: '[PC preview] unknown repeatCount', - bundleName: '[PC preview] unknown bundleName', - abilityName: '[PC preview] unknown abilityName', - } - const workInfoArrayMock = [workInfoMock] - const NetworkTypeMock = { - NETWORK_TYPE_AN: 0, - NETWORK_TYPE_MOBILE: 1, - NETWORK_TYPE_WIFI: 2, - NETWORK_TYPE_BLUETOOTH: 3, - NETWORK_TYPE_WIFI_P2P: 4, - NETWORK_TYPE_ETHERNET: 5, - } - const ChargingType = { - CHARGING_PLUGGED_ANY: 0, - CHARGING_PLUGGED_AC: 1, - CHARGING_PLUGGED_USB: 2, - CHARGING_PLUGGED_WIRELESS: 3, - } - const BatteryStatus = { - BATTERY_STATUS_LOW: 0, - BATTERY_STATUS_OKAY: 1, - BATTERY_STATUS_LOW_OR_OKAY: 2, - } - const StorageRequest = { - STORAGE_LEVEL_LOW: 0, - STORAGE_LEVEL_OKAY: 1, - STORAGE_LEVEL_LOW_OR_OKAY: 2 - } - global.ohosplugin.workScheduler = { - startWork: function (...args) { - console.warn("workScheduler.startWork interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - stopWork: function (...args) { - console.warn("workScheduler.stopWork interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getWorkStatus: function (...args) { - console.warn("workScheduler.getWorkStatus interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, workInfoMock) - } else { - return new Promise(resolve => { - resolve(workInfoMock); - }) - } - }, - obtainAllWorks: function (...args) { - console.warn("workScheduler.obtainAllWorks interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, workInfoArrayMock) - } else { - return new Promise(resolve => { - resolve(workInfoArrayMock); - }) - } - }, - stopAndClearWorks: function (...args) { - console.warn("workScheduler.stopAndClearWorks interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - isLastWorkTimeOut: function (...args) { - console.warn("workScheduler.isLastWorkTimeOut interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) - } else { - return new Promise(resolve => { - resolve(paramMock.paramBooleanMock); - }) - } - } +export function mockWorkScheduler() { + const workInfoMock = { + workId: '[PC preview] unknown workId', + networkType: '[PC preview] unknown networkType', + isDeepIdle: '[PC preview] unknown isDeepIdle', + idleWaitTime: '[PC preview] unknown idleWaitTime', + isCharging: '[PC preview] unknown isCharging', + chargerType: '[PC preview] unknown chargerType', + batteryLevel: '[PC preview] unknown batteryLevel', + batteryStatus: '[PC preview] unknown batteryStatus', + storageRequest: '[PC preview] unknown storageRequest', + isRepeat: '[PC preview] unknown isRepeat', + isPersisted: '[PC preview] unknown isPersisted', + repeatCycleTime: '[PC preview] unknown repeatCycleTime', + repeatCount: '[PC preview] unknown repeatCount', + bundleName: '[PC preview] unknown bundleName', + abilityName: '[PC preview] unknown abilityName', + } + const workInfoArrayMock = [workInfoMock] + const NetworkTypeMock = { + NETWORK_TYPE_AN: 0, + NETWORK_TYPE_MOBILE: 1, + NETWORK_TYPE_WIFI: 2, + NETWORK_TYPE_BLUETOOTH: 3, + NETWORK_TYPE_WIFI_P2P: 4, + NETWORK_TYPE_ETHERNET: 5, + } + const ChargingType = { + CHARGING_PLUGGED_ANY: 0, + CHARGING_PLUGGED_AC: 1, + CHARGING_PLUGGED_USB: 2, + CHARGING_PLUGGED_WIRELESS: 3, + } + const BatteryStatus = { + BATTERY_STATUS_LOW: 0, + BATTERY_STATUS_OKAY: 1, + BATTERY_STATUS_LOW_OR_OKAY: 2, + } + const StorageRequest = { + STORAGE_LEVEL_LOW: 0, + STORAGE_LEVEL_OKAY: 1, + STORAGE_LEVEL_LOW_OR_OKAY: 2 + } + global.ohosplugin.workScheduler = { + startWork: function (...args) { + console.warn("workScheduler.startWork interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + stopWork: function (...args) { + console.warn("workScheduler.stopWork interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; + }, + getWorkStatus: function (...args) { + console.warn("workScheduler.getWorkStatus interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, workInfoMock) + } else { + return new Promise(resolve => { + resolve(workInfoMock); + }) + } + }, + obtainAllWorks: function (...args) { + console.warn("workScheduler.obtainAllWorks interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, workInfoArrayMock) + } else { + return new Promise(resolve => { + resolve(workInfoArrayMock); + }) + } + }, + stopAndClearWorks: function (...args) { + console.warn("workScheduler.stopAndClearWorks interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + isLastWorkTimeOut: function (...args) { + console.warn("workScheduler.isLastWorkTimeOut interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length; + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) + } else { + return new Promise(resolve => { + resolve(paramMock.paramBooleanMock); + }) + } } + } } diff --git a/runtime/main/extend/systemplugin/pasteboard.js b/runtime/main/extend/systemplugin/pasteboard.js index b1eda885..c0a9943d 100644 --- a/runtime/main/extend/systemplugin/pasteboard.js +++ b/runtime/main/extend/systemplugin/pasteboard.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "./utils" export function mockPasteBoard() { diff --git a/runtime/main/extend/systemplugin/request.js b/runtime/main/extend/systemplugin/request.js index 640ff383..92f5f3b7 100644 --- a/runtime/main/extend/systemplugin/request.js +++ b/runtime/main/extend/systemplugin/request.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { hasComplete } from "./utils" export function mockRequest() { diff --git a/runtime/main/extend/systemplugin/screenLock.js b/runtime/main/extend/systemplugin/screenLock.js index ce383a8c..ffaf61fe 100644 --- a/runtime/main/extend/systemplugin/screenLock.js +++ b/runtime/main/extend/systemplugin/screenLock.js @@ -1,42 +1,57 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "./utils" -export function mockScreenLock () { - global.systemplugin.screenLock = { - isScreenLocked: function (...args) { - console.warn("screenLock.isScreenLocked interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock,paramMock.paramBooleanMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isSecureMode: function (...args) { - console.warn("screenLock.isSecureMode interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock,paramMock.paramBooleanMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - unlockScreen: function (...args) { - console.warn("screenLock.unlockScreen interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve(); - }) - } - } +export function mockScreenLock() { + global.systemplugin.screenLock = { + isScreenLocked: function (...args) { + console.warn("screenLock.isScreenLocked interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + isSecureMode: function (...args) { + console.warn("screenLock.isSecureMode interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + unlockScreen: function (...args) { + console.warn("screenLock.unlockScreen interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve(); + }) + } } + } } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/screenshot.js b/runtime/main/extend/systemplugin/screenshot.js index 0bfc64be..ac0bf318 100644 --- a/runtime/main/extend/systemplugin/screenshot.js +++ b/runtime/main/extend/systemplugin/screenshot.js @@ -1,22 +1,37 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "./utils" export function mockScreenshot() { - const screenshotMock = { - ImageSource: '[PC preview] unknow ImageSource' - } + const screenshotMock = { + ImageSource: '[PC preview] unknow ImageSource' + } - global.systemplugin.screenshot = { - save: function (...args) { - console.warn("screenshot.save interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, screenshotMock) - } else { - return new Promise((resolve, reject) => { - resolve(screenshotMock) - }) - } - } + global.systemplugin.screenshot = { + save: function (...args) { + console.warn("screenshot.save interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, screenshotMock) + } else { + return new Promise((resolve, reject) => { + resolve(screenshotMock) + }) + } } + } } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/sensor.js b/runtime/main/extend/systemplugin/sensor.js index 614c2f97..55fa3d8a 100644 --- a/runtime/main/extend/systemplugin/sensor.js +++ b/runtime/main/extend/systemplugin/sensor.js @@ -1,4 +1,19 @@ -import {getRandomArbitrary, hasComplete, paramMock} from './utils' +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { getRandomArbitrary, hasComplete, paramMock } from './utils' export function mockSensor() { global.systemplugin.sensor = {} @@ -18,7 +33,7 @@ export function mockSensor() { } function mockAccelerometer() { - global.systemplugin.sensor.subscribeAccelerometer = function(...args) { + global.systemplugin.sensor.subscribeAccelerometer = function (...args) { console.warn("sensor.subscribeAccelerometer interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") const time = { @@ -42,7 +57,7 @@ function mockAccelerometer() { args[0].success(ret) }, timer) } - global.systemplugin.sensor.unsubscribeAccelerometer = function() { + global.systemplugin.sensor.unsubscribeAccelerometer = function () { console.warn("sensor.unsubscribeAccelerometer interface mocked in the Previewer. How this interface works on" + " the Previewer may be different from that on a real device.") clearInterval(this.unsubscribeAcc) @@ -51,7 +66,7 @@ function mockAccelerometer() { } function mockBarometer() { - global.systemplugin.sensor.subscribeBarometer = function(...args) { + global.systemplugin.sensor.subscribeBarometer = function (...args) { console.warn("sensor.subscribeBarometer interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") if (!this.unsubscribePressure) { @@ -62,7 +77,7 @@ function mockBarometer() { }, 500) } } - global.systemplugin.sensor.unsubscribeBarometer = function() { + global.systemplugin.sensor.unsubscribeBarometer = function () { console.warn("sensor.unsubscribeBarometer interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") clearInterval(this.unsubscribePressure) @@ -71,7 +86,7 @@ function mockBarometer() { } function mockCompass() { - global.systemplugin.sensor.subscribeCompass = function(...args) { + global.systemplugin.sensor.subscribeCompass = function (...args) { console.warn("sensor.subscribeCompass interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") if (!this.unsubscribeDirection) { @@ -82,7 +97,7 @@ function mockCompass() { }, 100) } } - global.systemplugin.sensor.unsubscribeCompass = function() { + global.systemplugin.sensor.unsubscribeCompass = function () { console.warn("sensor.unsubscribeCompass interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") clearInterval(this.unsubscribeDirection) @@ -91,7 +106,7 @@ function mockCompass() { } function mockGyroscope() { - global.systemplugin.sensor.subscribeGyroscope = function(...args) { + global.systemplugin.sensor.subscribeGyroscope = function (...args) { console.warn("sensor.subscribeGyroscope interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") const time = { @@ -115,7 +130,7 @@ function mockGyroscope() { args[0].success(ret) }, timer) } - global.systemplugin.sensor.unsubscribeGyroscope = function() { + global.systemplugin.sensor.unsubscribeGyroscope = function () { console.warn("sensor.unsubscribeGyroscope interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") clearInterval(this.unsubscribeGyr) @@ -124,7 +139,7 @@ function mockGyroscope() { } function mockDeviceOrientation() { - global.systemplugin.sensor.subscribeDeviceOrientation = function(...args) { + global.systemplugin.sensor.subscribeDeviceOrientation = function (...args) { console.warn("sensor.subscribeDeviceOrientation interface mocked in the Previewer. How this interface works on" + " the Previewer may be different from that on a real device.") const time = { @@ -148,7 +163,7 @@ function mockDeviceOrientation() { args[0].success(ret) }, timer) } - global.systemplugin.sensor.unsubscribeDeviceOrientation = function() { + global.systemplugin.sensor.unsubscribeDeviceOrientation = function () { console.warn("sensor.unsubscribeDeviceOrientation interface mocked in the Previewer. How this interface works" + " on the Previewer may be different from that on a real device.") clearInterval(this.unsubscribeDevOri) @@ -157,7 +172,7 @@ function mockDeviceOrientation() { } function mockHeartRate() { - global.systemplugin.sensor.subscribeHeartRate = function(...args) { + global.systemplugin.sensor.subscribeHeartRate = function (...args) { console.warn("sensor.subscribeHeartRate interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") if (!this.unsubscribeRate) { @@ -167,8 +182,8 @@ function mockHeartRate() { args[0].success(ret) }, 500) } - }, - global.systemplugin.sensor.unsubscribeHeartRate = function() { + } + global.systemplugin.sensor.unsubscribeHeartRate = function () { console.warn("sensor.unsubscribeHeartRate interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") clearInterval(this.unsubscribeRate) @@ -177,7 +192,7 @@ function mockHeartRate() { } function mockLight() { - global.systemplugin.sensor.subscribeLight = function(...args) { + global.systemplugin.sensor.subscribeLight = function (...args) { console.warn("sensor.subscribeLight interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") if (!this.unsubscribeIntensity) { @@ -188,7 +203,7 @@ function mockLight() { }, 500) } } - global.systemplugin.sensor.unsubscribeLight = function() { + global.systemplugin.sensor.unsubscribeLight = function () { console.warn("sensor.unsubscribeLight interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") clearInterval(this.unsubscribeIntensity) @@ -197,7 +212,7 @@ function mockLight() { } function mockOnBodyState() { - global.systemplugin.sensor.subscribeOnBodyState = function(...args) { + global.systemplugin.sensor.subscribeOnBodyState = function (...args) { console.warn("sensor.subscribeOnBodyState interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") if (!this.unsubscribeBodyState) { @@ -208,7 +223,7 @@ function mockOnBodyState() { }, 500) } } - global.systemplugin.sensor.unsubscribeOnBodyState = function() { + global.systemplugin.sensor.unsubscribeOnBodyState = function () { console.warn("sensor.unsubscribeOnBodyState interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") clearInterval(this.unsubscribeBodyState) @@ -226,7 +241,7 @@ function mockOnBodyState() { } function mockProximity() { - global.systemplugin.sensor.subscribeProximity = function(...args) { + global.systemplugin.sensor.subscribeProximity = function (...args) { console.warn("sensor.subscribeProximity interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") if (!this.unsubscribeDistance) { @@ -237,7 +252,7 @@ function mockProximity() { }, 1000) } } - global.systemplugin.sensor.unsubscribeProximity = function() { + global.systemplugin.sensor.unsubscribeProximity = function () { console.warn("sensor.unsubscribeProximity interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") clearInterval(this.unsubscribeDistance) @@ -246,18 +261,18 @@ function mockProximity() { } function mockStepCounter() { - global.systemplugin.sensor.subscribeStepCounter = function(...args) { + global.systemplugin.sensor.subscribeStepCounter = function (...args) { console.warn("sensor.subscribeStepCounter interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") if (!this.unsubscribeSteps) { - let ret = {steps: 0} + let ret = { steps: 0 } this.unsubscribeSteps = setInterval(() => { ret.steps += 1 args[0].success(ret) }, 1000) } } - global.systemplugin.sensor.unsubscribeStepCounter = function() { + global.systemplugin.sensor.unsubscribeStepCounter = function () { console.warn("sensor.unsubscribeStepCounter interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") clearInterval(this.unsubscribeSteps) @@ -266,7 +281,7 @@ function mockStepCounter() { } function mockGravity() { - global.systemplugin.sensor.subscribeGravity = function(...args) { + global.systemplugin.sensor.subscribeGravity = function (...args) { console.warn("sensor.subscribeGravity interface mocked in the Previewer. How this interface works on" + " the Previewer may be different from that on a real device.") const time = { @@ -290,7 +305,7 @@ function mockGravity() { args[0].success(ret) }, timer) } - global.systemplugin.sensor.unsubscribeGravity = function() { + global.systemplugin.sensor.unsubscribeGravity = function () { console.warn("sensor.unsubscribeGravity interface mocked in the Previewer. How this interface works" + " on the Previewer may be different from that on a real device.") clearInterval(this.unsubscribeGrav) @@ -299,7 +314,7 @@ function mockGravity() { } function mockMagnetic() { - global.systemplugin.sensor.subscribeMagnetic = function(...args) { + global.systemplugin.sensor.subscribeMagnetic = function (...args) { console.warn("sensor.subscribeMagnetic interface mocked in the Previewer. How this interface works on" + " the Previewer may be different from that on a real device.") const time = { @@ -323,7 +338,7 @@ function mockMagnetic() { args[0].success(ret) }, timer) } - global.systemplugin.sensor.unsubscribeMagnetic = function() { + global.systemplugin.sensor.unsubscribeMagnetic = function () { console.warn("sensor.unsubscribeMagnetic interface mocked in the Previewer. How this interface works" + " on the Previewer may be different from that on a real device.") clearInterval(this.unsubscribeMag) @@ -332,7 +347,7 @@ function mockMagnetic() { } function mockHall() { - global.systemplugin.sensor.subscribeHall = function(...args) { + global.systemplugin.sensor.subscribeHall = function (...args) { console.warn("sensor.subscribeHall interface mocked in the Previewer. How this interface works on" + " the Previewer may be different from that on a real device.") const time = { @@ -354,7 +369,7 @@ function mockHall() { args[0].success(ret) }, timer) } - global.systemplugin.sensor.unsubscribeHall = function() { + global.systemplugin.sensor.unsubscribeHall = function () { console.warn("sensor.unsubscribeHall interface mocked in the Previewer. How this interface works" + " on the Previewer may be different from that on a real device.") clearInterval(this.unsubscribeHal) diff --git a/runtime/main/extend/systemplugin/storage.js b/runtime/main/extend/systemplugin/storage.js index b3d73201..bb6ba3f7 100644 --- a/runtime/main/extend/systemplugin/storage.js +++ b/runtime/main/extend/systemplugin/storage.js @@ -1,30 +1,45 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { hasComplete } from "./utils" export function mockStorage() { - global.systemplugin.storage = { - get: function(...args) { - console.warn("storage.get interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - args[0].success("[PC Preview]: no system") - hasComplete(args[0].complete) - }, - set: function(...args) { - console.warn("storage.set interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - args[0].success("[PC Preview]: no system") - hasComplete(args[0].complete) - }, - clear: function(...args) { - console.warn("storage.clear interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - args[0].success("[PC Preview]: no system") - hasComplete(args[0].complete) - }, - delete: function(...args) { - console.warn("storage.delete interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - args[0].success("[PC Preview]: no system") - hasComplete(args[0].complete) - } + global.systemplugin.storage = { + get: function (...args) { + console.warn("storage.get interface mocked in the Previewer. How this interface works on the Previewer may be" + + " different from that on a real device.") + args[0].success("[PC Preview]: no system") + hasComplete(args[0].complete) + }, + set: function (...args) { + console.warn("storage.set interface mocked in the Previewer. How this interface works on the Previewer may be" + + " different from that on a real device.") + args[0].success("[PC Preview]: no system") + hasComplete(args[0].complete) + }, + clear: function (...args) { + console.warn("storage.clear interface mocked in the Previewer. How this interface works on the Previewer may be" + + " different from that on a real device.") + args[0].success("[PC Preview]: no system") + hasComplete(args[0].complete) + }, + delete: function (...args) { + console.warn("storage.delete interface mocked in the Previewer. How this interface works on the Previewer may be" + + " different from that on a real device.") + args[0].success("[PC Preview]: no system") + hasComplete(args[0].complete) } - } \ No newline at end of file + } +} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/systemPackage.js b/runtime/main/extend/systemplugin/systemPackage.js index 275bbd09..d17d10ac 100644 --- a/runtime/main/extend/systemplugin/systemPackage.js +++ b/runtime/main/extend/systemplugin/systemPackage.js @@ -1,12 +1,27 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { hasComplete } from "./utils" export function mockSystemPackage() { - global.systemplugin.package = { - hasInstalled: function (...args) { - console.warn("package.hasInstalled interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - args[0].success(true) - hasComplete(args[0].complete) - } + global.systemplugin.package = { + hasInstalled: function (...args) { + console.warn("package.hasInstalled interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + args[0].success(true) + hasComplete(args[0].complete) } - } \ No newline at end of file + } +} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/telephony.js b/runtime/main/extend/systemplugin/telephony.js index fe1ed723..e8993071 100644 --- a/runtime/main/extend/systemplugin/telephony.js +++ b/runtime/main/extend/systemplugin/telephony.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "./utils" const CallState = "[PC Preview] unknow CallState"; diff --git a/runtime/main/extend/systemplugin/userIAM.js b/runtime/main/extend/systemplugin/userIAM.js index 73151956..06ed6212 100644 --- a/runtime/main/extend/systemplugin/userIAM.js +++ b/runtime/main/extend/systemplugin/userIAM.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "./utils" export function mockUserauth() { diff --git a/runtime/main/extend/systemplugin/utils.js b/runtime/main/extend/systemplugin/utils.js index d9e8592e..fdfd56c8 100644 --- a/runtime/main/extend/systemplugin/utils.js +++ b/runtime/main/extend/systemplugin/utils.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + export function hasComplete(...args) { if (args[0] === undefined) { return; diff --git a/runtime/main/extend/systemplugin/vibrator.js b/runtime/main/extend/systemplugin/vibrator.js index 41e6e89e..f4013d6d 100644 --- a/runtime/main/extend/systemplugin/vibrator.js +++ b/runtime/main/extend/systemplugin/vibrator.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { hasComplete } from "./utils" export function mockVibrator() { diff --git a/runtime/main/extend/systemplugin/wifi.js b/runtime/main/extend/systemplugin/wifi.js index 14ebcea7..b329990f 100644 --- a/runtime/main/extend/systemplugin/wifi.js +++ b/runtime/main/extend/systemplugin/wifi.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "./utils" export function mockWifi() { diff --git a/runtime/main/extend/systemplugin/window.js b/runtime/main/extend/systemplugin/window.js index 42033044..0cb9ea6a 100644 --- a/runtime/main/extend/systemplugin/window.js +++ b/runtime/main/extend/systemplugin/window.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { paramMock } from "./utils" export const windowPropertiesMock = { diff --git a/runtime/preparation/init.ts b/runtime/preparation/init.ts index 0a141c98..28dc07f6 100644 --- a/runtime/preparation/init.ts +++ b/runtime/preparation/init.ts @@ -111,43 +111,43 @@ type components = { } const ComponentsInfo: components[] = [ - {'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'clock'}, - {'methods': ['show'], 'type': 'colorpicker'}, - {'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'image'}, - {'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'label'}, - {'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'list-item'}, - {'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'list-item-group'}, - {'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'progress'}, - {'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'rating'}, - {'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'select'}, - {'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'switch'}, - {'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'tabs'}, - {'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'tab-bar'}, - {'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'tab-content'}, - {'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'text'}, - {'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'div'}, + { 'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'clock' }, + { 'methods': ['show'], 'type': 'colorpicker' }, + { 'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'image' }, + { 'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'label' }, + { 'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'list-item' }, + { 'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'list-item-group' }, + { 'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'progress' }, + { 'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'rating' }, + { 'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'select' }, + { 'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'switch' }, + { 'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'tabs' }, + { 'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'tab-bar' }, + { 'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'tab-content' }, + { 'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'text' }, + { 'methods': ['focus', 'addChild', 'animate', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'div' }, { - 'methods': ['setProgress', 'focus', 'addChild', 'animate', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], + 'methods': ['setProgress', 'focus', 'addChild', 'animate', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'button' }, - {'methods': ['append', 'focus', 'addChild', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'chart'}, - {'methods': ['goto', 'focus', 'addChild', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'calendar'}, + { 'methods': ['append', 'focus', 'addChild', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'chart' }, + { 'methods': ['goto', 'focus', 'addChild', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'calendar' }, { - 'methods': ['getContext', 'toDataURL', 'focus', 'addChild', 'animate', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], + 'methods': ['getContext', 'toDataURL', 'focus', 'addChild', 'animate', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'canvas' }, { 'methods': ['getXComponentContext', 'createIntersectionObserver', 'addChild', 'getXComponentSurfaceId'], 'type': 'xcomponent' }, - {'methods': ['show', 'close', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver', 'addChild'], 'type': 'dialog'}, - {'methods': ['animate', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver', 'addChild'], 'type': 'divider'}, + { 'methods': ['show', 'close', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver', 'addChild'], 'type': 'dialog' }, + { 'methods': ['animate', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver', 'addChild'], 'type': 'divider' }, { - 'methods': ['getColumns', 'getColumnWidth', 'getGutterWidth', 'getSizeType', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver', 'addChild'], + 'methods': ['getColumns', 'getColumnWidth', 'getGutterWidth', 'getSizeType', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver', 'addChild'], 'type': 'grid-container' }, { - 'methods': ['start', 'stop', 'pause', 'resume', 'getState', 'focus', 'addChild', 'animate', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], + 'methods': ['start', 'stop', 'pause', 'resume', 'getState', 'focus', 'addChild', 'animate', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'image-animator' }, { @@ -155,46 +155,46 @@ const ComponentsInfo: components[] = [ 'type': 'input' }, { - 'methods': ['scrollTo', 'scrollBy', 'focus', 'addChild', 'scrollArrow', 'scrollTop', 'scrollBottom', 'scrollPage', 'collapseGroup', 'expandGroup', 'currentOffset', 'rotation', 'animate', 'chainanimation', 'getBoundingClientRect', 'getScrollOffset', 'createIntersectionObserver'], + 'methods': ['scrollTo', 'scrollBy', 'focus', 'addChild', 'scrollArrow', 'scrollTop', 'scrollBottom', 'scrollPage', 'collapseGroup', 'expandGroup', 'currentOffset', 'rotation', 'animate', 'chainanimation', 'getBoundingClientRect', 'getInspector', 'getScrollOffset', 'createIntersectionObserver'], 'type': 'list' }, { - 'methods': ['start', 'stop', 'focus', 'addChild', 'animate', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], + 'methods': ['start', 'stop', 'focus', 'addChild', 'animate', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'marquee' }, - {'methods': ['show', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver', 'addChild'], 'type': 'menu'}, - {'methods': ['focus', 'addChild', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'option'}, - {'methods': ['show', 'close', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver', 'addChild'], 'type': 'panel'}, - {'methods': ['show', 'animate', 'focus', 'addChild', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'picker'}, + { 'methods': ['show', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver', 'addChild'], 'type': 'menu' }, + { 'methods': ['focus', 'addChild', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'option' }, + { 'methods': ['show', 'close', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver', 'addChild'], 'type': 'panel' }, + { 'methods': ['show', 'animate', 'focus', 'addChild', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'picker' }, { - 'methods': ['rotation', 'animate', 'focus', 'addChild', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], + 'methods': ['rotation', 'animate', 'focus', 'addChild', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'picker-view' }, - {'methods': ['focus', 'addChild', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'piece'}, - {'methods': ['focus', 'addChild', 'show', 'hide', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'popup'}, - {'methods': ['animate', 'focus', 'addChild', 'delete', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'search'}, + { 'methods': ['focus', 'addChild', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'piece' }, + { 'methods': ['focus', 'addChild', 'show', 'hide', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'popup' }, + { 'methods': ['animate', 'focus', 'addChild', 'delete', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'search' }, { - 'methods': ['rotation', 'focus', 'addChild', 'animate', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], + 'methods': ['rotation', 'focus', 'addChild', 'animate', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'slider' }, - {'methods': ['focus', 'addChild', 'animate', 'getScrollOffset', 'scrollBy', 'getBoundingClientRect', 'scrollTo', 'createIntersectionObserver'], 'type': 'stack'}, + { 'methods': ['focus', 'addChild', 'animate', 'getScrollOffset', 'scrollBy', 'getBoundingClientRect', 'getInspector', 'scrollTo', 'createIntersectionObserver'], 'type': 'stack' }, { - 'methods': ['swipeTo', 'focus', 'addChild', 'showPrevious', 'showNext', 'rotation', 'animate', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], + 'methods': ['swipeTo', 'focus', 'addChild', 'showPrevious', 'showNext', 'rotation', 'animate', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'swiper' }, { - 'methods': ['start', 'pause', 'stop', 'setCurrentTime', 'requestFullscreen', 'exitFullscreen', 'focus', 'addChild', 'animate', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], + 'methods': ['start', 'pause', 'stop', 'setCurrentTime', 'requestFullscreen', 'exitFullscreen', 'focus', 'addChild', 'animate', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'video' }, { - 'methods': ['setNextButtonStatus', 'focus', 'addChild', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], + 'methods': ['setNextButtonStatus', 'focus', 'addChild', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'stepper' }, { - 'methods': ['focus', 'addChild', 'animate', 'delete', 'getBoundingClientRect', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], + 'methods': ['focus', 'addChild', 'animate', 'delete', 'getBoundingClientRect', 'getInspector', 'scrollBy', 'getScrollOffset', 'scrollTo', 'createIntersectionObserver'], 'type': 'textarea' }, - {'methods': ['reload', 'createIntersectionObserver', 'addChild'], 'type': 'web'}, + { 'methods': ['reload', 'createIntersectionObserver', 'addChild'], 'type': 'web' }, { 'methods': ['takePhoto', 'startRecorder', 'closeRecorder', 'scrollTo', 'createIntersectionObserver', 'addChild'], 'type': 'camera' diff --git a/test/ut/extend/i18n.ts b/test/ut/extend/i18n.ts deleted file mode 100644 index a871445a..00000000 --- a/test/ut/extend/i18n.ts +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import chai from 'chai'; -import sinon from 'sinon'; -import { - describe, - it, - after -} from 'mocha'; -import { - fakeLog, - fakeLogRestore -} from '../../fakeLog'; -import i18n from '../../../runtime/main/extend/i18n'; -import { getValue } from '../../../runtime/utils'; - -const expect = chai.expect; - -describe('api of i18n', () => { - fakeLog(); - - const i18nOptions0 = { - locale: 'zh', - messages: [ - { - 'strings': { - 'hello': 'hello' - }, - 'files': { - 'image': 'image/rain_bg.jpg' - } - }, - { - 'strings': { - 'hello': 'Hello world!', - 'object': 'Object parameter substitution-{name}', - 'object1': 'Object parameter substitution-{name1}-{name0}', - 'array': 'Array type parameter substitution-{0}', - 'array1': 'Array type parameter substitution-{1}-{0}-{2}', - 'num': 1, - 'bool': true, - 'plurals': { - 'one': 'one person', - 'other': '{count} people' - } - }, - 'files': { - 'image': 'image/en_picture.PNG' - } - } - ] - }; - const i18nOptions1 = { - locale: 'en', - messages: [[], {'strings': 'hello'}] - }; - const i18nPluralRules = { - select: (count) => { - return count === 1 ? 'one' : 'other'; - } - }; - const I18n = i18n.I18n.create(0).instance.I18n; - const i18nInstance0 = new I18n(i18nOptions0); - const i18nInstance1 = new I18n(i18nOptions1); - const fakeGetChoice = sinon.stub(i18nInstance0, '_getChoice').callsFake((count, path, message) => { - const pluralChoice = i18nPluralRules.select(count); - if (!pluralChoice) { - return path; - } - return getValue(pluralChoice, message); - }); - - after(() => { - fakeGetChoice.restore(); - }); - - describe('i18n', () => { - it('$t(path)', () => { - expect(i18nInstance0.$t).to.be.an.instanceof(Function); - expect(i18nInstance0.$t('strings.hello')).eql('hello'); - expect(i18nInstance0.$t('strings.num')).eql(1); - expect(i18nInstance0.$t('strings.bool')).to.be.true; - expect(i18nInstance0.$t('files.image')).eql('image/rain_bg.jpg'); - expect(i18nInstance0.$t('strings.plurals.one')).eql('one person'); - expect(i18nInstance0.$t('strings.plurals')).eql({ - 'one': 'one person', - 'other': '{count} people' - }); - expect(i18nInstance0.$t('strings.plurals')['one']).eql('one person'); - expect(i18nInstance0.$t('strings.plurals')['two']).eql(undefined); - expect(i18nInstance0.$t('strings.hell.key')).eql('strings.hell.key'); - expect(i18nInstance0.$t(null)).to.be.undefined; - expect(i18nInstance0.$t(undefined)).to.be.undefined; - - // @ts-ignore - expect(i18nInstance0.$t(1)).to.be.undefined; - }); - - it('$t(path, params)', () => { - expect(i18nInstance0.$t('strings.object', {'name': 'object_value'})) - .eql('Object parameter substitution-object_value'); - expect(i18nInstance0.$t('strings.object1', {'name0': 'object_value_0', 'name1': 'object_value_1'})) - .eql('Object parameter substitution-object_value_1-object_value_0'); - expect(i18nInstance0.$t('strings.array', [1])) - .eql('Array type parameter substitution-1'); - expect(i18nInstance0.$t('strings.array1', [1, false])) - .eql('Array type parameter substitution-false-1-'); - expect(i18nInstance0.$t('strings.array1', null)) - .eql('Array type parameter substitution-{1}-{0}-{2}'); - expect(i18nInstance0.$t('strings.array1', undefined)) - .eql('Array type parameter substitution-{1}-{0}-{2}'); - expect(i18nInstance0.$t('strings.array1', 1)) - .eql('Array type parameter substitution-{1}-{0}-{2}'); - expect(i18nInstance0.$t('strings.array1', {0: 'object_value_0', 1: 'object_value_1'})) - .eql('Array type parameter substitution-object_value_1-object_value_0-'); - expect(i18nInstance0.$t('strings.array1', {'name0': 'object_value_0', 'name1': 'object_value_1'})) - .eql('Array type parameter substitution---'); - }); - - it('$tc(path, count)', () => { - expect(i18nInstance0.$tc).to.be.an.instanceof(Function); - expect(i18nInstance0.$tc('strings.plurals', 0)).eql('0 people'); - expect(i18nInstance0.$tc('strings.plurals', 1)).eql('one person'); - expect(i18nInstance0.$tc('strings.plurals', undefined)).eql('one person'); - expect(i18nInstance0.$tc('strings.plurals')).eql('one person'); - expect(i18nInstance0.$tc('strings.plurals', null)).eql('one person'); - expect(i18nInstance0.$tc('strings.hello', 0)).eql('strings.hello'); - expect(i18nInstance0.$tc('strings.hello')).eql('strings.hello'); - expect(i18nInstance0.$tc(null)).to.be.undefined; - expect(i18nInstance0.$tc(undefined)).to.be.undefined; - - // @ts-ignore - expect(i18nInstance0.$tc(1)).to.be.undefined; - }); - - it('messages are null', () => { - expect(i18nInstance1.$t('strings.hello')).eql('strings.hello'); - expect(i18nInstance1.$t('strings')).eql('hello'); - }); - }); - - fakeLogRestore(); -});