未验证 提交 7ca0f0c8 编写于 作者: O openharmony_ci 提交者: Gitee

!6126 新增xts用例

Merge pull request !6126 from ry/master
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
*/ */
import bundle from '@ohos.bundle.bundleManager'; import bundle from '@ohos.bundle.bundleManager';
import util from "./Utils";
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"
const BUNDLE_NAME = "ohos.acts.bundle.stage.test"; const BUNDLE_NAME = "ohos.acts.bundle.stage.test";
...@@ -25,6 +26,7 @@ const ABILITY_NAME1 = "ohos.acts.bundle.stage.test.MainAbility1"; ...@@ -25,6 +26,7 @@ const ABILITY_NAME1 = "ohos.acts.bundle.stage.test.MainAbility1";
const APPID = "ohos.acts.bundle.stage.test_BNtg4JBClbl92Rgc3jm/RfcAdrHXaM8F0QO" + const APPID = "ohos.acts.bundle.stage.test_BNtg4JBClbl92Rgc3jm/RfcAdrHXaM8F0QO" +
"iwVEhnV5ebE5jNIYnAx+weFRT3QTyUjRNdhmc2aAzWyi+5t5CoBM="; "iwVEhnV5ebE5jNIYnAx+weFRT3QTyUjRNdhmc2aAzWyi+5t5CoBM=";
const FINGERPRINT = "8E93863FC32EE238060BF69A9B37E2608FFFB21F93C862DD511CBAC9F30024B5"; const FINGERPRINT = "8E93863FC32EE238060BF69A9B37E2608FFFB21F93C862DD511CBAC9F30024B5";
const PARAM_ERROR_CODE = 401;
export default function getBundleInfoForSelf() { export default function getBundleInfoForSelf() {
describe('getBundleInfoForSelf', function () { describe('getBundleInfoForSelf', function () {
...@@ -186,24 +188,25 @@ export default function getBundleInfoForSelf() { ...@@ -186,24 +188,25 @@ export default function getBundleInfoForSelf() {
* @tc.desc: Test getBundleInfoForSelf with hapModuleInfo flag(by promise). * @tc.desc: Test getBundleInfoForSelf with hapModuleInfo flag(by promise).
*/ */
it('getBundleInfoForSelfModulePro', 0, async function (done) { it('getBundleInfoForSelfModulePro', 0, async function (done) {
bundle.getBundleInfoForSelf(bundle.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE).then(data => { await bundle.getBundleInfoForSelf(bundle.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE).then(data => {
console.info("ModulePro" + JSON.stringify(data.hapModulesInfo[0])); console.info("ModulePro" + JSON.stringify(data.hapModulesInfo[0]));
checkCommonBundleInfo(data); checkCommonBundleInfo(data);
expect(data.appInfo).assertEqual(null); expect(data.appInfo).assertEqual(null);
expect(data.hapModulesInfo.length).assertEqual(1); expect(data.hapModulesInfo.length).assertEqual(1);
expect(data.hapModulesInfo[0].name).assertEqual("testModule"); expect(data.hapModulesInfo[0].name).assertEqual("testModule");
// expect(data.hapModulesInfo[0].icon).assertEqual(""); expect(data.hapModulesInfo[0].icon).assertEqual("$media:icon");
// expect(data.hapModulesInfo[0].iconId).assertEqual(0); expect(data.hapModulesInfo[0].iconId).assertLarger(0);
expect(data.hapModulesInfo[0].label).assertEqual("$string:entry_label"); expect(data.hapModulesInfo[0].label).assertEqual("$string:entry_label");
expect(data.hapModulesInfo[0].labelId).assertLarger(0); expect(data.hapModulesInfo[0].labelId).assertLarger(0);
expect(data.hapModulesInfo[0].description).assertEqual("$string:testModule_entry_dsc"); expect(data.hapModulesInfo[0].description).assertEqual("$string:testModule_entry_dsc");
expect(data.hapModulesInfo[0].descriptionId).assertLarger(0); expect(data.hapModulesInfo[0].descriptionId).assertLarger(0);
expect(data.hapModulesInfo[0].mainElementName).assertEqual("MainAbility"); expect(data.hapModulesInfo[0].mainElementName).assertEqual(ABILITY_NAME);
expect(data.hapModulesInfo[0].abilitiesInfo.length).assertEqual(0); expect(data.hapModulesInfo[0].abilitiesInfo.length).assertEqual(0);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo.length).assertEqual(0); expect(data.hapModulesInfo[0].extensionAbilitiesInfo.length).assertEqual(0);
expect(data.hapModulesInfo[0].metadata.length).assertEqual(0); expect(data.hapModulesInfo[0].metadata.length).assertEqual(0);
expect(data.hapModulesInfo[0].deviceTypes.length).assertEqual(1); expect(data.hapModulesInfo[0].deviceTypes.length).assertEqual(2);
expect(data.hapModulesInfo[0].deviceTypes[0]).assertEqual("default"); expect(data.hapModulesInfo[0].deviceTypes[0]).assertEqual("default");
expect(data.hapModulesInfo[0].deviceTypes[1]).assertEqual("tablet");
expect(data.hapModulesInfo[0].installationFree).assertFalse(); expect(data.hapModulesInfo[0].installationFree).assertFalse();
expect(data.hapModulesInfo[0].hashValue).assertEqual(""); expect(data.hapModulesInfo[0].hashValue).assertEqual("");
expect(data.hapModulesInfo[0].moduleSourceDir).assertEqual(SOURCE_DIR); expect(data.hapModulesInfo[0].moduleSourceDir).assertEqual(SOURCE_DIR);
...@@ -230,18 +233,19 @@ export default function getBundleInfoForSelf() { ...@@ -230,18 +233,19 @@ export default function getBundleInfoForSelf() {
expect(data.appInfo).assertEqual(null); expect(data.appInfo).assertEqual(null);
expect(data.hapModulesInfo.length).assertEqual(1); expect(data.hapModulesInfo.length).assertEqual(1);
expect(data.hapModulesInfo[0].name).assertEqual("testModule"); expect(data.hapModulesInfo[0].name).assertEqual("testModule");
// expect(data.hapModulesInfo[0].icon).assertEqual(""); expect(data.hapModulesInfo[0].icon).assertEqual("$media:icon");
// expect(data.hapModulesInfo[0].iconId).assertEqual(0); expect(data.hapModulesInfo[0].iconId).assertLarger(0);
expect(data.hapModulesInfo[0].label).assertEqual("$string:entry_label"); expect(data.hapModulesInfo[0].label).assertEqual("$string:entry_label");
expect(data.hapModulesInfo[0].labelId).assertLarger(0); expect(data.hapModulesInfo[0].labelId).assertLarger(0);
expect(data.hapModulesInfo[0].description).assertEqual("$string:testModule_entry_dsc"); expect(data.hapModulesInfo[0].description).assertEqual("$string:testModule_entry_dsc");
expect(data.hapModulesInfo[0].descriptionId).assertLarger(0); expect(data.hapModulesInfo[0].descriptionId).assertLarger(0);
expect(data.hapModulesInfo[0].mainElementName).assertEqual("MainAbility"); expect(data.hapModulesInfo[0].mainElementName).assertEqual(ABILITY_NAME);
expect(data.hapModulesInfo[0].abilitiesInfo.length).assertEqual(0); expect(data.hapModulesInfo[0].abilitiesInfo.length).assertEqual(0);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo.length).assertEqual(0); expect(data.hapModulesInfo[0].extensionAbilitiesInfo.length).assertEqual(0);
expect(data.hapModulesInfo[0].metadata.length).assertEqual(0); expect(data.hapModulesInfo[0].metadata.length).assertEqual(0);
expect(data.hapModulesInfo[0].deviceTypes.length).assertEqual(1); expect(data.hapModulesInfo[0].deviceTypes.length).assertEqual(2);
expect(data.hapModulesInfo[0].deviceTypes[0]).assertEqual("default"); expect(data.hapModulesInfo[0].deviceTypes[0]).assertEqual("default");
expect(data.hapModulesInfo[0].deviceTypes[1]).assertEqual("tablet");
expect(data.hapModulesInfo[0].installationFree).assertFalse(); expect(data.hapModulesInfo[0].installationFree).assertFalse();
expect(data.hapModulesInfo[0].hashValue).assertEqual(""); expect(data.hapModulesInfo[0].hashValue).assertEqual("");
expect(data.hapModulesInfo[0].moduleSourceDir).assertEqual(SOURCE_DIR); expect(data.hapModulesInfo[0].moduleSourceDir).assertEqual(SOURCE_DIR);
...@@ -259,14 +263,14 @@ export default function getBundleInfoForSelf() { ...@@ -259,14 +263,14 @@ export default function getBundleInfoForSelf() {
* @tc.desc: Test getBundleInfoForSelf with ability flag(by promise). * @tc.desc: Test getBundleInfoForSelf with ability flag(by promise).
*/ */
it('getBundleInfoForSelfAbilityPro', 0, async function (done) { it('getBundleInfoForSelfAbilityPro', 0, async function (done) {
bundle.getBundleInfoForSelf( await bundle.getBundleInfoForSelf(
bundle.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE | bundle.BundleFlag.GET_BUNDLE_INFO_WITH_ABILITY bundle.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE | bundle.BundleFlag.GET_BUNDLE_INFO_WITH_ABILITY
).then(data => { ).then(data => {
console.info("AbilityPro" + JSON.stringify(data.hapModulesInfo[0].abilitiesInfo[0])); console.info("AbilityPro" + JSON.stringify(data.hapModulesInfo[0].abilitiesInfo[0]));
checkCommonBundleInfo(data); checkCommonBundleInfo(data);
checkCommonHapModuleInfo(data); checkCommonHapModuleInfo(data);
expect(data.appInfo).assertEqual(null); expect(data.appInfo).assertEqual(null);
expect(data.hapModulesInfo[0].abilitiesInfo.length).assertEqual(2); expect(data.hapModulesInfo[0].abilitiesInfo.length).assertEqual(3);
expect(data.hapModulesInfo[0].abilitiesInfo[0].bundleName).assertEqual(BUNDLE_NAME); expect(data.hapModulesInfo[0].abilitiesInfo[0].bundleName).assertEqual(BUNDLE_NAME);
expect(data.hapModulesInfo[0].abilitiesInfo[0].moduleName).assertEqual("testModule"); expect(data.hapModulesInfo[0].abilitiesInfo[0].moduleName).assertEqual("testModule");
expect(data.hapModulesInfo[0].abilitiesInfo[0].name).assertEqual("ohos.acts.bundle.stage.test.MainAbility"); expect(data.hapModulesInfo[0].abilitiesInfo[0].name).assertEqual("ohos.acts.bundle.stage.test.MainAbility");
...@@ -280,20 +284,24 @@ export default function getBundleInfoForSelf() { ...@@ -280,20 +284,24 @@ export default function getBundleInfoForSelf() {
expect(data.hapModulesInfo[0].abilitiesInfo[0].isVisible).assertTrue(); expect(data.hapModulesInfo[0].abilitiesInfo[0].isVisible).assertTrue();
expect(data.hapModulesInfo[0].abilitiesInfo[0].type).assertEqual(1); expect(data.hapModulesInfo[0].abilitiesInfo[0].type).assertEqual(1);
expect(data.hapModulesInfo[0].abilitiesInfo[0].orientation).assertEqual(2); expect(data.hapModulesInfo[0].abilitiesInfo[0].orientation).assertEqual(2);
expect(data.hapModulesInfo[0].abilitiesInfo[0].launchType).assertEqual(0); expect(data.hapModulesInfo[0].abilitiesInfo[0].launchType).assertEqual(bundle.LaunchType.SINGLETON);
expect(data.hapModulesInfo[0].abilitiesInfo[0].permissions.length).assertEqual(0); expect(data.hapModulesInfo[0].abilitiesInfo[0].permissions.length).assertEqual(0);
expect(data.hapModulesInfo[0].abilitiesInfo[0].readPermission).assertEqual(""); expect(data.hapModulesInfo[0].abilitiesInfo[0].readPermission).assertEqual("");
expect(data.hapModulesInfo[0].abilitiesInfo[0].writePermission).assertEqual(""); expect(data.hapModulesInfo[0].abilitiesInfo[0].writePermission).assertEqual("");
expect(data.hapModulesInfo[0].abilitiesInfo[0].uri).assertEqual(""); expect(data.hapModulesInfo[0].abilitiesInfo[0].uri).assertEqual("");
expect(data.hapModulesInfo[0].abilitiesInfo[0].deviceTypes.length).assertEqual(1); expect(data.hapModulesInfo[0].abilitiesInfo[0].deviceTypes.length).assertEqual(2);
expect(data.hapModulesInfo[0].abilitiesInfo[0].deviceTypes[0]).assertEqual("default"); expect(data.hapModulesInfo[0].abilitiesInfo[0].deviceTypes[0]).assertEqual("default");
expect(data.hapModulesInfo[0].abilitiesInfo[0].deviceTypes[1]).assertEqual("tablet");
expect(data.hapModulesInfo[0].abilitiesInfo[0].applicationInfo).assertEqual(null); expect(data.hapModulesInfo[0].abilitiesInfo[0].applicationInfo).assertEqual(null);
expect(data.hapModulesInfo[0].abilitiesInfo[0].metadata.length).assertEqual(0); expect(data.hapModulesInfo[0].abilitiesInfo[0].metadata.length).assertEqual(0);
expect(data.hapModulesInfo[0].abilitiesInfo[0].enabled).assertTrue(); expect(data.hapModulesInfo[0].abilitiesInfo[0].enabled).assertTrue();
expect(data.hapModulesInfo[0].abilitiesInfo[0].supportWindowModes.length).assertEqual(3); expect(data.hapModulesInfo[0].abilitiesInfo[0].supportWindowModes.length).assertEqual(3);
expect(data.hapModulesInfo[0].abilitiesInfo[0].supportWindowModes[0]).assertEqual(0); expect(data.hapModulesInfo[0].abilitiesInfo[0].supportWindowModes[0])
expect(data.hapModulesInfo[0].abilitiesInfo[0].supportWindowModes[1]).assertEqual(1); .assertEqual(bundle.SupportWindowMode.FULL_SCREEN);
expect(data.hapModulesInfo[0].abilitiesInfo[0].supportWindowModes[2]).assertEqual(2); expect(data.hapModulesInfo[0].abilitiesInfo[0].supportWindowModes[1])
.assertEqual(bundle.SupportWindowMode.SPLIT);
expect(data.hapModulesInfo[0].abilitiesInfo[0].supportWindowModes[2])
.assertEqual(bundle.SupportWindowMode.FLOATING);
expect(data.hapModulesInfo[0].abilitiesInfo[0].windowSize.maxWindowRatio).assertEqual(0); expect(data.hapModulesInfo[0].abilitiesInfo[0].windowSize.maxWindowRatio).assertEqual(0);
expect(data.hapModulesInfo[0].abilitiesInfo[0].windowSize.minWindowRatio).assertEqual(0); expect(data.hapModulesInfo[0].abilitiesInfo[0].windowSize.minWindowRatio).assertEqual(0);
expect(data.hapModulesInfo[0].abilitiesInfo[0].windowSize.maxWindowWidth).assertEqual(0); expect(data.hapModulesInfo[0].abilitiesInfo[0].windowSize.maxWindowWidth).assertEqual(0);
...@@ -301,7 +309,11 @@ export default function getBundleInfoForSelf() { ...@@ -301,7 +309,11 @@ export default function getBundleInfoForSelf() {
expect(data.hapModulesInfo[0].abilitiesInfo[0].windowSize.maxWindowHeight).assertEqual(0); expect(data.hapModulesInfo[0].abilitiesInfo[0].windowSize.maxWindowHeight).assertEqual(0);
expect(data.hapModulesInfo[0].abilitiesInfo[0].windowSize.minWindowHeight).assertEqual(0); expect(data.hapModulesInfo[0].abilitiesInfo[0].windowSize.minWindowHeight).assertEqual(0);
expect(data.hapModulesInfo[0].abilitiesInfo[1].name).assertEqual("ohos.acts.bundle.stage.test.MainAbility1"); expect(data.hapModulesInfo[0].abilitiesInfo[1].name).assertEqual("ohos.acts.bundle.stage.test.MainAbility1");
expect(data.hapModulesInfo[0].abilitiesInfo[1].launchType).assertEqual(bundle.LaunchType.STANDARD);
expect(data.hapModulesInfo[0].abilitiesInfo[2].name).assertEqual("ohos.acts.bundle.stage.test.MainAbility2");
expect(data.hapModulesInfo[0].abilitiesInfo[2].launchType).assertEqual(bundle.LaunchType.SPECIFIED);
checkCommonAbilityInfo(data.hapModulesInfo[0].abilitiesInfo[1]) checkCommonAbilityInfo(data.hapModulesInfo[0].abilitiesInfo[1])
checkCommonAbilityInfo(data.hapModulesInfo[0].abilitiesInfo[2])
expect(data.hapModulesInfo[0].extensionAbilitiesInfo.length).assertEqual(0); expect(data.hapModulesInfo[0].extensionAbilitiesInfo.length).assertEqual(0);
expect(data.hapModulesInfo[0].metadata.length).assertEqual(0); expect(data.hapModulesInfo[0].metadata.length).assertEqual(0);
expect(data.reqPermissionDetails.length).assertEqual(0); expect(data.reqPermissionDetails.length).assertEqual(0);
...@@ -329,7 +341,7 @@ export default function getBundleInfoForSelf() { ...@@ -329,7 +341,7 @@ export default function getBundleInfoForSelf() {
checkCommonBundleInfo(data); checkCommonBundleInfo(data);
checkCommonHapModuleInfo(data); checkCommonHapModuleInfo(data);
expect(data.appInfo).assertEqual(null); expect(data.appInfo).assertEqual(null);
expect(data.hapModulesInfo[0].abilitiesInfo.length).assertEqual(2); expect(data.hapModulesInfo[0].abilitiesInfo.length).assertEqual(3);
expect(data.hapModulesInfo[0].abilitiesInfo[0].bundleName).assertEqual(BUNDLE_NAME); expect(data.hapModulesInfo[0].abilitiesInfo[0].bundleName).assertEqual(BUNDLE_NAME);
expect(data.hapModulesInfo[0].abilitiesInfo[0].moduleName).assertEqual("testModule"); expect(data.hapModulesInfo[0].abilitiesInfo[0].moduleName).assertEqual("testModule");
expect(data.hapModulesInfo[0].abilitiesInfo[0].name).assertEqual("ohos.acts.bundle.stage.test.MainAbility"); expect(data.hapModulesInfo[0].abilitiesInfo[0].name).assertEqual("ohos.acts.bundle.stage.test.MainAbility");
...@@ -343,20 +355,24 @@ export default function getBundleInfoForSelf() { ...@@ -343,20 +355,24 @@ export default function getBundleInfoForSelf() {
expect(data.hapModulesInfo[0].abilitiesInfo[0].isVisible).assertTrue(); expect(data.hapModulesInfo[0].abilitiesInfo[0].isVisible).assertTrue();
expect(data.hapModulesInfo[0].abilitiesInfo[0].type).assertEqual(1); expect(data.hapModulesInfo[0].abilitiesInfo[0].type).assertEqual(1);
expect(data.hapModulesInfo[0].abilitiesInfo[0].orientation).assertEqual(2); expect(data.hapModulesInfo[0].abilitiesInfo[0].orientation).assertEqual(2);
expect(data.hapModulesInfo[0].abilitiesInfo[0].launchType).assertEqual(0); expect(data.hapModulesInfo[0].abilitiesInfo[0].launchType).assertEqual(bundle.LaunchType.SINGLETON);
expect(data.hapModulesInfo[0].abilitiesInfo[0].permissions.length).assertEqual(0); expect(data.hapModulesInfo[0].abilitiesInfo[0].permissions.length).assertEqual(0);
expect(data.hapModulesInfo[0].abilitiesInfo[0].readPermission).assertEqual(""); expect(data.hapModulesInfo[0].abilitiesInfo[0].readPermission).assertEqual("");
expect(data.hapModulesInfo[0].abilitiesInfo[0].writePermission).assertEqual(""); expect(data.hapModulesInfo[0].abilitiesInfo[0].writePermission).assertEqual("");
expect(data.hapModulesInfo[0].abilitiesInfo[0].uri).assertEqual(""); expect(data.hapModulesInfo[0].abilitiesInfo[0].uri).assertEqual("");
expect(data.hapModulesInfo[0].abilitiesInfo[0].deviceTypes.length).assertEqual(1); expect(data.hapModulesInfo[0].abilitiesInfo[0].deviceTypes.length).assertEqual(2);
expect(data.hapModulesInfo[0].abilitiesInfo[0].deviceTypes[0]).assertEqual("default"); expect(data.hapModulesInfo[0].abilitiesInfo[0].deviceTypes[0]).assertEqual("default");
expect(data.hapModulesInfo[0].abilitiesInfo[0].deviceTypes[1]).assertEqual("tablet");
expect(data.hapModulesInfo[0].abilitiesInfo[0].applicationInfo).assertEqual(null); expect(data.hapModulesInfo[0].abilitiesInfo[0].applicationInfo).assertEqual(null);
expect(data.hapModulesInfo[0].abilitiesInfo[0].metadata.length).assertEqual(0); expect(data.hapModulesInfo[0].abilitiesInfo[0].metadata.length).assertEqual(0);
expect(data.hapModulesInfo[0].abilitiesInfo[0].enabled).assertTrue(); expect(data.hapModulesInfo[0].abilitiesInfo[0].enabled).assertTrue();
expect(data.hapModulesInfo[0].abilitiesInfo[0].supportWindowModes.length).assertEqual(3); expect(data.hapModulesInfo[0].abilitiesInfo[0].supportWindowModes.length).assertEqual(3);
expect(data.hapModulesInfo[0].abilitiesInfo[0].supportWindowModes[0]).assertEqual(0); expect(data.hapModulesInfo[0].abilitiesInfo[0].supportWindowModes[0])
expect(data.hapModulesInfo[0].abilitiesInfo[0].supportWindowModes[1]).assertEqual(1); .assertEqual(bundle.SupportWindowMode.FULL_SCREEN);
expect(data.hapModulesInfo[0].abilitiesInfo[0].supportWindowModes[2]).assertEqual(2); expect(data.hapModulesInfo[0].abilitiesInfo[0].supportWindowModes[1])
.assertEqual(bundle.SupportWindowMode.SPLIT);
expect(data.hapModulesInfo[0].abilitiesInfo[0].supportWindowModes[2])
.assertEqual(bundle.SupportWindowMode.FLOATING);
expect(data.hapModulesInfo[0].abilitiesInfo[0].windowSize.maxWindowRatio).assertEqual(0); expect(data.hapModulesInfo[0].abilitiesInfo[0].windowSize.maxWindowRatio).assertEqual(0);
expect(data.hapModulesInfo[0].abilitiesInfo[0].windowSize.minWindowRatio).assertEqual(0); expect(data.hapModulesInfo[0].abilitiesInfo[0].windowSize.minWindowRatio).assertEqual(0);
expect(data.hapModulesInfo[0].abilitiesInfo[0].windowSize.maxWindowWidth).assertEqual(0); expect(data.hapModulesInfo[0].abilitiesInfo[0].windowSize.maxWindowWidth).assertEqual(0);
...@@ -364,7 +380,11 @@ export default function getBundleInfoForSelf() { ...@@ -364,7 +380,11 @@ export default function getBundleInfoForSelf() {
expect(data.hapModulesInfo[0].abilitiesInfo[0].windowSize.maxWindowHeight).assertEqual(0); expect(data.hapModulesInfo[0].abilitiesInfo[0].windowSize.maxWindowHeight).assertEqual(0);
expect(data.hapModulesInfo[0].abilitiesInfo[0].windowSize.minWindowHeight).assertEqual(0); expect(data.hapModulesInfo[0].abilitiesInfo[0].windowSize.minWindowHeight).assertEqual(0);
expect(data.hapModulesInfo[0].abilitiesInfo[1].name).assertEqual("ohos.acts.bundle.stage.test.MainAbility1"); expect(data.hapModulesInfo[0].abilitiesInfo[1].name).assertEqual("ohos.acts.bundle.stage.test.MainAbility1");
expect(data.hapModulesInfo[0].abilitiesInfo[1].launchType).assertEqual(bundle.LaunchType.STANDARD);
expect(data.hapModulesInfo[0].abilitiesInfo[2].name).assertEqual("ohos.acts.bundle.stage.test.MainAbility2");
expect(data.hapModulesInfo[0].abilitiesInfo[2].launchType).assertEqual(bundle.LaunchType.SPECIFIED);
checkCommonAbilityInfo(data.hapModulesInfo[0].abilitiesInfo[1]) checkCommonAbilityInfo(data.hapModulesInfo[0].abilitiesInfo[1])
checkCommonAbilityInfo(data.hapModulesInfo[0].abilitiesInfo[2])
expect(data.hapModulesInfo[0].extensionAbilitiesInfo.length).assertEqual(0); expect(data.hapModulesInfo[0].extensionAbilitiesInfo.length).assertEqual(0);
expect(data.hapModulesInfo[0].metadata.length).assertEqual(0); expect(data.hapModulesInfo[0].metadata.length).assertEqual(0);
expect(data.reqPermissionDetails.length).assertEqual(0); expect(data.reqPermissionDetails.length).assertEqual(0);
...@@ -381,7 +401,7 @@ export default function getBundleInfoForSelf() { ...@@ -381,7 +401,7 @@ export default function getBundleInfoForSelf() {
* @tc.desc: Test getBundleInfoForSelf with extensionAbility flag(by promise). * @tc.desc: Test getBundleInfoForSelf with extensionAbility flag(by promise).
*/ */
it('getBundleInfoForSelfExtensionPro', 0, async function (done) { it('getBundleInfoForSelfExtensionPro', 0, async function (done) {
bundle.getBundleInfoForSelf( await bundle.getBundleInfoForSelf(
bundle.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE | bundle.BundleFlag.GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY bundle.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE | bundle.BundleFlag.GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY
).then(data => { ).then(data => {
console.info("ExtensionPro" + JSON.stringify(data.hapModulesInfo[0].extensionAbilitiesInfo)); console.info("ExtensionPro" + JSON.stringify(data.hapModulesInfo[0].extensionAbilitiesInfo));
...@@ -389,35 +409,106 @@ export default function getBundleInfoForSelf() { ...@@ -389,35 +409,106 @@ export default function getBundleInfoForSelf() {
checkCommonHapModuleInfo(data); checkCommonHapModuleInfo(data);
expect(data.appInfo).assertEqual(null); expect(data.appInfo).assertEqual(null);
expect(data.hapModulesInfo[0].abilitiesInfo.length).assertEqual(0); expect(data.hapModulesInfo[0].abilitiesInfo.length).assertEqual(0);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo.length).assertEqual(2); let extensionList = data.hapModulesInfo[0].extensionAbilitiesInfo
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].bundleName).assertEqual(BUNDLE_NAME); expect(extensionList.length).assertEqual(13);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].moduleName).assertEqual("testModule"); let count = 0;
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].name).assertEqual("Form"); for (let i = 0;i < 13; i++) {
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].labelId).assertLarger(0); switch (extensionList[i].name) {
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].descriptionId).assertLarger(0); case "Form":
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].iconId).assertLarger(0); console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].isVisible).assertTrue(); expect(extensionList[i].bundleName).assertEqual(BUNDLE_NAME);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].extensionAbilityType).assertEqual(0); expect(extensionList[i].moduleName).assertEqual("testModule");
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].permissions.length).assertEqual(0); expect(extensionList[i].name).assertEqual("Form");
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].applicationInfo).assertEqual(null); expect(extensionList[i].labelId).assertLarger(0);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].metadata.length).assertEqual(0); expect(extensionList[i].descriptionId).assertLarger(0);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].enabled).assertTrue(); expect(extensionList[i].iconId).assertLarger(0);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].readPermission).assertEqual(""); expect(extensionList[i].isVisible).assertTrue();
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].writePermission).assertEqual(""); expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.FORM);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].bundleName).assertEqual(BUNDLE_NAME); expect(extensionList[i].permissions.length).assertEqual(0);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].moduleName).assertEqual("testModule"); expect(extensionList[i].applicationInfo).assertEqual(null);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].name).assertEqual("Form1"); expect(extensionList[i].metadata.length).assertEqual(0);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].labelId).assertLarger(0); expect(extensionList[i].enabled).assertTrue();
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].descriptionId).assertLarger(0); expect(extensionList[i].readPermission).assertEqual("");
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].iconId).assertLarger(0); expect(extensionList[i].writePermission).assertEqual("");
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].isVisible).assertTrue(); count = count + 1;
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].extensionAbilityType).assertEqual(0); break;
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].permissions.length).assertEqual(0); case "Form1":
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].applicationInfo).assertEqual(null); console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].metadata.length).assertEqual(0); expect(extensionList[i].bundleName).assertEqual(BUNDLE_NAME);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].enabled).assertTrue(); expect(extensionList[i].moduleName).assertEqual("testModule");
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].readPermission).assertEqual(""); expect(extensionList[i].name).assertEqual("Form1");
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].writePermission).assertEqual(""); expect(extensionList[i].labelId).assertLarger(0);
expect(extensionList[i].descriptionId).assertLarger(0);
expect(extensionList[i].iconId).assertLarger(0);
expect(extensionList[i].isVisible).assertTrue();
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.FORM);
expect(extensionList[i].permissions.length).assertEqual(0);
expect(extensionList[i].applicationInfo).assertEqual(null);
expect(extensionList[i].metadata.length).assertEqual(0);
expect(extensionList[i].enabled).assertTrue();
expect(extensionList[i].readPermission).assertEqual("");
expect(extensionList[i].writePermission).assertEqual("");
count = count + 2;
break;
case 'workScheduler':
console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.WORK_SCHEDULER)
count = count + 3;
break;
case 'inputMethod':
console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.INPUT_METHOD)
count = count + 4;
break;
case 'accessibility':
console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.ACCESSIBILITY)
count = count + 5;
break;
case 'fileShare':
console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.FILE_SHARE)
count = count + 6;
break;
case 'staticSubscriber':
console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.STATIC_SUBSCRIBER)
count = count + 7;
break;
case 'wallpaper':
console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.WALLPAPER)
count = count + 8;
break;
case 'backup':
console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.BACKUP)
count = count + 9;
break;
case 'window':
console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.WINDOW)
count = count + 10;
break;
case 'enterpriseAdmin':
console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.ENTERPRISE_ADMIN)
count = count + 11;
break;
case 'thumbnail':
console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.THUMBNAIL)
count = count + 12;
break;
case 'preview':
console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.PREVIEW)
count = count + 13;
break;
}
console.info("count" + JSON.stringify(count));
}
expect(count).assertEqual(91);
expect(data.hapModulesInfo[0].metadata.length).assertEqual(0); expect(data.hapModulesInfo[0].metadata.length).assertEqual(0);
expect(data.reqPermissionDetails.length).assertEqual(0); expect(data.reqPermissionDetails.length).assertEqual(0);
expect(data.permissionGrantStates.length).assertEqual(0); expect(data.permissionGrantStates.length).assertEqual(0);
...@@ -444,37 +535,105 @@ export default function getBundleInfoForSelf() { ...@@ -444,37 +535,105 @@ export default function getBundleInfoForSelf() {
checkCommonHapModuleInfo(data); checkCommonHapModuleInfo(data);
expect(data.appInfo).assertEqual(null); expect(data.appInfo).assertEqual(null);
expect(data.hapModulesInfo[0].abilitiesInfo.length).assertEqual(0); expect(data.hapModulesInfo[0].abilitiesInfo.length).assertEqual(0);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo.length).assertEqual(2); let extensionList = data.hapModulesInfo[0].extensionAbilitiesInfo
expect(data.hapModulesInfo[0].abilitiesInfo.length).assertEqual(0); let count = 0;
expect(data.hapModulesInfo[0].extensionAbilitiesInfo.length).assertEqual(2); for (let i = 0;i < 13; i++) {
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].bundleName).assertEqual(BUNDLE_NAME); switch (extensionList[i].name) {
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].moduleName).assertEqual("testModule"); case "Form":
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].name).assertEqual("Form"); console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].labelId).assertLarger(0); expect(extensionList[i].bundleName).assertEqual(BUNDLE_NAME);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].descriptionId).assertLarger(0); expect(extensionList[i].moduleName).assertEqual("testModule");
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].iconId).assertLarger(0); expect(extensionList[i].name).assertEqual("Form");
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].isVisible).assertTrue(); expect(extensionList[i].labelId).assertLarger(0);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].extensionAbilityType).assertEqual(0); expect(extensionList[i].descriptionId).assertLarger(0);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].permissions.length).assertEqual(0); expect(extensionList[i].iconId).assertLarger(0);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].applicationInfo).assertEqual(null); expect(extensionList[i].isVisible).assertTrue();
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].metadata.length).assertEqual(0); expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.FORM);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].enabled).assertTrue(); expect(extensionList[i].permissions.length).assertEqual(0);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].readPermission).assertEqual(""); expect(extensionList[i].applicationInfo).assertEqual(null);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[0].writePermission).assertEqual(""); expect(extensionList[i].metadata.length).assertEqual(0);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].bundleName).assertEqual(BUNDLE_NAME); expect(extensionList[i].enabled).assertTrue();
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].moduleName).assertEqual("testModule"); expect(extensionList[i].readPermission).assertEqual("");
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].name).assertEqual("Form1"); expect(extensionList[i].writePermission).assertEqual("");
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].labelId).assertLarger(0); count = count + 1;
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].descriptionId).assertLarger(0); break;
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].iconId).assertLarger(0); case "Form1":
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].isVisible).assertTrue(); console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].extensionAbilityType).assertEqual(0); expect(extensionList[i].bundleName).assertEqual(BUNDLE_NAME);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].permissions.length).assertEqual(0); expect(extensionList[i].moduleName).assertEqual("testModule");
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].applicationInfo).assertEqual(null); expect(extensionList[i].name).assertEqual("Form1");
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].metadata.length).assertEqual(0); expect(extensionList[i].labelId).assertLarger(0);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].enabled).assertTrue(); expect(extensionList[i].descriptionId).assertLarger(0);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].readPermission).assertEqual(""); expect(extensionList[i].iconId).assertLarger(0);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo[1].writePermission).assertEqual(""); expect(extensionList[i].isVisible).assertTrue();
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.FORM);
expect(extensionList[i].permissions.length).assertEqual(0);
expect(extensionList[i].applicationInfo).assertEqual(null);
expect(extensionList[i].metadata.length).assertEqual(0);
expect(extensionList[i].enabled).assertTrue();
expect(extensionList[i].readPermission).assertEqual("");
expect(extensionList[i].writePermission).assertEqual("");
count = count + 2;
break;
case 'workScheduler':
console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.WORK_SCHEDULER)
count = count + 3;
break;
case 'inputMethod':
console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.INPUT_METHOD)
count = count + 4;
break;
case 'accessibility':
console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.ACCESSIBILITY)
count = count + 5;
break;
case 'fileShare':
console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.FILE_SHARE)
count = count + 6;
break;
case 'staticSubscriber':
console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.STATIC_SUBSCRIBER)
count = count + 7;
break;
case 'wallpaper':
console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.WALLPAPER)
count = count + 8;
break;
case 'backup':
console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.BACKUP)
count = count + 9;
break;
case 'window':
console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.WINDOW)
count = count + 10;
break;
case 'enterpriseAdmin':
console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.ENTERPRISE_ADMIN)
count = count + 11;
break;
case 'thumbnail':
console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.THUMBNAIL)
count = count + 12;
break;
case 'preview':
console.info("Form" + JSON.stringify(extensionList[i].extensionAbilityType));
expect(extensionList[i].extensionAbilityType).assertEqual(bundle.ExtensionAbilityType.PREVIEW)
count = count + 13;
break;
}
console.info("count" + JSON.stringify(count));
}
expect(count).assertEqual(91);
expect(data.hapModulesInfo[0].metadata.length).assertEqual(0); expect(data.hapModulesInfo[0].metadata.length).assertEqual(0);
expect(data.reqPermissionDetails.length).assertEqual(0); expect(data.reqPermissionDetails.length).assertEqual(0);
expect(data.permissionGrantStates.length).assertEqual(0); expect(data.permissionGrantStates.length).assertEqual(0);
...@@ -490,21 +649,28 @@ export default function getBundleInfoForSelf() { ...@@ -490,21 +649,28 @@ export default function getBundleInfoForSelf() {
* @tc.desc: Test getBundleInfoForSelf with permission flag(by promise). * @tc.desc: Test getBundleInfoForSelf with permission flag(by promise).
*/ */
it('getBundleInfoForSelfPermissionPro', 0, async function (done) { it('getBundleInfoForSelfPermissionPro', 0, async function (done) {
bundle.getBundleInfoForSelf( await bundle.getBundleInfoForSelf(
bundle.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION).then(data => { bundle.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION).then(data => {
console.info("PermissionPro" + JSON.stringify(data.reqPermissionDetails)); console.info("PermissionPro" + JSON.stringify(data.reqPermissionDetails));
console.info("PermissionPro" + JSON.stringify(data.permissionGrantStates)); console.info("PermissionPro" + JSON.stringify(data.permissionGrantStates));
checkCommonBundleInfo(data); checkCommonBundleInfo(data);
expect(data.appInfo).assertEqual(null); expect(data.appInfo).assertEqual(null);
expect(data.hapModulesInfo.length).assertEqual(0); expect(data.hapModulesInfo.length).assertEqual(0);
expect(data.reqPermissionDetails.length).assertEqual(1); expect(data.reqPermissionDetails.length).assertEqual(2);
expect(data.reqPermissionDetails[0].name).assertEqual("ohos.permission.GET_BUNDLE_INFO"); expect(data.reqPermissionDetails[0].name).assertEqual("ohos.permission.GET_BUNDLE_INFO");
expect(data.reqPermissionDetails[0].reason).assertEqual("$string:permission_reason"); expect(data.reqPermissionDetails[0].reason).assertEqual("$string:permission_reason");
expect(data.reqPermissionDetails[0].reasonId).assertLarger(0); expect(data.reqPermissionDetails[0].reasonId).assertLarger(0);
expect(data.reqPermissionDetails[0].usedScene.abilities.length).assertEqual(1); expect(data.reqPermissionDetails[0].usedScene.abilities.length).assertEqual(1);
expect(data.reqPermissionDetails[0].usedScene.abilities[0]).assertEqual("MainAbility"); expect(data.reqPermissionDetails[0].usedScene.abilities[0]).assertEqual("MainAbility");
expect(data.reqPermissionDetails[0].usedScene.when).assertEqual("inuse"); expect(data.reqPermissionDetails[0].usedScene.when).assertEqual("always");
expect(data.permissionGrantStates[0]).assertEqual(0); expect(data.permissionGrantStates[0]).assertEqual(bundle.PermissionGrantState.PERMISSION_GRANTED);
expect(data.reqPermissionDetails[1].name).assertEqual("ohos.permission.READ_CALENDAR");
expect(data.reqPermissionDetails[1].reason).assertEqual("$string:permission_reason");
expect(data.reqPermissionDetails[1].reasonId).assertLarger(0);
expect(data.reqPermissionDetails[1].usedScene.abilities.length).assertEqual(1);
expect(data.reqPermissionDetails[1].usedScene.abilities[0]).assertEqual("MainAbility");
expect(data.reqPermissionDetails[1].usedScene.when).assertEqual("inuse");
expect(data.permissionGrantStates[1]).assertEqual(bundle.PermissionGrantState.PERMISSION_DENIED);
expect(data.signatureInfo).assertEqual(null); expect(data.signatureInfo).assertEqual(null);
done(); done();
}).catch(err => { }).catch(err => {
...@@ -526,15 +692,21 @@ export default function getBundleInfoForSelf() { ...@@ -526,15 +692,21 @@ export default function getBundleInfoForSelf() {
console.info("PermissionPro" + JSON.stringify(data.permissionGrantStates)); console.info("PermissionPro" + JSON.stringify(data.permissionGrantStates));
checkCommonBundleInfo(data); checkCommonBundleInfo(data);
expect(data.appInfo).assertEqual(null); expect(data.appInfo).assertEqual(null);
expect(data.hapModulesInfo.length).assertEqual(0); expect(data.reqPermissionDetails.length).assertEqual(2);
expect(data.reqPermissionDetails.length).assertEqual(1);
expect(data.reqPermissionDetails[0].name).assertEqual("ohos.permission.GET_BUNDLE_INFO"); expect(data.reqPermissionDetails[0].name).assertEqual("ohos.permission.GET_BUNDLE_INFO");
expect(data.reqPermissionDetails[0].reason).assertEqual("$string:permission_reason"); expect(data.reqPermissionDetails[0].reason).assertEqual("$string:permission_reason");
expect(data.reqPermissionDetails[0].reasonId).assertLarger(0); expect(data.reqPermissionDetails[0].reasonId).assertLarger(0);
expect(data.reqPermissionDetails[0].usedScene.abilities.length).assertEqual(1); expect(data.reqPermissionDetails[0].usedScene.abilities.length).assertEqual(1);
expect(data.reqPermissionDetails[0].usedScene.abilities[0]).assertEqual("MainAbility"); expect(data.reqPermissionDetails[0].usedScene.abilities[0]).assertEqual("MainAbility");
expect(data.reqPermissionDetails[0].usedScene.when).assertEqual("inuse"); expect(data.reqPermissionDetails[0].usedScene.when).assertEqual("always");
expect(data.permissionGrantStates[0]).assertEqual(0); expect(data.permissionGrantStates[0]).assertEqual(bundle.PermissionGrantState.PERMISSION_GRANTED);
expect(data.reqPermissionDetails[1].name).assertEqual("ohos.permission.READ_CALENDAR");
expect(data.reqPermissionDetails[1].reason).assertEqual("$string:permission_reason");
expect(data.reqPermissionDetails[1].reasonId).assertLarger(0);
expect(data.reqPermissionDetails[1].usedScene.abilities.length).assertEqual(1);
expect(data.reqPermissionDetails[1].usedScene.abilities[0]).assertEqual("MainAbility");
expect(data.reqPermissionDetails[1].usedScene.when).assertEqual("inuse");
expect(data.permissionGrantStates[1]).assertEqual(bundle.PermissionGrantState.PERMISSION_DENIED);
expect(data.signatureInfo).assertEqual(null); expect(data.signatureInfo).assertEqual(null);
expect(err).assertEqual(null); expect(err).assertEqual(null);
done(); done();
...@@ -547,7 +719,7 @@ export default function getBundleInfoForSelf() { ...@@ -547,7 +719,7 @@ export default function getBundleInfoForSelf() {
* @tc.desc: Test getBundleInfoForSelf with metadata flag(by promise). * @tc.desc: Test getBundleInfoForSelf with metadata flag(by promise).
*/ */
it('getBundleInfoForSelfMetaPro', 0, async function (done) { it('getBundleInfoForSelfMetaPro', 0, async function (done) {
bundle.getBundleInfoForSelf( await bundle.getBundleInfoForSelf(
bundle.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE | bundle.BundleFlag.GET_BUNDLE_INFO_WITH_METADATA) bundle.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE | bundle.BundleFlag.GET_BUNDLE_INFO_WITH_METADATA)
.then(data => { .then(data => {
console.info("MetaPro" + JSON.stringify(data.hapModulesInfo[0].metadata)); console.info("MetaPro" + JSON.stringify(data.hapModulesInfo[0].metadata));
...@@ -605,7 +777,7 @@ export default function getBundleInfoForSelf() { ...@@ -605,7 +777,7 @@ export default function getBundleInfoForSelf() {
* @tc.desc: Test getBundleInfoForSelf with signatureInfo flag(by promise). * @tc.desc: Test getBundleInfoForSelf with signatureInfo flag(by promise).
*/ */
it('getBundleInfoForSelfSigPro', 0, async function (done) { it('getBundleInfoForSelfSigPro', 0, async function (done) {
bundle.getBundleInfoForSelf( await bundle.getBundleInfoForSelf(
bundle.BundleFlag.GET_BUNDLE_INFO_WITH_SIGNATURE_INFO).then(data => { bundle.BundleFlag.GET_BUNDLE_INFO_WITH_SIGNATURE_INFO).then(data => {
console.info("SigPro" + JSON.stringify(data.signatureInfo)); console.info("SigPro" + JSON.stringify(data.signatureInfo));
checkCommonBundleInfo(data); checkCommonBundleInfo(data);
...@@ -650,7 +822,7 @@ export default function getBundleInfoForSelf() { ...@@ -650,7 +822,7 @@ export default function getBundleInfoForSelf() {
* @tc.desc: Test getBundleInfoForSelf with disable flag(by promise). * @tc.desc: Test getBundleInfoForSelf with disable flag(by promise).
*/ */
it('getBundleInfoForSelfDisPro', 0, async function (done) { it('getBundleInfoForSelfDisPro', 0, async function (done) {
bundle.getBundleInfoForSelf(bundle.BundleFlag.GET_BUNDLE_INFO_WITH_DISABLE).then(data => { await bundle.getBundleInfoForSelf(bundle.BundleFlag.GET_BUNDLE_INFO_WITH_DISABLE).then(data => {
console.info("DisPro" + JSON.stringify(data)); console.info("DisPro" + JSON.stringify(data));
checkCommonBundleInfo(data); checkCommonBundleInfo(data);
expect(data.appInfo).assertEqual(null); expect(data.appInfo).assertEqual(null);
...@@ -686,6 +858,69 @@ export default function getBundleInfoForSelf() { ...@@ -686,6 +858,69 @@ export default function getBundleInfoForSelf() {
}) })
}) })
/*
* @tc.number: SUB_BMS_APPINFO_QUERY_0136
* @tc.name: getBundleInfoForSelfParamErrPro
* @tc.desc: Test getBundleInfoForSelf with error param(by promise).
*/
it('getBundleInfoForSelfParamErrPro', 0, async function (done) {
try {
await bundle.getBundleInfoForSelf(null).then(data => {
console.info("ParamErrPro null success " + JSON.stringify(data));
expect(data).assertFail();
}).catch(err => {
console.info("ParamErrPro null fail1 " + JSON.stringify(err));
expect(err).assertFail();
})
} catch (err) {
console.info("ParamErrPro null fail2 " + JSON.stringify(err));
expect(err.code).assertEqual(PARAM_ERROR_CODE);
}
try {
await bundle.getBundleInfoForSelf(undefined).then(data => {
console.info("ParamErrPro undefined success " + JSON.stringify(data));
expect(data).assertFail();
}).catch(err => {
console.info("ParamErrPro undefined fail1 " + JSON.stringify(err));
expect(err).assertFail();
})
} catch (err) {
console.info("ParamErrPro undefined fail2 " + JSON.stringify(err));
expect(err.code).assertEqual(PARAM_ERROR_CODE);
done();
}
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERY_0137
* @tc.name: getBundleInfoForSelfParamErrCal
* @tc.desc: Test getBundleInfoForSelf with error param(by callback).
*/
it('getBundleInfoForSelfParamErrCal', 0, async function (done) {
try {
bundle.getBundleInfoForSelf(null, (err, data) => {
console.info("ParamErrCal null success " + JSON.stringify(data));
console.info("ParamErrCal null success " + JSON.stringify(err));
expect(data).assertFail();
})
} catch (err) {
console.info("ParamErrCal null fail2 " + JSON.stringify(err));
expect(err.code).assertEqual(PARAM_ERROR_CODE);
}
await util.sleep(200);
try {
bundle.getBundleInfoForSelf(undefined, (err, data) => {
console.info("ParamErrCal undefined success " + JSON.stringify(data));
console.info("ParamErrCal undefined success " + JSON.stringify(err));
expect(data).assertFail();
})
} catch (err) {
console.info("ParamErrCal undefined fail2 " + JSON.stringify(err));
expect(err.code).assertEqual(PARAM_ERROR_CODE);
done();
}
})
function checkCommonBundleInfo(data) { function checkCommonBundleInfo(data) {
expect(data.name).assertEqual(BUNDLE_NAME); expect(data.name).assertEqual(BUNDLE_NAME);
expect(data.vendor).assertEqual(VENDOR); expect(data.vendor).assertEqual(VENDOR);
...@@ -731,15 +966,16 @@ export default function getBundleInfoForSelf() { ...@@ -731,15 +966,16 @@ export default function getBundleInfoForSelf() {
function checkCommonHapModuleInfo(data) { function checkCommonHapModuleInfo(data) {
expect(data.hapModulesInfo.length).assertEqual(1); expect(data.hapModulesInfo.length).assertEqual(1);
expect(data.hapModulesInfo[0].name).assertEqual("testModule"); expect(data.hapModulesInfo[0].name).assertEqual("testModule");
// expect(data.hapModulesInfo[0].icon).assertEqual(""); expect(data.hapModulesInfo[0].icon).assertEqual("$media:icon");
// expect(data.hapModulesInfo[0].iconId).assertEqual(0); expect(data.hapModulesInfo[0].iconId).assertLarger(0);
expect(data.hapModulesInfo[0].label).assertEqual("$string:entry_label"); expect(data.hapModulesInfo[0].label).assertEqual("$string:entry_label");
expect(data.hapModulesInfo[0].labelId).assertLarger(0); expect(data.hapModulesInfo[0].labelId).assertLarger(0);
expect(data.hapModulesInfo[0].description).assertEqual("$string:testModule_entry_dsc"); expect(data.hapModulesInfo[0].description).assertEqual("$string:testModule_entry_dsc");
expect(data.hapModulesInfo[0].descriptionId).assertLarger(0); expect(data.hapModulesInfo[0].descriptionId).assertLarger(0);
expect(data.hapModulesInfo[0].mainElementName).assertEqual("MainAbility"); expect(data.hapModulesInfo[0].mainElementName).assertEqual(ABILITY_NAME);
expect(data.hapModulesInfo[0].deviceTypes.length).assertEqual(1); expect(data.hapModulesInfo[0].deviceTypes.length).assertEqual(2);
expect(data.hapModulesInfo[0].deviceTypes[0]).assertEqual("default"); expect(data.hapModulesInfo[0].deviceTypes[0]).assertEqual("default");
expect(data.hapModulesInfo[0].deviceTypes[1]).assertEqual("tablet");
expect(data.hapModulesInfo[0].installationFree).assertFalse(); expect(data.hapModulesInfo[0].installationFree).assertFalse();
expect(data.hapModulesInfo[0].hashValue).assertEqual(""); expect(data.hapModulesInfo[0].hashValue).assertEqual("");
expect(data.hapModulesInfo[0].moduleSourceDir).assertEqual(SOURCE_DIR); expect(data.hapModulesInfo[0].moduleSourceDir).assertEqual(SOURCE_DIR);
...@@ -759,20 +995,20 @@ export default function getBundleInfoForSelf() { ...@@ -759,20 +995,20 @@ export default function getBundleInfoForSelf() {
expect(data.isVisible).assertTrue(); expect(data.isVisible).assertTrue();
expect(data.type).assertEqual(1); expect(data.type).assertEqual(1);
expect(data.orientation).assertEqual(2); expect(data.orientation).assertEqual(2);
expect(data.launchType).assertEqual(0);
expect(data.permissions.length).assertEqual(0); expect(data.permissions.length).assertEqual(0);
expect(data.readPermission).assertEqual(""); expect(data.readPermission).assertEqual("");
expect(data.writePermission).assertEqual(""); expect(data.writePermission).assertEqual("");
expect(data.uri).assertEqual(""); expect(data.uri).assertEqual("");
expect(data.deviceTypes.length).assertEqual(1); expect(data.deviceTypes.length).assertEqual(2);
expect(data.deviceTypes[0]).assertEqual("default"); expect(data.deviceTypes[0]).assertEqual("default");
expect(data.deviceTypes[1]).assertEqual("tablet");
expect(data.applicationInfo).assertEqual(null); expect(data.applicationInfo).assertEqual(null);
expect(data.metadata.length).assertEqual(0); expect(data.metadata.length).assertEqual(0);
expect(data.enabled).assertTrue(); expect(data.enabled).assertTrue();
expect(data.supportWindowModes.length).assertEqual(3); expect(data.supportWindowModes.length).assertEqual(3);
expect(data.supportWindowModes[0]).assertEqual(0); expect(data.supportWindowModes[0]).assertEqual(bundle.SupportWindowMode.FULL_SCREEN);
expect(data.supportWindowModes[1]).assertEqual(1); expect(data.supportWindowModes[1]).assertEqual(bundle.SupportWindowMode.SPLIT);
expect(data.supportWindowModes[2]).assertEqual(2); expect(data.supportWindowModes[2]).assertEqual(bundle.SupportWindowMode.FLOATING);
expect(data.windowSize.maxWindowRatio).assertEqual(0); expect(data.windowSize.maxWindowRatio).assertEqual(0);
expect(data.windowSize.minWindowRatio).assertEqual(0); expect(data.windowSize.minWindowRatio).assertEqual(0);
expect(data.windowSize.maxWindowWidth).assertEqual(0); expect(data.windowSize.maxWindowWidth).assertEqual(0);
......
/*
* 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 bundle from '@ohos.bundle.bundleManager';
import { describe, beforeAll, it, expect } from '@ohos/hypium'
export default function GetSecondModuleTest() {
describe('getSecondModuleTest', function () {
/**
* @tc.number SUB_BMS_APPINFO_QUERY_0138
* @tc.name GetSecondModuleTest
* @tc.desc Test the bundleManager secondary module
*/
it('GetSecondModuleTest', 0, async function (done) {
let bundleInfo = await bundle.getBundleInfoForSelf(
bundle.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION |
bundle.BundleFlag.GET_BUNDLE_INFO_WITH_SIGNATURE_INFO |
bundle.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE |
bundle.BundleFlag.GET_BUNDLE_INFO_WITH_METADATA |
bundle.BundleFlag.GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY |
bundle.BundleFlag.GET_BUNDLE_INFO_WITH_ABILITY |
bundle.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION)
let applicationInfoTest: bundle.ApplicationInfo = bundleInfo.appInfo;
expect(typeof (applicationInfoTest.name)).assertEqual('string');
let metadataTest: bundle.Metadata = bundleInfo.hapModulesInfo[0].metadata[0];
expect(typeof (metadataTest.name)).assertEqual('string');
let bundleInfoTest: bundle.BundleInfo = bundleInfo;
expect(typeof (bundleInfoTest.name)).assertEqual('string');
let usedSceneTest: bundle.UsedScene = bundleInfo.reqPermissionDetails[0].usedScene
expect(typeof (usedSceneTest.abilities[0])).assertEqual('string');
let reqPermissionDetailsTest: bundle.ReqPermissionDetail = bundleInfo.reqPermissionDetails[0]
expect(typeof (reqPermissionDetailsTest.name)).assertEqual('string');
let signatureInfoTest: bundle.SignatureInfo = bundleInfo.signatureInfo;
expect(typeof (signatureInfoTest.appId)).assertEqual('string');
let hapModuleInfoTest: bundle.HapModuleInfo = bundleInfo.hapModulesInfo[0];
expect(typeof (hapModuleInfoTest.name)).assertEqual('string');
let abilityInfoTest: bundle.AbilityInfo = bundleInfo.hapModulesInfo[0].abilitiesInfo[0];
expect(typeof (abilityInfoTest.bundleName)).assertEqual('string');
let windowSizeTest: bundle.WindowSize = bundleInfo.hapModulesInfo[0].abilitiesInfo[0].windowSize;
expect(windowSizeTest.maxWindowRatio).assertEqual(0);
let extensionAbilityInfoTest: bundle.ExtensionAbilityInfo = bundleInfo.hapModulesInfo[0].extensionAbilitiesInfo[0];
expect(typeof (extensionAbilityInfoTest.bundleName)).assertEqual('string');
let elementNameExample = {
deviceId: "123456789",
bundleName: "bundleName",
moduleName:"moduleName",
abilityName: "abilityName",
uri:"uri",
shortName:"shortName"
}
let elementNameTest: bundle.ElementName = elementNameExample;
expect(elementNameTest.deviceId).assertEqual("123456789");
expect(elementNameTest.bundleName).assertEqual("bundleName");
expect(elementNameTest.moduleName).assertEqual("moduleName");
expect(elementNameTest.abilityName).assertEqual("abilityName");
expect(elementNameTest.uri).assertEqual("uri");
expect(elementNameTest.shortName).assertEqual("shortName");
done();
})
})
}
...@@ -16,9 +16,11 @@ ...@@ -16,9 +16,11 @@
import getProfileByAbility from './GetProfileByAbility.test.ets'; import getProfileByAbility from './GetProfileByAbility.test.ets';
import getProfileByExtensionAbility from './GetProfileByExtensionAbility.test.ets'; import getProfileByExtensionAbility from './GetProfileByExtensionAbility.test.ets';
import getBundleInfoForSelf from './GetBundleInfoForSelf.test.ets'; import getBundleInfoForSelf from './GetBundleInfoForSelf.test.ets';
import getSecondModuleTest from './GetSecondModule.test.ets';
export default function testsuite() { export default function testsuite() {
getProfileByAbility(); getProfileByAbility();
getProfileByExtensionAbility(); getProfileByExtensionAbility();
getBundleInfoForSelf(); getBundleInfoForSelf();
getSecondModuleTest();
} }
\ No newline at end of file
/**
* 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 default class Utils {
static sleep(time) {
return new Promise((resolve, reject) => {
setTimeout((data) => {
resolve(data)
}, time)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
}
...@@ -4,9 +4,10 @@ ...@@ -4,9 +4,10 @@
"type": "entry", "type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts", "srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:testModule_entry_dsc", "description": "$string:testModule_entry_dsc",
"mainElement": "MainAbility", "mainElement": "ohos.acts.bundle.stage.test.MainAbility",
"deviceTypes": [ "deviceTypes": [
"default" "default",
"tablet"
], ],
"deliveryWithInstall": true, "deliveryWithInstall": true,
"installationFree": false, "installationFree": false,
...@@ -20,6 +21,7 @@ ...@@ -20,6 +21,7 @@
"icon": "$media:icon", "icon": "$media:icon",
"label": "$string:entry_label", "label": "$string:entry_label",
"visible": true, "visible": true,
"launchType": "singleton",
"orientation": "portrait", "orientation": "portrait",
"skills": [ "skills": [
{ {
...@@ -66,6 +68,18 @@ ...@@ -66,6 +68,18 @@
"icon": "$media:icon", "icon": "$media:icon",
"label": "$string:entry_label", "label": "$string:entry_label",
"visible": true, "visible": true,
"launchType": "standard",
"orientation": "portrait",
"skills": []
},
{
"name": "ohos.acts.bundle.stage.test.MainAbility2",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:testModule_entry_main",
"icon": "$media:icon",
"label": "$string:entry_label",
"visible": true,
"launchType": "specified",
"orientation": "portrait", "orientation": "portrait",
"skills": [] "skills": []
} }
...@@ -119,12 +133,141 @@ ...@@ -119,12 +133,141 @@
"srcEntrance": "./ets/FormAbility/FormAbility.ts", "srcEntrance": "./ets/FormAbility/FormAbility.ts",
"type": "form", "type": "form",
"visible": true "visible": true
},
{
"description": "$string:form_description",
"descriptionId": 16777219,
"icon": "$media:icon",
"iconId": 16777225,
"label": "$string:entry_label",
"name": "workScheduler",
"srcEntrance": "./ets/FormAbility/FormAbility.ts",
"type": "workScheduler",
"visible": true
},
{
"description": "$string:form_description",
"descriptionId": 16777219,
"icon": "$media:icon",
"iconId": 16777225,
"label": "$string:entry_label",
"name": "inputMethod",
"srcEntrance": "./ets/FormAbility/FormAbility.ts",
"type": "inputMethod",
"visible": true
},
{
"description": "$string:form_description",
"descriptionId": 16777219,
"icon": "$media:icon",
"iconId": 16777225,
"label": "$string:entry_label",
"name": "accessibility",
"srcEntrance": "./ets/FormAbility/FormAbility.ts",
"type": "accessibility",
"visible": true
},
{
"description": "$string:form_description",
"descriptionId": 16777219,
"icon": "$media:icon",
"iconId": 16777225,
"label": "$string:entry_label",
"name": "fileShare",
"srcEntrance": "./ets/FormAbility/FormAbility.ts",
"type": "fileShare",
"visible": true
},
{
"description": "$string:form_description",
"descriptionId": 16777219,
"icon": "$media:icon",
"iconId": 16777225,
"label": "$string:entry_label",
"name": "staticSubscriber",
"srcEntrance": "./ets/FormAbility/FormAbility.ts",
"type": "staticSubscriber",
"visible": true
},
{
"description": "$string:form_description",
"descriptionId": 16777219,
"icon": "$media:icon",
"iconId": 16777225,
"label": "$string:entry_label",
"name": "wallpaper",
"srcEntrance": "./ets/FormAbility/FormAbility.ts",
"type": "wallpaper",
"visible": true
},
{
"description": "$string:form_description",
"descriptionId": 16777219,
"icon": "$media:icon",
"iconId": 16777225,
"label": "$string:entry_label",
"name": "backup",
"srcEntrance": "./ets/FormAbility/FormAbility.ts",
"type": "backup",
"visible": true
},
{
"description": "$string:form_description",
"descriptionId": 16777219,
"icon": "$media:icon",
"iconId": 16777225,
"label": "$string:entry_label",
"name": "window",
"srcEntrance": "./ets/FormAbility/FormAbility.ts",
"type": "window",
"visible": true
},
{
"description": "$string:form_description",
"descriptionId": 16777219,
"icon": "$media:icon",
"iconId": 16777225,
"label": "$string:entry_label",
"name": "enterpriseAdmin",
"srcEntrance": "./ets/FormAbility/FormAbility.ts",
"type": "enterpriseAdmin",
"visible": true
},
{
"description": "$string:form_description",
"descriptionId": 16777219,
"icon": "$media:icon",
"iconId": 16777225,
"label": "$string:entry_label",
"name": "thumbnail",
"srcEntrance": "./ets/FormAbility/FormAbility.ts",
"type": "thumbnail",
"visible": true
},
{
"description": "$string:form_description",
"descriptionId": 16777219,
"icon": "$media:icon",
"iconId": 16777225,
"label": "$string:entry_label",
"name": "preview",
"srcEntrance": "./ets/FormAbility/FormAbility.ts",
"type": "preview",
"visible": true
} }
], ],
"requestPermissions": [ "requestPermissions": [
{ {
"name": "ohos.permission.GET_BUNDLE_INFO", "name": "ohos.permission.GET_BUNDLE_INFO",
"reason": "$string:permission_reason", "reason": "$string:permission_reason",
"usedScene": {
"abilities": ["MainAbility"],
"when": "always"
}
},
{
"name": "ohos.permission.READ_CALENDAR",
"reason": "$string:permission_reason",
"usedScene": { "usedScene": {
"abilities": ["MainAbility"], "abilities": ["MainAbility"],
"when": "inuse" "when": "inuse"
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
"forms": [ "forms": [
{ {
"isDefault": true, "isDefault": true,
"src": "./js/widget/pages/index/index",
"scheduledUpdateTime": "10:30", "scheduledUpdateTime": "10:30",
"defaultDimension": "2*2", "defaultDimension": "2*2",
"name": "widget", "name": "widget",
...@@ -21,7 +20,6 @@ ...@@ -21,7 +20,6 @@
}, },
{ {
"isDefault": true, "isDefault": true,
"src": "./js/widget1/pages/index/index",
"scheduledUpdateTime": "10:30", "scheduledUpdateTime": "10:30",
"defaultDimension": "2*2", "defaultDimension": "2*2",
"name": "widget1", "name": "widget1",
...@@ -41,7 +39,6 @@ ...@@ -41,7 +39,6 @@
}, },
{ {
"isDefault": true, "isDefault": true,
"src": "./js/widget2/pages/index/index",
"scheduledUpdateTime": "10:30", "scheduledUpdateTime": "10:30",
"defaultDimension": "2*2", "defaultDimension": "2*2",
"name": "widget2", "name": "widget2",
...@@ -60,7 +57,6 @@ ...@@ -60,7 +57,6 @@
}, },
{ {
"isDefault": true, "isDefault": true,
"src": "./js/widget3/pages/index/index",
"scheduledUpdateTime": "10:30", "scheduledUpdateTime": "10:30",
"defaultDimension": "2*2", "defaultDimension": "2*2",
"name": "widget3", "name": "widget3",
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
"forms": [ "forms": [
{ {
"isDefault": true, "isDefault": true,
"src": "./js/widget/pages/index/index",
"scheduledUpdateTime": "10:30", "scheduledUpdateTime": "10:30",
"defaultDimension": "2*2", "defaultDimension": "2*2",
"name": "widget", "name": "widget",
...@@ -21,7 +20,6 @@ ...@@ -21,7 +20,6 @@
}, },
{ {
"isDefault": true, "isDefault": true,
"src": "./js/widget1/pages/index/index",
"scheduledUpdateTime": "10:30", "scheduledUpdateTime": "10:30",
"defaultDimension": "2*2", "defaultDimension": "2*2",
"name": "widget1", "name": "widget1",
...@@ -41,7 +39,6 @@ ...@@ -41,7 +39,6 @@
}, },
{ {
"isDefault": true, "isDefault": true,
"src": "./js/widget2/pages/index/index",
"scheduledUpdateTime": "10:30", "scheduledUpdateTime": "10:30",
"defaultDimension": "2*2", "defaultDimension": "2*2",
"name": "widget2", "name": "widget2",
...@@ -60,7 +57,6 @@ ...@@ -60,7 +57,6 @@
}, },
{ {
"isDefault": true, "isDefault": true,
"src": "./js/widget3/pages/index/index",
"scheduledUpdateTime": "10:30", "scheduledUpdateTime": "10:30",
"defaultDimension": "2*2", "defaultDimension": "2*2",
"name": "widget3", "name": "widget3",
......
...@@ -21,8 +21,9 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from ...@@ -21,8 +21,9 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
var dir = ""; var dir = "";
var infos = ""; var infos = "";
var SRC_FILE_INVALID = 900001; var SRC_FILE_INVALID = 900001;
export default function ActsZlibTest() { export default function ActsZlibTest() {
describe('ActsZlibTest', function () { describe('ActsZlibTest', function () {
beforeEach(async (done) => { beforeEach(async (done) => {
var context = featureAbility.getContext(); var context = featureAbility.getContext();
context.getCacheDir((err, data) => { context.getCacheDir((err, data) => {
...@@ -30,20 +31,20 @@ describe('ActsZlibTest', function () { ...@@ -30,20 +31,20 @@ describe('ActsZlibTest', function () {
dir = data; dir = data;
var objectone = "com.example.amsZipfileUnzipfileST.MainAbility/com.example.amsZipfileUnzipfileST/"; var objectone = "com.example.amsZipfileUnzipfileST.MainAbility/com.example.amsZipfileUnzipfileST/";
var objecttwo = "com.example.amsZipfileUnzipfileST.MainAbility/com.example.amsZipfileUnzipfileST/zipunzip"; var objecttwo = "com.example.amsZipfileUnzipfileST.MainAbility/com.example.amsZipfileUnzipfileST/zipunzip";
var objectthree ="com.example.amsZipfileUnzipfileST.MainAbility/ActsZlibTest/example.amsZipfileUnzipfileST"; var objectthree = "com.example.amsZipfileUnzipfileST.MainAbility/ActsZlibTest/example.amsZipfileUnzipfileST";
infos =dir + objectone + objecttwo + objectthree; infos = dir + objectone + objecttwo + objectthree;
done(); done();
}) })
}); });
/* /*
* @tc.number: ACTS_ZipFile_0100 * @tc.number: ACTS_ZipFile_0100
* @tc.name: zipFile * @tc.name: zipFile
* @tc.desc: inFile is empty * @tc.desc: inFile is empty
*/ */
it('ACTS_ZipFile_0100', 0, async function (done) { it('ACTS_ZipFile_0100', 0, async function (done) {
console.log("==================ACTS_ZipFile_0100 start=================="); console.log("==================ACTS_ZipFile_0100 start==================");
var path =""; var path = "";
var zipDest = dir + "/ACTS_ZipFile_0100.zip" var zipDest = dir + "/ACTS_ZipFile_0100.zip"
var options = {}; var options = {};
options.level = zlib.CompressLevel.COMPRESS_LEVEL_NO_COMPRESSION; options.level = zlib.CompressLevel.COMPRESS_LEVEL_NO_COMPRESSION;
...@@ -59,12 +60,12 @@ it('ACTS_ZipFile_0100', 0, async function (done) { ...@@ -59,12 +60,12 @@ it('ACTS_ZipFile_0100', 0, async function (done) {
console.log("==================ACTS_ZipFile_0100 end=================="); console.log("==================ACTS_ZipFile_0100 end==================");
}) })
/* /*
* @tc.number: ACTS_ZipFile_0200 * @tc.number: ACTS_ZipFile_0200
* @tc.name: zipFile * @tc.name: zipFile
* @tc.desc: inFile doesn't exist * @tc.desc: inFile doesn't exist
*/ */
it('ACTS_ZipFile_0200', 0, async function (done) { it('ACTS_ZipFile_0200', 0, async function (done) {
console.log("==================ACTS_ZipFile_0200 start=================="); console.log("==================ACTS_ZipFile_0200 start==================");
var path = dir + "/ACTS_ZipFile_9999900.txt"; var path = dir + "/ACTS_ZipFile_9999900.txt";
var src = dir + "/ACTS_ZipFile_999991100.txt"; var src = dir + "/ACTS_ZipFile_999991100.txt";
...@@ -90,15 +91,15 @@ it('ACTS_ZipFile_0200', 0, async function (done) { ...@@ -90,15 +91,15 @@ it('ACTS_ZipFile_0200', 0, async function (done) {
console.log("==================ACTS_ZipFile_0200 end=================="); console.log("==================ACTS_ZipFile_0200 end==================");
}) })
/* /*
* @tc.number: ACTS_ZipFile_0300 * @tc.number: ACTS_ZipFile_0300
* @tc.name: zipFile * @tc.name: zipFile
* @tc.desc: output file not specified * @tc.desc: output file not specified
*/ */
it('ACTS_ZipFile_0300', 0, async function (done) { it('ACTS_ZipFile_0300', 0, async function (done) {
console.log("==================ACTS_ZipFile_0300 start=================="); console.log("==================ACTS_ZipFile_0300 start==================");
var path = dir + "/ACTS_ZipFile_0300.txt"; var path = dir + "/ACTS_ZipFile_0300.txt";
var zipDest =""; var zipDest = "";
var fd = fileio.openSync(path, 0o100 | 0o2, 0o666); var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
fileio.write(fd, infos).then(function (number) { fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_0300 write data to file successfully:" + number); console.info("ACTS_ZipFile_0300 write data to file successfully:" + number);
...@@ -121,15 +122,15 @@ it('ACTS_ZipFile_0300', 0, async function (done) { ...@@ -121,15 +122,15 @@ it('ACTS_ZipFile_0300', 0, async function (done) {
console.log("==================ACTS_ZipFile_0300 end=================="); console.log("==================ACTS_ZipFile_0300 end==================");
}) })
/* /*
* @tc.number: ACTS_ZipFile_0400 * @tc.number: ACTS_ZipFile_0400
* @tc.name: zipFile * @tc.name: zipFile
* @tc.desc: The output file is a directory that does not exist * @tc.desc: The output file is a directory that does not exist
*/ */
it('ACTS_ZipFile_0400', 0, async function (done) { it('ACTS_ZipFile_0400', 0, async function (done) {
console.log("==================ACTS_ZipFile_0400 start=================="); console.log("==================ACTS_ZipFile_0400 start==================");
var path = dir + "/ACTS_ZipFile_0400.txt"; var path = dir + "/ACTS_ZipFile_0400.txt";
var zipDest ="/ACTS_ZipFile_0400.zip"; var zipDest = "/ACTS_ZipFile_0400.zip";
var fd = fileio.openSync(path, 0o100 | 0o2, 0o666); var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
fileio.write(fd, infos).then(function (number) { fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_0400 write data to file successfully:" + number); console.info("ACTS_ZipFile_0400 write data to file successfully:" + number);
...@@ -152,12 +153,12 @@ it('ACTS_ZipFile_0400', 0, async function (done) { ...@@ -152,12 +153,12 @@ it('ACTS_ZipFile_0400', 0, async function (done) {
console.log("==================ACTS_ZipFile_0400 end=================="); console.log("==================ACTS_ZipFile_0400 end==================");
}) })
/* /*
* @tc.number: ACTS_ZipFile_2200 * @tc.number: ACTS_ZipFile_2200
* @tc.name: zipFile * @tc.name: zipFile
* @tc.desc: COMPRESS_LEVEL_NO_COMPRESSION, * @tc.desc: COMPRESS_LEVEL_NO_COMPRESSION,
*/ */
it('ACTS_ZipFile_2200', 0, async function (done) { it('ACTS_ZipFile_2200', 0, async function (done) {
console.log("==================ACTS_ZipFile_2200 start=================="); console.log("==================ACTS_ZipFile_2200 start==================");
var path = dir + "/ACTS_ZipFile_2200.txt"; var path = dir + "/ACTS_ZipFile_2200.txt";
var zipDest = dir + "/ACTS_ZipFile_2200.zip" var zipDest = dir + "/ACTS_ZipFile_2200.zip"
...@@ -212,12 +213,12 @@ it('ACTS_ZipFile_2200', 0, async function (done) { ...@@ -212,12 +213,12 @@ it('ACTS_ZipFile_2200', 0, async function (done) {
console.log("==================ACTS_ZipFile_2200 end=================="); console.log("==================ACTS_ZipFile_2200 end==================");
}); });
/* /*
* @tc.number: ACTS_ZipFile_2300 * @tc.number: ACTS_ZipFile_2300
* @tc.name: zipFile * @tc.name: zipFile
* @tc.desc: COMPRESS_LEVEL_BEST_SPEED, * @tc.desc: COMPRESS_LEVEL_BEST_SPEED,
*/ */
it('ACTS_ZipFile_2300', 0, async function (done) { it('ACTS_ZipFile_2300', 0, async function (done) {
console.log("==================ACTS_ZipFile_2300 start=================="); console.log("==================ACTS_ZipFile_2300 start==================");
var path = dir + "/ACTS_ZipFile_2300.txt"; var path = dir + "/ACTS_ZipFile_2300.txt";
var zipDest = dir + "/ACTS_ZipFile_2300.zip" var zipDest = dir + "/ACTS_ZipFile_2300.zip"
...@@ -272,12 +273,12 @@ it('ACTS_ZipFile_2300', 0, async function (done) { ...@@ -272,12 +273,12 @@ it('ACTS_ZipFile_2300', 0, async function (done) {
console.log("==================ACTS_ZipFile_2300 end=================="); console.log("==================ACTS_ZipFile_2300 end==================");
}) })
/* /*
* @tc.number: ACTS_ZipFile_2400 * @tc.number: ACTS_ZipFile_2400
* @tc.name: zipFile * @tc.name: zipFile
* @tc.desc: COMPRESS_LEVEL_BEST_COMPRESSION, * @tc.desc: COMPRESS_LEVEL_BEST_COMPRESSION,
*/ */
it('ACTS_ZipFile_2400', 0, async function (done) { it('ACTS_ZipFile_2400', 0, async function (done) {
console.log("==================ACTS_ZipFile_2400 start=================="); console.log("==================ACTS_ZipFile_2400 start==================");
var path = dir + "/ACTS_ZipFile_2400.txt"; var path = dir + "/ACTS_ZipFile_2400.txt";
var zipDest = dir + "/ACTS_ZipFile_2400.zip" var zipDest = dir + "/ACTS_ZipFile_2400.zip"
...@@ -332,12 +333,12 @@ it('ACTS_ZipFile_2400', 0, async function (done) { ...@@ -332,12 +333,12 @@ it('ACTS_ZipFile_2400', 0, async function (done) {
console.log("==================ACTS_ZipFile_2400 end=================="); console.log("==================ACTS_ZipFile_2400 end==================");
}); });
/* /*
* @tc.number: ACTS_ZipFile_2500 * @tc.number: ACTS_ZipFile_2500
* @tc.name: zipFile * @tc.name: zipFile
* @tc.desc: COMPRESS_LEVEL_DEFAULT_COMPRESSION, * @tc.desc: COMPRESS_LEVEL_DEFAULT_COMPRESSION,
*/ */
it('ACTS_ZipFile_2500', 0, async function (done) { it('ACTS_ZipFile_2500', 0, async function (done) {
console.log("==================ACTS_ZipFile_2500 start=================="); console.log("==================ACTS_ZipFile_2500 start==================");
var path = dir + "/ACTS_ZipFile_2500.txt"; var path = dir + "/ACTS_ZipFile_2500.txt";
var zipDest = dir + "/ACTS_ZipFile_2500.zip" var zipDest = dir + "/ACTS_ZipFile_2500.zip"
...@@ -392,12 +393,12 @@ it('ACTS_ZipFile_2500', 0, async function (done) { ...@@ -392,12 +393,12 @@ it('ACTS_ZipFile_2500', 0, async function (done) {
console.log("==================ACTS_ZipFile_2500 end=================="); console.log("==================ACTS_ZipFile_2500 end==================");
}); });
/* /*
* @tc.number: ACTS_ZipFile_2600 * @tc.number: ACTS_ZipFile_2600
* @tc.name: zipFile * @tc.name: zipFile
* @tc.desc: MEM_LEVEL_MIN_MEMLEVEL,, * @tc.desc: MEM_LEVEL_MIN_MEMLEVEL,,
*/ */
it('ACTS_ZipFile_2600', 0, async function (done) { it('ACTS_ZipFile_2600', 0, async function (done) {
console.log("==================ACTS_ZipFile_2600 start=================="); console.log("==================ACTS_ZipFile_2600 start==================");
var path = dir + "/ACTS_ZipFile_2600.txt"; var path = dir + "/ACTS_ZipFile_2600.txt";
var zipDest = dir + "/ACTS_ZipFile_2600.zip" var zipDest = dir + "/ACTS_ZipFile_2600.zip"
...@@ -452,12 +453,12 @@ it('ACTS_ZipFile_2600', 0, async function (done) { ...@@ -452,12 +453,12 @@ it('ACTS_ZipFile_2600', 0, async function (done) {
console.log("==================ACTS_ZipFile_2600 end=================="); console.log("==================ACTS_ZipFile_2600 end==================");
}); });
/* /*
* @tc.number: ACTS_ZipFile_2700 * @tc.number: ACTS_ZipFile_2700
* @tc.name: zipFile * @tc.name: zipFile
* @tc.desc: MEM_LEVEL_MAX_MEMLEVEL,, * @tc.desc: MEM_LEVEL_MAX_MEMLEVEL,,
*/ */
it('ACTS_ZipFile_2700', 0, async function (done) { it('ACTS_ZipFile_2700', 0, async function (done) {
console.log("==================ACTS_ZipFile_2700 start=================="); console.log("==================ACTS_ZipFile_2700 start==================");
var path = dir + "/ACTS_ZipFile_2700.txt"; var path = dir + "/ACTS_ZipFile_2700.txt";
var zipDest = dir + "/ACTS_ZipFile_2700.zip" var zipDest = dir + "/ACTS_ZipFile_2700.zip"
...@@ -512,12 +513,12 @@ it('ACTS_ZipFile_2700', 0, async function (done) { ...@@ -512,12 +513,12 @@ it('ACTS_ZipFile_2700', 0, async function (done) {
console.log("==================ACTS_ZipFile_2700 end=================="); console.log("==================ACTS_ZipFile_2700 end==================");
}); });
/* /*
* @tc.number: ACTS_ZipFile_2800 * @tc.number: ACTS_ZipFile_2800
* @tc.name: zipFile * @tc.name: zipFile
* @tc.desc: MEM_LEVEL_DEFAULT_MEMLEVEL,, * @tc.desc: MEM_LEVEL_DEFAULT_MEMLEVEL,,
*/ */
it('ACTS_ZipFile_2800', 0, async function (done) { it('ACTS_ZipFile_2800', 0, async function (done) {
console.log("==================ACTS_ZipFile_2800 start=================="); console.log("==================ACTS_ZipFile_2800 start==================");
var path = dir + "/ACTS_ZipFile_2800.txt"; var path = dir + "/ACTS_ZipFile_2800.txt";
var zipDest = dir + "/ACTS_ZipFile_2800.zip" var zipDest = dir + "/ACTS_ZipFile_2800.zip"
...@@ -572,12 +573,12 @@ it('ACTS_ZipFile_2800', 0, async function (done) { ...@@ -572,12 +573,12 @@ it('ACTS_ZipFile_2800', 0, async function (done) {
console.log("==================ACTS_ZipFile_2800 end=================="); console.log("==================ACTS_ZipFile_2800 end==================");
}); });
/* /*
* @tc.number: ACTS_ZipFile_2900 * @tc.number: ACTS_ZipFile_2900
* @tc.name: zipFile * @tc.name: zipFile
* @tc.desc: COMPRESS_STRATEGY_DEFAULT_STRATEGY,, * @tc.desc: COMPRESS_STRATEGY_DEFAULT_STRATEGY,,
*/ */
it('ACTS_ZipFile_2900', 0, async function (done) { it('ACTS_ZipFile_2900', 0, async function (done) {
console.log("==================ACTS_ZipFile_2900 start=================="); console.log("==================ACTS_ZipFile_2900 start==================");
var path = dir + "/ACTS_ZipFile_2900.txt"; var path = dir + "/ACTS_ZipFile_2900.txt";
var zipDest = dir + "/ACTS_ZipFile_2900.zip" var zipDest = dir + "/ACTS_ZipFile_2900.zip"
...@@ -632,12 +633,12 @@ it('ACTS_ZipFile_2900', 0, async function (done) { ...@@ -632,12 +633,12 @@ it('ACTS_ZipFile_2900', 0, async function (done) {
console.log("==================ACTS_ZipFile_2900 end=================="); console.log("==================ACTS_ZipFile_2900 end==================");
}); });
/* /*
* @tc.number: ACTS_ZipFile_3000 * @tc.number: ACTS_ZipFile_3000
* @tc.name: zipFile * @tc.name: zipFile
* @tc.desc: COMPRESS_STRATEGY_FILTERED,, * @tc.desc: COMPRESS_STRATEGY_FILTERED,,
*/ */
it('ACTS_ZipFile_3000', 0, async function (done) { it('ACTS_ZipFile_3000', 0, async function (done) {
console.log("==================ACTS_ZipFile_3000 start=================="); console.log("==================ACTS_ZipFile_3000 start==================");
var path = dir + "/ACTS_ZipFile_3000.txt"; var path = dir + "/ACTS_ZipFile_3000.txt";
var zipDest = dir + "/ACTS_ZipFile_3000.zip" var zipDest = dir + "/ACTS_ZipFile_3000.zip"
...@@ -692,12 +693,12 @@ it('ACTS_ZipFile_3000', 0, async function (done) { ...@@ -692,12 +693,12 @@ it('ACTS_ZipFile_3000', 0, async function (done) {
console.log("==================ACTS_ZipFile_3000 end=================="); console.log("==================ACTS_ZipFile_3000 end==================");
}); });
/* /*
* @tc.number: ACTS_ZipFile_3100 * @tc.number: ACTS_ZipFile_3100
* @tc.name: zipFile * @tc.name: zipFile
* @tc.desc: COMPRESS_STRATEGY_HUFFMAN_ONLY,, * @tc.desc: COMPRESS_STRATEGY_HUFFMAN_ONLY,,
*/ */
it('ACTS_ZipFile_3100', 0, async function (done) { it('ACTS_ZipFile_3100', 0, async function (done) {
console.log("==================ACTS_ZipFile_3100 start=================="); console.log("==================ACTS_ZipFile_3100 start==================");
var path = dir + "/ACTS_ZipFile_3100.txt"; var path = dir + "/ACTS_ZipFile_3100.txt";
var zipDest = dir + "/ACTS_ZipFile_3100.zip" var zipDest = dir + "/ACTS_ZipFile_3100.zip"
...@@ -752,12 +753,12 @@ it('ACTS_ZipFile_3100', 0, async function (done) { ...@@ -752,12 +753,12 @@ it('ACTS_ZipFile_3100', 0, async function (done) {
console.log("==================ACTS_ZipFile_3100 end=================="); console.log("==================ACTS_ZipFile_3100 end==================");
}); });
/* /*
* @tc.number: ACTS_ZipFile_3200 * @tc.number: ACTS_ZipFile_3200
* @tc.name: zipFile * @tc.name: zipFile
* @tc.desc: COMPRESS_STRATEGY_RLE,, * @tc.desc: COMPRESS_STRATEGY_RLE,,
*/ */
it('ACTS_ZipFile_3200', 0, async function (done) { it('ACTS_ZipFile_3200', 0, async function (done) {
console.log("==================ACTS_ZipFile_3200 start=================="); console.log("==================ACTS_ZipFile_3200 start==================");
var path = dir + "/ACTS_ZipFile_3200.txt"; var path = dir + "/ACTS_ZipFile_3200.txt";
var zipDest = dir + "/ACTS_ZipFile_3200.zip"; var zipDest = dir + "/ACTS_ZipFile_3200.zip";
...@@ -790,7 +791,8 @@ it('ACTS_ZipFile_3200', 0, async function (done) { ...@@ -790,7 +791,8 @@ it('ACTS_ZipFile_3200', 0, async function (done) {
console.error('ACTS_ZipFile_3200 unzipFile'); console.error('ACTS_ZipFile_3200 unzipFile');
done(); done();
}).catch((err) => { }).catch((err) => {
console.log("ACTS_ZipFile_3200 err: " + err);done(); console.log("ACTS_ZipFile_3200 err: " + err);
done();
expect(err).assertFail(); expect(err).assertFail();
done(); done();
}) })
...@@ -812,12 +814,12 @@ it('ACTS_ZipFile_3200', 0, async function (done) { ...@@ -812,12 +814,12 @@ it('ACTS_ZipFile_3200', 0, async function (done) {
console.log("==================ACTS_ZipFile_3200 end=================="); console.log("==================ACTS_ZipFile_3200 end==================");
}); });
/* /*
* @tc.number: ACTS_ZipFile_3300 * @tc.number: ACTS_ZipFile_3300
* @tc.name: zipFile * @tc.name: zipFile
* @tc.desc: COMPRESS_STRATEGY_FIXED,, * @tc.desc: COMPRESS_STRATEGY_FIXED,,
*/ */
it('ACTS_ZipFile_3300', 0, async function (done) { it('ACTS_ZipFile_3300', 0, async function (done) {
console.log("==================ACTS_ZipFile_3300 start=================="); console.log("==================ACTS_ZipFile_3300 start==================");
var path = dir + "/ACTS_ZipFile_3300.txt"; var path = dir + "/ACTS_ZipFile_3300.txt";
var zipDest = dir + "/ACTS_ZipFile_3300.zip" var zipDest = dir + "/ACTS_ZipFile_3300.zip"
...@@ -872,12 +874,12 @@ it('ACTS_ZipFile_3300', 0, async function (done) { ...@@ -872,12 +874,12 @@ it('ACTS_ZipFile_3300', 0, async function (done) {
console.log("==================ACTS_ZipFile_3300 end=================="); console.log("==================ACTS_ZipFile_3300 end==================");
}); });
/* /*
* @tc.number: ACTS_ZipFile_3500 * @tc.number: ACTS_ZipFile_3500
* @tc.name: zipFile * @tc.name: zipFile
* @tc.desc: INPUT_FILE_NOT_EXIST,, * @tc.desc: INPUT_FILE_NOT_EXIST,,
*/ */
it('ACTS_ZipFile_3500', 0, async function (done) { it('ACTS_ZipFile_3500', 0, async function (done) {
console.log("==================ACTS_ZipFile_3500 start=================="); console.log("==================ACTS_ZipFile_3500 start==================");
var path = dir + "/ACTS_ZipFile_3500.txt"; var path = dir + "/ACTS_ZipFile_3500.txt";
var src = dir + "/ACTS_ZipFile_9900.txt"; var src = dir + "/ACTS_ZipFile_9900.txt";
...@@ -904,12 +906,12 @@ it('ACTS_ZipFile_3500', 0, async function (done) { ...@@ -904,12 +906,12 @@ it('ACTS_ZipFile_3500', 0, async function (done) {
console.log("==================ACTS_ZipFile_3500 end =================="); console.log("==================ACTS_ZipFile_3500 end ==================");
}) })
/* /*
* @tc.number: ACTS_ZipFile_3600 * @tc.number: ACTS_ZipFile_3600
* @tc.name: zipFile * @tc.name: zipFile
* @tc.desc: INPUT_FILE_NULL,, * @tc.desc: INPUT_FILE_NULL,,
*/ */
it('ACTS_ZipFile_3600', 0, async function (done) { it('ACTS_ZipFile_3600', 0, async function (done) {
console.log("==================ACTS_ZipFile_3600 start=================="); console.log("==================ACTS_ZipFile_3600 start==================");
var path = dir + "/ACTS_ZipFile_3600.txt"; var path = dir + "/ACTS_ZipFile_3600.txt";
var zipDest = ""; var zipDest = "";
...@@ -935,12 +937,12 @@ it('ACTS_ZipFile_3600', 0, async function (done) { ...@@ -935,12 +937,12 @@ it('ACTS_ZipFile_3600', 0, async function (done) {
console.log("==================ACTS_ZipFile_3600 end ==================") console.log("==================ACTS_ZipFile_3600 end ==================")
}) })
/* /*
* @tc.number: ACTS_ZipFile_4500 * @tc.number: ACTS_ZipFile_4500
* @tc.name: zipFile * @tc.name: zipFile
* @tc.desc: COMPRESS_STRATEGY_FILTERED_CALLBACK,, * @tc.desc: COMPRESS_STRATEGY_FILTERED_CALLBACK,,
*/ */
it('ACTS_ZipFile_4500', 0, async function (done) { it('ACTS_ZipFile_4500', 0, async function (done) {
console.log("==================ACTS_ZipFile_4500 start=================="); console.log("==================ACTS_ZipFile_4500 start==================");
var path = dir + "/ACTS_ZipFile_4500.txt"; var path = dir + "/ACTS_ZipFile_4500.txt";
var zipDest = dir + "/ACTS_ZipFile_4500.zip" var zipDest = dir + "/ACTS_ZipFile_4500.zip"
...@@ -989,12 +991,12 @@ it('ACTS_ZipFile_4500', 0, async function (done) { ...@@ -989,12 +991,12 @@ it('ACTS_ZipFile_4500', 0, async function (done) {
console.log("==================ACTS_ZipFile_4500 end=================="); console.log("==================ACTS_ZipFile_4500 end==================");
}) })
/* /*
* @tc.number: ACTS_ZipFile_4900 * @tc.number: ACTS_ZipFile_4900
* @tc.name: zipFile * @tc.name: zipFile
* @tc.desc: COMPRESS_STRATEGY_FILTERED_PROMISE, * @tc.desc: COMPRESS_STRATEGY_FILTERED_PROMISE,
*/ */
it('ACTS_ZipFile_4900', 0, async function (done) { it('ACTS_ZipFile_4900', 0, async function (done) {
console.log("==================ACTS_ZipFile_4900 start=================="); console.log("==================ACTS_ZipFile_4900 start==================");
var path = dir + "/ACTS_ZipFile_4900.txt"; var path = dir + "/ACTS_ZipFile_4900.txt";
var zipDest = dir + "/ACTS_ZipFile_4900.zip" var zipDest = dir + "/ACTS_ZipFile_4900.zip"
...@@ -1041,14 +1043,14 @@ it('ACTS_ZipFile_4900', 0, async function (done) { ...@@ -1041,14 +1043,14 @@ it('ACTS_ZipFile_4900', 0, async function (done) {
done(); done();
}); });
console.log("==================ACTS_ZipFile_4900 end=================="); console.log("==================ACTS_ZipFile_4900 end==================");
}) })
/* /*
* @tc.number: ACTS_ZipFile_5000 * @tc.number: ACTS_ZipFile_5000
* @tc.name: zipFile * @tc.name: zipFile
* @tc.desc: COMPRESS_STRATEGY_FIXED, * @tc.desc: COMPRESS_STRATEGY_FIXED,
*/ */
it('ACTS_ZipFile_5000', 0, async function (done) { it('ACTS_ZipFile_5000', 0, async function (done) {
console.log("==================ACTS_ZipFile_5000 start=================="); console.log("==================ACTS_ZipFile_5000 start==================");
var path = dir + "/ACTS_ZipFile_5000.txt"; var path = dir + "/ACTS_ZipFile_5000.txt";
var zipDest = dir + "/ACTS_ZipFile_5000.zip" var zipDest = dir + "/ACTS_ZipFile_5000.zip"
...@@ -1095,152 +1097,205 @@ it('ACTS_ZipFile_5000', 0, async function (done) { ...@@ -1095,152 +1097,205 @@ it('ACTS_ZipFile_5000', 0, async function (done) {
console.log("==================ACTS_ZipFile_5000 end=================="); console.log("==================ACTS_ZipFile_5000 end==================");
}) })
/* /*
* @tc.number: SUB_BMS_TOOL_ZLIB_0076 * @tc.number: SUB_BMS_TOOL_ZLIB_0076
* @tc.name: compressFile success * @tc.name: compressFile success
* @tc.desc: inFile and out file is valid * @tc.desc: inFile and out file is valid
*/ */
it('SUB_BMS_TOOL_ZLIB_0077', 0, async function (done) { it('SUB_BMS_TOOL_ZLIB_0077', 0, async function (done) {
console.log("==================ACTS_compressFile_0100 start=================="); console.log("==================ACTS_compressFile_0100 start==================");
var path = dir + "/SUB_BMS_TOOL_ZLIB_0077.txt"; let path1 = dir + "/SUB_BMS_TOOL_ZLIB_00771.txt";
var zipDest = dir + "/SUB_BMS_TOOL_ZLIB_0077.zip"; let zipDest1 = dir + "/SUB_BMS_TOOL_ZLIB_00771.zip";
var fd = fileio.openSync(path, 0o100 | 0o2, 0o666); let path2 = dir + "/SUB_BMS_TOOL_ZLIB_00772.txt";
fileio.write(fd, infos).then(function (number) { let zipDest2 = dir + "/SUB_BMS_TOOL_ZLIB_00772.zip";
let fd = fileio.openSync(path1, 0o100 | 0o2, 0o666);
await fileio.write(fd, infos).then(function (number) {
console.info("SUB_BMS_TOOL_ZLIB_0077 write data to file successfully :" + number); console.info("SUB_BMS_TOOL_ZLIB_0077 write data to file successfully :" + number);
var options = {}; }).catch(function (err) {
options.level = zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION; console.info("SUB_BMS_TOOL_ZLIB_0077 write data to file failed with error:" + err);
expect(err).assertFail();
});
console.info("SUB_BMS_TOOL_ZLIB_0077 start compressFile"); console.info("SUB_BMS_TOOL_ZLIB_0077 start compressFile");
zlib.compressFile(path, zipDest, options).then((data) => { await zlib.compressFile(path1, zipDest1, {
console.log("SUB_BMS_TOOL_ZLIB_0077 data: " + data); level: zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION
var zipStat = fileio.statSync(zipDest); }).then((data) => {
var isFile = zipStat.isFile(); console.info("SUB_BMS_TOOL_ZLIB_0077 data: " + JSON.stringify(data));
let zipStat = fileio.statSync(zipDest1);
let isFile = zipStat.isFile();
expect(isFile).assertTrue(); expect(isFile).assertTrue();
var srcSize = fileio.statSync(path).size; let srcSize = fileio.statSync(path1).size;
var destSize = zipStat.size; let destSize = zipStat.size;
expect(srcSize > destSize).assertTrue(); expect(srcSize > destSize).assertTrue();
expect(data).assertEqual(null); expect(data).assertEqual(null);
done();
}).catch((err) => { }).catch((err) => {
console.log("SUB_BMS_TOOL_ZLIB_0077 zipFile fail: " + err); console.info("SUB_BMS_TOOL_ZLIB_0077 data: " + JSON.stringify(err));
expect(data).assertFail(); expect(err).assertFail();
}) })
let fd2 = fileio.openSync(path2, 0o100 | 0o2, 0o666);
await fileio.write(fd2, infos).then(function (number) {
console.info("SUB_BMS_TOOL_ZLIB_0077 write data to file successfully :" + number);
}).catch(function (err) { }).catch(function (err) {
console.info("SUB_BMS_TOOL_ZLIB_0077 write data to file failed with error:" + err); console.info("SUB_BMS_TOOL_ZLIB_0077 write data to file failed with error:" + err);
expect(err).assertFail(); expect(err).assertFail();
done();
}); });
console.log("==================SUB_BMS_TOOL_ZLIB_0077 end=================="); zlib.compressFile(path2, zipDest2, {
}) level: zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION
}, (err, data) => {
console.info("SUB_BMS_TOOL_ZLIB_0077 data2: " + JSON.stringify(data));
console.info("SUB_BMS_TOOL_ZLIB_0077 err2: " + JSON.stringify(err));
let zipStat = fileio.statSync(zipDest2);
let isFile = zipStat.isFile();
expect(isFile).assertTrue();
let srcSize = fileio.statSync(path2).size;
let destSize = zipStat.size;
expect(srcSize > destSize).assertTrue();
expect(data).assertEqual(undefined);
expect(err).assertEqual(null);
done();
})
})
/* /*
* @tc.number: SUB_BMS_TOOL_ZLIB_0077 * @tc.number: SUB_BMS_TOOL_ZLIB_0077
* @tc.name: compressFile src file is invalid * @tc.name: compressFile src file is invalid
* @tc.desc: inFile is not exist * @tc.desc: inFile is not exist
*/ */
it('SUB_BMS_TOOL_ZLIB_0078', 0, async function (done) { it('SUB_BMS_TOOL_ZLIB_0078', 0, async function (done) {
console.log("==================SUB_BMS_TOOL_ZLIB_0078 start=================="); console.log("==================SUB_BMS_TOOL_ZLIB_0078 start==================");
var path ="nonexist.txt"; var path = "nonexist.txt";
var zipDest = dir + "/SUB_BMS_TOOL_ZLIB_0078.zip" var zipDest = dir + "/SUB_BMS_TOOL_ZLIB_0078.zip"
var options = {}; await zlib.compressFile(path, zipDest, {
options.level = zlib.CompressLevel.COMPRESS_LEVEL_NO_COMPRESSION; level: zlib.CompressLevel.COMPRESS_LEVEL_NO_COMPRESSION
zlib.compressFile(path, zipDest, options).then((data) => { }).then((data) => {
console.log("SUB_BMS_TOOL_ZLIB_0078 invalid src file success!") console.log("SUB_BMS_TOOL_ZLIB_0078 invalid src file success!")
expect(data).assertFail(); expect(data).assertFail();
done(); done();
}).catch((err) => { }).catch((err) => {
console.log("SUB_BMS_TOOL_ZLIB_0078 zipFile fail: " + err); console.log("SUB_BMS_TOOL_ZLIB_0078 zipFile fail: " + JSON.stringify(err));
expect(err.code).assertEqual(SRC_FILE_INVALID); expect(err.code).assertEqual(SRC_FILE_INVALID);
done(); done();
}) })
console.log("==================SUB_BMS_TOOL_ZLIB_0078 end=================="); console.log("==================SUB_BMS_TOOL_ZLIB_0078 end==================");
}) })
/* /*
* @tc.number: SUB_BMS_TOOL_ZLIB_0077 * @tc.number: SUB_BMS_TOOL_ZLIB_0077
* @tc.name: decompressFile success * @tc.name: decompressFile success
* @tc.desc: inFile and out file is valid * @tc.desc: inFile and out file is valid
*/ */
it('SUB_BMS_TOOL_ZLIB_0087', 0, async function (done) { it('SUB_BMS_TOOL_ZLIB_0087', 0, async function (done) {
console.log("==================SUB_BMS_TOOL_ZLIB_0087 start=================="); console.log("==================SUB_BMS_TOOL_ZLIB_0087 start==================");
var path = dir + "/SUB_BMS_TOOL_ZLIB_0087.txt"; let path = dir + "/SUB_BMS_TOOL_ZLIB_0087.txt";
var zipDest = dir + "/SUB_BMS_TOOL_ZLIB_0087.zip" let zipDest1 = dir + "/SUB_BMS_TOOL_ZLIB_00871.zip"
var unzipdir = dir + "/SUB_BMS_TOOL_ZLIB_0087"; let zipDest2 = dir + "/SUB_BMS_TOOL_ZLIB_00872.zip"
var finalFile = unzipdir + "/SUB_BMS_TOOL_ZLIB_0087.txt"; let unzipdir1 = dir + "/SUB_BMS_TOOL_ZLIB_00871";
var options = {}; let unzipdir2 = dir + "/SUB_BMS_TOOL_ZLIB_00872";
options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FIXED; let finalFile1 = unzipdir1 + "/SUB_BMS_TOOL_ZLIB_0087.txt";
var fd = fileio.openSync(path, 0o100 | 0o2, 0o666); let finalFile2 = unzipdir2 + "/SUB_BMS_TOOL_ZLIB_0087.txt";
fileio.write(fd, infos).then(function (number) { let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
console.info("SUB_BMS_TOOL_ZLIB_0087 write data to file successfully:" + number); await fileio.write(fd, infos).then(function (number) {
zlib.compressFile(path, zipDest, options).then(data => { console.info("SUB_BMS_TOOL_ZLIB_0087 write data to file success " + JSON.stringify(number));
var zipStat = fileio.statSync(zipDest); }).catch(function (err) {
var isFile = zipStat.isFile(); console.info("SUB_BMS_TOOL_ZLIB_0087 write data to file failed with error:" + err);
expect(err).assertFail();
});
await zlib.compressFile(path, zipDest1, {
level: zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION
}).then(data => {
console.info("compressFile success " + JSON.stringify(data));
let zipStat = fileio.statSync(zipDest1);
let isFile = zipStat.isFile();
expect(isFile).assertTrue(); expect(isFile).assertTrue();
var srcSize = fileio.statSync(path).size; let srcSize = fileio.statSync(path).size;
var destSize = zipStat.size; let destSize = zipStat.size;
expect(srcSize > destSize).assertTrue(); expect(srcSize > destSize).assertTrue();
expect(data).assertEqual(null); expect(data).assertEqual(null);
fileio.mkdir(unzipdir).then(function () { }).catch(err => {
console.info("SUB_BMS_TOOL_ZLIB_0087 mkdir successfully"); console.info("compressFile fail " + JSON.stringify(err));
zlib.decompressFile(zipDest, unzipdir, options).then(data => { expect(err).assertFail();
console.log("SUB_BMS_TOOL_ZLIB_0087 data: " + data); })
var zipStat = fileio.statSync(finalFile); await zlib.compressFile(path, zipDest2, {
var isFile = zipStat.isFile(); level: zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION
}).then(data => {
console.info("compressFile success " + JSON.stringify(data));
let zipStat = fileio.statSync(zipDest2);
let isFile = zipStat.isFile();
expect(isFile).assertTrue(); expect(isFile).assertTrue();
let srcSize = fileio.statSync(path).size;
let destSize = zipStat.size;
expect(srcSize > destSize).assertTrue();
expect(data).assertEqual(null); expect(data).assertEqual(null);
done();
}).catch(err => { }).catch(err => {
console.log("decomepressFile fail: " + err); console.info("compressFile fail " + JSON.stringify(err));
expect(err).assertFail(); expect(err).assertFail();
done();
}) })
await fileio.mkdir(unzipdir1).then(function () {
console.info("SUB_BMS_TOOL_ZLIB_0087 mkdir successfully");
}).catch(function (error) { }).catch(function (error) {
console.info("SUB_BMS_TOOL_ZLIB_0087 mkdir failed with error:" + error); console.info("SUB_BMS_TOOL_ZLIB_0087 mkdir failed with error:" + error);
expect(error).assertFail(); expect(error).assertFail();
done();
}); });
await zlib.decompressFile(zipDest1, unzipdir1, {
level: zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION
}).then(data => {
console.info("decompressFile success1 " + JSON.stringify(data));
let zipStat = fileio.statSync(finalFile1);
let isFile = zipStat.isFile();
expect(isFile).assertTrue();
expect(data).assertEqual(null);
}).catch(err => { }).catch(err => {
console.log("compress fail: " + err); console.info("decompressFile fail1 " + JSON.stringify(err));
expect(err).assertFail(); expect(err).assertFail();
done();
}) })
}).catch(function (err) { await fileio.mkdir(unzipdir2).then(function () {
console.info("SUB_BMS_TOOL_ZLIB_0087 write data to file failed with error:" + err); console.info("SUB_BMS_TOOL_ZLIB_0087 mkdir successfully");
expect(err).assertFail(); }).catch(function (error) {
done(); console.info("SUB_BMS_TOOL_ZLIB_0087 mkdir failed with error:" + error);
expect(error).assertFail();
}); });
console.log("==================SUB_BMS_TOOL_ZLIB_0087 end=================="); zlib.decompressFile(zipDest2, unzipdir2, {
level: zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION
}, (err, data) => {
console.info("decompressFile success2 " + JSON.stringify(data));
console.info("decompressFile success2 " + JSON.stringify(err));
let zipStat = fileio.statSync(finalFile2);
let isFile = zipStat.isFile();
expect(isFile).assertTrue();
expect(data).assertEqual(undefined);
expect(err).assertEqual(null);
done();
})
}) })
/* /*
* @tc.number: ACTS_decompressFile_0200 * @tc.number: ACTS_decompressFile_0200
* @tc.name: decompressFile src file invalid * @tc.name: decompressFile src file invalid
* @tc.desc: inFile is empty * @tc.desc: inFile is empty
*/ */
it('SUB_BMS_TOOL_ZLIB_0088', 0, async function (done) { it('SUB_BMS_TOOL_ZLIB_0088', 0, async function (done) {
console.log("==================SUB_BMS_TOOL_ZLIB_0088 start=================="); console.log("==================SUB_BMS_TOOL_ZLIB_0088 start==================");
var zipDest = dir + "/noneexist.zip" var zipDest = dir + "/noneexist.zip"
var unzipdir = dir + "/SUB_BMS_TOOL_ZLIB_0088"; var unzipdir = dir + "/SUB_BMS_TOOL_ZLIB_0088";
var options = {}; await fileio.mkdir(unzipdir).then(function () {
options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FIXED;
fileio.mkdir(unzipdir).then(function () {
console.info("SUB_BMS_TOOL_ZLIB_0088 mkdir successfully"); console.info("SUB_BMS_TOOL_ZLIB_0088 mkdir successfully");
zlib.decompressFile(zipDest, unzipdir, options).then(data => { }).catch(function (error) {
console.info("SUB_BMS_TOOL_ZLIB_0088 mkdir failed with error:" + error);
expect(error).assertFail();
});
await zlib.decompressFile(zipDest, unzipdir, {
strategy: zlib.CompressStrategy.COMPRESS_STRATEGY_FIXED
}).then(data => {
console.log("SUB_BMS_TOOL_ZLIB_0088 data: " + data); console.log("SUB_BMS_TOOL_ZLIB_0088 data: " + data);
expect(data).assertEqual(null); expect(data).assertFail(null);
done(); done();
}).catch(err => { }).catch(err => {
console.log("decompress fail: " + err); console.log("decompress fail: " + JSON.stringify(err));
expect(err.code).assertEqual(SRC_FILE_INVALID); expect(err.code).assertEqual(SRC_FILE_INVALID);
done(); done();
}) })
}).catch(function (error) {
console.info("SUB_BMS_TOOL_ZLIB_0088 mkdir failed with error:" + error);
expect(error).assertFail();
done();
});
console.log("==================SUB_BMS_TOOL_ZLIB_0088 end=================="); console.log("==================SUB_BMS_TOOL_ZLIB_0088 end==================");
}) })
}) })
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册