提交 155448c7 编写于 作者: R r00559040

xts update

Signed-off-by: Nr00559040 <ry.renyi@huawei.com>
上级 65f7cc95
...@@ -1892,4 +1892,49 @@ it('FWK_ZipFile_5100', 0, async function (done) { ...@@ -1892,4 +1892,49 @@ it('FWK_ZipFile_5100', 0, async function (done) {
console.log("==================FWK_ZipFile_5100 end=================="); console.log("==================FWK_ZipFile_5100 end==================");
}) })
/*
* @tc.number: FWK_ZipFile_5200
* @tc.name: zipFile
* @tc.desc: strategy.COMPRESS_STRATEGY_FIXED
*/
it('FWK_ZipFile_5200', 0, async function (done) {
console.log("==================FWK_ZipFile_5200 start==================");
var src = "/data/test/ceshi.txt";
var zipDest = "/data/testA/ceshi.zip";
var unzipDir = "/data/testA/";
var unzipDest = "/data/testA/ceshi.txt";
try{
var options = {};
options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FIXED,
await zlib.zipFile(src, zipDest, options,
(err, data) => {
var zipStat = fileio.statSync(zipDest);
var isFile = zipStat.isFile();
expect(isFile).assertTrue();
var srcSize = fileio.statSync(src).size;
var destSize = zipStat.size;
expect(srcSize>destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
zlib.unzipFile(zipDest, unzipDir, options,
(err, data) => {
var unzipStat = fileio.statSync(unzipDest);
var isFile = unzipStat.isFile();
expect(isFile).assertTrue();
var destSize = unzipStat.size;
var originSize = fileio.statSync(src).size;
var result = (originSize == destSize);
expect(result).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done();
})
});
} catch(err) {
console.error('FWK_ZipFile_5200 err:' + err);
done();
}
console.log("==================FWK_ZipFile_5200 end==================");
})
}) })
...@@ -1786,7 +1786,7 @@ describe('ActsBmsFormsInfoTest', function () { ...@@ -1786,7 +1786,7 @@ describe('ActsBmsFormsInfoTest', function () {
expect(typeof dataInfo.description).assertEqual('string'); expect(typeof dataInfo.description).assertEqual('string');
expect(typeof dataInfo.descriptionId).assertEqual('number'); expect(typeof dataInfo.descriptionId).assertEqual('number');
expect(typeof dataInfo.type).assertEqual('number'); expect(typeof dataInfo.type).assertEqual('number');
expect(typeof dataInfo.colorMode).assertEqual('number'); expect(dataInfo.colorMode).assertEqual(bundle.ColorMode.LIGHT_MODE);
expect(typeof dataInfo.defaultFlag).assertEqual('boolean'); expect(typeof dataInfo.defaultFlag).assertEqual('boolean');
expect(typeof dataInfo.jsComponentName).assertEqual('string'); expect(typeof dataInfo.jsComponentName).assertEqual('string');
expect(typeof dataInfo.formVisibleNotify).assertEqual('boolean'); expect(typeof dataInfo.formVisibleNotify).assertEqual('boolean');
......
...@@ -39,7 +39,8 @@ describe('ActsBmsQueryAbilityByWant', function () { ...@@ -39,7 +39,8 @@ describe('ActsBmsQueryAbilityByWant', function () {
action: ['action.system.home'], action: ['action.system.home'],
entities: ['entity.system.home'], entities: ['entity.system.home'],
bundleName: BUNDLE_NAME1 bundleName: BUNDLE_NAME1
}, 132, 0, (err, data) => { }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION|bundle.BundleFlag.GET_ABILITY_INFO_SYSTEMAPP_ONLY,
0, (err, data) => {
if (err) { if (err) {
console.log('bms_queryAbilityByWant_0100 test query system app err is ' + err) console.log('bms_queryAbilityByWant_0100 test query system app err is ' + err)
expect(err).assertEqual(1); expect(err).assertEqual(1);
...@@ -51,6 +52,9 @@ describe('ActsBmsQueryAbilityByWant', function () { ...@@ -51,6 +52,9 @@ describe('ActsBmsQueryAbilityByWant', function () {
isKeepData: false isKeepData: false
} }
, (err, data) => { , (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
done(); done();
}); });
} }
...@@ -78,8 +82,9 @@ describe('ActsBmsQueryAbilityByWant', function () { ...@@ -78,8 +82,9 @@ describe('ActsBmsQueryAbilityByWant', function () {
{ {
action: ['action.system.home'], action: ['action.system.home'],
entities: ['entity.system.home'] entities: ['entity.system.home']
} },
, 132, 0).then(data => { bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION|bundle.BundleFlag.GET_ABILITY_INFO_SYSTEMAPP_ONLY,
0).then(data => {
for(let i = 0; i < data.length; ++i) { for(let i = 0; i < data.length; ++i) {
var jsondata = JSON.stringify(data[i]); var jsondata = JSON.stringify(data[i]);
console.log('bms_queryAbilityByWant_0200 test query system app ' + jsondata) console.log('bms_queryAbilityByWant_0200 test query system app ' + jsondata)
...@@ -89,6 +94,8 @@ describe('ActsBmsQueryAbilityByWant', function () { ...@@ -89,6 +94,8 @@ describe('ActsBmsQueryAbilityByWant', function () {
} }
).catch(err => { ).catch(err => {
console.log('bms_queryAbilityByWant_0200 test query system app err is ' + err) console.log('bms_queryAbilityByWant_0200 test query system app err is ' + err)
expect(err).assertFail()
done();
}) })
}) })
......
...@@ -84,7 +84,8 @@ describe('ActsBundleManagerTest', function () { ...@@ -84,7 +84,8 @@ describe('ActsBundleManagerTest', function () {
getInfo(); getInfo();
}); });
async function getInfo() { async function getInfo() {
var datainfo = await demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES) var datainfo = await demo.getBundleInfo(NAME1,
demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES|demo.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION)
expect(datainfo.name).assertEqual(NAME1) expect(datainfo.name).assertEqual(NAME1)
expect(datainfo.vendor).assertEqual("example") expect(datainfo.vendor).assertEqual("example")
expect(datainfo.versionCode).assertEqual(VERSIONCODE1) expect(datainfo.versionCode).assertEqual(VERSIONCODE1)
...@@ -100,8 +101,11 @@ describe('ActsBundleManagerTest', function () { ...@@ -100,8 +101,11 @@ describe('ActsBundleManagerTest', function () {
expect(datainfo.appInfo.systemApp).assertEqual(true) expect(datainfo.appInfo.systemApp).assertEqual(true)
expect(datainfo.appInfo.supportedModes).assertEqual(0) expect(datainfo.appInfo.supportedModes).assertEqual(0)
expect(datainfo.updateTime).assertLarger(0) expect(datainfo.updateTime).assertLarger(0)
expect(datainfo.reqPermissions.length).assertEqual(0) expect(datainfo.reqPermissions[0]).assertEqual("com.permission.PERMISSION_A")
expect(datainfo.reqPermissionDetails.length).assertEqual(0) expect(datainfo.reqPermissionDetails[0].name).assertEqual("com.permission.PERMISSION_A")
expect(datainfo.reqPermissionDetails[0].reason).assertEqual("Need PERMISSION_A")
expect(datainfo.reqPermissionDetails[0].usedScene.abilities[0]).assertEqual(NAME1 + ".MainAbility")
expect(datainfo.reqPermissionDetails[0].usedScene.when).assertEqual("always")
expect(datainfo.compatibleVersion).assertEqual(5) expect(datainfo.compatibleVersion).assertEqual(5)
expect(datainfo.targetVersion).assertEqual(5) expect(datainfo.targetVersion).assertEqual(5)
expect(datainfo.isCompressNativeLibs).assertEqual(false) expect(datainfo.isCompressNativeLibs).assertEqual(false)
...@@ -455,7 +459,9 @@ describe('ActsBundleManagerTest', function () { ...@@ -455,7 +459,9 @@ describe('ActsBundleManagerTest', function () {
getInfo(); getInfo();
}); });
async function getInfo() { async function getInfo() {
await demo.getApplicationInfo(NAME1, demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, 0).then(datainfo => { await demo.getApplicationInfo(NAME1,
demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION|demo.BundleFlag.GET_APPLICATION_INFO_WITH_METADATA,
0).then(datainfo => {
expect(typeof datainfo).assertEqual(OBJECT) expect(typeof datainfo).assertEqual(OBJECT)
console.info("getApplicationInfo success:" + JSON.stringify(datainfo)) console.info("getApplicationInfo success:" + JSON.stringify(datainfo))
expect(datainfo.moduleSourceDirs.length).assertLarger(0) expect(datainfo.moduleSourceDirs.length).assertLarger(0)
...@@ -472,6 +478,9 @@ describe('ActsBundleManagerTest', function () { ...@@ -472,6 +478,9 @@ describe('ActsBundleManagerTest', function () {
expect(datainfo.process).assertEqual("") expect(datainfo.process).assertEqual("")
expect(datainfo.enabled).assertEqual(true) expect(datainfo.enabled).assertEqual(true)
expect(datainfo.flags).assertEqual(0) expect(datainfo.flags).assertEqual(0)
expect(datainfo.metaData.entry[0].name).assertEqual("metaDataName")
expect(datainfo.metaData.entry[0].value).assertEqual("metaDataValue")
expect(datainfo.metaData.entry[0].extra).assertEqual("$string:app_name")
expect(datainfo.moduleSourceDirs.length).assertLarger(0) expect(datainfo.moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleInfos; j++) { for (var j = 0; j < datainfo.moduleInfos; j++) {
expect(datainfo.moduleInfos[j].moduleName).assertEqual("entry") expect(datainfo.moduleInfos[j].moduleName).assertEqual("entry")
...@@ -2142,6 +2151,7 @@ describe('ActsBundleManagerTest', function () { ...@@ -2142,6 +2151,7 @@ describe('ActsBundleManagerTest', function () {
expect(datainfo.moduleName).assertEqual("entry") expect(datainfo.moduleName).assertEqual("entry")
expect(datainfo.bundleName).assertEqual(NAME1) expect(datainfo.bundleName).assertEqual(NAME1)
expect(datainfo.type).assertEqual(1) expect(datainfo.type).assertEqual(1)
expect(datainfo.subType).assertEqual(demo.AbilitySubType.UNSPECIFIED)
expect(datainfo.orientation).assertEqual(0) expect(datainfo.orientation).assertEqual(0)
expect(datainfo.launchMode).assertEqual(demo.LaunchMode.STANDARD) expect(datainfo.launchMode).assertEqual(demo.LaunchMode.STANDARD)
expect(datainfo.permissions[0]).assertEqual("com.permission.BMS_PERMISSION_CAMERA") expect(datainfo.permissions[0]).assertEqual("com.permission.BMS_PERMISSION_CAMERA")
...@@ -2245,60 +2255,92 @@ describe('ActsBundleManagerTest', function () { ...@@ -2245,60 +2255,92 @@ describe('ActsBundleManagerTest', function () {
*/ */
it('queryAbilityByWant_0300', 0, async function (done) { it('queryAbilityByWant_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], {
userId: 0, userId: 0,
installFlag: 0, installFlag: 0,
isKeepData: false isKeepData: false
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(-1); expect(data.status).assertEqual(0);
expect(data.status).assertEqual(3); installData.install([PATH + BMSJSTEST5], {
expect(data.statusMessage).assertEqual('STATUS_INSTALL_FAILURE_INVALID'); userId: 0,
getInfo(); installFlag: 0,
isKeepData: false
}, async (err, data) => {
expect(data.status).assertEqual(0);
installData.install([PATH + BMSJSTEST6], {
userId: 0,
installFlag: 0,
isKeepData: false
}, async (err, data) => {
expect(data.status).assertEqual(0);
getInfo();
});
});
}); });
async function getInfo() { async function getInfo() {
demo.queryAbilityByWant( demo.queryAbilityByWant(
{ {
"bundleName": "com.example.myapplication4", entities: ['entity.system.home','entitiesentities']
"abilityName": "com.example.myapplication.MainAbility",
}, 4, 0).then(data => { }, 4, 0).then(data => {
let queryResultCount = 0;
for (let i = 0, len = data.length; i < len; i++) { for (let i = 0, len = data.length; i < len; i++) {
var datainfo = data[i]; var datainfo = data[i];
expect(datainfo.name).assertEqual("com.example.myapplication.MainAbility") if (datainfo.bundleName == NAME3){
expect(datainfo.label).assertEqual("$string:app_name") expect(datainfo.name).assertEqual("com.example.myapplication.MainAbility")
expect(datainfo.description).assertEqual("$string:mainability_description") expect(datainfo.label).assertEqual("$string:app_name")
expect(datainfo.icon).assertEqual("$media:icon") expect(datainfo.description).assertEqual("$string:mainability_description")
expect(datainfo.moduleName).assertEqual("entry") expect(datainfo.icon).assertEqual("$media:icon")
expect(datainfo.bundleName).assertEqual(NAME3) expect(datainfo.moduleName).assertEqual("entry")
expect(datainfo.applicationInfo.name).assertEqual(NAME3) expect(datainfo.bundleName).assertEqual(NAME3)
expect(datainfo.applicationInfo.description).assertEqual("$string:mainability_description") expect(datainfo.applicationInfo.name).assertEqual(NAME3)
expect(datainfo.applicationInfo.descriptionId >= 0).assertTrue() expect(datainfo.applicationInfo.description).assertEqual("$string:mainability_description")
expect(datainfo.applicationInfo.icon).assertEqual("$media:icon") expect(datainfo.applicationInfo.descriptionId >= 0).assertTrue()
expect(datainfo.applicationInfo.iconId >= 0).assertTrue() expect(datainfo.applicationInfo.icon).assertEqual("$media:icon")
expect(datainfo.applicationInfo.label).assertEqual("$string:app_name") expect(datainfo.applicationInfo.iconId >= 0).assertTrue()
expect(datainfo.applicationInfo.labelId >= 0).assertTrue() expect(datainfo.applicationInfo.label).assertEqual("$string:app_name")
expect(datainfo.applicationInfo.systemApp).assertEqual(true) expect(datainfo.applicationInfo.labelId >= 0).assertTrue()
expect(datainfo.applicationInfo.supportedModes).assertEqual(0) expect(datainfo.applicationInfo.systemApp).assertEqual(true)
expect(datainfo.applicationInfo.enabled).assertEqual(true) expect(datainfo.applicationInfo.supportedModes).assertEqual(0)
for (var j = 0; j < datainfo.applicationInfo.moduleInfos; j++) { expect(datainfo.orientation).assertEqual(2)
expect(datainfo.applicationInfo.moduleInfos[j].moduleName).assertEqual("entry") expect(datainfo.applicationInfo.enabled).assertEqual(true)
for (var j = 0; j < datainfo.applicationInfo.moduleInfos; j++) {
expect(datainfo.applicationInfo.moduleInfos[j].moduleName).assertEqual("entry")
}
queryResultCount++
}
if (datainfo.bundleName == NAME4){
expect(datainfo.name).assertEqual("com.example.myapplication.MainAbility")
expect(datainfo.bundleName).assertEqual(NAME4)
expect(datainfo.orientation).assertEqual(3)
queryResultCount++
}
if (datainfo.bundleName == NAME5){
expect(datainfo.name).assertEqual("com.example.myapplication.MainAbility")
expect(datainfo.bundleName).assertEqual(NAME5)
expect(datainfo.orientation).assertEqual(0)
queryResultCount++
} }
} }
expect(queryResultCount).assertEqual(3)
}) })
installData.uninstall(NAME3, { installData.uninstall(NAME3, {
userId: 0, userId: 0,
installFlag: 0, installFlag: 0,
isKeepData: false isKeepData: false
}, (err, data) => { }, (err, data) => {
expect(data.status).assertEqual(0);
installData.uninstall(NAME4, { installData.uninstall(NAME4, {
userId: 0, userId: 0,
installFlag: 0, installFlag: 0,
isKeepData: false isKeepData: false
}, (err, data) => { }, (err, data) => {
expect(data.status).assertEqual(0);
installData.uninstall(NAME5, { installData.uninstall(NAME5, {
userId: 0, userId: 0,
installFlag: 0, installFlag: 0,
isKeepData: false isKeepData: false
}, (err, data) => { }, (err, data) => {
expect(data.status).assertEqual(0);
done(); done();
}); });
}); });
......
...@@ -77,7 +77,31 @@ ...@@ -77,7 +77,31 @@
"name": "com.permission.BMS_PERMISSION_CAMERA", "name": "com.permission.BMS_PERMISSION_CAMERA",
"description": "BMS_PERMISSION_CAMERA permission in detail", "description": "BMS_PERMISSION_CAMERA permission in detail",
"label": "BMS_PERMISSION_CAMERA permission" "label": "BMS_PERMISSION_CAMERA permission"
},
{
"name": "com.permission.PERMISSION_A",
"grantMode": "system_grant",
"availableScope": ["signature"]
}
],
"reqPermissions": [
{
"name": "com.permission.PERMISSION_A",
"reason": "Need PERMISSION_A",
"usedScene": {
"ability": [
"com.example.myapplication1.MainAbility"
],
"when": "always"
}
} }
] ],
"metaData":{
"customizeData":[{
"name":"metaDataName",
"value":"metaDataValue",
"extra":"$string:app_name"
}]
}
} }
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册