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

!3068 删除系统api调用,新增公共api用例

Merge pull request !3068 from ry/master
......@@ -26,18 +26,12 @@ group("bundlemanager") {
"actsbmsmetadatatest:ActsBmsMetaDataTest",
"actsbundlemanageretstest:ActsBundleManagerEtsTest",
"actsbundlemanagertest:ActsBundleManagerTest",
"actsbundlemanageruninstall:ActsBundleManagerUninstallTest",
"actsbundlemgrmultipleinstalltest:ActsBundleMgrMultipleInstallTest",
"sceneProject/bmsaccesstokenfive:bmsAccessTokenTest5",
"sceneProject/bmsaccesstokenfour:bmsAccessTokenTest4",
"sceneProject/bmsaccesstokenone:bmsAccessTokenTest1",
"sceneProject/bmsaccesstokenthree:bmsAccessTokenTest3",
"sceneProject/bmsaccesstokentwo:bmsAccessTokenTest2",
"sceneProject/bmseighthright:eighth_right",
"sceneProject/bmseleventhright:eleventh_right",
"sceneProject/bmsfifthright:fifth_right",
"sceneProject/bmsfirstrequestpermissions:FirstRequestPermissions",
"sceneProject/bmsfirstright:first_right",
"sceneProject/bmsfourteenthright:fourteenth_right",
"sceneProject/bmsfourthright:fourth_right",
"sceneProject/bmsgetinfosfifthscene:bmsThirdBundleTest5",
"sceneProject/bmsgetinfosfirstscene:bmsThirdBundleTest1",
"sceneProject/bmsgetinfosfirstsceneupdate:bmsThirdBundleTestA1",
......@@ -45,34 +39,20 @@ group("bundlemanager") {
"sceneProject/bmsgetinfoshapc:bmsThirdBundleC",
"sceneProject/bmsgetinfosjsscene:bmsThirdBundleJs",
"sceneProject/bmsgetinfosscenesystem:bmsSystemBundleTest1",
"sceneProject/bmsgetinfosscenesystemfeature:bmsSystemBundleTest2Feature",
"sceneProject/bmsgetinfosscenesystemtwo:bmsSystemBundleTest2",
"sceneProject/bmsgetinfosscenesystemupdate:bmsSystemBundleTest2Update",
"sceneProject/bmsgetinfosscenevendor:bmsVendorBundleTest1",
"sceneProject/bmsgetinfossecondscene:bmsThirdBundleTest2",
"sceneProject/bmsgetinfossixthscene:bmsThirdBundleTest6",
"sceneProject/bmsgetinfosthirdscene:bmsThirdBundleTest3",
"sceneProject/bmsmainabilityfirstscene:bmsMainAbilityFirstScene",
"sceneProject/bmsmainabilitysecondscene:bmsMainAbilitySecondScene",
"sceneProject/bmsninthright:ninth_right",
"sceneProject/bmssceneeight:bmsJstest8",
"sceneProject/bmsscenefive:bmsJstest5",
"sceneProject/bmsscenefour:bmsJstest4",
"sceneProject/bmsscenenine:bmsJstest9",
"sceneProject/bmssceneone:bmsJstest1",
"sceneProject/bmssceneseven:bmsJstest7",
"sceneProject/bmsscenesix:bmsJstest6",
"sceneProject/bmsscenethree:bmsJstest3",
"sceneProject/bmsscenetwo:bmsJstest2",
"sceneProject/bmssecondbackupright:second_backup_right",
"sceneProject/bmssecondrequestpermissions:SecondRequestPermissions",
"sceneProject/bmssecondright:second_right",
"sceneProject/bmssixteenthright:sixteenth_right",
"sceneProject/bmssixthright:sixth_right",
"sceneProject/bmstenthright:tenth_right",
"sceneProject/bmsthirdright:third_right",
"sceneProject/bmsthirteenthright:thirteenth_right",
"sceneProject/bmstwelfthright:twelfth_right",
]
}
}
......@@ -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"
......@@ -58,18 +54,6 @@
{
"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": [
......
......@@ -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,68 +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();
});
}
});
/**
* @tc.number bms_AccessTokenId_0800
* @tc.name BUNDLE::getBundleInfos
* @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_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();
});
});
function checkInstallOrUninstall(err, data) {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
}
});
......@@ -15,6 +15,7 @@
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "deccjsunit/index.ets"
import bundle from '@ohos.bundle'
import pkg from '@system.package'
const DEFAULT_FLAG = bundle.BundleFlag.GET_BUNDLE_DEFAULT;
const INVALID_CODE = 1;
......@@ -85,6 +86,58 @@ export default function actsBmsJsUnPermissionTest() {
});
});
/*
* @tc.number: SUB_BMS_HAP_STATUS_0011
* @tc.name: test hasInstalled
* @tc.desc: test hasInstalled without permission
*/
it('SUB_BMS_HAP_STATUS_0011', 0, async function (done) {
pkg.hasInstalled({
bundleName: SELF_BUNDLENAME,
success: function success(data) {
console.info("get hasInstalled success" + JSON.stringify(data));
expect(data.result).assertTrue();
done();
},
fail: function fail(data, code) {
console.info("get hasInstalled fail" + JSON.stringify(data));
expect(data).assertFail();
done();
},
complete: function complete() {
console.info("get hasInstalled complete");
expect(data).assertFail();
done();
}
})
});
/*
* @tc.number: SUB_BMS_HAP_STATUS_0012
* @tc.name: test hasInstalled
* @tc.desc: test hasInstalled without permission
*/
it('SUB_BMS_HAP_STATUS_0012', 0, async function (done) {
pkg.hasInstalled({
bundleName: LAUNCHER_BUNDLE_NAME,
success: function success(data) {
console.info("get hasInstalled success" + JSON.stringify(data));
expect(data.result).assertFalse();
done();
},
fail: function fail(data, code) {
console.info("get hasInstalled fail" + JSON.stringify(data));
expect(data).assertFail();
done();
},
complete: function complete() {
console.info("get hasInstalled complete");
expect(data).assertFail();
done();
}
})
});
/*
* @tc.number: getAbilityInfo_100
* @tc.name: test getAbilityInfo
......
......@@ -33,15 +33,28 @@
"bmsThirdBundleTest5.hap->/data/test/bmsThirdBundleTest5.hap",
"bmsThirdBundleTest6.hap->/data/test/bmsThirdBundleTest6.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/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.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"
......@@ -58,18 +54,6 @@
{
"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": [
......
......@@ -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
......@@ -27,8 +27,6 @@
"push": [
"bmsMainAbilityFirstScene.hap->/data/test/bmsMainAbilityFirstScene.hap",
"bmsMainAbilitySecondScene.hap->/data/test/bmsMainAbilitySecondScene.hap",
"bmsThirdBundleTest1.hap->/data/test/bmsThirdBundleTest1.hap",
"bmsThirdBundleTestA1.hap->/data/test/bmsThirdBundleTestA1.hap",
"bmsThirdBundleTest2.hap->/data/test/bmsThirdBundleTest2.hap",
"bmsThirdBundleTest5.hap->/data/test/bmsThirdBundleTest5.hap"
]
......@@ -36,7 +34,17 @@
{
"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/bmsThirdBundleTest2.hap",
"bm install -p /data/test/bmsThirdBundleTest5.hap"
],
"teardown-command":[
"bm uninstall -n com.example.third2",
"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"
......@@ -58,18 +54,6 @@
{
"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": [
......
......@@ -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"
......@@ -59,18 +55,6 @@
{
"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": [
......
......@@ -118,4 +118,48 @@ describe('ActsBmsHasInstalldTest', function () {
}
});
});
/*
* @tc.number: hasInstalled_0500
* @tc.name: test hasInstalled bundleName is number
* @tc.desc: test hasInstalled bundleName is number without function fail
* @tc.level 3
*/
it('hasInstalled_0500', 0, async function (done) {
pkg.hasInstalled({
bundleName: NUM_TWO,
success: function success(data) {
console.info('hasInstalled success' + JSON.stringify(data));
expect(error).assertFail();
done();
},
complete: function complete() {
console.info('hasInstalled complete');
done();
}
})
});
/*
* @tc.number: hasInstalled_0600
* @tc.name: test hasInstalled bundleName is number
* @tc.desc: test hasInstalled bundleName is number without function complete
* @tc.level 3
*/
it('hasInstalled_0600', 0, async function (done) {
pkg.hasInstalled({
bundleName: NUM_TWO,
success: function success(data) {
console.info('hasInstalled success' + JSON.stringify(data));
expect(error).assertFail();
done();
},
fail: function fail(data, code) {
console.info('hasInstalled fail');
expect(data).assertEqual("value is not an available number");
expect(code).assertEqual(202);
done();
}
})
});
})
\ No newline at end of file
......@@ -27,15 +27,25 @@
"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"
]
},
{
"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"
],
"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",
"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"
......@@ -58,18 +54,6 @@
{
"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": [
......
......@@ -16,6 +16,18 @@
import bundle from '@ohos.bundle'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
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 ABILITY_NAME1 = 'com.example.third1.MainAbility';
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 USERID = 100;
describe('ActsBmsMetaDataTest', function () {
/*
......@@ -24,133 +36,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();
});
});
})
/*
* @tc.number: bms_getMetaData_0200
* @tc.name: test to get meta data for an update application.
* @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);
});
}).catch(err => {
expect(err).assertFail();
done();
});
});
})
});
/*
* @tc.number: bms_getMetaData_0400
......@@ -158,44 +59,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 +82,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 +102,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 +125,21 @@ 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');
}
}
})
\ No newline at end of file
......@@ -29,9 +29,6 @@
},
{
"name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
},
{
"name": "ohos.permission.INSTALL_BUNDLE"
}
],
"distro": {
......
......@@ -166,7 +166,6 @@ export default function getAbilityLabelJsUnit() {
done();
});
/*
* @tc.number: context_getAbilityLabel_test_0700
* @tc.name: getAbilityLabel : Gets the specified ability label
......
......@@ -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();
});
});
......
......@@ -31,228 +31,107 @@ const ABILITY_ERROR = {
export default function isAbilityEnabledETSUnit() {
describe('context_isAbilityEnabled_test', function () {
describe('isAbilityEnabled_test', function () {
/*
* @tc.number: context_isAbilityEnabled_test_0100
* @tc.number: isAbilityEnabled_test_0100
* @tc.name: isAbilityEnabled : Get whether to enable a specified ability
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
*/
it('context_isAbilityEnabled_test_0100', 0, async function (done) {
it('isAbilityEnabled_test_0100', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
let mData;
await Bundle.isAbilityEnabled(ABILITY).then((data) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0100]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[isAbilityEnabled_test_0100]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isAbilityEnabled_test_0100] promise data is: ' + JSON.stringify(data));
console.info('[isAbilityEnabled_test_0100] promise data is: ' + JSON.stringify(data));
}).catch((error) => {
console.info('[context_isAbilityEnabled_test_0100] promise error is: ' + error);
console.info('[isAbilityEnabled_test_0100] promise error is: ' + error);
expect(error).assertFail();
});
getAbilityEnabledSuccess('[context_isAbilityEnabled_test_0100]', mData);
getAbilityEnabledTrue('[isAbilityEnabled_test_0100]', mData);
done();
});
/*
* @tc.number: context_isAbilityEnabled_test_0200
* @tc.number: isAbilityEnabled_test_0200
* @tc.name: isAbilityEnabled : Get whether to enable a specified ability
* @tc.desc: Check the return value of the interface (by callback)
* @tc.level 0
*/
it('context_isAbilityEnabled_test_0200', 0, async function (done) {
it('isAbilityEnabled_test_0200', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
let mData;
Bundle.isAbilityEnabled(ABILITY, (error, data) => {
if (error) {
console.error('[context_isAbilityEnabled_test_0200]Operation failed. Cause: ' + JSON.stringify(error));
console.error('[isAbilityEnabled_test_0200]Operation failed. Cause: ' + JSON.stringify(error));
expect(error).assertFail();
}
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0200]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[isAbilityEnabled_test_0200]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isAbilityEnabled_test_0200] callBack error: ' + error);
console.info('[context_isAbilityEnabled_test_0200] callBack data is:' + JSON.stringify(data));
console.info('[isAbilityEnabled_test_0200] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
getAbilityEnabledSuccess('[context_isAbilityEnabled_test_0200]', mData);
getAbilityEnabledTrue('[isAbilityEnabled_test_0200]', mData);
done();
});
/*
* @tc.number: context_isAbilityEnabled_test_0300
* @tc.number: isAbilityEnabled_test_0300
* @tc.name: isAbilityEnabled : Get whether to enable a specified ability
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
*/
it('context_isAbilityEnabled_test_0300', 0, async function (done) {
it('isAbilityEnabled_test_0300', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
let mData;
await Bundle.isAbilityEnabled(ABILITY_ERROR).then((data) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isAbilityEnabled_test_0300] promise data is: ' + JSON.stringify(data));
console.info('[isAbilityEnabled_test_0300] promise data is: ' + JSON.stringify(data));
}).catch((error) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp);
console.info('[context_isAbilityEnabled_test_0300] promise error is: ' + error);
Utils.getDurationTime('[isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp);
console.info('[isAbilityEnabled_test_0300] promise error is: ' + error);
expect(error).assertFail();
});
getAbilityEnabledFalse('[context_isAbilityEnabled_test_0300]', mData);
getAbilityEnabledFalse('[isAbilityEnabled_test_0300]', mData);
done();
});
/*
* @tc.number: context_isAbilityEnabled_test_0400
* @tc.number: isAbilityEnabled_test_0400
* @tc.name: isAbilityEnabled : Get whether to enable a specified ability
* @tc.desc: Check the return value of the interface (by callback)
* @tc.level 0
*/
it('context_isAbilityEnabled_test_0400', 0, async function (done) {
it('isAbilityEnabled_test_0400', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
let mData;
Bundle.isAbilityEnabled(ABILITY_ERROR, (error, data) => {
if (error) {
console.error('[context_isAbilityEnabled_test_0400]Operation failed. Cause: ' + JSON.stringify(error));
console.error('[isAbilityEnabled_test_0400]Operation failed. Cause: ' + JSON.stringify(error));
expect(error).assertFail();
}
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isAbilityEnabled_test_0400] callBack error: ' + error);
console.info('[context_isAbilityEnabled_test_0400] callBack data is:' + JSON.stringify(data));
console.info('[isAbilityEnabled_test_0400] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
console.info('[context_isAbilityEnabled_test_0400] Failure ');
getAbilityEnabledFalse('[context_isAbilityEnabled_test_0300]', mData);
console.info('[isAbilityEnabled_test_0400] Failure ');
getAbilityEnabledFalse('[isAbilityEnabled_test_0300]', mData);
done();
});
/*
* @tc.number: context_isAbilityEnabled_test_0500
* @tc.name: isAbilityEnabled : Get whether to enable a specified ability
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
*/
it('context_isAbilityEnabled_test_0500', 0, async function (done) {
await Bundle.setAbilityEnabled(ABILITY, true).then((data) => {
console.info('[context_isAbilityEnabled_test_0500] set enable true data is: ' + JSON.stringify(data));
}).catch((error) => {
console.info('[context_isAbilityEnabled_test_0500] set enable true error is: ' + error);
expect(error).assertFail();
})
let timeOldStamp = await Utils.getNowTime();
let mData;
await Bundle.isAbilityEnabled(ABILITY).then((data) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0500]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isAbilityEnabled_test_0500] promise data is: ' + JSON.stringify(data));
}).catch((error) => {
console.info('[context_isAbilityEnabled_test_0500] promise error is: ' + error);
expect(error).assertFail();
});
getAbilityEnabledTrue('[context_isAbilityEnabled_test_0500]', mData);
done();
});
/*
* @tc.number: context_isAbilityEnabled_test_0600
* @tc.name: isAbilityEnabled : Get whether to enable a specified ability
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
*/
it('context_isAbilityEnabled_test_0600', 0, async function (done) {
await Bundle.setAbilityEnabled(ABILITY, false).then((data) => {
console.info('[context_isAbilityEnabled_test_0600] set enable false data is: ' + JSON.stringify(data));
}).catch((error) => {
console.info('[context_isAbilityEnabled_test_0600] set enable false error is: ' + error);
expect(error).assertFail();
})
let timeOldStamp = await Utils.getNowTime();
let mData;
await Bundle.isAbilityEnabled(ABILITY).then((data) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0600]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isAbilityEnabled_test_0600] promise data is: ' + JSON.stringify(data));
}).catch((error) => {
console.info('[context_isAbilityEnabled_test_0600] promise error is: ' + error);
expect(error).assertFail();
});
getAbilityEnabledFalse('[context_isAbilityEnabled_test_0600]', mData);
done();
});
/*
* @tc.number: context_isAbilityEnabled_test_0700
* @tc.name: isAbilityEnabled : Get whether to enable a specified ability
* @tc.desc: Check the return value of the interface (by callback)
* @tc.level 0
*/
it('context_isAbilityEnabled_test_0700', 0, async function (done) {
await Bundle.setAbilityEnabled(ABILITY, true).then((data) => {
console.info('[context_isAbilityEnabled_test_0700] set enable true data is: ' + JSON.stringify(data));
}).catch((error) => {
console.info('[context_isAbilityEnabled_test_0700] set enable true error is: ' + error);
expect(error).assertFail();
})
let timeOldStamp = await Utils.getNowTime();
let mData;
Bundle.isAbilityEnabled(ABILITY, (error, data) => {
if (error) {
console.error('[context_isAbilityEnabled_test_0700]Operation failed. Cause: ' + JSON.stringify(error));
expect(error).assertFail();
}
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0700]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isAbilityEnabled_test_0700] callBack error: ' + error);
console.info('[context_isAbilityEnabled_test_0700] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
getAbilityEnabledTrue('[context_isAbilityEnabled_test_0700]', mData);
done();
});
/*
* @tc.number: context_isAbilityEnabled_test_0800
* @tc.name: isAbilityEnabled : Get whether to enable a specified ability
* @tc.desc: Check the return value of the interface (by callback)
* @tc.level 0
*/
it('context_isAbilityEnabled_test_0800', 0, async function (done) {
await Bundle.setAbilityEnabled(ABILITY, false).then((data) => {
console.info('[context_isAbilityEnabled_test_0800] set enable false data is: ' + JSON.stringify(data));
}).catch((error) => {
console.info('[context_isAbilityEnabled_test_0800] set enable false error is: ' + error);
expect(error).assertFail();
})
let timeOldStamp = await Utils.getNowTime();
let mData;
Bundle.isAbilityEnabled(ABILITY, (error, data) => {
if (error) {
console.error('[context_isAbilityEnabled_test_0800]Operation failed. Cause: ' + JSON.stringify(error));
expect(error).assertFail();
}
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0800]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isAbilityEnabled_test_0800] callBack error: ' + error);
console.info('[context_isAbilityEnabled_test_0800] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
getAbilityEnabledFalse('[context_isAbilityEnabled_test_0800]', mData);
done();
});
function getAbilityEnabledSuccess(msg, data) {
console.log(msg + ' start ' + JSON.stringify(data));
console.log(msg + ' data : ' + data);
expect(typeof (data)).assertEqual('boolean')
expect(typeof (data)).assertEqual('boolean');
}
function getAbilityEnabledTrue(msg, data) {
......
......@@ -21,170 +21,105 @@ const BUNDLE_NAME_ERROR = 'com.ohos.acepackage.error'
export default function IsApplicationEnabledETSUnit() {
describe('context_isApplicationEnabled_test', function () {
describe('isApplicationEnabled_test', function () {
/*
* @tc.number: context_isApplicationEnabled_test_0100
* @tc.number: isApplicationEnabled_test_0100
* @tc.name: isApplicationEnabled : Get whether to enable a specified application
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
*/
it('context_isApplicationEnabled_test_0100', 0, async function (done) {
it('isApplicationEnabled_test_0100', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
let mData;
await Bundle.isApplicationEnabled(BUNDLE_NAME).then((data) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0100]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[isApplicationEnabled_test_0100]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isApplicationEnabled_test_0100] promise data is: ' + JSON.stringify(data));
console.info('[isApplicationEnabled_test_0100] promise data is: ' + JSON.stringify(data));
}).catch((error) => {
console.info('[context_isApplicationEnabled_test_0100] promise error is: ' + error);
console.info('[isApplicationEnabled_test_0100] promise error is: ' + error);
expect(error).assertFail();
});
getApplicationEnabledSuccess('[context_isApplicationEnabled_test_0100]', mData);
getApplicationEnabledTrue('[isApplicationEnabled_test_0100]', mData);
done();
});
/*
* @tc.number: context_isApplicationEnabled_test_0200
* @tc.number: isApplicationEnabled_test_0200
* @tc.name: isApplicationEnabled : Get whether to enable a specified application
* @tc.desc: Check the return value of the interface (by callback)
* @tc.level 0
*/
it('context_isApplicationEnabled_test_0200', 0, async function (done) {
it('isApplicationEnabled_test_0200', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
let mData;
Bundle.isApplicationEnabled(BUNDLE_NAME, (error, data) => {
if (error) {
console.error('[context_isApplicationEnabled_test_0200]Operation failed. Cause: ' + JSON.stringify(error));
console.error('[isApplicationEnabled_test_0200]Operation failed. Cause: ' + JSON.stringify(error));
expect(error).assertFail();
}
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0200]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[isApplicationEnabled_test_0200]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isApplicationEnabled_test_0200] callBack error: ' + error);
console.info('[context_isApplicationEnabled_test_0200] callBack data is:' + JSON.stringify(data));
console.info('[isApplicationEnabled_test_0200] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
getApplicationEnabledSuccess('[context_isApplicationEnabled_test_0200]', mData);
getApplicationEnabledTrue('[isApplicationEnabled_test_0200]', mData);
done();
});
/*
* @tc.number: context_isApplicationEnabled_test_0300
* @tc.number: isApplicationEnabled_test_0300
* @tc.name: isApplicationEnabled : Get whether to enable a specified application
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
*/
it('context_isApplicationEnabled_test_0300', 0, async function (done) {
it('isApplicationEnabled_test_0300', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
let mData;
await Bundle.isApplicationEnabled(BUNDLE_NAME_ERROR).then((data) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0300]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[isApplicationEnabled_test_0300]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isApplicationEnabled_test_0300] promise data is: ' + JSON.stringify(data));
console.info('[isApplicationEnabled_test_0300] promise data is: ' + JSON.stringify(data));
}).catch((error) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0300]', timeOldStamp, timeNewStamp);
console.info('[context_isApplicationEnabled_test_0300] promise error is: ' + error);
Utils.getDurationTime('[isApplicationEnabled_test_0300]', timeOldStamp, timeNewStamp);
console.info('[isApplicationEnabled_test_0300] promise error is: ' + error);
expect(error).assertFail();
});
getApplicationEnabledFalse('[context_isApplicationEnabled_test_0300]', mData);
getApplicationEnabledFalse('[isApplicationEnabled_test_0300]', mData);
done();
});
/*
* @tc.number: context_isApplicationEnabled_test_0400
* @tc.number: isApplicationEnabled_test_0400
* @tc.name: isApplicationEnabled : Get whether to enable a specified application
* @tc.desc: Check the return value of the interface (by callback)
* @tc.level 0
*/
it('context_isApplicationEnabled_test_0400', 0, async function (done) {
it('isApplicationEnabled_test_0400', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
let mData;
Bundle.isApplicationEnabled(BUNDLE_NAME_ERROR, (error, data) => {
if (error) {
console.error('[context_isApplicationEnabled_test_0400]Operation failed. Cause: ' + JSON.stringify(error));
console.error('[isApplicationEnabled_test_0400]Operation failed. Cause: ' + JSON.stringify(error));
expect(error).assertFail();
}
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0400]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[isApplicationEnabled_test_0400]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isApplicationEnabled_test_0400] callBack error: ' + error);
console.info('[context_isApplicationEnabled_test_0400] callBack data is:' + JSON.stringify(data));
console.info('[isApplicationEnabled_test_0400] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
getApplicationEnabledFalse('[context_isApplicationEnabled_test_0300]', mData);
console.info('[context_isApplicationEnabled_test_0400] Failure ');
done();
});
/*
* @tc.number: context_isApplicationEnabled_test_0500
* @tc.name: isApplicationEnabled : Get whether to enable a specified application
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
*/
it('context_isApplicationEnabled_test_0500', 0, async function (done) {
await Bundle.setApplicationEnabled(BUNDLE_NAME, true).then((data) => {
console.info('[context_isApplicationEnabled_test_0500] set enable true data is: ' + JSON.stringify(data));
}).catch((error) => {
console.info('[context_isApplicationEnabled_test_0500] set enable true error is: ' + error);
expect(error).assertFail();
});
await Utils.sleep(1000);
let timeOldStamp = await Utils.getNowTime();
let mData;
await Bundle.isApplicationEnabled(BUNDLE_NAME).then((data) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0500]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isApplicationEnabled_test_0500] promise data is: ' + JSON.stringify(data));
}).catch((error) => {
console.info('[context_isApplicationEnabled_test_0500] promise error is: ' + error);
expect(error).assertFail();
});
getApplicationEnabledTrue('[context_isApplicationEnabled_test_0500]', mData);
done();
});
/*
* @tc.number: context_isApplicationEnabled_test_0600
* @tc.name: isApplicationEnabled : Get whether to enable a specified application
* @tc.desc: Check the return value of the interface (by callback)
* @tc.level 0
*/
it('context_isApplicationEnabled_test_0600', 0, async function (done) {
await Bundle.setApplicationEnabled(BUNDLE_NAME, false).then((data) => {
console.info('[context_isApplicationEnabled_test_0600] set enable false data is: ' + JSON.stringify(data));
}).catch((error) => {
console.info('[context_isApplicationEnabled_test_0600] set enable false error is: ' + error);
expect(error).assertFail();
});
await Utils.sleep(1000);
let timeOldStamp = await Utils.getNowTime();
let mData;
Bundle.isApplicationEnabled(BUNDLE_NAME, (error, data) => {
if (error) {
console.error('[context_isApplicationEnabled_test_0600]Operation failed. Cause: ' + JSON.stringify(error));
expect(error).assertFail();
}
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0600]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isApplicationEnabled_test_0600] callBack error: ' + error);
console.info('[context_isApplicationEnabled_test_0600] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
getApplicationEnabledFalse('[context_isApplicationEnabled_test_0600]', mData);
getApplicationEnabledFalse('[isApplicationEnabled_test_0300]', mData);
done();
});
function getApplicationEnabledSuccess(msg, data) {
console.log(msg + ' start ' + JSON.stringify(data));
console.log(msg + ' data : ' + data);
expect(typeof (data)).assertEqual('boolean')
expect(typeof (data)).assertEqual('boolean');
}
function getApplicationEnabledTrue(msg, data) {
......
......@@ -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"
......@@ -81,18 +77,6 @@
{
"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": [
......
# 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');
}
};
/*
* 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.
*/
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
......@@ -12,9 +12,9 @@
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap("fifth_right") {
ohos_hap("bmsAccessTokenTest5") {
hap_profile = "./src/main/config.json"
hap_name = "fifth_right"
hap_name = "bmsAccessTokenTest5"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
......
{
"app": {
"bundleName": "com.example.firstrequestpermissions",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.firstrequestpermissions",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.firstrequestpermissions.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard",
"permissions": ["ohos.permission.CAMERA"]
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"reqPermissions": [
{
"name": "com.permission.BMS_PERMISSIONCHANGE_U",
"reason": "Need PERMISSION_U",
"usedScene": {
"ability": [
"com.example.firstrequestpermissions.MainAbility"
],
"when": "always"
}
},
{
"name": "com.permission.BMS_PERMISSIONCHANGE_V",
"reason": "Need PERMISSION_V",
"usedScene": {
"ability": [
"com.example.firstrequestpermissions.MainAbility"
],
"when": "always"
}
}
]
}
{
"app": {
"bundleName": "com.example.bmsaccesstoken3",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.bmsaccesstoken3",
"name": ".MyApplication1",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": ".MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "standard",
"language": "C++",
"metaData": {
"customizeData": [
{
"name": "originWidgetName",
"value": "com.weather.testWidget"
}
]
}
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"definePermissions":[
{
"availableLevel":"normal",
"description":"ALPHA description",
"distributedSceneEnable":true,
"grantMode":"user_grant",
"label":"ALPHA label",
"name":"ohos.permission.ALPHA",
"provisionEnable":true
},
{
"availableLevel":"normal",
"description":"BETA description",
"distributedSceneEnable":true,
"grantMode":"user_grant",
"label":"BETA label",
"name":"ohos.permission.BETA",
"provisionEnable":true
}
],
"reqPermissions":[
{
"name":"ohos.permission.ALPHA",
"reason":"use ohos.permission.ALPHA"
},
{
"name":"ohos.permission.BETA",
"reason":"use ohos.permission.BETA"
},
{
"name": "ohos.permission.KEEP_BACKGROUND_RUNNING",
"reason": "use ohos.permission.KEEP_BACKGROUND_RUNNING"
}
]
}
}
\ 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) 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');
}
};
{
"string": [
{
"name": "app_name",
"value": "bmsscenfive"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
{
"string": [
{
"name": "app_name",
"value": "bmsfirstright"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
......@@ -12,9 +12,9 @@
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap("fourteenth_right") {
ohos_hap("bmsAccessTokenTest4") {
hap_profile = "./src/main/config.json"
hap_name = "fourteenth_right"
hap_name = "bmsAccessTokenTest4"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
......
{
"app": {
"bundleName": "com.example.secondrequestpermissions",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.secondrequestpermissions",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.secondrequestpermissions.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"reqPermissions": [
{
"name": "com.permission.BMS_PERMISSIONCHANGE_W",
"reason": "Need PERMISSIONCHANGE W",
"usedScene": {
"ability": [
"com.example.secondrequestpermissions.MainAbility"
],
"when": "always"
}
}
]
}
{
"app": {
"bundleName": "com.example.bmsaccesstoken2",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.bmsaccesstoken2",
"name": ".MyApplication1",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": ".MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "standard",
"language": "C++",
"metaData": {
"customizeData": [
{
"name": "originWidgetName",
"value": "com.weather.testWidget"
}
]
}
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"definePermissions":[
{
"availableLevel":"normal",
"description":"ALPHA description",
"distributedSceneEnable":true,
"grantMode":"user_grant",
"label":"ALPHA label",
"name":"ohos.permission.ALPHA",
"provisionEnable":true
},
{
"availableLevel":"normal",
"description":"BETA description",
"distributedSceneEnable":true,
"grantMode":"user_grant",
"label":"BETA label",
"name":"ohos.permission.BETA",
"provisionEnable":true
}
],
"reqPermissions":[
{
"name":"ohos.permission.ALPHA",
"reason":"use ohos.permission.ALPHA"
},
{
"name":"ohos.permission.BETA",
"reason":"use ohos.permission.BETA"
},
{
"name": "ohos.permission.KEEP_BACKGROUND_RUNNING",
"reason": "use ohos.permission.KEEP_BACKGROUND_RUNNING"
}
]
}
}
\ 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) 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');
}
};
{
"string": [
{
"name": "app_name",
"value": "bmsscenseven"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
{
"string": [
{
"name": "app_name",
"value": "bmsfirstright"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.bmsaccesstoken1",
"bundleName": "com.example.bmsaccesstoken2",
"vendor": "example",
"version": {
"code": 1,
......@@ -14,7 +14,7 @@
},
"deviceConfig": {},
"module": {
"package": "com.example.bmsaccesstoken1",
"package": "com.example.bmsaccesstoken2",
"name": ".MyApplication1",
"deviceType": [
"phone"
......
# 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_hap("eighth_right") {
hap_profile = "./src/main/config.json"
hap_name = "eighth_right"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./src/main/js/resources" ]
hap_profile = "./src/main/config.json"
}
{
"app": {
"iconId": 33554436,
"apiVersion": {
"compatible": 4,
"releaseType": "Release",
"target": 5
},
"labelId": 33554432,
"vendor": "example",
"icon": "$media:icon",
"bundleName": "com.example.l3jsdemo",
"label": "$string:app_name",
"version": {
"code": 2000000,
"name": "1.0.1"
}
},
"deviceConfig": {
"default": {
"debug": true
}
},
"module": {
"abilities": [
{
"iconId": 33554435,
"descriptionId": 33554434,
"visible": true,
"labelId": 33554433,
"icon": "$media:icon",
"name": "com.example.l2jsdemo.MainAbility",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"homeAbility": false,
"launchType": "standard"
}
],
"deviceType": [
"tablet"
],
"mainAbility": "com.example.l2jsdemo.MainAbility",
"distro": {
"moduleType": "feature",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "l2jsdemo"
},
"package": "com.example.l2jsdemo",
"name": ".MyApplication",
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
}
\ No newline at end of file
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"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>
{
"string": [
{
"name": "app_name",
"value": "bmseighthright"
},
{
"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("//test/xts/tools/build/suite.gni")
ohos_hap("eleventh_right") {
hap_profile = "./src/main/config.json"
hap_name = "eleventh_right"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./src/main/js/resources" ]
hap_profile = "./src/main/config.json"
}
{
"app": {
"iconId": 33554436,
"apiVersion": {
"compatible": 4,
"releaseType": "Release",
"target": 5
},
"labelId": 33554432,
"vendor": "huawei",
"icon": "$media:icon",
"bundleName": "com.example.l3jsdemo",
"label": "$string:app_name",
"version": {
"code": 2000000,
"name": "2.0.0"
}
},
"deviceConfig": {
"default": {
"debug": true
}
},
"module": {
"abilities": [
{
"iconId": 33554435,
"descriptionId": 33554434,
"visible": true,
"labelId": 33554433,
"icon": "$media:icon",
"name": "com.example.l2jsdemo.MainAbility",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"homeAbility": false,
"launchType": "standard"
}
],
"deviceType": [
"tablet"
],
"mainAbility": "com.example.l2jsdemo.MainAbility",
"distro": {
"moduleType": "feature",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "l2jsdemo"
},
"package": "com.example.l2jsdemo",
"name": ".MyApplication",
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
}
\ 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": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"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>
{
"string": [
{
"name": "app_name",
"value": "bmseleventhright"
},
{
"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.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册