提交 9f66a25d 编写于 作者: S shilei

update xts

Signed-off-by: Nshilei <shilei91@huawei.com>
上级 8465604c
...@@ -29,11 +29,9 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -29,11 +29,9 @@ describe('ActsBmsHapModuleTest', function () {
let bundleName = 'com.example.bmsmainabilityfirstscene'; let bundleName = 'com.example.bmsmainabilityfirstscene';
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, { installer.install(bundlePath, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, onReceiveInstallEvent); }, onReceiveInstallEvent);
function onReceiveInstallEvent(err, data) { function onReceiveInstallEvent(err, data) {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
...@@ -72,11 +70,9 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -72,11 +70,9 @@ describe('ActsBmsHapModuleTest', function () {
} }
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -100,11 +96,9 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -100,11 +96,9 @@ describe('ActsBmsHapModuleTest', function () {
let secondMainAbility = 'com.example.bmsmainabilitysecondscene.MainAbility'; let secondMainAbility = 'com.example.bmsmainabilitysecondscene.MainAbility';
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, { installer.install(bundlePath, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -120,11 +114,9 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -120,11 +114,9 @@ describe('ActsBmsHapModuleTest', function () {
checkHapModuleInfo(result.hapModuleInfo[1]); checkHapModuleInfo(result.hapModuleInfo[1]);
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -147,11 +139,9 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -147,11 +139,9 @@ describe('ActsBmsHapModuleTest', function () {
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
console.log('========install========' + typeof installer); console.log('========install========' + typeof installer);
installer.install(bundlePath, { installer.install(bundlePath, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, onReceiveInstallEvent); }, onReceiveInstallEvent);
function onReceiveInstallEvent(err, data) { function onReceiveInstallEvent(err, data) {
console.info('========install Finish========'); console.info('========install Finish========');
...@@ -170,11 +160,9 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -170,11 +160,9 @@ describe('ActsBmsHapModuleTest', function () {
checkHapModuleInfo(result.hapModuleInfo[0]); checkHapModuleInfo(result.hapModuleInfo[0]);
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, onReceiveUninstallEvent); }, onReceiveUninstallEvent);
function onReceiveUninstallEvent(err, data) { function onReceiveUninstallEvent(err, data) {
...@@ -192,8 +180,8 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -192,8 +180,8 @@ describe('ActsBmsHapModuleTest', function () {
/* /*
* @tc.number: bms_getHapModuleInfo_0400 * @tc.number: bms_getHapModuleInfo_0400
* @tc.name: get hapModuleInfo through getBundleInfo, an application that adds mainAbility * @tc.name: get hapModuleInfo through getBundleInfo, an application that adds mainAbility
* @tc.desc: get the module information of the hap with the added field mainAbility * @tc.desc: get the module information of the hap with the added field mainAbility
*/ */
it('bms_getHapModuleInfo_0400', 0, async function (done) { it('bms_getHapModuleInfo_0400', 0, async function (done) {
console.debug('===========begin bms_getHapModuleInfo_0400===========') console.debug('===========begin bms_getHapModuleInfo_0400===========')
...@@ -202,11 +190,9 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -202,11 +190,9 @@ describe('ActsBmsHapModuleTest', function () {
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
console.log('========install========' + typeof installer); console.log('========install========' + typeof installer);
installer.install(bundlePath, { installer.install(bundlePath, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, (err, data) => { }, (err, data) => {
console.info('========install Finish========'); console.info('========install Finish========');
expect(typeof err).assertEqual('object'); expect(typeof err).assertEqual('object');
...@@ -223,11 +209,9 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -223,11 +209,9 @@ describe('ActsBmsHapModuleTest', function () {
checkHapModuleInfo(result.hapModuleInfo[0]); checkHapModuleInfo(result.hapModuleInfo[0]);
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, onReceiveUninstallEvent); }, onReceiveUninstallEvent);
function onReceiveUninstallEvent(err, data) { function onReceiveUninstallEvent(err, data) {
...@@ -242,8 +226,8 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -242,8 +226,8 @@ describe('ActsBmsHapModuleTest', function () {
/* /*
* @tc.number: bms_getHapModuleInfo_0500 * @tc.number: bms_getHapModuleInfo_0500
* @tc.name: get the hapModuleInfo of the upgraded hap package from an application through getBundleInfo * @tc.name: get the hapModuleInfo of the upgraded hap package from an application through getBundleInfo
* @tc.desc: get the module information of the mainAbility upgrade hap * @tc.desc: get the module information of the mainAbility upgrade hap
*/ */
it('bms_getHapModuleInfo_0500', 0, async function (done) { it('bms_getHapModuleInfo_0500', 0, async function (done) {
console.debug('===========begin bms_getHapModuleInfo_0500===========') console.debug('===========begin bms_getHapModuleInfo_0500===========')
...@@ -252,21 +236,17 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -252,21 +236,17 @@ describe('ActsBmsHapModuleTest', function () {
let bundleName = 'com.example.third1'; let bundleName = 'com.example.third1';
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.install(bundlePath1, { installer.install(bundlePath1, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS'); expect(data.statusMessage).assertEqual('SUCCESS');
installer.install(bundlePath2, { installer.install(bundlePath2, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -283,11 +263,9 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -283,11 +263,9 @@ describe('ActsBmsHapModuleTest', function () {
checkHapModuleInfo(hapModuleInfo); checkHapModuleInfo(hapModuleInfo);
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
......
...@@ -29,11 +29,9 @@ describe('ActsBmsJsTest', function () { ...@@ -29,11 +29,9 @@ describe('ActsBmsJsTest', function () {
let abilityName = 'com.example.third2.MainAbility'; let abilityName = 'com.example.third2.MainAbility';
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.install(['/data/test/bmsThirdBundleTest2.hap'], { installer.install(['/data/test/bmsThirdBundleTest2.hap'], {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, onReceiveInstallEvent); }, onReceiveInstallEvent);
async function onReceiveInstallEvent(err, data) { async function onReceiveInstallEvent(err, data) {
...@@ -52,11 +50,9 @@ describe('ActsBmsJsTest', function () { ...@@ -52,11 +50,9 @@ describe('ActsBmsJsTest', function () {
expect(result.abilityInfo[0].srcPath).assertEqual(''); expect(result.abilityInfo[0].srcPath).assertEqual('');
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, (err, data) => { }, (err, data) => {
console.info('========uninstall Finish========'); console.info('========uninstall Finish========');
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
...@@ -80,11 +76,9 @@ describe('ActsBmsJsTest', function () { ...@@ -80,11 +76,9 @@ describe('ActsBmsJsTest', function () {
let abilityName2 = 'com.example.third5.BMainAbility'; let abilityName2 = 'com.example.third5.BMainAbility';
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.install(['/data/test/bmsThirdBundleTest5.hap'], { installer.install(['/data/test/bmsThirdBundleTest5.hap'], {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, onReceiveInstallEvent); }, onReceiveInstallEvent);
async function onReceiveInstallEvent(err, data) { async function onReceiveInstallEvent(err, data) {
...@@ -107,11 +101,9 @@ describe('ActsBmsJsTest', function () { ...@@ -107,11 +101,9 @@ describe('ActsBmsJsTest', function () {
expect(result.abilityInfo[1].srcPath).assertEqual(''); expect(result.abilityInfo[1].srcPath).assertEqual('');
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -133,11 +125,9 @@ describe('ActsBmsJsTest', function () { ...@@ -133,11 +125,9 @@ describe('ActsBmsJsTest', function () {
let abilityName = 'com.example.js.MainAbility'; let abilityName = 'com.example.js.MainAbility';
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.install(['/data/test/bmsThirdBundleJs.hap'], { installer.install(['/data/test/bmsThirdBundleJs.hap'], {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, onReceiveInstallEvent); }, onReceiveInstallEvent);
async function onReceiveInstallEvent(err, data) { async function onReceiveInstallEvent(err, data) {
...@@ -156,11 +146,9 @@ describe('ActsBmsJsTest', function () { ...@@ -156,11 +146,9 @@ describe('ActsBmsJsTest', function () {
expect(result.abilityInfo[0].srcPath).assertEqual('default'); expect(result.abilityInfo[0].srcPath).assertEqual('default');
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, (err, data) => { }, (err, data) => {
console.info('========uninstall Finish========'); console.info('========uninstall Finish========');
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
...@@ -183,11 +171,9 @@ describe('ActsBmsJsTest', function () { ...@@ -183,11 +171,9 @@ describe('ActsBmsJsTest', function () {
let abilityName = '.MainAbility'; let abilityName = '.MainAbility';
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.install(['/data/test/bmsThirdBundleC.hap'], { installer.install(['/data/test/bmsThirdBundleC.hap'], {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, onReceiveInstallEvent); }, onReceiveInstallEvent);
async function onReceiveInstallEvent(err, data) { async function onReceiveInstallEvent(err, data) {
...@@ -206,11 +192,9 @@ describe('ActsBmsJsTest', function () { ...@@ -206,11 +192,9 @@ describe('ActsBmsJsTest', function () {
expect(result.abilityInfo[0].srcPath).assertEqual('default/c++/'); expect(result.abilityInfo[0].srcPath).assertEqual('default/c++/');
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, (err, data) => { }, (err, data) => {
console.info('========uninstall Finish========'); console.info('========uninstall Finish========');
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
......
...@@ -96,11 +96,11 @@ describe('ActsBmsKitTest', function () { ...@@ -96,11 +96,11 @@ describe('ActsBmsKitTest', function () {
for (let i = 0; i < STRESSLEVEL; i++) { for (let i = 0; i < STRESSLEVEL; i++) {
bundle.getAllShortcutInfo(bundleName, async (err, data) => { bundle.getAllShortcutInfo(bundleName, async (err, data) => {
expect(data.length).assertEqual(1); expect(data.length).assertEqual(1);
expect(err.code).assertEqual(0); expect(err).assertEqual(0);
checkShortcutIsExist(data, 'id.third1', 'third1'); checkShortcutIsExist(data, 'id.third1', 'third1');
if (count == STRESSLEVEL - 1) { if (count == STRESSLEVEL - 1) {
done(); done();
} else if (err.code != 0) { } else if (err != 0) {
console.log('call function level is: ' + count); console.log('call function level is: ' + count);
expect().assertFail(); expect().assertFail();
flag = false; flag = false;
......
...@@ -25,47 +25,34 @@ describe('ActsBmsMetaDataTest', function () { ...@@ -25,47 +25,34 @@ describe('ActsBmsMetaDataTest', function () {
*/ */
it('bms_getMetaData_0100', 0, async function (done) { it('bms_getMetaData_0100', 0, async function (done) {
console.info('=====================bms_getMetaData_0100=================='); console.info('=====================bms_getMetaData_0100==================');
var bundlePath = ['/data/test/bmsThirdBundleTest1.hap', '/data/test/bmsThirdBundleTest3.hap'] var bundlePath = ['/data/test/bmsThirdBundleTest1.hap']
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
let abilityName1 = 'com.example.third1.MainAbility'; let abilityName1 = 'com.example.third1.MainAbility';
let abilityName2 = 'com.example.third3.MainAbility';
let dataMap = new Map(); let dataMap = new Map();
installer.install(bundlePath, { installer.install(bundlePath, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS'); expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({ bundle.queryAbilityByWant(
want: { {
action: 'action.system.home', "bundleName": 'com.example.third1',
entities: ['entity.system.home'], "abilityName": 'com.example.third1.MainAbility',
elementName: { }, 32, 0).then(dataInfos => {
deviceId: '0', for (let i = 0, len = dataInfos.length; i < len; i++) {
bundleName: 'com.example.third1', dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
abilityName: 'com.example.third1.MainAbility', }
}, })
} if (dataMap.has(abilityName1)) {
}, 0, 0)
for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
}
expect(dataMap.has(abilityName1)).assertTrue();
expect(dataMap.has(abilityName2)).assertTrue();
if (dataMap.has(abilityName1) && dataMap.has(abilityName2)) {
checkMetaData(dataMap.get(abilityName1), 'Data1'); checkMetaData(dataMap.get(abilityName1), 'Data1');
checkMetaData(dataMap.get(abilityName2), 'Data3');
} }
installer.uninstall('com.example.third1', { installer.uninstall('com.example.third1', {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -89,49 +76,37 @@ describe('ActsBmsMetaDataTest', function () { ...@@ -89,49 +76,37 @@ describe('ActsBmsMetaDataTest', function () {
let abilityName1 = 'com.example.third1.AMainAbility'; let abilityName1 = 'com.example.third1.AMainAbility';
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.install(bundlePath1, { installer.install(bundlePath1, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS'); expect(data.statusMessage).assertEqual('SUCCESS');
installer.install(bundlePath2, { installer.install(bundlePath2, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS'); expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({ bundle.queryAbilityByWant(
want: { {
action: 'action.system.home', "bundleName": 'com.example.third1',
entities: ['entity.system.home'], "abilityName": 'com.example.third1.AMainAbility',
elementName: { }, 32, 0).then(dataInfos => {
deviceId: '0', for (let i = 0, len = dataInfos.length; i < len; i++) {
bundleName: 'com.example.third1', dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
abilityName: 'com.example.third1.AMainAbility', }
}, })
}
}, 0, 0)
for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
}
expect(dataMap.has(abilityName1)).assertTrue();
if (dataMap.has(abilityName1)) { if (dataMap.has(abilityName1)) {
checkMetaData(dataMap.get(abilityName1), 'DataA1'); checkMetaData(dataMap.get(abilityName1), 'DataA1');
} }
installer.uninstall('com.example.third1', { installer.uninstall('com.example.third1', {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -153,37 +128,25 @@ describe('ActsBmsMetaDataTest', function () { ...@@ -153,37 +128,25 @@ describe('ActsBmsMetaDataTest', function () {
let bundleName = 'com.example.third1'; let bundleName = 'com.example.third1';
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, { installer.install(bundlePath, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS'); expect(data.statusMessage).assertEqual('SUCCESS');
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(0); bundle.queryAbilityByWant(
expect(data.status).assertEqual(0); {
expect(data.statusMessage).assertEqual('SUCCESS'); bundleName: 'com.example.third1',
var dataInfos = await bundle.queryAbilityByWant({ abilityName: 'com.example.third1.MainAbility',
want: { }, 32, 0).then(dataInfos => {
action: 'action.system.home', expect(dataInfos.length).assertEqual(0);
entities: ['entity.system.home'], });
elementName: {
deviceId: '0',
bundleName: 'com.example.third1',
abilityName: 'com.example.third1.MainAbility',
},
}
}, 0, 0);
expect(dataInfos.length).assertEqual(0);
done(); done();
}); });
}); });
...@@ -192,52 +155,39 @@ describe('ActsBmsMetaDataTest', function () { ...@@ -192,52 +155,39 @@ describe('ActsBmsMetaDataTest', function () {
/* /*
* @tc.number: bms_getMetaData_0400 * @tc.number: bms_getMetaData_0400
* @tc.name: test to get meta data for an application. * @tc.name: test to get meta data for an application.
* @tc.desc: get an application's meta data which has two abilities. * @tc.desc: get an application's meta data which has one ability.
*/ */
it('bms_getMetaData_0400', 0, async function (done) { it('bms_getMetaData_0400', 0, async function (done) {
console.info('=====================bms_getMetaData_0400=================='); console.info('=====================bms_getMetaData_0400==================');
var bundlePath = ['/data/test/bmsThirdBundleTest5.hap'] var bundlePath = ['/data/test/bmsThirdBundleTest5.hap']
let dataMap = new Map(); let dataMap = new Map();
let abilityName1 = 'com.example.third5.AMainAbility'; let abilityName1 = 'com.example.third5.AMainAbility';
let abilityName2 = 'com.example.third5.BMainAbility';
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, { installer.install(bundlePath, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, onReceiveinstallEvent); }, onReceiveinstallEvent);
async function onReceiveinstallEvent(err, data) { async function onReceiveinstallEvent(err, data) {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS'); expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({ bundle.queryAbilityByWant(
want: { {
action: 'action.system.home', bundleName: 'com.example.third5',
entities: ['entity.system.home'], abilityName: 'com.example.third5.AMainAbility',
elementName: { }, 32, 0).then(dataInfos => {
deviceId: '0', for (let i = 0, len = dataInfos.length; i < len; i++) {
bundleName: 'com.example.third5', dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
abilityName: 'com.example.third5.AMainAbility', }
}, })
} if (dataMap.has(abilityName1)) {
}, 0, 0)
for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
}
expect(dataMap.has(abilityName1)).assertTrue();
expect(dataMap.has(abilityName2)).assertTrue();
if (dataMap.has(abilityName1) && dataMap.has(abilityName2)) {
checkMetaData(dataMap.get(abilityName1), 'Data5A'); checkMetaData(dataMap.get(abilityName1), 'Data5A');
checkMetaData(dataMap.get(abilityName2), 'Data5B');
} }
installer.uninstall('com.example.third5', { installer.uninstall('com.example.third5', {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -254,18 +204,13 @@ describe('ActsBmsMetaDataTest', function () { ...@@ -254,18 +204,13 @@ describe('ActsBmsMetaDataTest', function () {
*/ */
it('bms_getMetaData_0500', 0, async function (done) { it('bms_getMetaData_0500', 0, async function (done) {
console.info('=====================bms_getMetaData_0500=================='); console.info('=====================bms_getMetaData_0500==================');
var dataInfos = await bundle.queryAbilityByWant({ bundle.queryAbilityByWant(
want: { {
action: 'action.system.home', bundleName: 'com.example.noexist',
entities: ['entity.system.home'], abilityName: 'com.example.noexist.MainAbility',
elementName: { }, 32, 0).then(dataInfos => {
deviceId: '0', expect(dataInfos.length).assertEqual(0);
bundleName: 'com.example.noexist', })
abilityName: 'com.example.noexist.MainAbility',
},
}
}, 0, 0)
expect(dataInfos.length).assertEqual(0);
done(); done();
}) })
...@@ -278,21 +223,15 @@ describe('ActsBmsMetaDataTest', function () { ...@@ -278,21 +223,15 @@ describe('ActsBmsMetaDataTest', function () {
console.info('=====================bms_getMetaData_0600=================='); console.info('=====================bms_getMetaData_0600==================');
let dataMap = new Map(); let dataMap = new Map();
let abilityName1 = 'com.example.system1.MainAbility'; let abilityName1 = 'com.example.system1.MainAbility';
var dataInfos = await bundle.queryAbilityByWant({ bundle.queryAbilityByWant(
want: { {
action: 'action.system.home', bundleName: 'com.example.system1',
entities: ['entity.system.home'], abilityName: 'com.example.system1.MainAbility',
elementName: { }, 32, 0).then(dataInfos => {
deviceId: '0', for (let i = 0, len = dataInfos.length; i < len; i++) {
bundleName: 'com.example.system1', dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
abilityName: 'com.example.system1.MainAbility', }
}, })
}
}, 0, 0);
for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
}
expect(dataMap.has(abilityName1)).assertTrue();
if (dataMap.has(abilityName1)) { if (dataMap.has(abilityName1)) {
checkMetaData(dataMap.get(abilityName1), 'Data1S'); checkMetaData(dataMap.get(abilityName1), 'Data1S');
} }
...@@ -308,21 +247,15 @@ describe('ActsBmsMetaDataTest', function () { ...@@ -308,21 +247,15 @@ describe('ActsBmsMetaDataTest', function () {
console.info('=====================bms_getMetaData_0700=================='); console.info('=====================bms_getMetaData_0700==================');
let dataMap = new Map(); let dataMap = new Map();
let abilityName1 = 'com.example.vendor1.MainAbility'; let abilityName1 = 'com.example.vendor1.MainAbility';
var dataInfos = await bundle.queryAbilityByWant({ bundle.queryAbilityByWant(
want: { {
action: 'action.system.home', bundleName: 'com.example.vendor1',
entities: ['entity.system.home'], abilityName: 'com.example.vendor1.MainAbility',
elementName: { }, 32, 0).then(dataInfos => {
deviceId: '0', for (let i = 0, len = dataInfos.length; i < len; i++) {
bundleName: 'com.example.vendor1', dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
abilityName: 'com.example.vendor1.MainAbility', }
}, });
}
}, 0, 0);
for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
}
expect(dataMap.has(abilityName1)).assertTrue();
if (dataMap.has(abilityName1)) { if (dataMap.has(abilityName1)) {
let data = dataMap.get(abilityName1); let data = dataMap.get(abilityName1);
var parameters = data.parameters; var parameters = data.parameters;
......
...@@ -75,11 +75,9 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -75,11 +75,9 @@ describe('ActsBmsModuleUsageRecordTest', function () {
console.debug('=======start ability========') console.debug('=======start ability========')
let installer = await bundle.getBundleInstaller(); let installer = await bundle.getBundleInstaller();
installer.install(['/data/test/bmsThirdBundleTest1.hap'], { installer.install(['/data/test/bmsThirdBundleTest1.hap'], {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
console.debug('========install Finish========'); console.debug('========install Finish========');
id = setTimeout(timeout, START_ABILITY_TIMEOUT); id = setTimeout(timeout, START_ABILITY_TIMEOUT);
...@@ -100,11 +98,9 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -100,11 +98,9 @@ describe('ActsBmsModuleUsageRecordTest', function () {
if (err.code != 0 && data.name.length == 0) { if (err.code != 0 && data.name.length == 0) {
let installer = await bundle.getBundleInstaller(); let installer = await bundle.getBundleInstaller();
installer.install(['/data/test/bmsThirdBundleTest1.hap'], { installer.install(['/data/test/bmsThirdBundleTest1.hap'], {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
console.debug('========install Finish========' + JSON.stringify(data)); console.debug('========install Finish========' + JSON.stringify(data));
done(); done();
...@@ -183,7 +179,7 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -183,7 +179,7 @@ describe('ActsBmsModuleUsageRecordTest', function () {
*/ */
it('bms_getModuleUsageRecordTest_0300', 0, async function (done) { it('bms_getModuleUsageRecordTest_0300', 0, async function (done) {
console.debug('=====================bms_getModuleUsageRecordTest_0300=================='); console.debug('=====================bms_getModuleUsageRecordTest_0300==================');
bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TEN, (err, data) => { bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TWO, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
checkModuleUsageRecord(data); checkModuleUsageRecord(data);
var result = checkIsExist(data, BUNDLE_NAME); var result = checkIsExist(data, BUNDLE_NAME);
...@@ -208,20 +204,21 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -208,20 +204,21 @@ describe('ActsBmsModuleUsageRecordTest', function () {
*/ */
it('bms_getModuleUsageRecordTest_0400', 0, async function (done) { it('bms_getModuleUsageRecordTest_0400', 0, async function (done) {
console.debug('=====================bms_getModuleUsageRecordTest_0400=================='); console.debug('=====================bms_getModuleUsageRecordTest_0400==================');
var records = await bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TEN); bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TWO).then(records => {
checkModuleUsageRecord(records); checkModuleUsageRecord(records);
var result = checkIsExist(records, BUNDLE_NAME); var result = checkIsExist(records, BUNDLE_NAME);
expect(result).assertTrue(); expect(result).assertTrue();
if (result) { if (result) {
let counts = new Map(); let counts = new Map();
console.debug('======LaunchedCount======' + START_COUNT); console.debug('======LaunchedCount======' + START_COUNT);
expect(records[0].launchedCount).assertEqual(START_COUNT); expect(records[0].launchedCount).assertEqual(START_COUNT);
for (let i = 0, length = records.length; i < length; i++) { for (let i = 0, length = records.length; i < length; i++) {
counts.set(records[i].bundleName, records[i].launchedCount); counts.set(records[i].bundleName, records[i].launchedCount);
console.debug('=============launchedCount is=========' + records[i].launchedCount); console.debug('=============launchedCount is=========' + records[i].launchedCount);
}
expect(counts.get(BUNDLE_NAME)).assertEqual(START_COUNT);
} }
expect(counts.get(BUNDLE_NAME)).assertEqual(START_COUNT); });
}
done(); done();
}) })
...@@ -235,11 +232,9 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -235,11 +232,9 @@ describe('ActsBmsModuleUsageRecordTest', function () {
console.debug('=====================bms_getModuleUsageRecordTest_0500=================='); console.debug('=====================bms_getModuleUsageRecordTest_0500==================');
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.uninstall(BUNDLE_NAME, { installer.uninstall(BUNDLE_NAME, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, onReceiveinstallEvent); }, onReceiveinstallEvent);
async function onReceiveinstallEvent(err, data) { async function onReceiveinstallEvent(err, data) {
...@@ -253,11 +248,9 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -253,11 +248,9 @@ describe('ActsBmsModuleUsageRecordTest', function () {
var result = checkIsExist(records, BUNDLE_NAME); var result = checkIsExist(records, BUNDLE_NAME);
expect(result).assertEqual(false); expect(result).assertEqual(false);
installer.install(['/data/test/bmsThirdBundleTest1.hap'], { installer.install(['/data/test/bmsThirdBundleTest1.hap'], {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -277,11 +270,9 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -277,11 +270,9 @@ describe('ActsBmsModuleUsageRecordTest', function () {
console.debug('=====================bms_getModuleUsageRecordTest_0600=================='); console.debug('=====================bms_getModuleUsageRecordTest_0600==================');
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.uninstall(BUNDLE_NAME, { installer.uninstall(BUNDLE_NAME, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -291,11 +282,9 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -291,11 +282,9 @@ describe('ActsBmsModuleUsageRecordTest', function () {
var result = checkIsExist(moduleUsageRecord, BUNDLE_NAME); var result = checkIsExist(moduleUsageRecord, BUNDLE_NAME);
expect(result).assertEqual(false); expect(result).assertEqual(false);
installer.install(['/data/test/bmsThirdBundleTest1.hap'], { installer.install(['/data/test/bmsThirdBundleTest1.hap'], {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -371,22 +360,18 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -371,22 +360,18 @@ describe('ActsBmsModuleUsageRecordTest', function () {
console.debug('=====================bms_getModuleUsageRecordTest_1100=================='); console.debug('=====================bms_getModuleUsageRecordTest_1100==================');
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.uninstall(BUNDLE_NAME, { installer.uninstall(BUNDLE_NAME, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS"); expect(data.statusMessage).assertEqual("SUCCESS");
var bundlePath = ['/data/test/bmsThirdBundleTest1.hap']; var bundlePath = ['/data/test/bmsThirdBundleTest1.hap'];
installer.install(bundlePath, { installer.install(bundlePath, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -408,22 +393,18 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -408,22 +393,18 @@ describe('ActsBmsModuleUsageRecordTest', function () {
console.debug('=====================bms_getModuleUsageRecordTest_1200=================='); console.debug('=====================bms_getModuleUsageRecordTest_1200==================');
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.uninstall(BUNDLE_NAME, { installer.uninstall(BUNDLE_NAME, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS"); expect(data.statusMessage).assertEqual("SUCCESS");
var bundlePath = ['/data/test/bmsThirdBundleTest1.hap'] var bundlePath = ['/data/test/bmsThirdBundleTest1.hap']
installer.install(bundlePath, { installer.install(bundlePath, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -476,21 +457,17 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -476,21 +457,17 @@ describe('ActsBmsModuleUsageRecordTest', function () {
} }
let installer = await bundle.getBundleInstaller(); let installer = await bundle.getBundleInstaller();
installer.uninstall(BUNDLE_NAME, { installer.uninstall(BUNDLE_NAME, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS"); expect(data.statusMessage).assertEqual("SUCCESS");
installer.install(['/data/test/bmsThirdBundleTest1.hap'], { installer.install(['/data/test/bmsThirdBundleTest1.hap'], {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -545,21 +522,17 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -545,21 +522,17 @@ describe('ActsBmsModuleUsageRecordTest', function () {
} }
let installer = await bundle.getBundleInstaller(); let installer = await bundle.getBundleInstaller();
installer.uninstall(BUNDLE_NAME, { installer.uninstall(BUNDLE_NAME, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS"); expect(data.statusMessage).assertEqual("SUCCESS");
installer.install(['/data/test/bmsThirdBundleTest1.hap'], { installer.install(['/data/test/bmsThirdBundleTest1.hap'], {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -700,11 +673,9 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -700,11 +673,9 @@ describe('ActsBmsModuleUsageRecordTest', function () {
console.debug('=======after all install========'); console.debug('=======after all install========');
let installer = await bundle.getBundleInstaller(); let installer = await bundle.getBundleInstaller();
installer.uninstall(BUNDLE_NAME, { installer.uninstall(BUNDLE_NAME, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, (err, data) => { }, (err, data) => {
console.info('uninstall finish'); console.info('uninstall finish');
done(); done();
......
...@@ -37,11 +37,14 @@ const LAUNCHER = "com.ohos.launcher" ...@@ -37,11 +37,14 @@ const LAUNCHER = "com.ohos.launcher"
const OBJECT = "object" const OBJECT = "object"
const SUCCESS = "SUCCESS" const SUCCESS = "SUCCESS"
const START_ABILITY_TIMEOUT = 3000; const START_ABILITY_TIMEOUT = 3000;
const ERR_CODE = -1;
const STATUS_INSTALL_FAILURE_INVALID = 3;
const STATUS_INSTALL_FAILURE_CONFLICT = 4;
var subscriberInfoEvent_0100 = { var subscriberInfoEvent_0100 = {
events: ['Third1_Publish_CommonEvent'], events: ['Third1_Publish_CommonEvent'],
}; };
describe('ActsBundleManagerTest', function () { describe('ActsBundleManagerUninstall', function () {
/** /**
* @tc.number uninstall_0100 * @tc.number uninstall_0100
* @tc.name BUNDLE::uninstall * @tc.name BUNDLE::uninstall
...@@ -50,11 +53,9 @@ describe('ActsBundleManagerTest', function () { ...@@ -50,11 +53,9 @@ describe('ActsBundleManagerTest', function () {
it('uninstall_0100', 0, async function (done) { it('uninstall_0100', 0, async function (done) {
let installData = await demo.getBundleInstaller(); let installData = await demo.getBundleInstaller();
installData.install([PATH + BMSJSTEST1], { installData.install([PATH + BMSJSTEST1], {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -62,11 +63,9 @@ describe('ActsBundleManagerTest', function () { ...@@ -62,11 +63,9 @@ describe('ActsBundleManagerTest', function () {
var datainfo1 = await demo.getBundleInfo(NAME1, 1); var datainfo1 = await demo.getBundleInfo(NAME1, 1);
expect(datainfo1.name).assertEqual(NAME1); expect(datainfo1.name).assertEqual(NAME1);
installData.uninstall(NAME1, { installData.uninstall(NAME1, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
var datainfo2 = await demo.getBundleInfo(NAME1, 1); var datainfo2 = await demo.getBundleInfo(NAME1, 1);
expect(datainfo2.name).assertEqual(''); expect(datainfo2.name).assertEqual('');
...@@ -83,34 +82,28 @@ describe('ActsBundleManagerTest', function () { ...@@ -83,34 +82,28 @@ describe('ActsBundleManagerTest', function () {
it('uninstall_0200', 0, async function (done) { it('uninstall_0200', 0, async function (done) {
let installData = await demo.getBundleInstaller() let installData = await demo.getBundleInstaller()
installData.install([PATH + BMSJSTEST1, PATH + BMSJSTEST3], { installData.install([PATH + BMSJSTEST1, PATH + BMSJSTEST3], {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(ERR_CODE);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(STATUS_INSTALL_FAILURE_CONFLICT);
expect(data.statusMessage).assertEqual('SUCCESS'); expect(data.statusMessage).assertEqual('STATUS_INSTALL_FAILURE_CONFLICT');
var datainfo1 = await demo.getBundleInfo(NAME1, 1); var datainfo1 = await demo.getBundleInfo(NAME1, 1);
var datainfo2 = await demo.getBundleInfo(NAME2, 1); var datainfo2 = await demo.getBundleInfo(NAME2, 1);
expect(datainfo1.name).assertEqual(NAME1); expect(datainfo1.name).assertEqual('');
expect(datainfo2.name).assertEqual(NAME2); expect(datainfo2.name).assertEqual('');
installData.uninstall(NAME1, { installData.uninstall(NAME1, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async(err, data) => { }, async(err, data) => {
var datainfo3 = await demo.getBundleInfo(NAME1, 1); var datainfo3 = await demo.getBundleInfo(NAME1, 1);
expect(datainfo3.name).assertEqual(''); expect(datainfo3.name).assertEqual('');
installData.uninstall(NAME2, { installData.uninstall(NAME2, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async(err, data) => { }, async(err, data) => {
var datainfo4 = await demo.getBundleInfo(NAME2, 1); var datainfo4 = await demo.getBundleInfo(NAME2, 1);
expect(datainfo4.name).assertEqual(''); expect(datainfo4.name).assertEqual('');
...@@ -128,45 +121,37 @@ describe('ActsBundleManagerTest', function () { ...@@ -128,45 +121,37 @@ describe('ActsBundleManagerTest', function () {
it('uninstall_0300', 0, async function (done) { it('uninstall_0300', 0, async function (done) {
let installData = await demo.getBundleInstaller() let installData = await demo.getBundleInstaller()
installData.install([PATH + BMSJSTEST4, PATH + BMSJSTEST5, PATH + BMSJSTEST6], { installData.install([PATH + BMSJSTEST4, PATH + BMSJSTEST5, PATH + BMSJSTEST6], {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(ERR_CODE);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(STATUS_INSTALL_FAILURE_INVALID);
expect(data.statusMessage).assertEqual('SUCCESS'); expect(data.statusMessage).assertEqual('STATUS_INSTALL_FAILURE_INVALID');
var datainfo1 = await demo.getBundleInfo(NAME3, 1); var datainfo1 = await demo.getBundleInfo(NAME3, 1);
expect(datainfo1.name).assertEqual(NAME3); expect(datainfo1.name).assertEqual('');
var datainfo2 = await demo.getBundleInfo(NAME4, 1); var datainfo2 = await demo.getBundleInfo(NAME4, 1);
expect(datainfo2.name).assertEqual(NAME4); expect(datainfo2.name).assertEqual('');
var datainfo3 = await demo.getBundleInfo(NAME5, 1); var datainfo3 = await demo.getBundleInfo(NAME5, 1);
expect(datainfo3.name).assertEqual(NAME5); expect(datainfo3.name).assertEqual('');
installData.uninstall(NAME3, { installData.uninstall(NAME3, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async(err, data) => { }, async(err, data) => {
var datainfo4 = await demo.getBundleInfo(NAME3, 1); var datainfo4 = await demo.getBundleInfo(NAME3, 1);
expect(datainfo4.name).assertEqual(''); expect(datainfo4.name).assertEqual('');
installData.uninstall(NAME4, { installData.uninstall(NAME4, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async(err, data) => { }, async(err, data) => {
var datainfo5 = await demo.getBundleInfo(NAME4, 1); var datainfo5 = await demo.getBundleInfo(NAME4, 1);
expect(datainfo5.name).assertEqual(''); expect(datainfo5.name).assertEqual('');
installData.uninstall(NAME5, { installData.uninstall(NAME5, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async(err, data) => { }, async(err, data) => {
var datainfo6 = await demo.getBundleInfo(NAME5, 1); var datainfo6 = await demo.getBundleInfo(NAME5, 1);
expect(datainfo6.name).assertEqual(''); expect(datainfo6.name).assertEqual('');
...@@ -185,11 +170,9 @@ describe('ActsBundleManagerTest', function () { ...@@ -185,11 +170,9 @@ describe('ActsBundleManagerTest', function () {
it('uninstall_0400', 0, async function (done) { it('uninstall_0400', 0, async function (done) {
demo.getBundleInstaller().then((data) => { demo.getBundleInstaller().then((data) => {
data.uninstall(ERROR, { data.uninstall(ERROR, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, OnReceiveinstallEvent); }, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err, data) { function OnReceiveinstallEvent(err, data) {
...@@ -208,11 +191,9 @@ describe('ActsBundleManagerTest', function () { ...@@ -208,11 +191,9 @@ describe('ActsBundleManagerTest', function () {
it('uninstall_0500', 0, async function (done) { it('uninstall_0500', 0, async function (done) {
demo.getBundleInstaller().then((data) => { demo.getBundleInstaller().then((data) => {
data.uninstall('', { data.uninstall('', {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, OnReceiveinstallEvent); }, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err, data) { function OnReceiveinstallEvent(err, data) {
...@@ -232,11 +213,9 @@ describe('ActsBundleManagerTest', function () { ...@@ -232,11 +213,9 @@ describe('ActsBundleManagerTest', function () {
it('uninstall_0600', 0, async function (done) { it('uninstall_0600', 0, async function (done) {
demo.getBundleInstaller().then((data) => { demo.getBundleInstaller().then((data) => {
data.uninstall(LAUNCHER, { data.uninstall(LAUNCHER, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, OnReceiveinstallEvent); }, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err, data) { function OnReceiveinstallEvent(err, data) {
...@@ -256,11 +235,9 @@ describe('ActsBundleManagerTest', function () { ...@@ -256,11 +235,9 @@ describe('ActsBundleManagerTest', function () {
it('uninstall_0700', 0, async function (done) { it('uninstall_0700', 0, async function (done) {
let result = await demo.getBundleInstaller(); let result = await demo.getBundleInstaller();
result.install([PATH + BMSJSTEST1], { result.install([PATH + BMSJSTEST1], {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: true
isKeepData: true
}
}, OnReceiveinstallEvent); }, OnReceiveinstallEvent);
async function OnReceiveinstallEvent(err, data) { async function OnReceiveinstallEvent(err, data) {
expect(typeof data).assertEqual(OBJECT); expect(typeof data).assertEqual(OBJECT);
...@@ -268,11 +245,9 @@ describe('ActsBundleManagerTest', function () { ...@@ -268,11 +245,9 @@ describe('ActsBundleManagerTest', function () {
var datainfo1 = await demo.getBundleInfo(NAME1, 1); var datainfo1 = await demo.getBundleInfo(NAME1, 1);
expect(datainfo1.name).assertEqual(NAME1); expect(datainfo1.name).assertEqual(NAME1);
result.uninstall(NAME1, { result.uninstall(NAME1, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async(err, data) => { }, async(err, data) => {
var datainfo2 = await demo.getBundleInfo(NAME1, 1); var datainfo2 = await demo.getBundleInfo(NAME1, 1);
expect(datainfo2.name).assertEqual(''); expect(datainfo2.name).assertEqual('');
...@@ -306,11 +281,9 @@ describe('ActsBundleManagerTest', function () { ...@@ -306,11 +281,9 @@ describe('ActsBundleManagerTest', function () {
} }
let installData = await demo.getBundleInstaller(); let installData = await demo.getBundleInstaller();
installData.install([PATH + BMSJSTEST8], { installData.install([PATH + BMSJSTEST8], {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
id = setTimeout(timeout, START_ABILITY_TIMEOUT); id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug('=======start ability========') console.debug('=======start ability========')
...@@ -340,11 +313,9 @@ describe('ActsBundleManagerTest', function () { ...@@ -340,11 +313,9 @@ describe('ActsBundleManagerTest', function () {
let uid = bundleInfo.uid; let uid = bundleInfo.uid;
expect(processMap1.has(uid)).assertTrue(); expect(processMap1.has(uid)).assertTrue();
installData.uninstall(THIRD1, { installData.uninstall(THIRD1, {
param: { userId: 0,
userId: 0, installFlag: 1,
installFlag: 1, isKeepData: false
isKeepData: false
}
}, async(err, data) => { }, async(err, data) => {
let processInfos2 = await abilityManager.getActiveProcessInfos(); let processInfos2 = await abilityManager.getActiveProcessInfos();
for (var i = 0, len = processInfos2.length; i < len; i++) { for (var i = 0, len = processInfos2.length; i < len; i++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册