提交 f43ae5aa 编写于 作者: R r00559040

xts update

Signed-off-by: Nr00559040 <ry.renyi@huawei.com>
上级 f58c1597
......@@ -32,6 +32,7 @@ const BUNDLE_NAME4 = 'com.example.third4';
const BUNDLE_NAME5 = 'com.example.third5';
const BUNDLE_NAME6 = 'com.example.third6';
const SYSTEM_NAME = 'com.example.system2';
const NUM_ONE = 1;
const NUM_TWO = 2;
const NUM_THREE = 3;
const NUM_FOUR = 4;
......@@ -58,40 +59,35 @@ describe('ActsBmsGetBackGroundModes', function () {
var bundlePath = [BUNDLE_PATH5]
var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({
want: {
bundleName: BUNDLE_NAME5,
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: BUNDLE_NAME5,
abilityName: 'com.example.third5.MainAbilityA',
},
}
}, 0, 0)
expect(dataInfos.length).assertEqual(NUM_FOUR);
if (dataInfos.length == NUM_FOUR) {
expect(dataInfos[NUM_TWO].name).assertEqual("com.example.third5.MainAbilityA");
expect(dataInfos[NUM_TWO].backgroundModes).assertEqual(dataTransfer + audioPlayback + audioRecording +
}, bundle.BundleFlag.GET_BUNDLE_DEFAULT, 0)
let queryResult = 0
for (let infoCount = 0; infoCount < dataInfos.length; infoCount++){
if(dataInfos[infoCount].name == "com.example.third5.MainAbilityA"){
expect(dataInfos[infoCount].backgroundModes).assertEqual(dataTransfer + audioPlayback + audioRecording +
location + bluetoothInteraction + multiDeviceConnection + wifiInteraction + voip + taskKeeping);
expect(dataInfos[NUM_THREE].name).assertEqual("com.example.third5.MainAbilityB");
expect(dataInfos[NUM_THREE].backgroundModes).assertEqual(dataTransfer + voip);
queryResult++
}
if(dataInfos[infoCount].name == "com.example.third5.MainAbilityB"){
expect(dataInfos[infoCount].backgroundModes).assertEqual(dataTransfer + voip);
queryResult++
}
}
expect(queryResult).assertEqual(NUM_TWO);
installer.uninstall(BUNDLE_NAME5, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
......@@ -112,26 +108,19 @@ describe('ActsBmsGetBackGroundModes', function () {
var bundlePath = [BUNDLE_PATH6]
var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: BUNDLE_NAME6,
abilityName: '',
},
}
}, 0, 0)
action: 'action.system.home',
entities: ['entity.system.home']
}, bundle.BundleFlag.GET_BUNDLE_DEFAULT, 0)
expect(dataInfos.length).assertEqual(NUM_NINE);
for (let i = 0, len = dataInfos.length; i < len; i++) {
expect(dataInfos[i].backgroundModes).assertEqual(1 << i);
......@@ -139,11 +128,9 @@ describe('ActsBmsGetBackGroundModes', function () {
console.info("==========dataInfos[1].name=========" + dataInfos[i].name);
}
installer.uninstall(BUNDLE_NAME6, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
......@@ -163,38 +150,27 @@ describe('ActsBmsGetBackGroundModes', function () {
var bundlePath = [BUNDLE_PATH2]
var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: BUNDLE_NAME2,
abilityName: 'com.example.third2.MainAbilityA',
},
}
}, 0, 0)
expect(dataInfos.length).assertEqual(NUM_TWO);
if (dataInfos.length == NUM_TWO) {
expect(dataInfos[1].name).assertEqual("com.example.third2.MainAbilityA")
expect(dataInfos[1].backgroundModes).assertEqual(audioPlayback + audioRecording + location
action: 'action.system.home',
entities: ['entity.system.home']
}, bundle.BundleFlag.GET_BUNDLE_DEFAULT, 0)
expect(dataInfos.length).assertEqual(NUM_ONE);
expect(dataInfos[0].name).assertEqual("com.example.third2.MainAbilityA")
expect(dataInfos[0].backgroundModes).assertEqual(audioPlayback + audioRecording + location
+ bluetoothInteraction + multiDeviceConnection + wifiInteraction + voip + taskKeeping)
}
installer.uninstall(BUNDLE_NAME2, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
......@@ -214,37 +190,28 @@ describe('ActsBmsGetBackGroundModes', function () {
var bundlePath1 = [BUNDLE_PATH4]
var installer = await bundle.getBundleInstaller();
installer.install(bundlePath1, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: BUNDLE_NAME4,
abilityName: 'com.example.third4.MainAbility',
},
}
}, 0, 0)
expect(dataInfos.length).assertEqual(1);
action: 'action.system.home',
entities: ['entity.system.home']
}, bundle.BundleFlag.GET_BUNDLE_DEFAULT, 0)
expect(dataInfos.length).assertEqual(NUM_ONE);
if (dataInfos.length == 1) {
expect(dataInfos[0].name).assertEqual("com.example.third4.MainAbility")
expect(dataInfos[0].backgroundModes).assertEqual(0)
}
installer.uninstall(BUNDLE_NAME4, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
......@@ -264,39 +231,28 @@ describe('ActsBmsGetBackGroundModes', function () {
var bundlePath = [BUNDLE_PATH1, BUNDLE_PATH3];
var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: BUNDLE_NAME1,
abilityName: 'com.example.third1.MainAbilityA',
},
}
}, 0, 0)
expect(dataInfos.length).assertEqual(NUM_FOUR);
if (dataInfos.length == NUM_FOUR) {
expect(dataInfos[1].name).assertEqual("com.example.third1.MainAbilityA")
expect(dataInfos[1].backgroundModes).assertEqual(dataTransfer + audioPlayback + audioRecording +
action: 'action.system.home',
entities: ['entity.system.home']
}, bundle.BundleFlag.GET_BUNDLE_DEFAULT, 0)
expect(dataInfos.length).assertEqual(NUM_ONE);
expect(dataInfos[0].name).assertEqual("com.example.third1.MainAbilityA")
expect(dataInfos[0].backgroundModes).assertEqual(dataTransfer + audioPlayback + audioRecording +
location + bluetoothInteraction + multiDeviceConnection + wifiInteraction + voip + taskKeeping)
}
console.info("========dataInfos[0].backgroundModes=======>" + dataInfos[0].backgroundModes)
installer.uninstall(BUNDLE_NAME1, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
......@@ -317,65 +273,45 @@ describe('ActsBmsGetBackGroundModes', function () {
var bundlePath2 = [BUNDLE_PATHUPDATE]
var installer = await bundle.getBundleInstaller();
installer.install(bundlePath1, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: BUNDLE_NAME1,
abilityName: 'com.example.third1.MainAbilityA',
},
}
}, 0, 0)
expect(dataInfos.length).assertEqual(NUM_TWO);
if (dataInfos.length == NUM_TWO) {
expect(dataInfos[1].name).assertEqual("com.example.third1.MainAbilityA")
expect(dataInfos[1].backgroundModes).assertEqual(dataTransfer + audioPlayback + audioRecording +
action: 'action.system.home',
entities: ['entity.system.home']
}, bundle.BundleFlag.GET_BUNDLE_DEFAULT, 0)
expect(dataInfos.length).assertEqual(NUM_ONE);
expect(dataInfos[0].name).assertEqual("com.example.third1.MainAbilityA")
expect(dataInfos[0].backgroundModes).assertEqual(dataTransfer + audioPlayback + audioRecording +
location + bluetoothInteraction + multiDeviceConnection + wifiInteraction + voip + taskKeeping)
}
installer.install(bundlePath2, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: BUNDLE_NAME1,
abilityName: 'com.example.third1.MainAbility',
},
}
}, 0, 0)
expect(dataInfos.length).assertEqual(NUM_TWO);
if (dataInfos.length == NUM_TWO) {
expect(dataInfos[1].name).assertEqual("com.example.third1.AMainAbilityA");
expect(dataInfos[1].backgroundModes).assertEqual(audioRecording + location + bluetoothInteraction +
abilityName: 'com.example.third1.AMainAbilityA',
action: 'action.system.home',
entities: ['entity.system.home']
}, bundle.BundleFlag.GET_BUNDLE_DEFAULT, 0)
expect(dataInfos.length).assertEqual(NUM_ONE);
expect(dataInfos[0].name).assertEqual("com.example.third1.AMainAbilityA");
expect(dataInfos[0].backgroundModes).assertEqual(audioRecording + location + bluetoothInteraction +
multiDeviceConnection + wifiInteraction + voip + taskKeeping);
}
installer.uninstall(BUNDLE_NAME1, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
......@@ -396,55 +332,43 @@ describe('ActsBmsGetBackGroundModes', function () {
var bundlePath = [BUNDLE_PATH1]
var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: BUNDLE_NAME1,
abilityName: 'com.example.third1.MainAbility'
}
}
}, 0, 0)
expect(dataInfos.length).assertEqual(NUM_TWO);
if (dataInfos.length == NUM_TWO) {
expect(dataInfos[1].name).assertEqual("com.example.third1.MainAbilityA")
expect(dataInfos[1].backgroundModes).assertEqual(dataTransfer + audioPlayback + audioRecording +
abilityName: 'com.example.third1.MainAbilityA',
action: 'action.system.home',
entities: ['entity.system.home']
}, bundle.BundleFlag.GET_BUNDLE_DEFAULT, 0)
expect(dataInfos.length).assertEqual(NUM_ONE);
expect(dataInfos[0].name).assertEqual("com.example.third1.MainAbilityA")
expect(dataInfos[0].backgroundModes).assertEqual(dataTransfer + audioPlayback + audioRecording +
location + bluetoothInteraction + multiDeviceConnection + wifiInteraction + voip + taskKeeping)
}
installer.uninstall(BUNDLE_NAME1, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({
want: {
await bundle.queryAbilityByWant({
bundleName: BUNDLE_NAME1,
abilityName: 'com.example.third1.MainAbility',
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: BUNDLE_NAME1,
abilityName: 'com.example.third1.MainAbility'
}
}
}, 0, 0)
expect(dataInfos.length).assertEqual(0);
}, bundle.BundleFlag.GET_BUNDLE_DEFAULT, 0).then(dataInfo => {
expect(dataInfo).assertFail();
done();
}).catch(error => {
expect(error).assertEqual(1);
done();
})
});
})
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册