提交 91f1d6e3 编写于 作者: I inter515

删除系统api

Signed-off-by: Ninter515 <ry.renyi@huawei.com>
上级 490bf131
......@@ -26,8 +26,6 @@ group("bundlemanager") {
"actsbmsmetadatatest:ActsBmsMetaDataTest",
"actsbundlemanageretstest:ActsBundleManagerEtsTest",
"actsbundlemanagertest:ActsBundleManagerTest",
"actsbundlemanageruninstall:ActsBundleManagerUninstallTest",
"actsbundlemgrmultipleinstalltest:ActsBundleMgrMultipleInstallTest",
"sceneProject/bmsaccesstokenone:bmsAccessTokenTest1",
"sceneProject/bmsaccesstokenthree:bmsAccessTokenTest3",
"sceneProject/bmsaccesstokentwo:bmsAccessTokenTest2",
......
......@@ -26,13 +26,25 @@
"push": [
"bmsAccessTokenTest1.hap->/data/test/bmsAccessTokenTest1.hap",
"bmsAccessTokenTest2.hap->/data/test/bmsAccessTokenTest2.hap",
"bmsAccessTokenTest3.hap->/data/test/bmsAccessTokenTest3.hap"
"bmsAccessTokenTest3.hap->/data/test/bmsAccessTokenTest3.hap",
"bmsAccessTokenTest4.hap->/data/test/bmsAccessTokenTest4.hap",
"bmsAccessTokenTest5.hap->/data/test/bmsAccessTokenTest5.hap"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod 644 /data/test/*.hap"
"bm install -p /data/test/bmsAccessTokenTest1.hap",
"bm install -p /data/test/bmsAccessTokenTest4.hap",
"bm install -p /data/test/bmsAccessTokenTest3.hap",
"bm install -p /data/test/bmsAccessTokenTest2.hap",
"bm install -p /data/test/bmsAccessTokenTest5.hap"
],
"teardown-command":[
"bm uninstall -n com.example.bmsaccesstoken1",
"bm uninstall -n com.example.bmsaccesstoken2",
"bm uninstall -n com.example.bmsaccesstoken3",
"rm -rf /data/test/"
]
}
]
......
......@@ -47,10 +47,6 @@
}
],
"reqPermissions": [
{
"name": "ohos.permission.INSTALL_BUNDLE",
"reason": "need use ohos.permission.INSTALL_BUNDLE"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
......@@ -62,14 +58,6 @@
{
"name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
"reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
},
{
"name":"ohos.permission.REMOVE_CACHE_FILES",
"reason":"need use ohos.permission.REMOVE_CACHE_FILES"
},
{
"name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
"reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
}
],
"js": [
......
......@@ -16,16 +16,10 @@
import bundle from '@ohos.bundle'
import { describe, it, expect } from 'deccjsunit/index'
const BUNDLE_PATH1 = ['/data/test/bmsAccessTokenTest1.hap'];
const BUNDLE_PATH2 = ['/data/test/bmsAccessTokenTest2.hap'];
const BUNDLE_PATH3 = ['/data/test/bmsAccessTokenTest3.hap'];
const BUNDLE_NAME1 = 'com.example.bmsaccesstoken1';
const BUNDLE_NAME2 = 'com.example.bmsaccesstoken2';
const BUNDLE_NAME3 = 'com.example.bmsaccesstoken3';
const USERID = 100;
let installParam = {
userId: 100,
installFlag: 1,
isKeepData: false
};
describe('ActsBmsAccessTokenTest', function () {
......@@ -35,23 +29,16 @@ describe('ActsBmsAccessTokenTest', function () {
* @tc.desc: get the accessTokenId
*/
it('bms_AccessTokenId_0100', 0, async function (done) {
let installer = await bundle.getBundleInstaller();
installer.install(BUNDLE_PATH1, installParam, OnReceiveInstallEvent);
async function OnReceiveInstallEvent(err, data) {
checkInstallOrUninstall(err, data);
await bundle.getApplicationInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_DEFAULT, USERID)
.then(applicationInfo => {
console.info('accessTokenId: ' + applicationInfo.accessTokenId);
expect(applicationInfo.name).assertEqual(BUNDLE_NAME1);
expect(applicationInfo.accessTokenId).assertLarger(0);
}).catch((err) => {
expect(err).assertFail();
});
installer.uninstall(BUNDLE_NAME1, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
await bundle.getApplicationInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_DEFAULT, USERID)
.then(applicationInfo => {
console.info('accessTokenId: ' + applicationInfo.accessTokenId);
expect(applicationInfo.name).assertEqual(BUNDLE_NAME1);
expect(applicationInfo.accessTokenId).assertLarger(0);
done();
}).catch((err) => {
expect(err).assertFail();
done();
});
}
});
/*
......@@ -60,29 +47,22 @@ describe('ActsBmsAccessTokenTest', function () {
* @tc.desc: get the reqPermissions and reqPermissionStates
*/
it('bms_AccessTokenId_0200', 0, async function (done) {
let installer = await bundle.getBundleInstaller();
installer.install(BUNDLE_PATH1, installParam, OnReceiveInstallEvent);
async function OnReceiveInstallEvent(err, data) {
checkInstallOrUninstall(err, data);
await bundle.getBundleInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION)
.then(bundleInfo => {
expect(bundleInfo.name).assertEqual(BUNDLE_NAME1);
expect(bundleInfo.reqPermissions.length).assertEqual(3);
expect(bundleInfo.reqPermissions[0]).assertEqual("ohos.permission.ALPHA");
expect(bundleInfo.reqPermissions[1]).assertEqual("ohos.permission.BETA");
expect(bundleInfo.reqPermissions[2]).assertEqual("ohos.permission.KEEP_BACKGROUND_RUNNING");
expect(bundleInfo.reqPermissionStates.length).assertEqual(3);
expect(bundleInfo.reqPermissionStates[0]).assertEqual(-1);
expect(bundleInfo.reqPermissionStates[1]).assertEqual(-1);
expect(bundleInfo.reqPermissionStates[2]).assertEqual(0);
}).catch((err) => {
expect(err).assertFail();
});
installer.uninstall(BUNDLE_NAME1, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
await bundle.getBundleInfo(BUNDLE_NAME3, bundle.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION)
.then(bundleInfo => {
expect(bundleInfo.name).assertEqual(BUNDLE_NAME3);
expect(bundleInfo.reqPermissions.length).assertEqual(3);
expect(bundleInfo.reqPermissions[0]).assertEqual("ohos.permission.ALPHA");
expect(bundleInfo.reqPermissions[1]).assertEqual("ohos.permission.BETA");
expect(bundleInfo.reqPermissions[2]).assertEqual("ohos.permission.KEEP_BACKGROUND_RUNNING");
expect(bundleInfo.reqPermissionStates.length).assertEqual(3);
expect(bundleInfo.reqPermissionStates[0]).assertEqual(-1);
expect(bundleInfo.reqPermissionStates[1]).assertEqual(-1);
expect(bundleInfo.reqPermissionStates[2]).assertEqual(0);
done();
}).catch((err) => {
expect(err).assertFail();
done();
});
}
});
/*
......@@ -91,37 +71,26 @@ describe('ActsBmsAccessTokenTest', function () {
* @tc.desc: get the reqPermissions and reqPermissionStates
*/
it('bms_AccessTokenId_0300', 0, async function (done) {
let installer = await bundle.getBundleInstaller();
installer.install(BUNDLE_PATH1, installParam, OnReceiveInstallEvent);
async function OnReceiveInstallEvent(err, data) {
checkInstallOrUninstall(err, data);
installer.install(BUNDLE_PATH2, installParam, OnReceiveUpdateEvent);
}
async function OnReceiveUpdateEvent(err, data) {
checkInstallOrUninstall(err, data);
await bundle.getBundleInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION)
.then(bundleInfo => {
expect(bundleInfo.name).assertEqual(BUNDLE_NAME1);
expect(bundleInfo.reqPermissions.length).assertEqual(5);
expect(bundleInfo.reqPermissions[0]).assertEqual("ohos.permission.ALPHA");
expect(bundleInfo.reqPermissions[1]).assertEqual("ohos.permission.KEEP_BACKGROUND_RUNNING");
expect(bundleInfo.reqPermissions[2]).assertEqual("ohos.permission.LOCATION_IN_BACKGROUND");
expect(bundleInfo.reqPermissions[3]).assertEqual("ohos.permission.SYSTEM_FLOAT_WINDOW");
expect(bundleInfo.reqPermissions[4]).assertEqual("ohos.permission.USE_BLUETOOTH");
expect(bundleInfo.reqPermissionStates.length).assertEqual(5);
expect(bundleInfo.reqPermissionStates[0]).assertEqual(-1);
expect(bundleInfo.reqPermissionStates[1]).assertEqual(0);
expect(bundleInfo.reqPermissionStates[2]).assertEqual(-1);
expect(bundleInfo.reqPermissionStates[3]).assertEqual(0);
expect(bundleInfo.reqPermissionStates[4]).assertEqual(0);
}).catch((err) => {
expect(err).assertFail();
});
installer.uninstall(BUNDLE_NAME1, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
await bundle.getBundleInfo(BUNDLE_NAME2, bundle.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION)
.then(bundleInfo => {
expect(bundleInfo.name).assertEqual(BUNDLE_NAME2);
expect(bundleInfo.reqPermissions.length).assertEqual(5);
expect(bundleInfo.reqPermissions[0]).assertEqual("ohos.permission.ALPHA");
expect(bundleInfo.reqPermissions[1]).assertEqual("ohos.permission.KEEP_BACKGROUND_RUNNING");
expect(bundleInfo.reqPermissions[2]).assertEqual("ohos.permission.LOCATION_IN_BACKGROUND");
expect(bundleInfo.reqPermissions[3]).assertEqual("ohos.permission.SYSTEM_FLOAT_WINDOW");
expect(bundleInfo.reqPermissions[4]).assertEqual("ohos.permission.USE_BLUETOOTH");
expect(bundleInfo.reqPermissionStates.length).assertEqual(5);
expect(bundleInfo.reqPermissionStates[0]).assertEqual(-1);
expect(bundleInfo.reqPermissionStates[1]).assertEqual(0);
expect(bundleInfo.reqPermissionStates[2]).assertEqual(-1);
expect(bundleInfo.reqPermissionStates[3]).assertEqual(0);
expect(bundleInfo.reqPermissionStates[4]).assertEqual(0);
done();
}).catch((err) => {
expect(err).assertFail();
done();
});
}
});
/*
......@@ -130,39 +99,28 @@ describe('ActsBmsAccessTokenTest', function () {
* @tc.desc: get the reqPermissions and reqPermissionStates
*/
it('bms_AccessTokenId_0400', 0, async function (done) {
let installer = await bundle.getBundleInstaller();
installer.install(BUNDLE_PATH1, installParam, OnReceiveInstallEvent);
async function OnReceiveInstallEvent(err, data) {
checkInstallOrUninstall(err, data);
installer.install(BUNDLE_PATH3, installParam, OnReceiveUpdateEvent);
}
async function OnReceiveUpdateEvent(err, data) {
checkInstallOrUninstall(err, data);
await bundle.getBundleInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION)
.then(bundleInfo => {
expect(bundleInfo.name).assertEqual(BUNDLE_NAME1);
expect(bundleInfo.reqPermissions.length).assertEqual(6);
expect(bundleInfo.reqPermissions[0]).assertEqual("ohos.permission.ALPHA");
expect(bundleInfo.reqPermissions[1]).assertEqual("ohos.permission.BETA");
expect(bundleInfo.reqPermissions[2]).assertEqual("ohos.permission.KEEP_BACKGROUND_RUNNING");
expect(bundleInfo.reqPermissions[3]).assertEqual("ohos.permission.LOCATION_IN_BACKGROUND");
expect(bundleInfo.reqPermissions[4]).assertEqual("ohos.permission.SYSTEM_FLOAT_WINDOW");
expect(bundleInfo.reqPermissions[5]).assertEqual("ohos.permission.USE_BLUETOOTH");
expect(bundleInfo.reqPermissionStates.length).assertEqual(6);
expect(bundleInfo.reqPermissionStates[0]).assertEqual(-1);
expect(bundleInfo.reqPermissionStates[1]).assertEqual(-1);
expect(bundleInfo.reqPermissionStates[2]).assertEqual(0);
expect(bundleInfo.reqPermissionStates[3]).assertEqual(-1);
expect(bundleInfo.reqPermissionStates[4]).assertEqual(0);
expect(bundleInfo.reqPermissionStates[5]).assertEqual(0);
}).catch((err) => {
expect(err).assertFail();
});
installer.uninstall(BUNDLE_NAME1, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
await bundle.getBundleInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION)
.then(bundleInfo => {
expect(bundleInfo.name).assertEqual(BUNDLE_NAME1);
expect(bundleInfo.reqPermissions.length).assertEqual(6);
expect(bundleInfo.reqPermissions[0]).assertEqual("ohos.permission.ALPHA");
expect(bundleInfo.reqPermissions[1]).assertEqual("ohos.permission.BETA");
expect(bundleInfo.reqPermissions[2]).assertEqual("ohos.permission.KEEP_BACKGROUND_RUNNING");
expect(bundleInfo.reqPermissions[3]).assertEqual("ohos.permission.LOCATION_IN_BACKGROUND");
expect(bundleInfo.reqPermissions[4]).assertEqual("ohos.permission.SYSTEM_FLOAT_WINDOW");
expect(bundleInfo.reqPermissions[5]).assertEqual("ohos.permission.USE_BLUETOOTH");
expect(bundleInfo.reqPermissionStates.length).assertEqual(6);
expect(bundleInfo.reqPermissionStates[0]).assertEqual(-1);
expect(bundleInfo.reqPermissionStates[1]).assertEqual(-1);
expect(bundleInfo.reqPermissionStates[2]).assertEqual(0);
expect(bundleInfo.reqPermissionStates[3]).assertEqual(-1);
expect(bundleInfo.reqPermissionStates[4]).assertEqual(0);
expect(bundleInfo.reqPermissionStates[5]).assertEqual(0);
done();
}).catch((err) => {
expect(err).assertFail();
done();
});
}
});
/**
......@@ -171,30 +129,16 @@ describe('ActsBmsAccessTokenTest', function () {
* @tc.desc Test getBundleInfos interfaces with with a flag
*/
it("bms_AccessTokenId_0500", 0, async function (done) {
let installer = await bundle.getBundleInstaller();
installer.install(
BUNDLE_PATH1,
installParam,
OnReceiveInstallEvent
);
async function OnReceiveInstallEvent(err, data) {
checkInstallOrUninstall(err, data);
await bundle.getApplicationInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_DEFAULT)
.then((applicationInfo) => {
console.info("bms_AccessTokenId_0500 accessTokenId: " + applicationInfo.accessTokenId);
expect(applicationInfo.name).assertEqual(BUNDLE_NAME1);
expect(applicationInfo.accessTokenId).assertLarger(0);
}).catch((err) => {
expect(err).assertFail();
});
installer.uninstall(
BUNDLE_NAME1,
installParam,
(err, data) => {
checkInstallOrUninstall(err, data);
done();
});
}
await bundle.getApplicationInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_DEFAULT)
.then((applicationInfo) => {
console.info("bms_AccessTokenId_0500 accessTokenId: " + applicationInfo.accessTokenId);
expect(applicationInfo.name).assertEqual(BUNDLE_NAME1);
expect(applicationInfo.accessTokenId).assertLarger(0);
done();
}).catch((err) => {
expect(err).assertFail();
done();
});
});
/**
......@@ -203,30 +147,16 @@ describe('ActsBmsAccessTokenTest', function () {
* @tc.desc Test getBundleInfos interfaces with a flag
*/
it("bms_AccessTokenId_0600", 0, async function (done) {
let installer = await bundle.getBundleInstaller();
installer.install(
BUNDLE_PATH1,
installParam,
OnReceiveInstallEvent
);
async function OnReceiveInstallEvent(err, data) {
checkInstallOrUninstall(err, data);
await bundle.getApplicationInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES)
.then((applicationInfo) => {
console.info("bms_AccessTokenId_0600 accessTokenId: " + applicationInfo.accessTokenId);
expect(applicationInfo.name).assertEqual(BUNDLE_NAME1);
expect(applicationInfo.accessTokenId).assertLarger(0);
}).catch((err) => {
expect(err).assertFail();
});
installer.uninstall(
BUNDLE_NAME1,
installParam,
(err, data) => {
checkInstallOrUninstall(err, data);
done();
});
}
await bundle.getApplicationInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES)
.then((applicationInfo) => {
console.info("bms_AccessTokenId_0600 accessTokenId: " + applicationInfo.accessTokenId);
expect(applicationInfo.name).assertEqual(BUNDLE_NAME1);
expect(applicationInfo.accessTokenId).assertLarger(0);
done();
}).catch((err) => {
expect(err).assertFail();
done();
});
});
/**
......@@ -235,30 +165,16 @@ describe('ActsBmsAccessTokenTest', function () {
* @tc.desc Test getBundleInfos interfaces with a flag
*/
it("bms_AccessTokenId_0700", 0, async function (done) {
let installer = await bundle.getBundleInstaller();
installer.install(
BUNDLE_PATH1,
installParam,
OnReceiveInstallEvent
);
async function OnReceiveInstallEvent(err, data) {
checkInstallOrUninstall(err, data);
await bundle.getApplicationInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION)
.then((applicationInfo) => {
console.info("bms_AccessTokenId_0700 accessTokenId: " + applicationInfo.accessTokenId);
expect(applicationInfo.name).assertEqual(BUNDLE_NAME1);
expect(applicationInfo.accessTokenId).assertLarger(0);
}).catch((err) => {
expect(err).assertFail();
});
installer.uninstall(
BUNDLE_NAME1,
installParam,
(err, data) => {
checkInstallOrUninstall(err, data);
done();
});
}
await bundle.getApplicationInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION)
.then((applicationInfo) => {
console.info("bms_AccessTokenId_0700 accessTokenId: " + applicationInfo.accessTokenId);
expect(applicationInfo.name).assertEqual(BUNDLE_NAME1);
expect(applicationInfo.accessTokenId).assertLarger(0);
done();
}).catch((err) => {
expect(err).assertFail();
done();
});
});
/**
......@@ -267,36 +183,16 @@ describe('ActsBmsAccessTokenTest', function () {
* @tc.desc Test getBundleInfos interfaces with a flag
*/
it("bms_AccessTokenId_0800", 0, async function (done) {
let installer = await bundle.getBundleInstaller();
installer.install(
BUNDLE_PATH1,
installParam,
OnReceiveInstallEvent
);
async function OnReceiveInstallEvent(err, data) {
checkInstallOrUninstall(err, data);
await bundle.getApplicationInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION)
.then((applicationInfo) => {
console.info("bms_AccessTokenId_0800 accessTokenId: " + applicationInfo.accessTokenId);
expect(applicationInfo.name).assertEqual(BUNDLE_NAME1);
expect(applicationInfo.accessTokenId).assertLarger(0);
}).catch((err) => {
expect(err).assertFail();
});
installer.uninstall(
BUNDLE_NAME1,
installParam,
(err, data) => {
checkInstallOrUninstall(err, data);
done();
});
}
await bundle.getApplicationInfo(BUNDLE_NAME2, bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION)
.then((applicationInfo) => {
console.info("bms_AccessTokenId_0800 accessTokenId: " + applicationInfo.accessTokenId);
expect(applicationInfo.name).assertEqual(BUNDLE_NAME2);
expect(applicationInfo.accessTokenId).assertLarger(0);
done();
}).catch((err) => {
expect(err).assertFail();
done();
});
});
function checkInstallOrUninstall(err, data) {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
}
});
......@@ -32,16 +32,34 @@
"bmsThirdBundleTest4.hap->/data/test/bmsThirdBundleTest4.hap",
"bmsThirdBundleTest5.hap->/data/test/bmsThirdBundleTest5.hap",
"bmsThirdBundleTest6.hap->/data/test/bmsThirdBundleTest6.hap",
"bmsThirdBundleTest7.hap->/data/test/bmsThirdBundleTest7.hap",
"bmsThirdBundleTest7A.hap->/data/test/bmsThirdBundleTest7A.hap",
"bmsThirdBundleTestA1.hap->/data/test/bmsThirdBundleTestA1.hap",
"bmsSystemBundleTest2.hap->/data/test/bmsSystemBundleTest2.hap",
"bmsSystemBundleTest2Feature.hap->/data/test/bmsSystemBundleTest2Feature.hap",
"bmsSystemBundleTest2Update.hap->/data/test/bmsSystemBundleTest2Update.hap"
"bmsSystemBundleTest2.hap->/data/test/bmsSystemBundleTest2.hap"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod 644 /data/test/*.hap"
"bm install -p /data/test/bmsThirdBundleTest1.hap",
"bm install -p /data/test/bmsThirdBundleTest2.hap",
"bm install -p /data/test/bmsThirdBundleTest3.hap",
"bm install -p /data/test/bmsThirdBundleTest4.hap",
"bm install -p /data/test/bmsThirdBundleTest5.hap",
"bm install -p /data/test/bmsThirdBundleTest6.hap",
"bm install -p /data/test/bmsThirdBundleTest7.hap",
"bm install -p /data/test/bmsThirdBundleTest7A.hap",
"bm install -p /data/test/bmsSystemBundleTest2.hap"
],
"teardown-command":[
"bm uninstall -n com.example.third1",
"bm uninstall -n com.example.third2",
"bm uninstall -n com.example.third4",
"bm uninstall -n com.example.third5",
"bm uninstall -n com.example.third6",
"bm uninstall -n com.example.third7",
"bm uninstall -n com.example.system2",
"rm -rf /data/test/"
]
}
]
......
......@@ -47,10 +47,6 @@
}
],
"reqPermissions": [
{
"name": "ohos.permission.INSTALL_BUNDLE",
"reason": "need use ohos.permission.INSTALL_BUNDLE"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
......@@ -62,14 +58,6 @@
{
"name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
"reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
},
{
"name":"ohos.permission.REMOVE_CACHE_FILES",
"reason":"need use ohos.permission.REMOVE_CACHE_FILES"
},
{
"name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
"reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
}
],
"js": [
......
......@@ -16,16 +16,9 @@ import bundle from '@ohos.bundle'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit'
const BUNDLE_NAME1 = 'com.example.third1';
const BUNDLE_PATH1 = ['/data/test/bmsThirdBundleTest1.hap'];
const SYSTEM_PATH = '/data/test/bmsSystemBundleTest2.hap';
const SYSTEM_NAME = 'com.example.system2';
const ABILITIY_NAME8 = 'com.example.system2.MainAbility';
const USERID = 100;
let installParam = {
userId: 100,
installFlag: 1,
isKeepData: false
};
describe('ActsBmsQueryAbilityByWant', function () {
......@@ -36,35 +29,26 @@ describe('ActsBmsQueryAbilityByWant', function () {
* 2.queryAbilityByWant for third app
*/
it('bms_queryAbilityByWant_0100', 0, async function (done) {
await bundle.getBundleInstaller().then(installer => {
installer.install(BUNDLE_PATH1, installParam, onReceiveinstallEvent);
async function onReceiveinstallEvent(err, data) {
checkInstallOrUninstall(err, data);
await bundle.queryAbilityByWant({
action: ['action.system.home'],
entities: ['entity.system.home'],
bundleName: BUNDLE_NAME1
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | bundle.BundleFlag.GET_ABILITY_INFO_SYSTEMAPP_ONLY,
USERID).then(data => {
expect(data).assertFail();
}).catch(err => {
expect(err).assertEqual(1);
});
bundle.queryAbilityByWant({
action: ['action.system.home'],
entities: ['entity.system.home'],
bundleName: BUNDLE_NAME1
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | bundle.BundleFlag.GET_ABILITY_INFO_SYSTEMAPP_ONLY,
USERID, (err, data) => {
expect(err).assertEqual(1);
expect(data).assertEqual("QueryAbilityInfos failed");
installer.uninstall(BUNDLE_NAME1, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
done();
});
});
}
});
await bundle.queryAbilityByWant({
action: ['action.system.home'],
entities: ['entity.system.home'],
bundleName: BUNDLE_NAME1
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | bundle.BundleFlag.GET_ABILITY_INFO_SYSTEMAPP_ONLY,
USERID).then(data => {
expect(data).assertFail();
}).catch(err => {
expect(err).assertEqual(1);
});
bundle.queryAbilityByWant({
action: ['action.system.home'],
entities: ['entity.system.home'],
bundleName: BUNDLE_NAME1
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | bundle.BundleFlag.GET_ABILITY_INFO_SYSTEMAPP_ONLY,
USERID, (err, data) => {
expect(err).assertEqual(1);
expect(data).assertEqual("QueryAbilityInfos failed");
done();
});
});
/*
......@@ -113,52 +97,45 @@ describe('ActsBmsQueryAbilityByWant', function () {
* @tc.desc: The entities in the parameter want pass in the new field, and use the implicit query to get abilitInfos
*/
it('bms_queryAbilityByEntities_0300', 0, async function (done) {
let installer = await bundle.getBundleInstaller();
installer.install([SYSTEM_PATH], installParam, async (err, data) => {
checkInstallOrUninstall(err, data);
let dataInfos = await bundle.queryAbilityByWant({
action: 'action.system.home',
entities: ["entity.app.music",
"entity.app.email",
"entity.app.contacts",
"entity.app.maps",
"entity.app.browser",
"entity.app.calendar",
"entity.app.messaging",
"entity.app.files",
"entity.app.gallery"],
elementName: {
deviceId: '0',
bundleName: '',
abilityName: '',
},
}, bundle.BundleFlag.GET_BUNDLE_DEFAULT, USERID);
expect(dataInfos.length).assertEqual(1);
cheackAbilityInfos(dataInfos[0]);
bundle.queryAbilityByWant({
action: 'action.system.home',
entities: ["entity.app.music",
"entity.app.email",
"entity.app.contacts",
"entity.app.maps",
"entity.app.browser",
"entity.app.calendar",
"entity.app.messaging",
"entity.app.files",
"entity.app.gallery"],
elementName: {
deviceId: '0',
bundleName: '',
abilityName: '',
},
}, bundle.BundleFlag.GET_BUNDLE_DEFAULT, USERID, (err, data) => {
expect(data.length).assertEqual(1);
cheackAbilityInfos(data[0]);
});
installer.uninstall(SYSTEM_NAME, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
done();
});
let dataInfos = await bundle.queryAbilityByWant({
action: 'action.system.home',
entities: ["entity.app.music",
"entity.app.email",
"entity.app.contacts",
"entity.app.maps",
"entity.app.browser",
"entity.app.calendar",
"entity.app.messaging",
"entity.app.files",
"entity.app.gallery"],
elementName: {
deviceId: '0',
bundleName: '',
abilityName: '',
},
}, bundle.BundleFlag.GET_BUNDLE_DEFAULT, USERID);
expect(dataInfos.length).assertEqual(1);
cheackAbilityInfos(dataInfos[0]);
bundle.queryAbilityByWant({
action: 'action.system.home',
entities: ["entity.app.music",
"entity.app.email",
"entity.app.contacts",
"entity.app.maps",
"entity.app.browser",
"entity.app.calendar",
"entity.app.messaging",
"entity.app.files",
"entity.app.gallery"],
elementName: {
deviceId: '0',
bundleName: '',
abilityName: '',
},
}, bundle.BundleFlag.GET_BUNDLE_DEFAULT, USERID, (err, data) => {
expect(data.length).assertEqual(1);
cheackAbilityInfos(data[0]);
done();
});
});
......@@ -196,9 +173,4 @@ describe('ActsBmsQueryAbilityByWant', function () {
expect(data.enabled).assertEqual(true);
}
function checkInstallOrUninstall(err, data) {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
}
})
\ No newline at end of file
......@@ -36,7 +36,20 @@
{
"type": "ShellKit",
"run-command": [
"chmod 644 /data/test/*.hap"
"chmod 644 /data/test/*.hap",
"bm install -p /data/test/bmsMainAbilityFirstScene.hap",
"bm install -p /data/test/bmsMainAbilitySecondScene.hap",
"bm install -p /data/test/bmsThirdBundleTest1.hap",
"bm install -p /data/test/bmsThirdBundleTest2.hap",
"bm install -p /data/test/bmsThirdBundleTest5.hap",
"bm install -p /data/test/bmsThirdBundleTestA1.hap"
],
"teardown-command":[
"bm uninstall -n com.example.third2",
"bm uninstall -n com.example.third1",
"bm uninstall -n com.example.third5",
"bm uninstall -n com.example.bmsmainabilityfirstscene",
"rm -rf /data/test/"
]
}
]
......
......@@ -47,10 +47,6 @@
}
],
"reqPermissions": [
{
"name": "ohos.permission.INSTALL_BUNDLE",
"reason": "need use ohos.permission.INSTALL_BUNDLE"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
......@@ -62,14 +58,6 @@
{
"name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
"reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
},
{
"name":"ohos.permission.REMOVE_CACHE_FILES",
"reason":"need use ohos.permission.REMOVE_CACHE_FILES"
},
{
"name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
"reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
}
],
"js": [
......
......@@ -16,12 +16,6 @@
import bundle from '@ohos.bundle'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
const BUNDLE_PATH1 = ['/data/test/bmsMainAbilityFirstScene.hap'];
const BUNDLE_PATH2 = ['/data/test/bmsMainAbilityFirstScene.hap', '/data/test/bmsMainAbilitySecondScene.hap'];
const BUNDLE_PATH3 = ['/data/test/bmsThirdBundleTest2.hap'];
const BUNDLE_PATH4 = ['/data/test/bmsThirdBundleTest5.hap'];
const BUNDLE_PATH5 = ['/data/test/bmsThirdBundleTest1.hap'];
const BUNDLE_PATH6 = ['/data/test/bmsThirdBundleTestA1.hap'];
const BUNDLE_NAME1 = 'com.example.bmsmainabilityfirstscene';
const BUNDLE_NAME2 = 'com.example.third2';
const BUNDLE_NAME3 = 'com.example.third5';
......@@ -30,11 +24,6 @@ const BUNDLE_NAME5 = 'com.example.system1';
const BUNDLE_NAME6 = "com.example.bmsmainabilitysecondscene";
const FIRSTMAINABILITY = 'com.example.bmsmainabilityfirstscene.MainAbility';
const SECONDMAINABILITY = 'com.example.bmsmainabilitysecondscene.MainAbility';
let installParam = {
userId: 100,
installFlag: 1,
isKeepData: false
};
describe('ActsBmsHapModuleTest', function () {
......@@ -44,40 +33,34 @@ describe('ActsBmsHapModuleTest', function () {
* @tc.desc: get the module information of the hap with type of entry
*/
it('bms_getHapModuleInfo_0100', 0, async function (done) {
let installer = await bundle.getBundleInstaller();
installer.install(BUNDLE_PATH1, installParam, onReceiveInstallEvent);
function onReceiveInstallEvent(err, data) {
checkInstallOrUninstall(err, data);
bundle.getBundleInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES, callback);
async function callback(err, result) {
expect(result.hapModuleInfos.length).assertEqual(1);
if (result.hapModuleInfos.length > 0) {
let hapModuleInfo = result.hapModuleInfos[0];
expect(hapModuleInfo.name).assertEqual(BUNDLE_NAME1);
expect(hapModuleInfo.moduleName).assertEqual('entry');
expect(hapModuleInfo.description).assertEqual('');
expect(hapModuleInfo.descriptionId).assertEqual(0);
expect(hapModuleInfo.iconPath).assertEqual("$media:icon");
expect(hapModuleInfo.icon).assertEqual('');
expect(hapModuleInfo.label).assertEqual('$string:app_name');
expect(hapModuleInfo.labelId).assertEqual(0);
expect(hapModuleInfo.iconId).assertEqual(0);
expect(hapModuleInfo.backgroundImg).assertEqual("");
expect(hapModuleInfo.supportedModes).assertEqual(0);
expect(hapModuleInfo.reqCapabilities.length).assertEqual(0);
expect(hapModuleInfo.deviceTypes[0]).assertEqual('phone');
expect(hapModuleInfo.mainAbilityName).assertEqual(FIRSTMAINABILITY);
expect(hapModuleInfo.mainElementName).assertEqual(FIRSTMAINABILITY);
expect(hapModuleInfo.abilityInfo.length).assertLarger(0);
expect(hapModuleInfo.colorMode).assertEqual(-1);
expect(hapModuleInfo.extensionAbilityInfo.length).assertEqual(0);
expect(hapModuleInfo.metadata.length).assertEqual(0);
expect(hapModuleInfo.installationFree).assertEqual(false);
}
installer.uninstall(BUNDLE_NAME1, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
done();
});
let dataInfo = await bundle.getBundleInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES);
bundle.getBundleInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES, callback);
async function callback(err, result) {
expect(JSON.stringify(result)).assertEqual(JSON.stringify(dataInfo));
expect(result.hapModuleInfos.length).assertEqual(2);
if (result.hapModuleInfos.length > 0) {
let hapModuleInfo = result.hapModuleInfos[0];
expect(hapModuleInfo.name).assertEqual(BUNDLE_NAME1);
expect(hapModuleInfo.moduleName).assertEqual('entry');
expect(hapModuleInfo.description).assertEqual('');
expect(hapModuleInfo.descriptionId).assertEqual(0);
expect(hapModuleInfo.iconPath).assertEqual("$media:icon");
expect(hapModuleInfo.icon).assertEqual('');
expect(hapModuleInfo.label).assertEqual('$string:app_name');
expect(hapModuleInfo.labelId).assertEqual(0);
expect(hapModuleInfo.iconId).assertEqual(0);
expect(hapModuleInfo.backgroundImg).assertEqual("");
expect(hapModuleInfo.supportedModes).assertEqual(0);
expect(hapModuleInfo.reqCapabilities.length).assertEqual(0);
expect(hapModuleInfo.deviceTypes[0]).assertEqual('phone');
expect(hapModuleInfo.mainAbilityName).assertEqual(FIRSTMAINABILITY);
expect(hapModuleInfo.mainElementName).assertEqual(FIRSTMAINABILITY);
expect(hapModuleInfo.abilityInfo.length).assertLarger(0);
expect(hapModuleInfo.colorMode).assertEqual(-1);
expect(hapModuleInfo.extensionAbilityInfo.length).assertEqual(0);
expect(hapModuleInfo.metadata.length).assertEqual(0);
expect(hapModuleInfo.installationFree).assertEqual(false);
done();
}
}
});
......@@ -88,31 +71,26 @@ describe('ActsBmsHapModuleTest', function () {
* @tc.desc: get the module information of the hap with type of feature
*/
it('bms_getHapModuleInfo_0200', 0, async function (done) {
let installer = await bundle.getBundleInstaller();
installer.install(BUNDLE_PATH2, installParam, async (err, data) => {
checkInstallOrUninstall(err, data);
bundle.getBundleInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES, async (err, result) => {
expect(result.hapModuleInfos.length).assertEqual(2);
if (result.hapModuleInfos.length == 2) {
let hapModuleInfo = result.hapModuleInfos[0];
let hapModuleInfo1 = result.hapModuleInfos[1];
checkHapMoudleInfos(hapModuleInfo);
checkHapMoudleInfos(hapModuleInfo1);
expect(hapModuleInfo.label).assertEqual('$string:app_name');
expect(hapModuleInfo.name).assertEqual(BUNDLE_NAME1);
expect(hapModuleInfo1.name).assertEqual(BUNDLE_NAME6);
expect(hapModuleInfo.moduleName).assertEqual('entry');
expect(hapModuleInfo.mainAbilityName).assertEqual(FIRSTMAINABILITY);
expect(hapModuleInfo.mainElementName).assertEqual(FIRSTMAINABILITY);
expect(hapModuleInfo1.moduleName).assertEqual('bmsmainabilitysecondscene');
expect(hapModuleInfo1.mainAbilityName).assertEqual(SECONDMAINABILITY);
expect(hapModuleInfo1.mainElementName).assertEqual(SECONDMAINABILITY);
}
installer.uninstall(BUNDLE_NAME1, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
done();
});
});
let dataInfo = await bundle.getBundleInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES);
bundle.getBundleInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES, async (err, result) => {
expect(JSON.stringify(result)).assertEqual(JSON.stringify(dataInfo));
expect(result.hapModuleInfos.length).assertEqual(2);
if (result.hapModuleInfos.length == 2) {
let hapModuleInfo = result.hapModuleInfos[0];
let hapModuleInfo1 = result.hapModuleInfos[1];
checkHapMoudleInfos(hapModuleInfo);
checkHapMoudleInfos(hapModuleInfo1);
expect(hapModuleInfo.label).assertEqual('$string:app_name');
expect(hapModuleInfo.name).assertEqual(BUNDLE_NAME1);
expect(hapModuleInfo1.name).assertEqual(BUNDLE_NAME6);
expect(hapModuleInfo.moduleName).assertEqual('entry');
expect(hapModuleInfo.mainAbilityName).assertEqual(FIRSTMAINABILITY);
expect(hapModuleInfo.mainElementName).assertEqual(FIRSTMAINABILITY);
expect(hapModuleInfo1.moduleName).assertEqual('bmsmainabilitysecondscene');
expect(hapModuleInfo1.mainAbilityName).assertEqual(SECONDMAINABILITY);
expect(hapModuleInfo1.mainElementName).assertEqual(SECONDMAINABILITY);
done();
}
});
});
......@@ -122,58 +100,15 @@ describe('ActsBmsHapModuleTest', function () {
* @tc.desc: get the module information of the hap without mainAbility
*/
it('bms_getHapModuleInfo_0300', 0, async function (done) {
let installer = await bundle.getBundleInstaller();
installer.install(BUNDLE_PATH3, installParam, onReceiveInstallEvent);
async function onReceiveInstallEvent(err, data) {
checkInstallOrUninstall(err, data);
await bundle.getBundleInfo(BUNDLE_NAME2, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES)
.then(async (result) => {
expect(result.hapModuleInfos.length).assertEqual(1);
if (result.hapModuleInfos.length > 0) {
let hapModuleInfo = result.hapModuleInfos[0];
expect(hapModuleInfo.name).assertEqual(BUNDLE_NAME2);
expect(hapModuleInfo.moduleName).assertEqual('entry');
expect(hapModuleInfo.description).assertEqual('');
expect(hapModuleInfo.descriptionId).assertEqual(0);
expect(hapModuleInfo.iconPath).assertEqual("$media:icon");
expect(hapModuleInfo.icon).assertEqual('');
expect(hapModuleInfo.label).assertEqual('$string:app_name');
expect(hapModuleInfo.labelId).assertEqual(0);
expect(hapModuleInfo.iconId).assertEqual(0);
expect(hapModuleInfo.backgroundImg).assertEqual("");
expect(hapModuleInfo.supportedModes).assertEqual(0);
expect(hapModuleInfo.reqCapabilities.length).assertEqual(0);
expect(hapModuleInfo.deviceTypes[0]).assertEqual('phone');
expect(hapModuleInfo.mainAbilityName).assertEqual("");
expect(hapModuleInfo.mainElementName).assertEqual("");
expect(hapModuleInfo.abilityInfo.length).assertLarger(0);
expect(hapModuleInfo.colorMode).assertEqual(-1);
expect(hapModuleInfo.extensionAbilityInfo.length).assertEqual(0);
expect(hapModuleInfo.metadata.length).assertEqual(0);
expect(hapModuleInfo.installationFree).assertEqual(false);
}
installer.uninstall(BUNDLE_NAME2, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
done();
});
await bundle.getBundleInfo(BUNDLE_NAME2, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES)
.then(async (result) => {
bundle.getBundleInfo(BUNDLE_NAME2, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES,(err,data)=>{
expect(JSON.stringify(result)).assertEqual(JSON.stringify(data));
});
}
});
/*
* @tc.number: bms_getHapModuleInfo_0400
* @tc.name: get hapModuleInfo through getBundleInfo, an application that adds mainAbility
* @tc.desc: get the module information of the hap with the added field mainAbility
*/
it('bms_getHapModuleInfo_0400', 0, async function (done) {
let installer = await bundle.getBundleInstaller();
installer.install(BUNDLE_PATH4, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
bundle.getBundleInfo(BUNDLE_NAME3, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES, async (err, result) => {
expect(result.hapModuleInfos.length).assertEqual(1);
if (result.hapModuleInfos.length == 1) {
if (result.hapModuleInfos.length > 0) {
let hapModuleInfo = result.hapModuleInfos[0];
expect(hapModuleInfo.name).assertEqual(BUNDLE_NAME3);
expect(hapModuleInfo.name).assertEqual(BUNDLE_NAME2);
expect(hapModuleInfo.moduleName).assertEqual('entry');
expect(hapModuleInfo.description).assertEqual('');
expect(hapModuleInfo.descriptionId).assertEqual(0);
......@@ -186,19 +121,52 @@ describe('ActsBmsHapModuleTest', function () {
expect(hapModuleInfo.supportedModes).assertEqual(0);
expect(hapModuleInfo.reqCapabilities.length).assertEqual(0);
expect(hapModuleInfo.deviceTypes[0]).assertEqual('phone');
expect(hapModuleInfo.mainAbilityName).assertEqual("com.example.third5.AMainAbility");
expect(hapModuleInfo.mainElementName).assertEqual("com.example.third5.AMainAbility");
expect(hapModuleInfo.mainAbilityName).assertEqual("");
expect(hapModuleInfo.mainElementName).assertEqual("");
expect(hapModuleInfo.abilityInfo.length).assertLarger(0);
expect(hapModuleInfo.colorMode).assertEqual(-1);
expect(hapModuleInfo.extensionAbilityInfo.length).assertEqual(0);
expect(hapModuleInfo.metadata.length).assertEqual(0);
expect(hapModuleInfo.installationFree).assertEqual(false);
}
installer.uninstall(BUNDLE_NAME3, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
done();
});
}
});
});
/*
* @tc.number: bms_getHapModuleInfo_0400
* @tc.name: get hapModuleInfo through getBundleInfo, an application that adds mainAbility
* @tc.desc: get the module information of the hap with the added field mainAbility
*/
it('bms_getHapModuleInfo_0400', 0, async function (done) {
let dataInfo = await bundle.getBundleInfo(BUNDLE_NAME3, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES);
bundle.getBundleInfo(BUNDLE_NAME3, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES, async (err, result) => {
expect(JSON.stringify(result)).assertEqual(JSON.stringify(dataInfo));
expect(result.hapModuleInfos.length).assertEqual(1);
if (result.hapModuleInfos.length == 1) {
let hapModuleInfo = result.hapModuleInfos[0];
expect(hapModuleInfo.name).assertEqual(BUNDLE_NAME3);
expect(hapModuleInfo.moduleName).assertEqual('entry');
expect(hapModuleInfo.description).assertEqual('');
expect(hapModuleInfo.descriptionId).assertEqual(0);
expect(hapModuleInfo.iconPath).assertEqual("$media:icon");
expect(hapModuleInfo.icon).assertEqual('');
expect(hapModuleInfo.label).assertEqual('$string:app_name');
expect(hapModuleInfo.labelId).assertEqual(0);
expect(hapModuleInfo.iconId).assertEqual(0);
expect(hapModuleInfo.backgroundImg).assertEqual("");
expect(hapModuleInfo.supportedModes).assertEqual(0);
expect(hapModuleInfo.reqCapabilities.length).assertEqual(0);
expect(hapModuleInfo.deviceTypes[0]).assertEqual('phone');
expect(hapModuleInfo.mainAbilityName).assertEqual("com.example.third5.AMainAbility");
expect(hapModuleInfo.mainElementName).assertEqual("com.example.third5.AMainAbility");
expect(hapModuleInfo.abilityInfo.length).assertLarger(0);
expect(hapModuleInfo.colorMode).assertEqual(-1);
expect(hapModuleInfo.extensionAbilityInfo.length).assertEqual(0);
expect(hapModuleInfo.metadata.length).assertEqual(0);
expect(hapModuleInfo.installationFree).assertEqual(false);
done();
}
});
});
......@@ -208,15 +176,10 @@ describe('ActsBmsHapModuleTest', function () {
* @tc.desc: get the module information of the mainAbility upgrade hap
*/
it('bms_getHapModuleInfo_0500', 0, async function (done) {
let installer = await bundle.getBundleInstaller();
installer.install(BUNDLE_PATH5, installParam, async (err, data) => {
checkInstallOrUninstall(err, data);
installer.install(BUNDLE_PATH6, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
bundle.getBundleInfo(BUNDLE_NAME4, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES, callback);
})
});
let dataInfo = await bundle.getBundleInfo(BUNDLE_NAME4, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES);
bundle.getBundleInfo(BUNDLE_NAME4, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES, callback);
function callback(err, result) {
expect(JSON.stringify(result)).assertEqual(JSON.stringify(dataInfo));
expect(result.hapModuleInfos.length).assertEqual(1);
if (result.hapModuleInfos.length == 1) {
let hapModuleInfo = result.hapModuleInfos[0];
......@@ -240,11 +203,8 @@ describe('ActsBmsHapModuleTest', function () {
expect(hapModuleInfo.extensionAbilityInfo.length).assertEqual(0);
expect(hapModuleInfo.metadata.length).assertEqual(0);
expect(hapModuleInfo.installationFree).assertEqual(false);
}
installer.uninstall(BUNDLE_NAME4, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
done();
});
}
}
});
......@@ -254,8 +214,10 @@ describe('ActsBmsHapModuleTest', function () {
* @tc.desc: get module information of mainAbility system application
*/
it('bms_getHapModuleInfo_0600', 0, async function (done) {
let dataInfo = await bundle.getBundleInfo(BUNDLE_NAME5, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES);
bundle.getBundleInfo(BUNDLE_NAME5, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES, callback);
function callback(err, data) {
expect(JSON.stringify(data)).assertEqual(JSON.stringify(dataInfo));
expect(data.hapModuleInfos.length).assertEqual(1);
if (data.hapModuleInfos.length == 1) {
let hapModuleInfo = data.hapModuleInfos[0];
......@@ -302,9 +264,4 @@ describe('ActsBmsHapModuleTest', function () {
expect(info.installationFree).assertEqual(false);
}
function checkInstallOrUninstall(err, data) {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
}
})
\ No newline at end of file
......@@ -48,10 +48,6 @@
}
],
"reqPermissions": [
{
"name": "ohos.permission.INSTALL_BUNDLE",
"reason": "need use ohos.permission.INSTALL_BUNDLE"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
......@@ -63,14 +59,6 @@
{
"name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
"reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
},
{
"name":"ohos.permission.REMOVE_CACHE_FILES",
"reason":"need use ohos.permission.REMOVE_CACHE_FILES"
},
{
"name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
"reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
}
],
"js": [
......
......@@ -13,5 +13,5 @@
* limitations under the License.
*/
require('./ActsBmsJsTest.test.js')
require('./ActsBmsJsTest.test.js'),
require('./ActsBmsHasInstalldTest.test.js')
\ No newline at end of file
......@@ -27,15 +27,30 @@
"type": "PushKit",
"push": [
"bmsThirdBundleTest1.hap->/data/test/bmsThirdBundleTest1.hap",
"bmsThirdBundleTest3.hap->/data/test/bmsThirdBundleTest3.hap",
"bmsThirdBundleTest5.hap->/data/test/bmsThirdBundleTest5.hap",
"bmsThirdBundleTestA1.hap->/data/test/bmsThirdBundleTestA1.hap"
"bmsSystemBundleTest1.hap->/data/test/bmsSystemBundleTest1.hap",
"bmsVendorBundleTest1.hap->/data/test/bmsVendorBundleTest1.hap",
"bmsThirdBundleTest7.hap->/data/test/bmsThirdBundleTest7.hap",
"bmsThirdBundleTest7A.hap->/data/test/bmsThirdBundleTest7A.hap"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod 644 /data/test/*.hap"
"bm install -p /data/test/bmsThirdBundleTest1.hap",
"bm install -p /data/test/bmsSystemBundleTest1.hap",
"bm install -p /data/test/bmsVendorBundleTest1.hap",
"bm install -p /data/test/bmsThirdBundleTest5.hap",
"bm install -p /data/test/bmsThirdBundleTest7.hap",
"bm install -p /data/test/bmsThirdBundleTest7A.hap"
],
"teardown-command":[
"bm uninstall -n com.example.third1",
"bm uninstall -n com.example.system1",
"bm uninstall -n com.example.vendor1",
"bm uninstall -n com.example.third5",
"bm uninstall -n com.example.third7",
"rm -rf /data/test/"
]
}
]
......
......@@ -47,10 +47,6 @@
}
],
"reqPermissions": [
{
"name": "ohos.permission.INSTALL_BUNDLE",
"reason": "need use ohos.permission.INSTALL_BUNDLE"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
......@@ -62,14 +58,6 @@
{
"name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
"reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
},
{
"name":"ohos.permission.REMOVE_CACHE_FILES",
"reason":"need use ohos.permission.REMOVE_CACHE_FILES"
},
{
"name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
"reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
}
],
"js": [
......
......@@ -16,6 +16,31 @@
import bundle from '@ohos.bundle'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
const BUNDLE_PATH1 = ['/data/test/bmsThirdBundleTest1.hap'];
const BUNDLE_PATH2 = ['/data/test/bmsThirdBundleTestA1.hap'];
const BUNDLE_PATH3 = ['/data/test/bmsThirdBundleTest5.hap'];
const BUNDLE_PATH4 = ['/data/test/bmsSystemBundleTest1.hap'];
const BUNDLE_PATH5 = ['/data/test/bmsVendorBundleTest1.hap'];
const BUNDLE_NAME1 = 'com.example.third1';
const BUNDLE_NAME2 = 'com.example.third5';
const BUNDLE_NAME3 = 'com.example.noexist';
const BUNDLE_NAME4 = 'com.example.system1';
const BUNDLE_NAME5 = 'com.example.vendor1';
const BUNDLE_NAME6 = 'com.example.third7';
const ABILITY_NAME1 = 'com.example.third1.MainAbility';
const ABILITY_NAME2 = 'com.example.third1.AMainAbility';
const ABILITY_NAME3 = 'com.example.third5.AMainAbility';
const ABILITY_NAME4 = 'com.example.noexist.MainAbility';
const ABILITY_NAME5 = 'com.example.system1.MainAbility';
const ABILITY_NAME6 = 'com.example.vendor1.MainAbility';
const ABILITY_NAME7 = 'com.example.third7.AMainAbility';
const USERID = 100;
const INSTALLPARAM = {
userId: 100,
installFlag: 1,
isKeepData: false
};
describe('ActsBmsMetaDataTest', function () {
/*
......@@ -24,44 +49,22 @@ describe('ActsBmsMetaDataTest', function () {
* @tc.desc: get an application's meta data which contains two HAP packages.
*/
it('bms_getMetaData_0100', 0, async function (done) {
console.info('=====================bms_getMetaData_0100==================');
let bundlePath = ['/data/test/bmsThirdBundleTest1.hap']
let installer = await bundle.getBundleInstaller();
let abilityName1 = 'com.example.third1.MainAbility';
let dataMap = new Map();
installer.install(bundlePath, {
userId: 100,
installFlag: 1,
isKeepData: false
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
bundle.queryAbilityByWant(
{
"bundleName": 'com.example.third1',
"abilityName": 'com.example.third1.MainAbility',
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, 100).then(dataInfos => {
for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
}
})
if (dataMap.has(abilityName1)) {
checkMetaData(dataMap.get(abilityName1), 'Data1');
}
installer.uninstall('com.example.third1', {
userId: 100,
installFlag: 1,
isKeepData: false
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
await bundle.queryAbilityByWant(
{
"bundleName": BUNDLE_NAME1,
"abilityName": ABILITY_NAME1
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID).then(dataInfos => {
console.info("dataInfos[0].metaData" + JSON.stringify(dataInfos[0].metaData));
let metaData = dataInfos[0].metaData;
expect(metaData[0].name).assertEqual("Data1");
expect(metaData[0].value).assertEqual("float");
expect(metaData[0].extra).assertEqual("$string:mainability_description");
done();
}).catch(err => {
expect(err).assertFail();
done();
});
});
})
});
/*
* @tc.number: bms_getMetaData_0200
......@@ -69,88 +72,22 @@ describe('ActsBmsMetaDataTest', function () {
* @tc.desc: get an application's meta data that is updated.
*/
it('bms_getMetaData_0200', 0, async function (done) {
console.info('=====================bms_getMetaData_0200==================');
let bundlePath1 = ['/data/test/bmsThirdBundleTest1.hap']
let bundlePath2 = ['/data/test/bmsThirdBundleTestA1.hap']
let dataMap = new Map();
let abilityName1 = 'com.example.third1.AMainAbility';
let installer = await bundle.getBundleInstaller();
installer.install(bundlePath1, {
userId: 100,
installFlag: 1,
isKeepData: false
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
installer.install(bundlePath2, {
userId: 100,
installFlag: 1,
isKeepData: false
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
bundle.queryAbilityByWant(
{
"bundleName": 'com.example.third1',
"abilityName": 'com.example.third1.AMainAbility',
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, 100).then(dataInfos => {
for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
}
})
if (dataMap.has(abilityName1)) {
checkMetaData(dataMap.get(abilityName1), 'DataA1');
}
installer.uninstall('com.example.third1', {
userId: 100,
installFlag: 1,
isKeepData: false
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
done();
});
})
})
})
/*
* @tc.number: bms_getMetaData_0300
* @tc.name: test to get meta data for an uninstalled application.
* @tc.desc: get an application's meta data that is uninstalled.
*/
it('bms_getMetaData_0300', 0, async function (done) {
console.info('=====================bms_getMetaData_0300==================');
let bundlePath = ['/data/test/bmsThirdBundleTest1.hap']
let bundleName = 'com.example.third1';
let installer = await bundle.getBundleInstaller();
installer.install(bundlePath, {
userId: 100,
installFlag: 1,
isKeepData: false
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
installer.uninstall(bundleName, {
userId: 100,
installFlag: 1,
isKeepData: false
}, async (err, data) => {
bundle.queryAbilityByWant(
{
bundleName: 'com.example.third1',
abilityName: 'com.example.third1.MainAbility',
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, 100).then(dataInfos => {
expect(dataInfos.length).assertEqual(0);
});
await bundle.queryAbilityByWant(
{
"bundleName": BUNDLE_NAME6,
"abilityName": ABILITY_NAME7
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID).then(dataInfos => {
console.info("dataInfos[0].metaData" + JSON.stringify(dataInfos[0].metaData));
let metaData = dataInfos[0].metaData;
expect(metaData[0].name).assertEqual("DataA1");
expect(metaData[0].value).assertEqual("float");
expect(metaData[0].extra).assertEqual("$string:mainability_description");
done();
}).catch(err => {
expect(err).assertFail();
done();
});
});
})
});
/*
* @tc.number: bms_getMetaData_0400
......@@ -158,44 +95,22 @@ describe('ActsBmsMetaDataTest', function () {
* @tc.desc: get an application's meta data which has one ability.
*/
it('bms_getMetaData_0400', 0, async function (done) {
console.info('=====================bms_getMetaData_0400==================');
let bundlePath = ['/data/test/bmsThirdBundleTest5.hap']
let dataMap = new Map();
let abilityName1 = 'com.example.third5.AMainAbility';
let installer = await bundle.getBundleInstaller();
installer.install(bundlePath, {
userId: 100,
installFlag: 1,
isKeepData: false
}, onReceiveinstallEvent);
async function onReceiveinstallEvent(err, data) {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
bundle.queryAbilityByWant(
{
bundleName: 'com.example.third5',
abilityName: 'com.example.third5.AMainAbility',
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, 100).then(dataInfos => {
for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
}
})
if (dataMap.has(abilityName1)) {
checkMetaData(dataMap.get(abilityName1), 'Data5A');
}
installer.uninstall('com.example.third5', {
userId: 100,
installFlag: 1,
isKeepData: false
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
await bundle.queryAbilityByWant(
{
bundleName: BUNDLE_NAME2,
abilityName: ABILITY_NAME3,
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID).then(dataInfos => {
console.info("dataInfos[0].metaData" + JSON.stringify(dataInfos[0].metaData));
let metaData = dataInfos[0].metaData;
expect(metaData[0].name).assertEqual("Data5A");
expect(metaData[0].value).assertEqual("float");
expect(metaData[0].extra).assertEqual("$string:mainability_description");
done();
}).catch(err => {
expect(err).assertFail();
done();
})
}
})
});
});
/*
* @tc.number: bms_getMetaData_0500
......@@ -203,16 +118,19 @@ describe('ActsBmsMetaDataTest', function () {
* @tc.desc: get an application's meta data which does not exist.
*/
it('bms_getMetaData_0500', 0, async function (done) {
console.info('=====================bms_getMetaData_0500==================');
bundle.queryAbilityByWant(
await bundle.queryAbilityByWant(
{
bundleName: 'com.example.noexist',
abilityName: 'com.example.noexist.MainAbility',
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, 100).then(dataInfos => {
bundleName: BUNDLE_NAME3,
abilityName: ABILITY_NAME4,
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID).then(dataInfos => {
expect(dataInfos.length).assertEqual(0);
})
done();
})
done();
}).catch(err => {
console.info("err====: " + err);
expect(err).assertEqual(1);
done();
});
});
/*
* @tc.number: bms_getMetaData_0600
......@@ -220,23 +138,22 @@ describe('ActsBmsMetaDataTest', function () {
* @tc.desc: get a system application's meta data.
*/
it('bms_getMetaData_0600', 0, async function (done) {
console.info('=====================bms_getMetaData_0600==================');
let dataMap = new Map();
let abilityName1 = 'com.example.system1.MainAbility';
bundle.queryAbilityByWant(
await bundle.queryAbilityByWant(
{
bundleName: 'com.example.system1',
abilityName: 'com.example.system1.MainAbility',
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, 100).then(dataInfos => {
for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
}
})
if (dataMap.has(abilityName1)) {
checkMetaData(dataMap.get(abilityName1), 'Data1S');
}
done();
})
bundleName: BUNDLE_NAME4,
abilityName: ABILITY_NAME5,
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID).then(dataInfos => {
console.info("dataInfos[0].metaData" + JSON.stringify(dataInfos[0].metaData));
let metaData = dataInfos[0].metaData;
expect(metaData[0].name).assertEqual("Data1S");
expect(metaData[0].value).assertEqual("float");
expect(metaData[0].extra).assertEqual("$string:mainability_description");
done();
}).catch(err => {
expect(err).assertFail();
done();
});
});
/*
* @tc.number: bms_getMetaData_0700
......@@ -244,73 +161,27 @@ describe('ActsBmsMetaDataTest', function () {
* @tc.desc: get a vendor application's meta data.
*/
it('bms_getMetaData_0700', 0, async function (done) {
console.info('=====================bms_getMetaData_0700==================');
let dataMap = new Map();
let abilityName1 = 'com.example.vendor1.MainAbility';
bundle.queryAbilityByWant(
await bundle.queryAbilityByWant(
{
bundleName: 'com.example.vendor1',
abilityName: 'com.example.vendor1.MainAbility',
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, 100).then(dataInfos => {
for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
}
bundleName: BUNDLE_NAME5,
abilityName: ABILITY_NAME6,
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID).then(dataInfos => {
console.info("dataInfos[0].metaData" + JSON.stringify(dataInfos[0].metaData));
let metaData = dataInfos[0].metaData;
expect(metaData[0].name).assertEqual("");
expect(metaData[0].value).assertEqual("");
expect(metaData[0].extra).assertEqual("");
done();
}).catch(err => {
expect(err).assertFail();
done();
});
if (dataMap.has(abilityName1)) {
let data = dataMap.get(abilityName1);
let parameters = data.parameters;
let results = data.results;
let customizeDatas = data.customizeDatas;
expect(parameters.length).assertEqual(2);
expect(results.length).assertEqual(1);
expect(customizeDatas.length).assertEqual(1);
console.debug('=====customizeDatas length=====' + customizeDatas.length);
for (let i = 0; i < parameters.length; i++) {
expect(parameters[i].description).assertEqual('$string:mainability_description');
expect(parameters[i].name).assertEqual("Data1V" + i);
expect(parameters[i].type).assertEqual('float');
}
for (let i = 0; i < results.length; i++) {
expect(results[i].description).assertEqual('$string:mainability_description');
expect(results[i].name).assertEqual('Data1V');
expect(results[i].type).assertEqual('float');
}
for (let i = 0; i < customizeDatas.length; i++) {
expect(customizeDatas[i].name).assertEqual('');
expect(customizeDatas[i].value).assertEqual('');
expect(customizeDatas[i].extra).assertEqual('');
}
}
done();
})
});
function checkMetaData(data, name) {
let parameters = data.parameters;
let results = data.results;
let customizeDatas = data.customizeDatas;
expect(typeof parameters).assertEqual('object');
expect(typeof results).assertEqual('object');
expect(typeof customizeDatas).assertEqual('object');
expect(parameters.length).assertLarger(0);
expect(results.length).assertLarger(0);
expect(customizeDatas.length).assertLarger(0);
for (let i = 0; i < parameters.length; i++) {
expect(typeof parameters[i].description).assertEqual('string');
expect(typeof parameters[i].name).assertEqual('string');
expect(parameters[i].name).assertEqual(name);
expect(typeof parameters[i].type).assertEqual('string');
}
for (let i = 0; i < results.length; i++) {
expect(typeof results[i].description).assertEqual('string');
expect(typeof results[i].name).assertEqual('string');
expect(results[i].name).assertEqual(name);
expect(typeof results[i].type).assertEqual('string');
}
for (let i = 0; i < customizeDatas.length; i++) {
expect(typeof customizeDatas[i].name).assertEqual('string');
expect(typeof customizeDatas[i].value).assertEqual('string');
expect(customizeDatas[i].name).assertEqual(name);
expect(typeof customizeDatas[i].extra).assertEqual('string');
}
function checkInstallOrUninstall(err, data) {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
}
})
\ No newline at end of file
......@@ -29,9 +29,6 @@
},
{
"name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
},
{
"name": "ohos.permission.INSTALL_BUNDLE"
}
],
"distro": {
......
......@@ -42,12 +42,8 @@ export default function GetabilityInfo() {
let timeOldStamp = await Utils.getNowTime();
await bundleManager.getAbilityInfo(BUNDLE_NAME1, ABILITY_NAME1).then((data) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('bundle_GetabilityInfo_test_0100', timeOldStamp, timeNewStamp)
Utils.getDurationTime('bundle_GetabilityInfo_test_0100', timeOldStamp, timeNewStamp);
console.info('[bundle_GetabilityInfo_test_0100] getApplicationInfo promise data is: ' + JSON.stringify(data));
for (const item in data) {
const a = data[item];
console.info(item + ":" + JSON.stringify(a));
};
expect(typeof (data)).assertEqual("object");
mData = data;
checkAbilityInfo(mData);
......@@ -93,10 +89,6 @@ export default function GetabilityInfo() {
await bundleManager.getAbilityInfo(BUNDLE_NAME4, ABILITY_NAME3).then(res => {
checkAbilityInfo_other(res);
console.info('actwsBundleManager getAbilityInfo promise success res:' + JSON.stringify(res));
for (const item in res) {
const a = res[item];
console.info(item + ":" + JSON.stringify(a));
};
}).catch(err => {
console.info('actwsBundleManager getAbilityInfo promise err:' + JSON.stringify(err));
expect().assertFail();
......@@ -110,10 +102,6 @@ export default function GetabilityInfo() {
}
checkAbilityInfo_other(res);
console.info('actwsBundleManager getAbilityInfo callback success res:' + JSON.stringify(res));
for (const item in res) {
const a = res[item];
console.info(item + ":" + JSON.stringify(a));
};
done();
});
});
......
......@@ -14,27 +14,42 @@
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"remount",
"mkdir /data/test/"
]
},
{
"type": "PushKit",
"push": [
"bmsJstest1.hap->/data/bmsJstest1.hap",
"bmsJstest2.hap->/data/bmsJstest2.hap",
"bmsJstest3.hap->/data/bmsJstest3.hap",
"bmsJstest4.hap->/data/bmsJstest4.hap",
"bmsJstest5.hap->/data/bmsJstest5.hap",
"bmsJstest6.hap->/data/bmsJstest6.hap",
"bmsJstest7.hap->/data/bmsJstest7.hap",
"bmsJstest8.hap->/data/bmsJstest8.hap",
"bmsJstest9.hap->/data/bmsJstest9.hap"
"bmsJstest1.hap->/data/test/bmsJstest1.hap",
"bmsJstest2.hap->/data/test/bmsJstest2.hap",
"bmsJstest3.hap->/data/test/bmsJstest3.hap",
"bmsJstest4.hap->/data/test/bmsJstest4.hap",
"bmsJstest5.hap->/data/test/bmsJstest5.hap",
"bmsJstest6.hap->/data/test/bmsJstest6.hap"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod 644 /data/*.hap",
"chmod 600 /data/bmsJstest7.hap"
"bm install -p /data/test/bmsJstest1.hap",
"bm install -p /data/test/bmsJstest2.hap",
"bm install -p /data/test/bmsJstest3.hap",
"bm install -p /data/test/bmsJstest4.hap",
"bm install -p /data/test/bmsJstest5.hap",
"bm install -p /data/test/bmsJstest6.hap"
],
"teardown-command":[
"bm uninstall -n com.example.myapplication1",
"bm uninstall -n com.example.myapplication2",
"bm uninstall -n com.example.myapplication4",
"bm uninstall -n com.example.myapplication5",
"bm uninstall -n com.example.myapplication6",
"rm -rf /data/test/"
]
}
}
]
}
......@@ -70,10 +70,6 @@
}
],
"reqPermissions": [
{
"name": "ohos.permission.INSTALL_BUNDLE",
"reason": "need use ohos.permission.INSTALL_BUNDLE"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
......@@ -85,14 +81,6 @@
{
"name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
"reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
},
{
"name":"ohos.permission.REMOVE_CACHE_FILES",
"reason":"need use ohos.permission.REMOVE_CACHE_FILES"
},
{
"name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
"reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
}
],
"js": [
......
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsBundleManagerUninstallTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsBundleManagerUninstallTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "120000",
"package": "com.example.actsbundlemanageruninstall",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsBundleManagerUninstallTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "PushKit",
"push": [
"bmsJstest1.hap->/data/bmsJstest1.hap",
"bmsJstest2.hap->/data/bmsJstest2.hap",
"bmsJstest3.hap->/data/bmsJstest3.hap",
"bmsJstest4.hap->/data/bmsJstest4.hap",
"bmsJstest5.hap->/data/bmsJstest5.hap",
"bmsJstest6.hap->/data/bmsJstest6.hap",
"bmsJstest8.hap->/data/bmsJstest8.hap"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod 644 /data/*.hap"
]
}
]
}
{
"app": {
"bundleName": "com.example.actsbundlemanageruninstall",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsbundlemanageruninstall",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home",
"flag.home.intent.from.system"
],
"actions": [
"action.system.home"
]
}
],
"visible": true,
"name": "com.example.actsbundlemanageruninstall.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"defPermissions": [
{
"name": "com.permission.CAMERA",
"grantMode": "system_grant",
"availableScope": ["signature"],
"label": "CAMERA permission",
"description": "CAMERA permission in detail"
},
{
"name": "com.permission.music",
"grantMode": "system_grant",
"availableScope": ["signature"],
"label": "music permission",
"description": "music permission in detail"
},
{
"name": "com.permission.WeChat",
"grantMode": "system_grant",
"availableScope": ["signature"],
"label": "WeChat permission",
"description": "WeChat permission in detail"
}
],
"reqPermissions": [
{
"name": "ohos.permission.INSTALL_BUNDLE",
"reason": "need use ohos.permission.INSTALL_BUNDLE"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO",
"reason":"need use ohos.permission.GET_BUNDLE_INFO"
},
{
"name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
"reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
},
{
"name":"ohos.permission.REMOVE_CACHE_FILES",
"reason":"need use ohos.permission.REMOVE_CACHE_FILES"
},
{
"name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
"reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ 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 {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
/*
* 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.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<!--
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.
-->
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
{
"string": [
{
"name": "app_name",
"value": "actsbundlemanageruninstall"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ 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.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
import demo from '@ohos.bundle'
const PATH = "/data/";
const ERROR = "error.hap";
const BMSJSTEST1 = "bmsJstest1.hap";
const BMSJSTEST2 = "bmsJstest2.hap";
const BMSJSTEST3 = "bmsJstest3.hap";
const BMSJSTEST4 = "bmsJstest4.hap";
const BMSJSTEST5 = "bmsJstest5.hap";
const BMSJSTEST6 = "bmsJstest6.hap";
const BMSJSTEST8 = "bmsJstest8.hap";
const NAME1 = "com.example.myapplication1";
const NAME2 = "com.example.myapplication2";
const NAME3 = "com.example.myapplication4";
const NAME4 = "com.example.myapplication5";
const NAME5 = "com.example.myapplication6";
const THIRD1 = "com.example.third1";
const LAUNCHER = "com.ohos.launcher";
const SUCCESS = "SUCCESS";
const installParam = {
userId: 100,
installFlag: 1,
isKeepData: false
};
describe('ActsBundleManagerUninstall', function () {
/**
* @tc.number uninstall_0100
* @tc.name BUNDLE::uninstall
* @tc.desc Test uninstall interfaces.
*/
it('uninstall_0100', 0, async function (done) {
let installData = await demo.getBundleInstaller();
installData.install([PATH + BMSJSTEST1], installParam, async (err, data) => {
checkInstallResult(err, data);
await queryInfo(NAME1, 0);
installData.uninstall(NAME1, installParam, async (err, data) => {
checkInstallResult(err, data);
await queryInfo(NAME1, 1);
done();
});
});
});
/**
* @tc.number uninstall_0200
* @tc.name BUNDLE::uninstall
* @tc.desc Test uninstall interfaces.
*/
it('uninstall_0200', 0, async function (done) {
let installData = await demo.getBundleInstaller();
installData.install([PATH + BMSJSTEST2, PATH + BMSJSTEST3], installParam, async (err, data) => {
checkInstallResult(err, data);
let bundleInfo = await demo.getBundleInfo(NAME2, demo.BundleFlag.GET_BUNDLE_DEFAULT);
expect(bundleInfo.appInfo.moduleSourceDirs.length).assertEqual(2);
installData.uninstall(NAME2, installParam, async(err, data) => {
checkInstallResult(err, data);
await queryInfo(NAME2, 1);
done();
});
});
});
/**
* @tc.number uninstall_0300
* @tc.name BUNDLE::uninstall
* @tc.desc Test uninstall interfaces.
*/
it('uninstall_0300', 0, async function (done) {
let installData = await demo.getBundleInstaller();
installData.install([PATH + BMSJSTEST4], installParam, async (err, data) => {
checkInstallResult(err, data);
installData.install([PATH + BMSJSTEST5], installParam, async (err, data) => {
checkInstallResult(err, data);
installData.install([PATH + BMSJSTEST6], installParam, async (err, data) => {
checkInstallResult(err, data);
await queryInfo(NAME3, 0);
await queryInfo(NAME4, 0);
await queryInfo(NAME5, 0);
installData.uninstall(NAME3, installParam, async (err, data) => {
checkInstallResult(err, data);
installData.uninstall(NAME4, installParam, async (err, data) => {
checkInstallResult(err, data);
installData.uninstall(NAME5, installParam, async (err, data) => {
checkInstallResult(err, data);
await queryInfo(NAME3, 1);
await queryInfo(NAME4, 1);
await queryInfo(NAME5, 1);
done();
});
});
});
});
});
});
});
/**
* @tc.number uninstall_0400
* @tc.name BUNDLE::uninstall
* @tc.desc Test uninstall interfaces.
*/
it('uninstall_0400', 0, async function (done) {
demo.getBundleInstaller().then((data) => {
data.uninstall(ERROR, installParam, (err, data) => {
expect(err.code).assertEqual(-1);
expect(data.status).assertEqual(demo.InstallErrorCode.STATUS_UNINSTALL_FAILURE);
expect(data.statusMessage).assertEqual("STATUS_UNINSTALL_FAILURE");
done();
});
});
});
/**
* @tc.number uninstall_0500
* @tc.name BUNDLE::uninstall
* @tc.desc Test uninstall interfaces.
*/
it('uninstall_0500', 0, async function (done) {
demo.getBundleInstaller().then((data) => {
data.uninstall('', installParam, (err, data) => {
expect(err.code).assertEqual(-1);
expect(data.status).assertEqual(demo.InstallErrorCode.STATUS_UNINSTALL_FAILURE);
expect(data.statusMessage).assertEqual("STATUS_UNINSTALL_FAILURE");
done();
});
});
});
/**
* @tc.number uninstall_0600
* @tc.name BUNDLE::uninstall
* @tc.desc Test uninstall interfaces.
*/
it('uninstall_0600', 0, async function (done) {
demo.getBundleInstaller().then((data) => {
data.uninstall(LAUNCHER, installParam, (err, data) => {
expect(err.code).assertEqual(-1);
expect(data.status).assertEqual(demo.InstallErrorCode.STATUS_UNINSTALL_FAILURE);
expect(data.statusMessage).assertEqual("STATUS_UNINSTALL_FAILURE");
done();
});
});
});
/**
* @tc.number uninstall_0700
* @tc.name BUNDLE::uninstall
* @tc.desc Test uninstall interfaces.
*/
it('uninstall_0700', 0, async function (done) {
let result = await demo.getBundleInstaller();
result.install([PATH + BMSJSTEST1], {
userId: 100,
installFlag: 1,
isKeepData: true
}, async (err, data) => {
checkInstallResult(err, data);
await queryInfo(NAME1, 0);
result.uninstall(NAME1, installParam, async (err, data) => {
checkInstallResult(err, data);
await queryInfo(NAME1, 1);
done();
});
});
});
/**
* @tc.number uninstall_0800
* @tc.name BUNDLE::uninstall
* @tc.desc Test uninstall interfaces.
*/
it('uninstall_0800', 0, async function (done) {
let installData = await demo.getBundleInstaller();
installData.install([PATH + BMSJSTEST8], installParam, async (err, data) => {
checkInstallResult(err, data);
let bundleInfo = await demo.getBundleInfo('com.example.third1', demo.BundleFlag.GET_BUNDLE_DEFAULT);
expect(bundleInfo.uid).assertLarger(10000);
installData.uninstall(THIRD1, installParam, async (err, data) => {
checkInstallResult(err, data);
await queryInfo('com.example.third1', 1);
done();
});
});
});
async function queryInfo(bundleName, assertFlag){
if (!assertFlag) {
await demo.getBundleInfo(bundleName, demo.BundleFlag.GET_BUNDLE_DEFAULT
).then(datainfo => {
console.info("getBundleInfo result0"+JSON.stringify(datainfo));
expect(datainfo.name).assertEqual(bundleName);
}).catch(err => {
console.info("getBundleInfo result0"+JSON.stringify(datainfo));
expect(err).assertFail();
});
} else {
await demo.getBundleInfo(bundleName, demo.BundleFlag.GET_BUNDLE_DEFAULT
).then(datainfo => {
console.info("getBundleInfo result1"+JSON.stringify(datainfo));
expect(datainfo).assertFail();
}).catch(err => {
console.info("getBundleInfo result1"+JSON.stringify(err));
expect(err).assertEqual(1);
});
}
}
function checkInstallResult(err, result) {
console.info("install uninstall result" + JSON.stringify(result));
expect(err.code).assertEqual(0);
expect(result.status).assertEqual(demo.InstallErrorCode.SUCCESS);
expect(result.statusMessage).assertEqual(SUCCESS);
}
})
\ 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.
*/
require('./ExampleJsunit.test.js')
\ 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.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsBundleMgrMultipleInstallTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsBundleMgrMultipleInstallTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "750000",
"package": "com.example.actsbundlemgrmultipleinstalltest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsBundleMgrMultipleInstallTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"remount",
"mkdir -p /data/test/resource/bms/install_bundle"
]
},
{
"type": "PushKit",
"push": [
"first_right.hap -> /data/test/resource/bms/install_bundle/first_right.hap",
"second_right.hap -> /data/test/resource/bms/install_bundle/second_right.hap",
"third_right.hap -> /data/test/resource/bms/install_bundle/third_right.hap",
"fourth_right.hap -> /data/test/resource/bms/install_bundle/fourth_right.hap",
"eighth_right.hap -> /data/test/resource/bms/install_bundle/eighth_right.hap",
"ninth_right.hap -> /data/test/resource/bms/install_bundle/ninth_right.hap",
"tenth_right.hap -> /data/test/resource/bms/install_bundle/tenth_right.hap",
"eleventh_right.hap -> /data/test/resource/bms/install_bundle/eleventh_right.hap",
"fifth_right.hap -> /data/test/resource/bms/install_bundle/fifth_right.hap",
"second_backup_right.hap -> /data/test/resource/bms/install_bundle/second_backup_right.hap",
"twelfth_right.hap -> /data/test/resource/bms/install_bundle/twelfth_right.hap",
"sixth_right.hap -> /data/test/resource/bms/install_bundle/sixth_right.hap",
"thirteenth_right.hap -> /data/test/resource/bms/install_bundle/thirteenth_right.hap",
"fourteenth_right.hap -> /data/test/resource/bms/install_bundle/fourteenth_right.hap",
"sixteenth_right.hap -> /data/test/resource/bms/install_bundle/sixteenth_right.hap"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod 777 /data/test/resource/bms/install_bundle/*"
]
}
]
}
{
"app": {
"bundleName": "com.example.actsbundlemgrmultipleinstalltest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsbundlemgrmultipleinstalltest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home",
"flag.home.intent.from.system"
],
"actions": [
"action.system.home"
]
}
],
"visible": true,
"name": "com.example.actsbundlemgrmultipleinstalltest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"defPermissions": [
{
"name": "com.permission.CAMERA",
"grantMode": "system_grant",
"availableScope": ["signature"],
"label": "CAMERA permission",
"description": "CAMERA permission in detail"
},
{
"name": "com.permission.music",
"grantMode": "system_grant",
"availableScope": ["signature"],
"label": "music permission",
"description": "music permission in detail"
},
{
"name": "com.permission.WeChat",
"grantMode": "system_grant",
"availableScope": ["signature"],
"label": "WeChat permission",
"description": "WeChat permission in detail"
}
],
"reqPermissions": [
{
"name": "ohos.permission.INSTALL_BUNDLE",
"reason": "need use ohos.permission.INSTALL_BUNDLE"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO",
"reason":"need use ohos.permission.GET_BUNDLE_INFO"
},
{
"name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
"reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
},
{
"name":"ohos.permission.REMOVE_CACHE_FILES",
"reason":"need use ohos.permission.REMOVE_CACHE_FILES"
},
{
"name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
"reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ 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 {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
/*
* 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.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<!--
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.
-->
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
{
"string": [
{
"name": "app_name",
"value": "actsbundlemgrmultipleinstalltest"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ 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.
*/
require('./ExampleJsunit.test.js')
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册