提交 f43ae5aa 编写于 作者: R r00559040

xts update

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