From 804dc39caea7b562bb42501a14637f87ea47fbfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=BF=E6=96=87=E5=B9=BF?= Date: Tue, 19 Jul 2022 15:15:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=85=E7=AE=A1=E8=A1=A5=E9=BD=90mock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 耿文广 --- .../systemplugin/napi/bundle/abilityInfo.js | 3 + .../systemplugin/napi/bundle/bundleInfo.js | 2 +- .../napi/bundle/bundleInstaller.js | 1 + .../systemplugin/napi/bundle/hapModuleInfo.js | 5 ++ .../napi/bundle/launcherAbilityInfo.js | 4 +- .../systemplugin/napi/bundle/packInfo.js | 2 +- .../extend/systemplugin/napi/ohos_zlib.js | 79 +++++++++---------- 7 files changed, 50 insertions(+), 46 deletions(-) diff --git a/runtime/main/extend/systemplugin/napi/bundle/abilityInfo.js b/runtime/main/extend/systemplugin/napi/bundle/abilityInfo.js index 3bcd1e31..3a0bbf33 100644 --- a/runtime/main/extend/systemplugin/napi/bundle/abilityInfo.js +++ b/runtime/main/extend/systemplugin/napi/bundle/abilityInfo.js @@ -41,6 +41,9 @@ export const AbilityInfo = { appId: '[PC Preview] unknow appId', label: "[PC preview] unknown label", description: "[PC preview] unknown description", + icon: "[PC preview] unknown icon", + labelId: "[PC preview] unknown labelId", + iconId: "[PC preview] unknown iconId", uid: '[PC Preview] unknow uid', installTime: '[PC Preview] unknow installTime', updateTime: '[PC Preview] unknow updateTime', diff --git a/runtime/main/extend/systemplugin/napi/bundle/bundleInfo.js b/runtime/main/extend/systemplugin/napi/bundle/bundleInfo.js index c55193b6..68793e40 100644 --- a/runtime/main/extend/systemplugin/napi/bundle/bundleInfo.js +++ b/runtime/main/extend/systemplugin/napi/bundle/bundleInfo.js @@ -39,7 +39,7 @@ export const BundleInfo = { installTime: "[PC preview] unknown installTime", updateTime: "[PC preview] unknown updateTime", appInfo: ApplicationInfo, - abilityInfo: [AbilityInfo], + abilityInfos: [AbilityInfo], reqPermissions: [paramMock.paramStringMock], reqPermissionDetails: [ReqPermissionDetail], vendor: "[PC preview] unknown vendor", diff --git a/runtime/main/extend/systemplugin/napi/bundle/bundleInstaller.js b/runtime/main/extend/systemplugin/napi/bundle/bundleInstaller.js index 801d5d8e..d0c85129 100755 --- a/runtime/main/extend/systemplugin/napi/bundle/bundleInstaller.js +++ b/runtime/main/extend/systemplugin/napi/bundle/bundleInstaller.js @@ -24,6 +24,7 @@ export const HashParam = { export const InstallParam = { userId: "[PC preview] unknown userId", installFlag: "[PC preview] unknown installFlag", + isKeepData: "[PC preview] unknown isKeepData", hashParams: [HashParam], crowdtestDeadline: "[PC preview] unknown crowdtestDeadline", } diff --git a/runtime/main/extend/systemplugin/napi/bundle/hapModuleInfo.js b/runtime/main/extend/systemplugin/napi/bundle/hapModuleInfo.js index 7496aef6..d137641f 100755 --- a/runtime/main/extend/systemplugin/napi/bundle/hapModuleInfo.js +++ b/runtime/main/extend/systemplugin/napi/bundle/hapModuleInfo.js @@ -15,6 +15,8 @@ import { paramMock } from "../../utils" import { AbilityInfo } from './abilityInfo'; +import { ExtensionAbilityInfo } from './extensionAbilityInfo'; +import { Metadata } from './metadata'; export const HapModuleInfo = { @@ -33,4 +35,7 @@ export const HapModuleInfo = { moduleName: "[PC preview] unknown moduleName", mainAbilityName: "[PC preview] unknown mainAbilityName", installationFree: "[PC preview] unknown installationFree", + mainElementName: "[PC preview] unknown mainElementName", + extensionAbilityInfo: [ExtensionAbilityInfo], + metadata: [Metadata], } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/bundle/launcherAbilityInfo.js b/runtime/main/extend/systemplugin/napi/bundle/launcherAbilityInfo.js index 54ca8cc3..830d0533 100644 --- a/runtime/main/extend/systemplugin/napi/bundle/launcherAbilityInfo.js +++ b/runtime/main/extend/systemplugin/napi/bundle/launcherAbilityInfo.js @@ -18,8 +18,8 @@ import { ApplicationInfo } from './applicationInfo'; import { ElementName } from './elementName' export const LauncherAbilityInfo = { - applicationInfo: {ApplicationInfo}, - elementName: {ElementName}, + applicationInfo: ApplicationInfo, + elementName: ElementName, labelId: "[PC preview] unknown labelId", iconId: "[PC preview] unknown iconId", userId: "[PC preview] unknown userId", diff --git a/runtime/main/extend/systemplugin/napi/bundle/packInfo.js b/runtime/main/extend/systemplugin/napi/bundle/packInfo.js index 8a7bfebf..fd6e7dc8 100755 --- a/runtime/main/extend/systemplugin/napi/bundle/packInfo.js +++ b/runtime/main/extend/systemplugin/napi/bundle/packInfo.js @@ -33,7 +33,7 @@ export const ModuleDistroInfo = { export const AbilityFormInfo = { name: "[PC preview] unknown name", type: "[PC preview] unknown type", - updateEnabledtype: "[PC preview] unknown updateEnabled", + updateEnabled: "[PC preview] unknown updateEnabled", scheduledUpdateTime: "[PC preview] unknown scheduledUpdateTime", updateDuration: "[PC preview] unknown updateDuration", supportDimensions: [paramMock.paramNumberMock], diff --git a/runtime/main/extend/systemplugin/napi/ohos_zlib.js b/runtime/main/extend/systemplugin/napi/ohos_zlib.js index 3ad3a5d7..d0a632c1 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_zlib.js +++ b/runtime/main/extend/systemplugin/napi/ohos_zlib.js @@ -13,57 +13,52 @@ * limitations under the License. */ export const MemLevel = { - MEM_LEVEL_MIN: 1, - MEM_LEVEL_MAX: 9, - MEM_LEVEL_DEFAULT: 8 + MEM_LEVEL_MIN: 1, + MEM_LEVEL_MAX: 9, + MEM_LEVEL_DEFAULT: 8 }; export const ErrorCode = { - ERROR_CODE_OK: 0, - ERROR_CODE_ERRNO: -1, + ERROR_CODE_OK: 0, + ERROR_CODE_ERRNO: -1, }; export const CompressLevel = { - COMPRESS_LEVEL_NO_COMPRESSION: 0, - COMPRESS_LEVEL_BEST_SPEED: 1, - COMPRESS_LEVEL_BEST_COMPRESSION: 9, - COMPRESS_LEVEL_DEFAULT_COMPRESSION: -1 + COMPRESS_LEVEL_NO_COMPRESSION: 0, + COMPRESS_LEVEL_BEST_SPEED: 1, + COMPRESS_LEVEL_BEST_COMPRESSION: 9, + COMPRESS_LEVEL_DEFAULT_COMPRESSION: -1 }; export const CompressStrategy = { - COMPRESS_STRATEGY_DEFAULT_STRATEGY: 0, - COMPRESS_STRATEGY_FILTERED: 1, - COMPRESS_STRATEGY_HUFFMAN_ONLY: 2, - COMPRESS_STRATEGY_RLE: 3, - COMPRESS_STRATEGY_FIXED: 4 + COMPRESS_STRATEGY_DEFAULT_STRATEGY: 0, + COMPRESS_STRATEGY_FILTERED: 1, + COMPRESS_STRATEGY_HUFFMAN_ONLY: 2, + COMPRESS_STRATEGY_RLE: 3, + COMPRESS_STRATEGY_FIXED: 4 }; export const Options = { - level: CompressLevel, - memLevel: MemLevel, - strategy: CompressStrategy, + level: CompressLevel, + memLevel: MemLevel, + strategy: CompressStrategy, }; -export function mockZlib() { - const zlib = { - ErrorCode, - MemLevel, - CompressLevel, - CompressStrategy, - Options: { - level: CompressLevel, - memLevel: MemLevel, - strategy: CompressStrategy, - }, - - 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() - }) - }, +export function mockZlib() { + const zlib = { + ErrorCode, + MemLevel, + CompressLevel, + CompressStrategy, + Options, + zipFile: function(...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) => { + 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() - }) + unzipFile: function(...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) => { + resolve(); + }) + } } - } - return zlib; + return zlib; } \ No newline at end of file