提交 e969a100 编写于 作者: O openharmony_ci 提交者: Gitee

!461 修改测试用例

Merge pull request !461 from chensi10/master
......@@ -10,13 +10,14 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/ohos_var.gni")
group("appexecfwk") {
group("bundle_standard") {
testonly = true
if (is_standard_system) {
} else {
deps = [
"bundlemanager:ActsBundleManagerTest",
]
}
}
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/config/ohos/rules.gni")
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("hjs_demo_test1") {
test_hap_name = "bmsJstest1.hap"
hap_source_path = "hap/bmsJstest1.hap"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"package": "ohos.acts.aafwk.ability",
"shell-timeout": "21600000"
},
"kits": [
{
"test-file-name": [
"AbilityDemo.hap",
"$module.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
import app from '@system.app'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import demo from '@ohos.bundle_mgr'
describe('appInfoTest', function () {
it('getApplicationInfos_0100', 0, async function (done) {
var datainfo = await demo.getApplicationInfos(8, 0);
checkgetApplicationInfos(datainfo)
done();
})
function checkgetApplicationInfos(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].bundleName.length).assertLarger(0)
expect(datainfo[i].supportedModes).assertEqual(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) {
expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo[i].moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleInfos.length; j++) {
expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].codePath.length).assertLarger(0)
expect(datainfo[i].dataDir.length).assertLarger(0)
expect(datainfo[i].dataBaseDir.length).assertLarger(0)
expect(datainfo[i].cacheDir.length).assertLarger(0)
}
}
it('getApplicationInfos_0600', 0, async function (done) {
await demo.getApplicationInfos(8, 0, OnReceiveEvent);
function OnReceiveEvent(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].bundleName.length).assertLarger(0)
expect(datainfo[i].supportedModes).assertEqual(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) {
expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo[i].moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleInfos.length; j++) {
expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].codePath.length).assertLarger(0)
expect(datainfo[i].dataDir.length).assertLarger(0)
expect(datainfo[i].dataBaseDir.length).assertLarger(0)
expect(datainfo[i].cacheDir.length).assertLarger(0)
}
}
done();
})
it('getApplicationInfo_0100', 0, async function (done) {
var datainfo = await demo.getApplicationInfo('com.example.napi_test_suite', 8, 1);
checkgetApplicationInfo(datainfo)
done();
})
function checkgetApplicationInfo(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.supportedModes).assertEqual(0)
expect(datainfo.moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) {
expect(datainfo.moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleInfos.length; j++) {
expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo.entryDir.length).assertLarger(0)
expect(datainfo.codePath.length).assertLarger(0)
expect(datainfo.dataDir.length).assertLarger(0)
expect(datainfo.dataBaseDir.length).assertLarger(0)
expect(datainfo.cacheDir.length).assertLarger(0)
}
it('getApplicationInfo_0600', 0, async function (done) {
await demo.getApplicationInfo('com.example.napi_test_suite', 8, 1, OnReceiveEvent);
function OnReceiveEvent(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.supportedModes).assertEqual(0)
expect(datainfo.moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) {
expect(datainfo.moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleInfos.length; j++) {
expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo.entryDir.length).assertLarger(0)
expect(datainfo.codePath.length).assertLarger(0)
expect(datainfo.dataDir.length).assertLarger(0)
expect(datainfo.dataBaseDir.length).assertLarger(0)
expect(datainfo.cacheDir.length).assertLarger(0)
}
done();
})
it('getBundleInfos_0100', 0, async function () {
var data = await demo.getBundleInfos(8)
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].applicationInfo.name.length).assertLarger(0)
expect(data[i].applicationInfo.bundleName.length).assertLarger(0)
expect(data[i].hapModuleNames.length).assertLarger(0)
for (var j = 0; j < data[i].hapModuleNames.length; j++) {
expect(data[i].hapModuleNames[j].length).assertLarger(0)
}
expect(data[i].moduleNames.length).assertLarger(0)
for (var j = 0; j < data[i].moduleNames.length; j++) {
expect(data[i].moduleNames[j].length).assertLarger(0)
}
expect(data[i].modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
expect(data[i].modulePublicDirs[j].length).assertLarger(0)
}
expect(data[i].moduleDirs.length).assertLarger(0)
for (var j = 0; j < data[i].moduleDirs.length; j++) {
expect(data[i].moduleDirs[j].length).assertLarger(0)
}
expect(data[i].moduleResPaths.length).assertLarger(0)
for (var j = 0; j < data[i].moduleResPaths.length; j++) {
expect(data[i].moduleResPaths[j].length).assertLarger(0)
}
expect(data[i].abilityInfos.length).assertLarger(0)
for (var j = 0; j < data[i].abilityInfos.length; j++) {
expect(data[i].abilityInfos[j].name.length).assertLarger(0)
expect(data[i].abilityInfos[j].package.length).assertLarger(0)
}
}
})
it('getBundleInfos_0600', 0, async function () {
await demo.getBundleInfos(8, OnReceiveEvent)
function OnReceiveEvent(data) {
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].applicationInfo.name.length).assertLarger(0)
expect(data[i].applicationInfo.bundleName.length).assertLarger(0)
expect(data[i].hapModuleNames.length).assertLarger(0)
for (var j = 0; j < data[i].hapModuleNames.length; j++) {
expect(data[i].hapModuleNames[j].length).assertLarger(0)
}
expect(data[i].moduleNames.length).assertLarger(0)
for (var j = 0; j < data[i].moduleNames.length; j++) {
expect(data[i].moduleNames[j].length).assertLarger(0)
}
expect(data[i].modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
expect(data[i].modulePublicDirs[j].length).assertLarger(0)
}
expect(data[i].moduleDirs.length).assertLarger(0)
for (var j = 0; j < data[i].moduleDirs.length; j++) {
expect(data[i].moduleDirs[j].length).assertLarger(0)
}
expect(data[i].moduleResPaths.length).assertLarger(0)
for (var j = 0; j < data[i].moduleResPaths.length; j++) {
expect(data[i].moduleResPaths[j].length).assertLarger(0)
}
expect(data[i].abilityInfos.length).assertLarger(0)
for (var j = 0; j < data[i].abilityInfos.length; j++) {
expect(data[i].abilityInfos[j].name.length).assertLarger(0)
expect(data[i].abilityInfos[j].package.length).assertLarger(0)
}
}
}
})
it('getApplicationInfo_0400', 0, async function (done) {
var datainfo = await demo.getApplicationInfo('com.example.napi_test_suitee', 8, 1);
checkgetApplicationInfoe(datainfo)
done();
})
function checkgetApplicationInfoe(datainfo) {
expect(datainfo.name.length).assertEqual(0)
expect(datainfo.bundleName.length).assertEqual(0)
}
it('getApplicationInfo_0500', 0, async function (done) {
await demo.getApplicationInfo('', 8, 1, OnReceiveEvent);
function OnReceiveEvent(datainfo) {
expect(datainfo.name.length).assertEqual(0)
expect(datainfo.bundleName.length).assertEqual(0)
}
done();
})
it('getApplicationInfo_0900', 0, async function (done) {
await demo.getApplicationInfo('com.example.napi_test_suitee', 8, 1, OnReceiveEvent);
function OnReceiveEvent(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.supportedModes).assertEqual(0)
expect(datainfo.moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) {
expect(datainfo.moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleInfos.length; j++) {
expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo.entryDir.length).assertLarger(0)
expect(datainfo.codePath.length).assertLarger(0)
expect(datainfo.dataDir.length).assertLarger(0)
expect(datainfo.dataBaseDir.length).assertLarger(0)
expect(datainfo.cacheDir.length).assertLarger(0)
}
done();
})
it('getApplicationInfo_1000', 0, async function (done) {
await demo.getApplicationInfo('', 8, 1, OnReceiveEvent);
function OnReceiveEvent(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.supportedModes).assertEqual(0)
expect(datainfo.moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) {
expect(datainfo.moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleInfos.length; j++) {
expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo.entryDir.length).assertLarger(0)
expect(datainfo.codePath.length).assertLarger(0)
expect(datainfo.dataDir.length).assertLarger(0)
expect(datainfo.dataBaseDir.length).assertLarger(0)
expect(datainfo.cacheDir.length).assertLarger(0)
}
done();
})
it('getBundleInfo_0100', 0, async function (done) {
var info = await demo.getBundleManager()
var datainfo = await info.getBundleInfo('com.example.napi_test_suite',1)
console.info('**************************getBundleInfo_01********************************')
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.minSdkVersion).assertEqual(0)
expect(datainfo.maxSdkVersion).assertEqual(0)
expect(datainfo.hapModuleNames.length).assertLarger(0)
for(var j = 0; j < datainfo.hapModuleNames.length; j++) {
expect(datainfo.hapModuleNames[j].length).assertLarger(0)
}
expect(datainfo.moduleNames.length).assertLarger(0)
for(var j = 0; j < datainfo.moduleNames.length; j++) {
expect(datainfo.moduleNames[j].length).assertLarger(0)
}
expect(datainfo.modulePublicDirs.length).assertLarger(0)
for(var j = 0; j < datainfo.modulePublicDirs.length; j++) {
expect(datainfo.modulePublicDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleDirs.length).assertLarger(0)
for(var j = 0; j < datainfo.moduleDirs.length; j++) {
expect(datainfo.moduleDirs[j].length).assertLarger(0)
}
done()
})
it('getBundleInfo_0400', 0, async function (done) {
var info = await demo.getBundleManager()
var datainfo = await info.getBundleInfo('com.example.myapplic',1);
expect(datainfo.installTime).assertEqual(0)
expect(datainfo.updateTime).assertEqual(0)
expect(datainfo.compatibleVersion).assertEqual(0)
expect(datainfo.targetVersion).assertEqual(0)
done();
})
it('getBundleInfo_0500', 0, async function (done) {
var info = await demo.getBundleManager()
var datainfo = await info.getBundleInfo();
expect(datainfo.installTime).assertEqual(0)
expect(datainfo.updateTime).assertEqual(0)
expect(datainfo.compatibleVersion).assertEqual(0)
expect(datainfo.targetVersion).assertEqual(0)
done();
})
it('getBundleInfo_0600', 0, async function (done) {
var info = await demo.getBundleManager()
await info.getBundleInfo('com.example.myapplicationInstall',1,OnReceiveEvent)
function OnReceiveEvent(datainfo) {
// console.info('**************************getBundleInfo_01********************************')
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.minSdkVersion).assertEqual(0)
expect(datainfo.maxSdkVersion).assertEqual(0)
expect(datainfo.hapModuleNames.length).assertLarger(0)
for(var j = 0; j < datainfo.hapModuleNames.length; j++) {
expect(datainfo.hapModuleNames[j].length).assertLarger(0)
}
expect(datainfo.moduleNames.length).assertLarger(0)
for(var j = 0; j < datainfo.moduleNames.length; j++) {
expect(datainfo.moduleNames[j].length).assertLarger(0)
}
expect(datainfo.modulePublicDirs.length).assertLarger(0)
for(var j = 0; j < datainfo.modulePublicDirs.length; j++) {
expect(datainfo.modulePublicDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleDirs.length).assertLarger(0)
for(var j = 0; j < datainfo.moduleDirs.length; j++) {
expect(datainfo.moduleDirs[j].length).assertLarger(0)
}
}
done()
})
it('getBundleInfo_0900', 0, async function (done) {
var info = await demo.getBundleManager()
await info.getBundleInfo('com.example.myapplical',1,OnReceiveEvent)
function OnReceiveEvent(datainfo) {
expect(datainfo.installTime).assertEqual(0)
expect(datainfo.updateTime).assertEqual(0)
expect(datainfo.compatibleVersion).assertEqual(0)
expect(datainfo.targetVersion).assertEqual(0)
}
done()
})
it('getBundleInfo_1000', 0, async function (done) {
var info = await demo.getBundleManager()
await info.getBundleInfo(OnReceiveEvent)
function OnReceiveEvent(datainfo) {
expect(datainfo.installTime).assertEqual(0)
expect(datainfo.updateTime).assertEqual(0)
expect(datainfo.compatibleVersion).assertEqual(0)
expect(datainfo.targetVersion).assertEqual(0)
}
done()
})
it('getBundleArchiveInfo_0100', 0, async function (done) {
var info = await demo.getBundleManager()
var datainfo = await info.getBundleArchiveInfo('/data/abc.hap',1)
expect(datainfo.entryModuleName.length).assertLarger(0)
expect(datainfo.compatibleVersion).assertEqual(5)
expect(datainfo.targetVersion).assertEqual(5)
expect(datainfo.isKeepAlive).assertEqual(false)
expect(datainfo.isNativeApp).assertEqual(false)
expect(datainfo.hapModuleNames.length).assertLarger(0)
// for(var j = 0; j < datainfo.hapModuleNames.length; j++) {
// expect(datainfo.hapModuleNames[j].length).assertLarger(0)
// }
// expect(datainfo.moduleNames.length).assertLarger(0)
// for(var j = 0; j < datainfo.moduleNames.length; j++) {
// expect(datainfo.moduleNames[j].length).assertLarger(0)
// }
// expect(datainfo.modulePublicDirs.length).assertLarger(0)
// for(var j = 0; j < datainfo.modulePublicDirs.length; j++) {
// expect(datainfo.modulePublicDirs[j].length).assertLarger(0)
// }
// expect(datainfo.moduleDirs.length).assertLarger(0)
// for(var j = 0; j < datainfo.moduleDirs.length; j++) {
// expect(datainfo.moduleDirs[j].length).assertLarger(0)
// }
done()
})
it('getBundleArchiveInfo_0400', 0, async function (done) {
var info = await demo.getBundleManager()
await info.getBundleArchiveInfo('/data/test.', 1,OnReceiveEvent)
function OnReceiveEvent(datainfo) {
expect(datainfo.installTime).assertEqual(0)
expect(datainfo.updateTime).assertEqual(0)
expect(datainfo.compatibleVersion).assertEqual(0)
expect(datainfo.targetVersion).assertEqual(0)
}
done()
})
it('getBundleArchiveInfo_0500', 0, async function (done) {
var info = await demo.getBundleManager()
await info.getBundleArchiveInfo(OnReceiveEvent)
function OnReceiveEvent(datainfo) {
expect(datainfo.installTime).assertEqual(0)
expect(datainfo.updateTime).assertEqual(0)
expect(datainfo.compatibleVersion).assertEqual(0)
expect(datainfo.targetVersion).assertEqual(0)
done()
}
})
it('queryAbilityByWant_0100', 0, async function (done) {
var info = await demo.getBundleManager()
var datainfo =
info.queryAbilityByWant({
want:{
action: "action.system.home",
entities:["entity.system.home"],
elementName: {
deviceId : "0",
bundleName : "com.example.myapplicationInstall",
abilityName : "com.example.myapplication.MainAbility",
},}},{
params:{
flags: 8 ,
userId:"0" ,
}
})
console.info('**************************queryAbilityByWant_01********************************')
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.iconPath.length).assertLarger(0)
expect(datainfo.visible.length).assertLarger(0)
expect(datainfo.kind.length).assertLarger(0)
expect(datainfo.package.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.moduleName.length).assertLarger(0)
expect(datainfo.applicationName.length).assertLarger(0)
expect(datainfo.resourcePath.length).assertLarger(0)
expect(datainfo.deviceTypes.length).assertLarger(0)
for(var j = 0; j < datainfo.deviceTypes.length; j++) {
expect(datainfo.deviceTypes[j].length).assertLarger(0)
}
expect(datainfo.deviceCapabilities.length).assertLarger(0)
for(var j = 0; j < datainfo.deviceCapabilities.length; j++) {
expect(datainfo.deviceCapabilities[j].length).assertLarger(0)
}
expect(datainfo.applicationInfo.name.length).assertLarger(0)
expect(datainfo.applicationInfo.bundleName.length).assertLarger(0)
done();
})
it('queryAbilityByWant_0400', 0, async function (done) {
var info = await demo.getBundleManager()
var datainfo =
info.queryAbilityByWant({
want:{
action: "action.system.home",
entities:["entity.system.home"],
elementName: {
deviceId : "0",
bundleName : "com.example.myapplicationInstall",
abilityName : "",
},}},{
params:{
flags: 8 ,
userId:"0" ,
}
})
console.info('**************************queryAbilityByWant_01********************************')
expect(datainfo.name.length).assertEqual(0)
expect(datainfo.label.length).assertEqual(0)
expect(datainfo.description.length).assertEqual(0)
expect(datainfo.iconPath.length).assertEqual(0)
expect(datainfo.visible.length).assertEqual(0)
expect(datainfo.kind.length).assertEqual(0)
expect(datainfo.package.length).assertEqual(0)
expect(datainfo.bundleName.length).assertEqual(0)
expect(datainfo.moduleName.length).assertEqual(0)
expect(datainfo.applicationName.length).assertEqual(0)
expect(datainfo.resourcePath.length).assertEqual(0)
expect(datainfo.deviceTypes.length).assertEqual(0)
for(var j = 0; j < datainfo.deviceTypes.length; j++) {
expect(datainfo.deviceTypes[j].length).assertEqual(0)
}
expect(datainfo.deviceCapabilities.length).assertEqual(0)
for(var j = 0; j < datainfo.deviceCapabilities.length; j++) {
expect(datainfo.deviceCapabilities[j].length).assertEqual(0)
}
expect(datainfo.applicationInfo.name.length).assertEqual(0)
expect(datainfo.applicationInfo.bundleName.length).assertEqual(0)
done();
})
it('queryAbilityByWant_0500', 0, async function (done) {
var info = await demo.getBundleManager()
var datainfo =
info.queryAbilityByWant({
want:{
action: "action.system.home",
entities:["entity.system.home"],
elementName: {
deviceId : "0",
bundleName : "",
abilityName : "",
},}},{
params:{
flags: 8 ,
userId:"0" ,
}
})
console.info('**************************queryAbilityByWant_01********************************')
expect(datainfo.name.length).assertEqual(0)
expect(datainfo.label.length).assertEqual(0)
expect(datainfo.description.length).assertEqual(0)
expect(datainfo.iconPath.length).assertEqual(0)
expect(datainfo.visible.length).assertEqual(0)
expect(datainfo.kind.length).assertEqual(0)
expect(datainfo.package.length).assertEqual(0)
expect(datainfo.bundleName.length).assertEqual(0)
expect(datainfo.moduleName.length).assertEqual(0)
expect(datainfo.applicationName.length).assertEqual(0)
expect(datainfo.resourcePath.length).assertEqual(0)
expect(datainfo.deviceTypes.length).assertEqual(0)
for(var j = 0; j < datainfo.deviceTypes.length; j++) {
expect(datainfo.deviceTypes[j].length).assertEqual(0)
}
expect(datainfo.deviceCapabilities.length).assertEqual(0)
for(var j = 0; j < datainfo.deviceCapabilities.length; j++) {
expect(datainfo.deviceCapabilities[j].length).assertEqual(0)
}
expect(datainfo.applicationInfo.name.length).assertEqual(0)
expect(datainfo.applicationInfo.bundleName.length).assertEqual(0)
done();
})
it('queryAbilityByWant_0600', 0, async function (done) {
var info = await demo.getBundleManager()
await info.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "com.example.myapplicationInstall",
abilityName: "com.example.myapplication.MainAbility",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
},OnReceiveEvent)
function OnReceiveEvent(datainfo) {
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.iconPath.length).assertLarger(0)
expect(datainfo.visible.length).assertLarger(0)
expect(datainfo.kind.length).assertLarger(0)
expect(datainfo.package.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.moduleName.length).assertLarger(0)
expect(datainfo.applicationName.length).assertLarger(0)
expect(datainfo.resourcePath.length).assertLarger(0)
expect(datainfo.deviceTypes.length).assertLarger(0)
for(var j = 0; j < datainfo.deviceTypes.length; j++) {
expect(datainfo.deviceTypes[j].length).assertLarger(0)
}
expect(datainfo.deviceCapabilities.length).assertLarger(0)
for(var j = 0; j < datainfo.deviceCapabilities.length; j++) {
expect(datainfo.deviceCapabilities[j].length).assertLarger(0)
}
expect(datainfo.applicationInfo.name.length).assertLarger(0)
expect(datainfo.applicationInfo.bundleName.length).assertLarger(0)
done()
}
})
it('queryAbilityByWant_0600', 0, async function (done) {
var info = await demo.getBundleManager()
await info.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "com.example.myapplicationInstall",
abilityName: "com.example.myapplication.MainAbility",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
},OnReceiveEvent)
function OnReceiveEvent(datainfo) {
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.iconPath.length).assertLarger(0)
expect(datainfo.visible.length).assertLarger(0)
expect(datainfo.kind.length).assertLarger(0)
expect(datainfo.package.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.moduleName.length).assertLarger(0)
expect(datainfo.applicationName.length).assertLarger(0)
expect(datainfo.resourcePath.length).assertLarger(0)
expect(datainfo.deviceTypes.length).assertLarger(0)
for(var j = 0; j < datainfo.deviceTypes.length; j++) {
expect(datainfo.deviceTypes[j].length).assertLarger(0)
}
expect(datainfo.deviceCapabilities.length).assertLarger(0)
for(var j = 0; j < datainfo.deviceCapabilities.length; j++) {
expect(datainfo.deviceCapabilities[j].length).assertLarger(0)
}
expect(datainfo.applicationInfo.name.length).assertLarger(0)
expect(datainfo.applicationInfo.bundleName.length).assertLarger(0)
done()
}
})
it('queryAbilityByWant_0900', 0, async function (done) {
var info = await demo.getBundleManager()
await info.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "com.example.myapplicationInstall",
abilityName: "",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
},OnReceiveEvent)
function OnReceiveEvent(datainfo) {
expect(datainfo.name.length).assertEqual(0)
expect(datainfo.label.length).assertEqual(0)
expect(datainfo.description.length).assertEqual(0)
expect(datainfo.iconPath.length).assertEqual(0)
expect(datainfo.visible.length).assertEqual(0)
expect(datainfo.kind.length).assertEqual(0)
expect(datainfo.package.length).assertEqual(0)
expect(datainfo.bundleName.length).assertEqual(0)
expect(datainfo.moduleName.length).assertEqual(0)
expect(datainfo.applicationName.length).assertEqual(0)
expect(datainfo.resourcePath.length).assertEqual(0)
expect(datainfo.deviceTypes.length).assertEqual(0)
for(var j = 0; j < datainfo.deviceTypes.length; j++) {
expect(datainfo.deviceTypes[j].length).assertEqual(0)
}
expect(datainfo.deviceCapabilities.length).assertEqual(0)
for(var j = 0; j < datainfo.deviceCapabilities.length; j++) {
expect(datainfo.deviceCapabilities[j].length).assertEqual(0)
}
expect(datainfo.applicationInfo.name.length).assertEqual(0)
expect(datainfo.applicationInfo.bundleName.length).assertEqual(0)
done();
}
})
it('queryAbilityByWant_0900', 0, async function (done) {
var info = await demo.getBundleManager()
await info.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "",
abilityName: "",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
},OnReceiveEvent)
function OnReceiveEvent(datainfo) {
expect(datainfo.name.length).assertEqual(0)
expect(datainfo.label.length).assertEqual(0)
expect(datainfo.description.length).assertEqual(0)
expect(datainfo.iconPath.length).assertEqual(0)
expect(datainfo.visible.length).assertEqual(0)
expect(datainfo.kind.length).assertEqual(0)
expect(datainfo.package.length).assertEqual(0)
expect(datainfo.bundleName.length).assertEqual(0)
expect(datainfo.moduleName.length).assertEqual(0)
expect(datainfo.applicationName.length).assertEqual(0)
expect(datainfo.resourcePath.length).assertEqual(0)
expect(datainfo.deviceTypes.length).assertEqual(0)
for(var j = 0; j < datainfo.deviceTypes.length; j++) {
expect(datainfo.deviceTypes[j].length).assertEqual(0)
}
expect(datainfo.deviceCapabilities.length).assertEqual(0)
for(var j = 0; j < datainfo.deviceCapabilities.length; j++) {
expect(datainfo.deviceCapabilities[j].length).assertEqual(0)
}
expect(datainfo.applicationInfo.name.length).assertEqual(0)
expect(datainfo.applicationInfo.bundleName.length).assertEqual(0)
done();
}
})
it('getPermissionDef_0100', 0, async function (done) {
demo.getPermissionDef('com.permission.CAMERA').then((infos) => {
expect(typeof infos).assertEqual("object");
expect(infos.name.length).assertLarger(0);
expect(infos.descriptionId.length).assertLarger(0);
expect(infos.grantMode.length).assertLarger(0);
expect(infos.availableScope.length).assertLarger(0);
});
done();
})
it('getPermissionDef_0400', 0, async function (done) {
demo.getPermissionDef('').then((infos) => {
expect(typeof infos).assertEqual("object");
expect(infos.name.length).assertLarger(0);
expect(infos.descriptionId.length).assertEqual(0);
expect(infos.grantMode.length).assertEqual(0);
expect(infos.availableScope.length).assertEqual(0);
});
done();
})
it('getPermissionDef_0500', 0, async function (done) {
demo.getPermissionDef('error').then((infos) => {
expect(typeof infos).assertEqual("object");
expect(infos.name.length).assertLarger(0);
expect(infos.descriptionId.length).assertEqual(0);
expect(infos.grantMode.length).assertEqual(0);
expect(infos.availableScope.length).assertEqual(0);
});
done();
})
it('getPermissionDef_0600', 0, async function (done) {
demo.getPermissionDef('com.permission.CAMERA', OnReceiveEvent);
function OnReceiveEvent(data) {
expect(typeof infos).assertEqual("object");
expect(data.name.length).assertLarger(0);
expect(data.descriptionId.length).assertEqual(0);
expect(data.grantMode.length).assertLarger(0);
expect(data.availableScope.length).assertLarger(0);
}
done();
})
it('getPermissionDef_0900', 0, async function (done) {
demo.getPermissionDef('', OnReceiveEvent);
function OnReceiveEvent(data) {
expect(typeof data).assertEqual("object");
expect(data.name.length).assertEqual(0);
expect(data.bundleName.length).assertEqual(0);
expect(data.descriptionId.length).assertEqual(0);
expect(data.grantMode.length).assertEqual(0);
expect(data.availableScope.length).assertEqual(0);
}
done();
})
it('getPermissionDef_1000', 0, async function (done) {
demo.getPermissionDef('error', OnReceiveEvent);
function OnReceiveEvent(data) {
expect(typeof data).assertEqual("object");
expect(data.name.length).assertEqual(0);
expect(data.bundleName.length).assertEqual(0);
expect(data.descriptionId.length).assertEqual(0);
expect(data.grantMode.length).assertEqual(0);
expect(data.availableScope.length).assertEqual(0);
}
done();
})
it('install_0100', 0, async function (done) {
demo.getBundleInstaller().then((data) => {
data.install(['/data/abc1.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(data) {
expect(typeof data).assertEqual("object");
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
}
});
done();
})
it('install_0400', 0, async function (done) {
demo.getBundleInstaller().then((data) => {
data.install(['ERROR'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(data) {
expect(typeof data).assertEqual("object");
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("STATUS_INSTALL_FAILURE_INVALID");
}
});
done();
})
it('install_0500', 0, async function (done) {
console.info("neu========================getBundleManager: for begin");
demo.getBundleInstaller().then((data) => {
data.install([''], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(data) {
expect(typeof data).assertEqual("object");
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("STATUS_INSTALL_FAILURE_INVALID");
}
});
done();
})
it('uninstall_0100', 0, async function (done) {
demo.getBundleInstaller().then((data) => {
data.uninstall('com.example.myapplication1', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(data) {
expect(typeof data).assertEqual("object");
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
}
});
done();
})
it('uninstall_0400', 0, async function (done) {
demo.getBundleInstaller().then((data) => {
data.uninstall('', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(data) {
expect(typeof data).assertEqual("object");
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("STATUS_UNINSTALL_FAILURE_ABORTED");
}
});
done();
})
it('uninstall_0500', 0, async function (done) {
demo.getBundleInstaller().then((data) => {
data.uninstall('', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(data) {
expect(typeof data).assertEqual("object");
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("STATUS_UNINSTALL_FAILURE_ABORTED");
}
});
done();
})
})
\ No newline at end of file
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/config/ohos/rules.gni")
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("hjs_demo_test2") {
test_hap_name = "bmsJstest2.hap"
hap_source_path = "hap/bmsJstest2.hap"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"package": "ohos.acts.aafwk.ability",
"shell-timeout": "21600000"
},
"kits": [
{
"test-file-name": [
"AbilityDemo.hap",
"$module.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
import app from '@system.app'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import demo from '@ohos.bundle_mgr'
describe('appInfoTest', function () {
it('getApplicationInfos_0200', 0, async function (done) {
var datainfo = await demo.getApplicationInfos(8, 0);
checkgetApplicationInfos(datainfo)
done();
})
function checkgetApplicationInfos(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].bundleName.length).assertLarger(0)
expect(datainfo[i].supportedModes).assertEqual(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) {
expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo[i].moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleInfos.length; j++) {
expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].codePath.length).assertLarger(0)
expect(datainfo[i].dataDir.length).assertLarger(0)
expect(datainfo[i].dataBaseDir.length).assertLarger(0)
expect(datainfo[i].cacheDir.length).assertLarger(0)
}
}
it('getApplicationInfos_0400', 0, async function (done) {
var datainfo = await demo.getApplicationInfos(8, 0);
checkgetApplicationInfos(datainfo)
done();
})
function checkgetApplicationInfos(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].bundleName.length).assertLarger(0)
expect(datainfo[i].supportedModes).assertEqual(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) {
expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo[i].moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleInfos.length; j++) {
expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].codePath.length).assertLarger(0)
expect(datainfo[i].dataDir.length).assertLarger(0)
expect(datainfo[i].dataBaseDir.length).assertLarger(0)
expect(datainfo[i].cacheDir.length).assertLarger(0)
}
}
it('getApplicationInfos_0700', 0, async function (done) {
await demo.getApplicationInfos(8, 0, OnReceiveEvent);
function OnReceiveEvent(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].bundleName.length).assertLarger(0)
expect(datainfo[i].supportedModes).assertEqual(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) {
expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo[i].moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleInfos.length; j++) {
expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].codePath.length).assertLarger(0)
expect(datainfo[i].dataDir.length).assertLarger(0)
expect(datainfo[i].dataBaseDir.length).assertLarger(0)
expect(datainfo[i].cacheDir.length).assertLarger(0)
}
}
done();
})
it('getApplicationInfos_0900', 0, async function (done) {
await demo.getApplicationInfos(8, 0, OnReceiveEvent);
function OnReceiveEvent(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].bundleName.length).assertLarger(0)
expect(datainfo[i].supportedModes).assertEqual(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) {
expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo[i].moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleInfos.length; j++) {
expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].codePath.length).assertLarger(0)
expect(datainfo[i].dataDir.length).assertLarger(0)
expect(datainfo[i].dataBaseDir.length).assertLarger(0)
expect(datainfo[i].cacheDir.length).assertLarger(0)
}
}
done();
})
it('getApplicationInfo_0200', 0, async function (done) {
var datainfo = await demo.getApplicationInfo('com.example.napi_test_suite', 8, 1);
checkgetApplicationInfo(datainfo)
done();
})
function checkgetApplicationInfo(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.supportedModes).assertEqual(0)
expect(datainfo.moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) {
expect(datainfo.moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleInfos.length; j++) {
expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo.entryDir.length).assertLarger(0)
expect(datainfo.codePath.length).assertLarger(0)
expect(datainfo.dataDir.length).assertLarger(0)
expect(datainfo.dataBaseDir.length).assertLarger(0)
expect(datainfo.cacheDir.length).assertLarger(0)
}
it('getApplicationInfo_0700', 0, async function (done) {
await demo.getApplicationInfo('com.example.napi_test_suite', 8, 1, OnReceiveEvent);
function OnReceiveEvent(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.supportedModes).assertEqual(0)
expect(datainfo.moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) {
expect(datainfo.moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleInfos.length; j++) {
expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo.entryDir.length).assertLarger(0)
expect(datainfo.codePath.length).assertLarger(0)
expect(datainfo.dataDir.length).assertLarger(0)
expect(datainfo.dataBaseDir.length).assertLarger(0)
expect(datainfo.cacheDir.length).assertLarger(0)
}
done();
})
it('getBundleInfos_0200', 0, async function () {
var data = await demo.getBundleInfos(8)
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].applicationInfo.name.length).assertLarger(0)
expect(data[i].applicationInfo.bundleName.length).assertLarger(0)
expect(data[i].hapModuleNames.length).assertLarger(0)
for (var j = 0; j < data[i].hapModuleNames.length; j++) {
expect(data[i].hapModuleNames[j].length).assertLarger(0)
}
expect(data[i].moduleNames.length).assertLarger(0)
for (var j = 0; j < data[i].moduleNames.length; j++) {
expect(data[i].moduleNames[j].length).assertLarger(0)
}
expect(data[i].modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
expect(data[i].modulePublicDirs[j].length).assertLarger(0)
}
expect(data[i].moduleDirs.length).assertLarger(0)
for (var j = 0; j < data[i].moduleDirs.length; j++) {
expect(data[i].moduleDirs[j].length).assertLarger(0)
}
expect(data[i].moduleResPaths.length).assertLarger(0)
for (var j = 0; j < data[i].moduleResPaths.length; j++) {
expect(data[i].moduleResPaths[j].length).assertLarger(0)
}
expect(data[i].abilityInfos.length).assertLarger(0)
for (var j = 0; j < data[i].abilityInfos.length; j++) {
expect(data[i].abilityInfos[j].name.length).assertLarger(0)
expect(data[i].abilityInfos[j].package.length).assertLarger(0)
}
}
})
it('getBundleInfos_0400', 0, async function () {
var data = await demo.getBundleInfos(8)
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].applicationInfo.name.length).assertLarger(0)
expect(data[i].applicationInfo.bundleName.length).assertLarger(0)
expect(data[i].hapModuleNames.length).assertLarger(0)
for (var j = 0; j < data[i].hapModuleNames.length; j++) {
expect(data[i].hapModuleNames[j].length).assertLarger(0)
}
expect(data[i].moduleNames.length).assertLarger(0)
for (var j = 0; j < data[i].moduleNames.length; j++) {
expect(data[i].moduleNames[j].length).assertLarger(0)
}
expect(data[i].modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
expect(data[i].modulePublicDirs[j].length).assertLarger(0)
}
expect(data[i].moduleDirs.length).assertLarger(0)
for (var j = 0; j < data[i].moduleDirs.length; j++) {
expect(data[i].moduleDirs[j].length).assertLarger(0)
}
expect(data[i].moduleResPaths.length).assertLarger(0)
for (var j = 0; j < data[i].moduleResPaths.length; j++) {
expect(data[i].moduleResPaths[j].length).assertLarger(0)
}
expect(data[i].abilityInfos.length).assertLarger(0)
for (var j = 0; j < data[i].abilityInfos.length; j++) {
expect(data[i].abilityInfos[j].name.length).assertLarger(0)
expect(data[i].abilityInfos[j].package.length).assertLarger(0)
}
}
})
it('getBundleInfos_0700', 0, async function () {
await demo.getBundleInfos(8, OnReceiveEvent)
function OnReceiveEvent(data) {
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].applicationInfo.name.length).assertLarger(0)
expect(data[i].applicationInfo.bundleName.length).assertLarger(0)
expect(data[i].hapModuleNames.length).assertLarger(0)
for (var j = 0; j < data[i].hapModuleNames.length; j++) {
expect(data[i].hapModuleNames[j].length).assertLarger(0)
}
expect(data[i].moduleNames.length).assertLarger(0)
for (var j = 0; j < data[i].moduleNames.length; j++) {
expect(data[i].moduleNames[j].length).assertLarger(0)
}
expect(data[i].modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
expect(data[i].modulePublicDirs[j].length).assertLarger(0)
}
expect(data[i].moduleDirs.length).assertLarger(0)
for (var j = 0; j < data[i].moduleDirs.length; j++) {
expect(data[i].moduleDirs[j].length).assertLarger(0)
}
expect(data[i].moduleResPaths.length).assertLarger(0)
for (var j = 0; j < data[i].moduleResPaths.length; j++) {
expect(data[i].moduleResPaths[j].length).assertLarger(0)
}
expect(data[i].abilityInfos.length).assertLarger(0)
for (var j = 0; j < data[i].abilityInfos.length; j++) {
expect(data[i].abilityInfos[j].name.length).assertLarger(0)
expect(data[i].abilityInfos[j].package.length).assertLarger(0)
}
}
}
})
it('getBundleInfos_0700', 0, async function () {
await demo.getBundleInfos(8, OnReceiveEvent)
function OnReceiveEvent(data) {
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].applicationInfo.name.length).assertLarger(0)
expect(data[i].applicationInfo.bundleName.length).assertLarger(0)
expect(data[i].hapModuleNames.length).assertLarger(0)
for (var j = 0; j < data[i].hapModuleNames.length; j++) {
expect(data[i].hapModuleNames[j].length).assertLarger(0)
}
expect(data[i].moduleNames.length).assertLarger(0)
for (var j = 0; j < data[i].moduleNames.length; j++) {
expect(data[i].moduleNames[j].length).assertLarger(0)
}
expect(data[i].modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
expect(data[i].modulePublicDirs[j].length).assertLarger(0)
}
expect(data[i].moduleDirs.length).assertLarger(0)
for (var j = 0; j < data[i].moduleDirs.length; j++) {
expect(data[i].moduleDirs[j].length).assertLarger(0)
}
expect(data[i].moduleResPaths.length).assertLarger(0)
for (var j = 0; j < data[i].moduleResPaths.length; j++) {
expect(data[i].moduleResPaths[j].length).assertLarger(0)
}
expect(data[i].abilityInfos.length).assertLarger(0)
for (var j = 0; j < data[i].abilityInfos.length; j++) {
expect(data[i].abilityInfos[j].name.length).assertLarger(0)
expect(data[i].abilityInfos[j].package.length).assertLarger(0)
}
}
}
})
it('getBundleInfos_0900', 0, async function () {
await demo.getBundleInfos(8, OnReceiveEvent)
function OnReceiveEvent(data) {
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].applicationInfo.name.length).assertLarger(0)
expect(data[i].applicationInfo.bundleName.length).assertLarger(0)
expect(data[i].hapModuleNames.length).assertLarger(0)
for (var j = 0; j < data[i].hapModuleNames.length; j++) {
expect(data[i].hapModuleNames[j].length).assertLarger(0)
}
expect(data[i].moduleNames.length).assertLarger(0)
for (var j = 0; j < data[i].moduleNames.length; j++) {
expect(data[i].moduleNames[j].length).assertLarger(0)
}
expect(data[i].modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
expect(data[i].modulePublicDirs[j].length).assertLarger(0)
}
expect(data[i].moduleDirs.length).assertLarger(0)
for (var j = 0; j < data[i].moduleDirs.length; j++) {
expect(data[i].moduleDirs[j].length).assertLarger(0)
}
expect(data[i].moduleResPaths.length).assertLarger(0)
for (var j = 0; j < data[i].moduleResPaths.length; j++) {
expect(data[i].moduleResPaths[j].length).assertLarger(0)
}
expect(data[i].abilityInfos.length).assertLarger(0)
for (var j = 0; j < data[i].abilityInfos.length; j++) {
expect(data[i].abilityInfos[j].name.length).assertLarger(0)
expect(data[i].abilityInfos[j].package.length).assertLarger(0)
}
}
}
})
it('getBundleInfo_0200', 0, async function (done) {
var info = await demo.getBundleManager()
var datainfo = await info.getBundleInfo('com.example.napi_test_suite', 1)
console.info('**************************getBundleInfo_01********************************')
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.minSdkVersion).assertEqual(0)
expect(datainfo.maxSdkVersion).assertEqual(0)
expect(datainfo.hapModuleNames.length).assertLarger(0)
for (var j = 0; j < datainfo.hapModuleNames.length; j++) {
expect(datainfo.hapModuleNames[j].length).assertLarger(0)
}
expect(datainfo.moduleNames.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleNames.length; j++) {
expect(datainfo.moduleNames[j].length).assertLarger(0)
}
expect(datainfo.modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.modulePublicDirs.length; j++) {
expect(datainfo.modulePublicDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleDirs.length; j++) {
expect(datainfo.moduleDirs[j].length).assertLarger(0)
}
done()
})
it('getBundleInfo_0700', 0, async function (done) {
var info = await demo.getBundleManager()
await info.getBundleInfo('com.example.napi_test_suite', 1, OnReceiveEvent)
function OnReceiveEvent(datainfo) {
console.info('**************************getBundleInfo_01********************************')
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.minSdkVersion).assertEqual(0)
expect(datainfo.maxSdkVersion).assertEqual(0)
expect(datainfo.hapModuleNames.length).assertLarger(0)
for (var j = 0; j < datainfo.hapModuleNames.length; j++) {
expect(datainfo.hapModuleNames[j].length).assertLarger(0)
}
expect(datainfo.moduleNames.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleNames.length; j++) {
expect(datainfo.moduleNames[j].length).assertLarger(0)
}
expect(datainfo.modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.modulePublicDirs.length; j++) {
expect(datainfo.modulePublicDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleDirs.length; j++) {
expect(datainfo.moduleDirs[j].length).assertLarger(0)
}
}
done()
})
it('getBundleArchiveInfo_0200', 0, async function (done) {
var info = await demo.getBundleManager()
var datainfo = await info.getBundleArchiveInfo('/data/abc2.hap', 1)
expect(datainfo.entryModuleName.length).assertLarger(0)
expect(datainfo.compatibleVersion).assertEqual(5)
expect(datainfo.targetVersion).assertEqual(5)
expect(datainfo.isKeepAlive).assertEqual(false)
expect(datainfo.isNativeApp).assertEqual(false)
expect(datainfo.hapModuleNames.length).assertLarger(0)
// for(var j = 0; j < datainfo.hapModuleNames.length; j++) {
// expect(datainfo.hapModuleNames[j].length).assertLarger(0)
// }
// expect(datainfo.moduleNames.length).assertLarger(0)
// for(var j = 0; j < datainfo.moduleNames.length; j++) {
// expect(datainfo.moduleNames[j].length).assertLarger(0)
// }
// expect(datainfo.modulePublicDirs.length).assertLarger(0)
// for(var j = 0; j < datainfo.modulePublicDirs.length; j++) {
// expect(datainfo.modulePublicDirs[j].length).assertLarger(0)
// }
// expect(datainfo.moduleDirs.length).assertLarger(0)
// for(var j = 0; j < datainfo.moduleDirs.length; j++) {
// expect(datainfo.moduleDirs[j].length).assertLarger(0)
// }
done()
})
it('getBundleArchiveInfo_0700', 0, async function (done) {
var info = await demo.getBundleManager()
await info.getBundleArchiveInfo('/data/abc2.hap', 1, OnReceiveEvent)
function OnReceiveEvent(datainfo) {
console.info('**************************getBundleInfo_01********************************')
expect(datainfo.entryModuleName.length).assertLarger(0)
expect(datainfo.compatibleVersion).assertEqual(5)
expect(datainfo.targetVersion).assertEqual(5)
expect(datainfo.isKeepAlive).assertEqual(false)
expect(datainfo.isNativeApp).assertEqual(false)
done()
}
})
it('queryAbilityByWant_0100', 0, async function (done) {
var info = await demo.getBundleManager()
var datainfo =
info.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "com.example.myapplicationInstall2",
abilityName: "com.example.myapplication.MainAbility",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
})
console.info('**************************queryAbilityByWant_01********************************')
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.iconPath.length).assertLarger(0)
expect(datainfo.visible.length).assertLarger(0)
expect(datainfo.kind.length).assertLarger(0)
expect(datainfo.package.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.moduleName.length).assertLarger(0)
expect(datainfo.applicationName.length).assertLarger(0)
expect(datainfo.resourcePath.length).assertLarger(0)
expect(datainfo.deviceTypes.length).assertLarger(0)
for (var j = 0; j < datainfo.deviceTypes.length; j++) {
expect(datainfo.deviceTypes[j].length).assertLarger(0)
}
expect(datainfo.deviceCapabilities.length).assertLarger(0)
for (var j = 0; j < datainfo.deviceCapabilities.length; j++) {
expect(datainfo.deviceCapabilities[j].length).assertLarger(0)
}
expect(datainfo.applicationInfo.name.length).assertLarger(0)
expect(datainfo.applicationInfo.bundleName.length).assertLarger(0)
done();
})
it('queryAbilityByWant_0700', 0, async function (done) {
var info = await demo.getBundleManager()
await info.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "com.example.myapplicationInstall2",
abilityName: "com.example.myapplication.MainAbility",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
}, OnReceiveEvent)
function OnReceiveEvent(datainfo) {
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.iconPath.length).assertLarger(0)
expect(datainfo.visible.length).assertLarger(0)
expect(datainfo.kind.length).assertLarger(0)
expect(datainfo.package.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.moduleName.length).assertLarger(0)
expect(datainfo.applicationName.length).assertLarger(0)
expect(datainfo.resourcePath.length).assertLarger(0)
expect(datainfo.deviceTypes.length).assertLarger(0)
for (var j = 0; j < datainfo.deviceTypes.length; j++) {
expect(datainfo.deviceTypes[j].length).assertLarger(0)
}
expect(datainfo.deviceCapabilities.length).assertLarger(0)
for (var j = 0; j < datainfo.deviceCapabilities.length; j++) {
expect(datainfo.deviceCapabilities[j].length).assertLarger(0)
}
expect(datainfo.applicationInfo.name.length).assertLarger(0)
expect(datainfo.applicationInfo.bundleName.length).assertLarger(0)
done()
}
})
it('getPermissionDef_0200', 0, async function (done) {
demo.getPermissionDef('com.permission.music').then((infos) => {
expect(typeof infos).assertEqual("object");
expect(infos.name.length).assertLarger(0);
expect(infos.descriptionId.length).assertLarger(0);
expect(infos.grantMode.length).assertLarger(0);
expect(infos.availableScope.length).assertLarger(0);
});
done();
})
it('getPermissionDef_0700', 0, async function (done) {
demo.getPermissionDef('com.permission.CAMERA', OnReceiveEvent);
demo.getPermissionDef('com.permission.music', OnReceiveEvent);
function OnReceiveEvent(data) {
expect(data.name.length).assertLarger(0);
expect(data.descriptionId.length).assertEqual(0);
expect(data.grantMode.length).assertLarger(0);
expect(data.availableScope.length).assertLarger(0);
}
done();
})
it('install_0200', 0, async function (done) {
demo.getBundleInstaller().then((data) => {
data.install(['/data/abc2.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
data.install(['/data/abc3.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(infos) {
expect(typeof infos).assertEqual("object");
expect(infos.status).assertEqual(0);
expect(infos.statusMessage).assertEqual("SUCCESS");
}
});
done();
})
it('uninstall_0200', 0, async function (done) {
demo.getBundleInstaller().then((data) => {
data.uninstall('com.example.myapplication2', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
// data.uninstall('com.example.myapplication2', {
// param: {
// userId: 0,
// isKeepData: false
// }
// }, OnReceiveinstallEvent);
function OnReceiveinstallEvent(data) {
expect(typeof data).assertEqual("object");
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
}
});
done();
})
})
\ No newline at end of file
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/config/ohos/rules.gni")
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("hjs_demo_test3") {
test_hap_name = "bmsJstest3.hap"
hap_source_path = "hap/bmsJstest3.hap"
}
import app from '@system.app'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import demo from '@ohos.bundle_mgr'
describe('appInfoTest', function () {
it('getApplicationInfos_0200', 0, async function (done) {
var datainfo = await demo.getApplicationInfos(8, 0);
checkgetApplicationInfos(datainfo)
done();
})
function checkgetApplicationInfos(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].bundleName.length).assertLarger(0)
expect(datainfo[i].supportedModes).assertEqual(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) {
expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo[i].moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleInfos.length; j++) {
expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].codePath.length).assertLarger(0)
expect(datainfo[i].dataDir.length).assertLarger(0)
expect(datainfo[i].dataBaseDir.length).assertLarger(0)
expect(datainfo[i].cacheDir.length).assertLarger(0)
}
}
it('getApplicationInfos_0400', 0, async function (done) {
var datainfo = await demo.getApplicationInfos(8, 0);
checkgetApplicationInfos(datainfo)
done();
})
function checkgetApplicationInfos(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].bundleName.length).assertLarger(0)
expect(datainfo[i].supportedModes).assertEqual(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) {
expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo[i].moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleInfos.length; j++) {
expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].codePath.length).assertLarger(0)
expect(datainfo[i].dataDir.length).assertLarger(0)
expect(datainfo[i].dataBaseDir.length).assertLarger(0)
expect(datainfo[i].cacheDir.length).assertLarger(0)
}
}
it('getApplicationInfos_0700', 0, async function (done) {
await demo.getApplicationInfos(8, 0, OnReceiveEvent);
function OnReceiveEvent(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].bundleName.length).assertLarger(0)
expect(datainfo[i].supportedModes).assertEqual(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) {
expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo[i].moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleInfos.length; j++) {
expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].codePath.length).assertLarger(0)
expect(datainfo[i].dataDir.length).assertLarger(0)
expect(datainfo[i].dataBaseDir.length).assertLarger(0)
expect(datainfo[i].cacheDir.length).assertLarger(0)
}
}
done();
})
it('getApplicationInfos_0900', 0, async function (done) {
await demo.getApplicationInfos(8, 0, OnReceiveEvent);
function OnReceiveEvent(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].bundleName.length).assertLarger(0)
expect(datainfo[i].supportedModes).assertEqual(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) {
expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo[i].moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleInfos.length; j++) {
expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].codePath.length).assertLarger(0)
expect(datainfo[i].dataDir.length).assertLarger(0)
expect(datainfo[i].dataBaseDir.length).assertLarger(0)
expect(datainfo[i].cacheDir.length).assertLarger(0)
}
}
done();
})
it('getApplicationInfo_0200', 0, async function (done) {
var datainfo = await demo.getApplicationInfo('com.example.napi_test_suite', 8, 1);
checkgetApplicationInfo(datainfo)
done();
})
function checkgetApplicationInfo(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.supportedModes).assertEqual(0)
expect(datainfo.moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) {
expect(datainfo.moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleInfos.length; j++) {
expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo.entryDir.length).assertLarger(0)
expect(datainfo.codePath.length).assertLarger(0)
expect(datainfo.dataDir.length).assertLarger(0)
expect(datainfo.dataBaseDir.length).assertLarger(0)
expect(datainfo.cacheDir.length).assertLarger(0)
}
it('getApplicationInfo_0700', 0, async function (done) {
await demo.getApplicationInfo('com.example.napi_test_suite', 8, 1, OnReceiveEvent);
function OnReceiveEvent(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.supportedModes).assertEqual(0)
expect(datainfo.moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) {
expect(datainfo.moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleInfos.length; j++) {
expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo.entryDir.length).assertLarger(0)
expect(datainfo.codePath.length).assertLarger(0)
expect(datainfo.dataDir.length).assertLarger(0)
expect(datainfo.dataBaseDir.length).assertLarger(0)
expect(datainfo.cacheDir.length).assertLarger(0)
}
done();
})
it('getBundleInfos_0200', 0, async function () {
var data = await demo.getBundleInfos(8)
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].applicationInfo.name.length).assertLarger(0)
expect(data[i].applicationInfo.bundleName.length).assertLarger(0)
expect(data[i].hapModuleNames.length).assertLarger(0)
for (var j = 0; j < data[i].hapModuleNames.length; j++) {
expect(data[i].hapModuleNames[j].length).assertLarger(0)
}
expect(data[i].moduleNames.length).assertLarger(0)
for (var j = 0; j < data[i].moduleNames.length; j++) {
expect(data[i].moduleNames[j].length).assertLarger(0)
}
expect(data[i].modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
expect(data[i].modulePublicDirs[j].length).assertLarger(0)
}
expect(data[i].moduleDirs.length).assertLarger(0)
for (var j = 0; j < data[i].moduleDirs.length; j++) {
expect(data[i].moduleDirs[j].length).assertLarger(0)
}
expect(data[i].moduleResPaths.length).assertLarger(0)
for (var j = 0; j < data[i].moduleResPaths.length; j++) {
expect(data[i].moduleResPaths[j].length).assertLarger(0)
}
expect(data[i].abilityInfos.length).assertLarger(0)
for (var j = 0; j < data[i].abilityInfos.length; j++) {
expect(data[i].abilityInfos[j].name.length).assertLarger(0)
expect(data[i].abilityInfos[j].package.length).assertLarger(0)
}
}
})
it('getBundleInfos_0400', 0, async function () {
var data = await demo.getBundleInfos(8)
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].applicationInfo.name.length).assertLarger(0)
expect(data[i].applicationInfo.bundleName.length).assertLarger(0)
expect(data[i].hapModuleNames.length).assertLarger(0)
for (var j = 0; j < data[i].hapModuleNames.length; j++) {
expect(data[i].hapModuleNames[j].length).assertLarger(0)
}
expect(data[i].moduleNames.length).assertLarger(0)
for (var j = 0; j < data[i].moduleNames.length; j++) {
expect(data[i].moduleNames[j].length).assertLarger(0)
}
expect(data[i].modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
expect(data[i].modulePublicDirs[j].length).assertLarger(0)
}
expect(data[i].moduleDirs.length).assertLarger(0)
for (var j = 0; j < data[i].moduleDirs.length; j++) {
expect(data[i].moduleDirs[j].length).assertLarger(0)
}
expect(data[i].moduleResPaths.length).assertLarger(0)
for (var j = 0; j < data[i].moduleResPaths.length; j++) {
expect(data[i].moduleResPaths[j].length).assertLarger(0)
}
expect(data[i].abilityInfos.length).assertLarger(0)
for (var j = 0; j < data[i].abilityInfos.length; j++) {
expect(data[i].abilityInfos[j].name.length).assertLarger(0)
expect(data[i].abilityInfos[j].package.length).assertLarger(0)
}
}
})
it('getBundleInfos_0700', 0, async function () {
await demo.getBundleInfos(8, OnReceiveEvent)
function OnReceiveEvent(data) {
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].applicationInfo.name.length).assertLarger(0)
expect(data[i].applicationInfo.bundleName.length).assertLarger(0)
expect(data[i].hapModuleNames.length).assertLarger(0)
for (var j = 0; j < data[i].hapModuleNames.length; j++) {
expect(data[i].hapModuleNames[j].length).assertLarger(0)
}
expect(data[i].moduleNames.length).assertLarger(0)
for (var j = 0; j < data[i].moduleNames.length; j++) {
expect(data[i].moduleNames[j].length).assertLarger(0)
}
expect(data[i].modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
expect(data[i].modulePublicDirs[j].length).assertLarger(0)
}
expect(data[i].moduleDirs.length).assertLarger(0)
for (var j = 0; j < data[i].moduleDirs.length; j++) {
expect(data[i].moduleDirs[j].length).assertLarger(0)
}
expect(data[i].moduleResPaths.length).assertLarger(0)
for (var j = 0; j < data[i].moduleResPaths.length; j++) {
expect(data[i].moduleResPaths[j].length).assertLarger(0)
}
expect(data[i].abilityInfos.length).assertLarger(0)
for (var j = 0; j < data[i].abilityInfos.length; j++) {
expect(data[i].abilityInfos[j].name.length).assertLarger(0)
expect(data[i].abilityInfos[j].package.length).assertLarger(0)
}
}
}
})
it('getBundleInfos_0900', 0, async function () {
await demo.getBundleInfos(8, OnReceiveEvent)
function OnReceiveEvent(data) {
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].applicationInfo.name.length).assertLarger(0)
expect(data[i].applicationInfo.bundleName.length).assertLarger(0)
expect(data[i].hapModuleNames.length).assertLarger(0)
for (var j = 0; j < data[i].hapModuleNames.length; j++) {
expect(data[i].hapModuleNames[j].length).assertLarger(0)
}
expect(data[i].moduleNames.length).assertLarger(0)
for (var j = 0; j < data[i].moduleNames.length; j++) {
expect(data[i].moduleNames[j].length).assertLarger(0)
}
expect(data[i].modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
expect(data[i].modulePublicDirs[j].length).assertLarger(0)
}
expect(data[i].moduleDirs.length).assertLarger(0)
for (var j = 0; j < data[i].moduleDirs.length; j++) {
expect(data[i].moduleDirs[j].length).assertLarger(0)
}
expect(data[i].moduleResPaths.length).assertLarger(0)
for (var j = 0; j < data[i].moduleResPaths.length; j++) {
expect(data[i].moduleResPaths[j].length).assertLarger(0)
}
expect(data[i].abilityInfos.length).assertLarger(0)
for (var j = 0; j < data[i].abilityInfos.length; j++) {
expect(data[i].abilityInfos[j].name.length).assertLarger(0)
expect(data[i].abilityInfos[j].package.length).assertLarger(0)
}
}
}
})
it('getBundleInfo_0200', 0, async function (done) {
var info = await demo.getBundleManager()
var datainfo = await info.getBundleInfo('com.example.napi_test_suite', 1)
console.info('**************************getBundleInfo_01********************************')
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.minSdkVersion).assertEqual(0)
expect(datainfo.maxSdkVersion).assertEqual(0)
expect(datainfo.hapModuleNames.length).assertLarger(0)
for (var j = 0; j < datainfo.hapModuleNames.length; j++) {
expect(datainfo.hapModuleNames[j].length).assertLarger(0)
}
expect(datainfo.moduleNames.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleNames.length; j++) {
expect(datainfo.moduleNames[j].length).assertLarger(0)
}
expect(datainfo.modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.modulePublicDirs.length; j++) {
expect(datainfo.modulePublicDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleDirs.length; j++) {
expect(datainfo.moduleDirs[j].length).assertLarger(0)
}
done()
})
it('getBundleInfo_0700', 0, async function (done) {
var info = await demo.getBundleManager()
await info.getBundleInfo('com.example.napi_test_suite', 1, OnReceiveEvent)
function OnReceiveEvent(datainfo) {
console.info('**************************getBundleInfo_01********************************')
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.minSdkVersion).assertEqual(0)
expect(datainfo.maxSdkVersion).assertEqual(0)
expect(datainfo.hapModuleNames.length).assertLarger(0)
for (var j = 0; j < datainfo.hapModuleNames.length; j++) {
expect(datainfo.hapModuleNames[j].length).assertLarger(0)
}
expect(datainfo.moduleNames.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleNames.length; j++) {
expect(datainfo.moduleNames[j].length).assertLarger(0)
}
expect(datainfo.modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.modulePublicDirs.length; j++) {
expect(datainfo.modulePublicDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleDirs.length; j++) {
expect(datainfo.moduleDirs[j].length).assertLarger(0)
}
}
done()
})
it('getBundleArchiveInfo_0200', 0, async function (done) {
var info = await demo.getBundleManager()
var datainfo = await info.getBundleArchiveInfo('/data/abc2.hap', 1)
expect(datainfo.entryModuleName.length).assertLarger(0)
expect(datainfo.compatibleVersion).assertEqual(5)
expect(datainfo.targetVersion).assertEqual(5)
expect(datainfo.isKeepAlive).assertEqual(false)
expect(datainfo.isNativeApp).assertEqual(false)
expect(datainfo.hapModuleNames.length).assertLarger(0)
// for(var j = 0; j < datainfo.hapModuleNames.length; j++) {
// expect(datainfo.hapModuleNames[j].length).assertLarger(0)
// }
// expect(datainfo.moduleNames.length).assertLarger(0)
// for(var j = 0; j < datainfo.moduleNames.length; j++) {
// expect(datainfo.moduleNames[j].length).assertLarger(0)
// }
// expect(datainfo.modulePublicDirs.length).assertLarger(0)
// for(var j = 0; j < datainfo.modulePublicDirs.length; j++) {
// expect(datainfo.modulePublicDirs[j].length).assertLarger(0)
// }
// expect(datainfo.moduleDirs.length).assertLarger(0)
// for(var j = 0; j < datainfo.moduleDirs.length; j++) {
// expect(datainfo.moduleDirs[j].length).assertLarger(0)
// }
done()
})
it('getBundleArchiveInfo_0700', 0, async function (done) {
var info = await demo.getBundleManager()
await info.getBundleArchiveInfo('/data/abc2.hap', 1, OnReceiveEvent)
function OnReceiveEvent(datainfo) {
console.info('**************************getBundleInfo_01********************************')
expect(datainfo.entryModuleName.length).assertLarger(0)
expect(datainfo.compatibleVersion).assertEqual(5)
expect(datainfo.targetVersion).assertEqual(5)
expect(datainfo.isKeepAlive).assertEqual(false)
expect(datainfo.isNativeApp).assertEqual(false)
done()
}
})
it('queryAbilityByWant_0100', 0, async function (done) {
var info = await demo.getBundleManager()
var datainfo =
info.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "com.example.myapplicationInstall2",
abilityName: "com.example.myapplication.MainAbility",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
})
console.info('**************************queryAbilityByWant_01********************************')
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.iconPath.length).assertLarger(0)
expect(datainfo.visible.length).assertLarger(0)
expect(datainfo.kind.length).assertLarger(0)
expect(datainfo.package.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.moduleName.length).assertLarger(0)
expect(datainfo.applicationName.length).assertLarger(0)
expect(datainfo.resourcePath.length).assertLarger(0)
expect(datainfo.deviceTypes.length).assertLarger(0)
for (var j = 0; j < datainfo.deviceTypes.length; j++) {
expect(datainfo.deviceTypes[j].length).assertLarger(0)
}
expect(datainfo.deviceCapabilities.length).assertLarger(0)
for (var j = 0; j < datainfo.deviceCapabilities.length; j++) {
expect(datainfo.deviceCapabilities[j].length).assertLarger(0)
}
expect(datainfo.applicationInfo.name.length).assertLarger(0)
expect(datainfo.applicationInfo.bundleName.length).assertLarger(0)
done();
})
it('queryAbilityByWant_0700', 0, async function (done) {
var info = await demo.getBundleManager()
await info.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "com.example.myapplicationInstall2",
abilityName: "com.example.myapplication.MainAbility",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
}, OnReceiveEvent)
function OnReceiveEvent(datainfo) {
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.iconPath.length).assertLarger(0)
expect(datainfo.visible.length).assertLarger(0)
expect(datainfo.kind.length).assertLarger(0)
expect(datainfo.package.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.moduleName.length).assertLarger(0)
expect(datainfo.applicationName.length).assertLarger(0)
expect(datainfo.resourcePath.length).assertLarger(0)
expect(datainfo.deviceTypes.length).assertLarger(0)
for (var j = 0; j < datainfo.deviceTypes.length; j++) {
expect(datainfo.deviceTypes[j].length).assertLarger(0)
}
expect(datainfo.deviceCapabilities.length).assertLarger(0)
for (var j = 0; j < datainfo.deviceCapabilities.length; j++) {
expect(datainfo.deviceCapabilities[j].length).assertLarger(0)
}
expect(datainfo.applicationInfo.name.length).assertLarger(0)
expect(datainfo.applicationInfo.bundleName.length).assertLarger(0)
done()
}
})
it('getPermissionDef_0200', 0, async function (done) {
demo.getPermissionDef('com.permission.music').then((infos) => {
expect(typeof infos).assertEqual("object");
expect(infos.name.length).assertLarger(0);
expect(infos.descriptionId.length).assertLarger(0);
expect(infos.grantMode.length).assertLarger(0);
expect(infos.availableScope.length).assertLarger(0);
});
done();
})
it('getPermissionDef_0700', 0, async function (done) {
demo.getPermissionDef('com.permission.CAMERA', OnReceiveEvent);
demo.getPermissionDef('com.permission.music', OnReceiveEvent);
function OnReceiveEvent(data) {
expect(data.name.length).assertLarger(0);
expect(data.descriptionId.length).assertEqual(0);
expect(data.grantMode.length).assertLarger(0);
expect(data.availableScope.length).assertLarger(0);
}
done();
})
it('install_0200', 0, async function (done) {
demo.getBundleInstaller().then((data) => {
data.install(['/data/abc2.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
data.install(['/data/abc3.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(infos) {
expect(typeof infos).assertEqual("object");
expect(infos.status).assertEqual(0);
expect(infos.statusMessage).assertEqual("SUCCESS");
}
});
done();
})
it('uninstall_0200', 0, async function (done) {
demo.getBundleInstaller().then((data) => {
data.uninstall('com.example.myapplication2', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
// data.uninstall('com.example.myapplication2', {
// param: {
// userId: 0,
// isKeepData: false
// }
// }, OnReceiveinstallEvent);
function OnReceiveinstallEvent(data) {
expect(typeof data).assertEqual("object");
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
}
});
done();
})
})
\ No newline at end of file
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"package": "ohos.acts.aafwk.ability",
"shell-timeout": "21600000"
},
"kits": [
{
"test-file-name": [
"AbilityDemo.hap",
"$module.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
import file from '@system.file'
import app from '@system.app'
import device from '@system.device'
import router from '@system.router'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
// const instrumentLog = new InstrumentLog({
// 'id': 'report'
// })
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
// core.addService('report', instrumentLog)
core.init()
// core.subscribeEvent('spec', instrumentLog)
// core.subscribeEvent('suite', instrumentLog)
// core.subscribeEvent('task', instrumentLog)
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
import app from '@system.app'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import demo from '@ohos.bundle_mgr'
describe('appInfoTest', function () {
it('getApplicationInfos_0300', 0, async function (done) {
var datainfo = await demo.getApplicationInfos(8, 0);
checkgetApplicationInfos(datainfo)
done();
})
function checkgetApplicationInfos(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].bundleName.length).assertLarger(0)
expect(datainfo[i].supportedModes).assertEqual(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) {
expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo[i].moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleInfos.length; j++) {
expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].codePath.length).assertLarger(0)
expect(datainfo[i].dataDir.length).assertLarger(0)
expect(datainfo[i].dataBaseDir.length).assertLarger(0)
expect(datainfo[i].cacheDir.length).assertLarger(0)
}
}
it('getApplicationInfos_0500', 0, async function (done) {
var datainfo = await demo.getApplicationInfos(8, 0);
checkgetApplicationInfos(datainfo)
done();
})
function checkgetApplicationInfos(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].bundleName.length).assertLarger(0)
expect(datainfo[i].supportedModes).assertEqual(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) {
expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo[i].moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleInfos.length; j++) {
expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].codePath.length).assertLarger(0)
expect(datainfo[i].dataDir.length).assertLarger(0)
expect(datainfo[i].dataBaseDir.length).assertLarger(0)
expect(datainfo[i].cacheDir.length).assertLarger(0)
}
}
it('getApplicationInfos_0800', 0, async function (done) {
await demo.getApplicationInfos(8, 0, OnReceiveEvent);
function OnReceiveEvent(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].bundleName.length).assertLarger(0)
expect(datainfo[i].supportedModes).assertEqual(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) {
expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo[i].moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleInfos.length; j++) {
expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].codePath.length).assertLarger(0)
expect(datainfo[i].dataDir.length).assertLarger(0)
expect(datainfo[i].dataBaseDir.length).assertLarger(0)
expect(datainfo[i].cacheDir.length).assertLarger(0)
}
}
done();
})
it('getApplicationInfos_1000', 0, async function (done) {
await demo.getApplicationInfos(8, 0, OnReceiveEvent);
function OnReceiveEvent(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].bundleName.length).assertLarger(0)
expect(datainfo[i].supportedModes).assertEqual(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) {
expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo[i].moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleInfos.length; j++) {
expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].codePath.length).assertLarger(0)
expect(datainfo[i].dataDir.length).assertLarger(0)
expect(datainfo[i].dataBaseDir.length).assertLarger(0)
expect(datainfo[i].cacheDir.length).assertLarger(0)
}
}
done();
})
it('getApplicationInfo_0300', 0, async function (done) {
var datainfo = await demo.getApplicationInfo('com.example.napi_test_suite', 8, 1);
checkgetApplicationInfo(datainfo)
done();
})
function checkgetApplicationInfo(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.supportedModes).assertEqual(0)
expect(datainfo.moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) {
expect(datainfo.moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleInfos.length; j++) {
expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo.entryDir.length).assertLarger(0)
expect(datainfo.codePath.length).assertLarger(0)
expect(datainfo.dataDir.length).assertLarger(0)
expect(datainfo.dataBaseDir.length).assertLarger(0)
expect(datainfo.cacheDir.length).assertLarger(0)
}
it('getApplicationInfo_0800', 0, async function (done) {
await demo.getApplicationInfo('com.example.napi_test_suite', 8, 1, OnReceiveEvent);
function OnReceiveEvent(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.supportedModes).assertEqual(0)
expect(datainfo.moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) {
expect(datainfo.moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleInfos.length; j++) {
expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo.entryDir.length).assertLarger(0)
expect(datainfo.codePath.length).assertLarger(0)
expect(datainfo.dataDir.length).assertLarger(0)
expect(datainfo.dataBaseDir.length).assertLarger(0)
expect(datainfo.cacheDir.length).assertLarger(0)
}
done();
})
it('getBundleInfos_0300', 0, async function () {
var data = await demo.getBundleInfos(8)
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].applicationInfo.name.length).assertLarger(0)
expect(data[i].applicationInfo.bundleName.length).assertLarger(0)
expect(data[i].hapModuleNames.length).assertLarger(0)
for (var j = 0; j < data[i].hapModuleNames.length; j++) {
expect(data[i].hapModuleNames[j].length).assertLarger(0)
}
expect(data[i].moduleNames.length).assertLarger(0)
for (var j = 0; j < data[i].moduleNames.length; j++) {
expect(data[i].moduleNames[j].length).assertLarger(0)
}
expect(data[i].modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
expect(data[i].modulePublicDirs[j].length).assertLarger(0)
}
expect(data[i].moduleDirs.length).assertLarger(0)
for (var j = 0; j < data[i].moduleDirs.length; j++) {
expect(data[i].moduleDirs[j].length).assertLarger(0)
}
expect(data[i].moduleResPaths.length).assertLarger(0)
for (var j = 0; j < data[i].moduleResPaths.length; j++) {
expect(data[i].moduleResPaths[j].length).assertLarger(0)
}
expect(data[i].abilityInfos.length).assertLarger(0)
for (var j = 0; j < data[i].abilityInfos.length; j++) {
expect(data[i].abilityInfos[j].name.length).assertLarger(0)
expect(data[i].abilityInfos[j].package.length).assertLarger(0)
}
}
})
it('getBundleInfos_0500', 0, async function () {
var data = await demo.getBundleInfos(8)
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].applicationInfo.name.length).assertLarger(0)
expect(data[i].applicationInfo.bundleName.length).assertLarger(0)
expect(data[i].hapModuleNames.length).assertLarger(0)
for (var j = 0; j < data[i].hapModuleNames.length; j++) {
expect(data[i].hapModuleNames[j].length).assertLarger(0)
}
expect(data[i].moduleNames.length).assertLarger(0)
for (var j = 0; j < data[i].moduleNames.length; j++) {
expect(data[i].moduleNames[j].length).assertLarger(0)
}
expect(data[i].modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
expect(data[i].modulePublicDirs[j].length).assertLarger(0)
}
expect(data[i].moduleDirs.length).assertLarger(0)
for (var j = 0; j < data[i].moduleDirs.length; j++) {
expect(data[i].moduleDirs[j].length).assertLarger(0)
}
expect(data[i].moduleResPaths.length).assertLarger(0)
for (var j = 0; j < data[i].moduleResPaths.length; j++) {
expect(data[i].moduleResPaths[j].length).assertLarger(0)
}
expect(data[i].abilityInfos.length).assertLarger(0)
for (var j = 0; j < data[i].abilityInfos.length; j++) {
expect(data[i].abilityInfos[j].name.length).assertLarger(0)
expect(data[i].abilityInfos[j].package.length).assertLarger(0)
}
}
})
it('getBundleInfos_0800', 0, async function () {
await demo.getBundleInfos(8, OnReceiveEvent)
function OnReceiveEvent(data) {
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].applicationInfo.name.length).assertLarger(0)
expect(data[i].applicationInfo.bundleName.length).assertLarger(0)
expect(data[i].hapModuleNames.length).assertLarger(0)
for (var j = 0; j < data[i].hapModuleNames.length; j++) {
expect(data[i].hapModuleNames[j].length).assertLarger(0)
}
expect(data[i].moduleNames.length).assertLarger(0)
for (var j = 0; j < data[i].moduleNames.length; j++) {
expect(data[i].moduleNames[j].length).assertLarger(0)
}
expect(data[i].modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
expect(data[i].modulePublicDirs[j].length).assertLarger(0)
}
expect(data[i].moduleDirs.length).assertLarger(0)
for (var j = 0; j < data[i].moduleDirs.length; j++) {
expect(data[i].moduleDirs[j].length).assertLarger(0)
}
expect(data[i].moduleResPaths.length).assertLarger(0)
for (var j = 0; j < data[i].moduleResPaths.length; j++) {
expect(data[i].moduleResPaths[j].length).assertLarger(0)
}
expect(data[i].abilityInfos.length).assertLarger(0)
for (var j = 0; j < data[i].abilityInfos.length; j++) {
expect(data[i].abilityInfos[j].name.length).assertLarger(0)
expect(data[i].abilityInfos[j].package.length).assertLarger(0)
}
}
}
})
it('getBundleInfos_1000', 0, async function () {
await demo.getBundleInfos(8, OnReceiveEvent)
function OnReceiveEvent(data) {
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].applicationInfo.name.length).assertLarger(0)
expect(data[i].applicationInfo.bundleName.length).assertLarger(0)
expect(data[i].hapModuleNames.length).assertLarger(0)
for (var j = 0; j < data[i].hapModuleNames.length; j++) {
expect(data[i].hapModuleNames[j].length).assertLarger(0)
}
expect(data[i].moduleNames.length).assertLarger(0)
for (var j = 0; j < data[i].moduleNames.length; j++) {
expect(data[i].moduleNames[j].length).assertLarger(0)
}
expect(data[i].modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
expect(data[i].modulePublicDirs[j].length).assertLarger(0)
}
expect(data[i].moduleDirs.length).assertLarger(0)
for (var j = 0; j < data[i].moduleDirs.length; j++) {
expect(data[i].moduleDirs[j].length).assertLarger(0)
}
expect(data[i].moduleResPaths.length).assertLarger(0)
for (var j = 0; j < data[i].moduleResPaths.length; j++) {
expect(data[i].moduleResPaths[j].length).assertLarger(0)
}
expect(data[i].abilityInfos.length).assertLarger(0)
for (var j = 0; j < data[i].abilityInfos.length; j++) {
expect(data[i].abilityInfos[j].name.length).assertLarger(0)
expect(data[i].abilityInfos[j].package.length).assertLarger(0)
}
}
}
})
it('getBundleInfo_0300', 0, async function (done) {
var info = await demo.getBundleManager()
var datainfo = await info.getBundleInfo('com.example.napi_test_suite', 1)
console.info('**************************getBundleInfo_01********************************')
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.minSdkVersion).assertEqual(0)
expect(datainfo.maxSdkVersion).assertEqual(0)
expect(datainfo.hapModuleNames.length).assertLarger(0)
for (var j = 0; j < datainfo.hapModuleNames.length; j++) {
expect(datainfo.hapModuleNames[j].length).assertLarger(0)
}
expect(datainfo.moduleNames.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleNames.length; j++) {
expect(datainfo.moduleNames[j].length).assertLarger(0)
}
expect(datainfo.modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.modulePublicDirs.length; j++) {
expect(datainfo.modulePublicDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleDirs.length; j++) {
expect(datainfo.moduleDirs[j].length).assertLarger(0)
}
done()
})
it('getBundleInfo_0800', 0, async function (done) {
var info = await demo.getBundleManager()
await info.getBundleInfo('com.example.napi_test_suite', 1, OnReceiveEvent)
function OnReceiveEvent(datainfo) {
console.info('**************************getBundleInfo_01********************************')
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.minSdkVersion).assertEqual(0)
expect(datainfo.maxSdkVersion).assertEqual(0)
expect(datainfo.hapModuleNames.length).assertLarger(0)
for (var j = 0; j < datainfo.hapModuleNames.length; j++) {
expect(datainfo.hapModuleNames[j].length).assertLarger(0)
}
expect(datainfo.moduleNames.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleNames.length; j++) {
expect(datainfo.moduleNames[j].length).assertLarger(0)
}
expect(datainfo.modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.modulePublicDirs.length; j++) {
expect(datainfo.modulePublicDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleDirs.length; j++) {
expect(datainfo.moduleDirs[j].length).assertLarger(0)
}
}
done()
})
it('getBundleArchiveInfo_0300', 0, async function (done) {
var info = await demo.getBundleManager()
var datainfo = await info.getBundleArchiveInfo('/data/abc2.hap', 1)
expect(datainfo.entryModuleName.length).assertLarger(0)
expect(datainfo.compatibleVersion).assertEqual(5)
expect(datainfo.targetVersion).assertEqual(5)
expect(datainfo.isKeepAlive).assertEqual(false)
expect(datainfo.isNativeApp).assertEqual(false)
expect(datainfo.hapModuleNames.length).assertLarger(0)
// for(var j = 0; j < datainfo.hapModuleNames.length; j++) {
// expect(datainfo.hapModuleNames[j].length).assertLarger(0)
// }
// expect(datainfo.moduleNames.length).assertLarger(0)
// for(var j = 0; j < datainfo.moduleNames.length; j++) {
// expect(datainfo.moduleNames[j].length).assertLarger(0)
// }
// expect(datainfo.modulePublicDirs.length).assertLarger(0)
// for(var j = 0; j < datainfo.modulePublicDirs.length; j++) {
// expect(datainfo.modulePublicDirs[j].length).assertLarger(0)
// }
// expect(datainfo.moduleDirs.length).assertLarger(0)
// for(var j = 0; j < datainfo.moduleDirs.length; j++) {
// expect(datainfo.moduleDirs[j].length).assertLarger(0)
// }
done()
})
it('getBundleArchiveInfo_0800', 0, async function (done) {
var info = await demo.getBundleManager()
await info.getBundleArchiveInfo('/data/abc2.hap', 1, OnReceiveEvent)
function OnReceiveEvent(datainfo) {
console.info('**************************getBundleInfo_01********************************')
expect(datainfo.entryModuleName.length).assertLarger(0)
expect(datainfo.compatibleVersion).assertEqual(5)
expect(datainfo.targetVersion).assertEqual(5)
expect(datainfo.isKeepAlive).assertEqual(false)
expect(datainfo.isNativeApp).assertEqual(false)
done()
}
})
it('queryAbilityByWant_0300', 0, async function (done) {
var info = await demo.getBundleManager()
var datainfo =
info.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "com.example.myapplicationInstall2",
abilityName: "com.example.myapplication.MainAbility",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
})
console.info('**************************queryAbilityByWant_01********************************')
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.iconPath.length).assertLarger(0)
expect(datainfo.visible.length).assertLarger(0)
expect(datainfo.kind.length).assertLarger(0)
expect(datainfo.package.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.moduleName.length).assertLarger(0)
expect(datainfo.applicationName.length).assertLarger(0)
expect(datainfo.resourcePath.length).assertLarger(0)
expect(datainfo.deviceTypes.length).assertLarger(0)
for (var j = 0; j < datainfo.deviceTypes.length; j++) {
expect(datainfo.deviceTypes[j].length).assertLarger(0)
}
expect(datainfo.deviceCapabilities.length).assertLarger(0)
for (var j = 0; j < datainfo.deviceCapabilities.length; j++) {
expect(datainfo.deviceCapabilities[j].length).assertLarger(0)
}
expect(datainfo.applicationInfo.name.length).assertLarger(0)
expect(datainfo.applicationInfo.bundleName.length).assertLarger(0)
done();
})
it('queryAbilityByWant_0800', 0, async function (done) {
var info = await demo.getBundleManager()
await info.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "com.example.myapplicationInstall2",
abilityName: "com.example.myapplication.MainAbility",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
}, OnReceiveEvent)
function OnReceiveEvent(datainfo) {
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.iconPath.length).assertLarger(0)
expect(datainfo.visible.length).assertLarger(0)
expect(datainfo.kind.length).assertLarger(0)
expect(datainfo.package.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.moduleName.length).assertLarger(0)
expect(datainfo.applicationName.length).assertLarger(0)
expect(datainfo.resourcePath.length).assertLarger(0)
expect(datainfo.deviceTypes.length).assertLarger(0)
for (var j = 0; j < datainfo.deviceTypes.length; j++) {
expect(datainfo.deviceTypes[j].length).assertLarger(0)
}
expect(datainfo.deviceCapabilities.length).assertLarger(0)
for (var j = 0; j < datainfo.deviceCapabilities.length; j++) {
expect(datainfo.deviceCapabilities[j].length).assertLarger(0)
}
expect(datainfo.applicationInfo.name.length).assertLarger(0)
expect(datainfo.applicationInfo.bundleName.length).assertLarger(0)
done()
}
})
it('install_0300', 0, async function (done) {
demo.getBundleInstaller().then((data) => {
data.install(['/data/abc4.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
data.install(['/data/abc5.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
data.install(['/data/abc6.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(infos) {
expect(typeof infos).assertEqual("object");
expect(infos.status).assertEqual(0);
expect(infos.statusMessage).assertEqual("SUCCESS");
}
});
done();
})
it('uninstall_0300', 0, async function (done) {
demo.getBundleInstaller().then((data) => {
data.uninstall('com.example.myapplication4', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
// data.uninstall('com.example.myapplication4', {
// param: {
// userId: 0,
// isKeepData: false
// }
// }, OnReceiveinstallEvent);
data.uninstall('com.example.myapplication5', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(data) {
expect(typeof data).assertEqual("object");
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
}
});
done();
})
})
\ No newline at end of file
require('./ExampleJsunit.test.js')
\ No newline at end of file
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/config/ohos/rules.gni")
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("hjs_demo_test5") {
test_hap_name = "bmsJstest5.hap"
hap_source_path = "hap/bmsJstest5.hap"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"package": "ohos.acts.aafwk.ability",
"shell-timeout": "21600000"
},
"kits": [
{
"test-file-name": [
"AbilityDemo.hap",
"$module.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.napi_test_suite",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.napi_test_suite",
"name": ".MyApplication2",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.napi_test_suite.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"defPermissions": [
{
"name": "com.permission.CAMERA",
"grantMode": "system_grant",
"availableScope": ["signature"],
"label": "CAMERA permission",
"description": "CAMERA permission in detail"
},
{
"name": "com.permission.music",
"grantMode": "system_grant",
"availableScope": ["signature"],
"label": "music permission",
"description": "music permission in detail"
},
{
"name": "com.permission.WeChat",
"grantMode": "system_grant",
"availableScope": ["signature"],
"label": "WeChat permission",
"description": "WeChat permission in detail"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
import file from '@system.file'
import app from '@system.app'
import device from '@system.device'
import router from '@system.router'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
// const instrumentLog = new InstrumentLog({
// 'id': 'report'
// })
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
// core.addService('report', instrumentLog)
core.init()
// core.subscribeEvent('spec', instrumentLog)
// core.subscribeEvent('suite', instrumentLog)
// core.subscribeEvent('task', instrumentLog)
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
import app from '@system.app'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import demo from '@ohos.bundle_mgr'
describe('appInfoTest', function () {
it('getApplicationInfos_0300', 0, async function (done) {
var datainfo = await demo.getApplicationInfos(8, 0);
checkgetApplicationInfos(datainfo)
done();
})
function checkgetApplicationInfos(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].bundleName.length).assertLarger(0)
expect(datainfo[i].supportedModes).assertEqual(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) {
expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo[i].moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleInfos.length; j++) {
expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].codePath.length).assertLarger(0)
expect(datainfo[i].dataDir.length).assertLarger(0)
expect(datainfo[i].dataBaseDir.length).assertLarger(0)
expect(datainfo[i].cacheDir.length).assertLarger(0)
}
}
it('getApplicationInfos_0500', 0, async function (done) {
var datainfo = await demo.getApplicationInfos(8, 0);
checkgetApplicationInfos(datainfo)
done();
})
function checkgetApplicationInfos(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].bundleName.length).assertLarger(0)
expect(datainfo[i].supportedModes).assertEqual(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) {
expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo[i].moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleInfos.length; j++) {
expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].codePath.length).assertLarger(0)
expect(datainfo[i].dataDir.length).assertLarger(0)
expect(datainfo[i].dataBaseDir.length).assertLarger(0)
expect(datainfo[i].cacheDir.length).assertLarger(0)
}
}
it('getApplicationInfos_0800', 0, async function (done) {
await demo.getApplicationInfos(8, 0, OnReceiveEvent);
function OnReceiveEvent(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].bundleName.length).assertLarger(0)
expect(datainfo[i].supportedModes).assertEqual(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) {
expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo[i].moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleInfos.length; j++) {
expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].codePath.length).assertLarger(0)
expect(datainfo[i].dataDir.length).assertLarger(0)
expect(datainfo[i].dataBaseDir.length).assertLarger(0)
expect(datainfo[i].cacheDir.length).assertLarger(0)
}
}
done();
})
it('getApplicationInfos_1000', 0, async function (done) {
await demo.getApplicationInfos(8, 0, OnReceiveEvent);
function OnReceiveEvent(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].bundleName.length).assertLarger(0)
expect(datainfo[i].supportedModes).assertEqual(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) {
expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo[i].moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleInfos.length; j++) {
expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].codePath.length).assertLarger(0)
expect(datainfo[i].dataDir.length).assertLarger(0)
expect(datainfo[i].dataBaseDir.length).assertLarger(0)
expect(datainfo[i].cacheDir.length).assertLarger(0)
}
}
done();
})
it('getApplicationInfo_0300', 0, async function (done) {
var datainfo = await demo.getApplicationInfo('com.example.napi_test_suite', 8, 1);
checkgetApplicationInfo(datainfo)
done();
})
function checkgetApplicationInfo(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.supportedModes).assertEqual(0)
expect(datainfo.moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) {
expect(datainfo.moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleInfos.length; j++) {
expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo.entryDir.length).assertLarger(0)
expect(datainfo.codePath.length).assertLarger(0)
expect(datainfo.dataDir.length).assertLarger(0)
expect(datainfo.dataBaseDir.length).assertLarger(0)
expect(datainfo.cacheDir.length).assertLarger(0)
}
it('getApplicationInfo_0800', 0, async function (done) {
await demo.getApplicationInfo('com.example.napi_test_suite', 8, 1, OnReceiveEvent);
function OnReceiveEvent(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.supportedModes).assertEqual(0)
expect(datainfo.moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) {
expect(datainfo.moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleInfos.length; j++) {
expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo.entryDir.length).assertLarger(0)
expect(datainfo.codePath.length).assertLarger(0)
expect(datainfo.dataDir.length).assertLarger(0)
expect(datainfo.dataBaseDir.length).assertLarger(0)
expect(datainfo.cacheDir.length).assertLarger(0)
}
done();
})
it('getBundleInfos_0300', 0, async function () {
var data = await demo.getBundleInfos(8)
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].applicationInfo.name.length).assertLarger(0)
expect(data[i].applicationInfo.bundleName.length).assertLarger(0)
expect(data[i].hapModuleNames.length).assertLarger(0)
for (var j = 0; j < data[i].hapModuleNames.length; j++) {
expect(data[i].hapModuleNames[j].length).assertLarger(0)
}
expect(data[i].moduleNames.length).assertLarger(0)
for (var j = 0; j < data[i].moduleNames.length; j++) {
expect(data[i].moduleNames[j].length).assertLarger(0)
}
expect(data[i].modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
expect(data[i].modulePublicDirs[j].length).assertLarger(0)
}
expect(data[i].moduleDirs.length).assertLarger(0)
for (var j = 0; j < data[i].moduleDirs.length; j++) {
expect(data[i].moduleDirs[j].length).assertLarger(0)
}
expect(data[i].moduleResPaths.length).assertLarger(0)
for (var j = 0; j < data[i].moduleResPaths.length; j++) {
expect(data[i].moduleResPaths[j].length).assertLarger(0)
}
expect(data[i].abilityInfos.length).assertLarger(0)
for (var j = 0; j < data[i].abilityInfos.length; j++) {
expect(data[i].abilityInfos[j].name.length).assertLarger(0)
expect(data[i].abilityInfos[j].package.length).assertLarger(0)
}
}
})
it('getBundleInfos_0500', 0, async function () {
var data = await demo.getBundleInfos(8)
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].applicationInfo.name.length).assertLarger(0)
expect(data[i].applicationInfo.bundleName.length).assertLarger(0)
expect(data[i].hapModuleNames.length).assertLarger(0)
for (var j = 0; j < data[i].hapModuleNames.length; j++) {
expect(data[i].hapModuleNames[j].length).assertLarger(0)
}
expect(data[i].moduleNames.length).assertLarger(0)
for (var j = 0; j < data[i].moduleNames.length; j++) {
expect(data[i].moduleNames[j].length).assertLarger(0)
}
expect(data[i].modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
expect(data[i].modulePublicDirs[j].length).assertLarger(0)
}
expect(data[i].moduleDirs.length).assertLarger(0)
for (var j = 0; j < data[i].moduleDirs.length; j++) {
expect(data[i].moduleDirs[j].length).assertLarger(0)
}
expect(data[i].moduleResPaths.length).assertLarger(0)
for (var j = 0; j < data[i].moduleResPaths.length; j++) {
expect(data[i].moduleResPaths[j].length).assertLarger(0)
}
expect(data[i].abilityInfos.length).assertLarger(0)
for (var j = 0; j < data[i].abilityInfos.length; j++) {
expect(data[i].abilityInfos[j].name.length).assertLarger(0)
expect(data[i].abilityInfos[j].package.length).assertLarger(0)
}
}
})
it('getBundleInfos_0800', 0, async function () {
await demo.getBundleInfos(8, OnReceiveEvent)
function OnReceiveEvent(data) {
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].applicationInfo.name.length).assertLarger(0)
expect(data[i].applicationInfo.bundleName.length).assertLarger(0)
expect(data[i].hapModuleNames.length).assertLarger(0)
for (var j = 0; j < data[i].hapModuleNames.length; j++) {
expect(data[i].hapModuleNames[j].length).assertLarger(0)
}
expect(data[i].moduleNames.length).assertLarger(0)
for (var j = 0; j < data[i].moduleNames.length; j++) {
expect(data[i].moduleNames[j].length).assertLarger(0)
}
expect(data[i].modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
expect(data[i].modulePublicDirs[j].length).assertLarger(0)
}
expect(data[i].moduleDirs.length).assertLarger(0)
for (var j = 0; j < data[i].moduleDirs.length; j++) {
expect(data[i].moduleDirs[j].length).assertLarger(0)
}
expect(data[i].moduleResPaths.length).assertLarger(0)
for (var j = 0; j < data[i].moduleResPaths.length; j++) {
expect(data[i].moduleResPaths[j].length).assertLarger(0)
}
expect(data[i].abilityInfos.length).assertLarger(0)
for (var j = 0; j < data[i].abilityInfos.length; j++) {
expect(data[i].abilityInfos[j].name.length).assertLarger(0)
expect(data[i].abilityInfos[j].package.length).assertLarger(0)
}
}
}
})
it('getBundleInfos_1000', 0, async function () {
await demo.getBundleInfos(8, OnReceiveEvent)
function OnReceiveEvent(data) {
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].applicationInfo.name.length).assertLarger(0)
expect(data[i].applicationInfo.bundleName.length).assertLarger(0)
expect(data[i].hapModuleNames.length).assertLarger(0)
for (var j = 0; j < data[i].hapModuleNames.length; j++) {
expect(data[i].hapModuleNames[j].length).assertLarger(0)
}
expect(data[i].moduleNames.length).assertLarger(0)
for (var j = 0; j < data[i].moduleNames.length; j++) {
expect(data[i].moduleNames[j].length).assertLarger(0)
}
expect(data[i].modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
expect(data[i].modulePublicDirs[j].length).assertLarger(0)
}
expect(data[i].moduleDirs.length).assertLarger(0)
for (var j = 0; j < data[i].moduleDirs.length; j++) {
expect(data[i].moduleDirs[j].length).assertLarger(0)
}
expect(data[i].moduleResPaths.length).assertLarger(0)
for (var j = 0; j < data[i].moduleResPaths.length; j++) {
expect(data[i].moduleResPaths[j].length).assertLarger(0)
}
expect(data[i].abilityInfos.length).assertLarger(0)
for (var j = 0; j < data[i].abilityInfos.length; j++) {
expect(data[i].abilityInfos[j].name.length).assertLarger(0)
expect(data[i].abilityInfos[j].package.length).assertLarger(0)
}
}
}
})
it('getBundleInfo_0300', 0, async function (done) {
var info = await demo.getBundleManager()
var datainfo = await info.getBundleInfo('com.example.napi_test_suite', 1)
console.info('**************************getBundleInfo_01********************************')
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.minSdkVersion).assertEqual(0)
expect(datainfo.maxSdkVersion).assertEqual(0)
expect(datainfo.hapModuleNames.length).assertLarger(0)
for (var j = 0; j < datainfo.hapModuleNames.length; j++) {
expect(datainfo.hapModuleNames[j].length).assertLarger(0)
}
expect(datainfo.moduleNames.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleNames.length; j++) {
expect(datainfo.moduleNames[j].length).assertLarger(0)
}
expect(datainfo.modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.modulePublicDirs.length; j++) {
expect(datainfo.modulePublicDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleDirs.length; j++) {
expect(datainfo.moduleDirs[j].length).assertLarger(0)
}
done()
})
it('getBundleInfo_0800', 0, async function (done) {
var info = await demo.getBundleManager()
await info.getBundleInfo('com.example.napi_test_suite', 1, OnReceiveEvent)
function OnReceiveEvent(datainfo) {
console.info('**************************getBundleInfo_01********************************')
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.minSdkVersion).assertEqual(0)
expect(datainfo.maxSdkVersion).assertEqual(0)
expect(datainfo.hapModuleNames.length).assertLarger(0)
for (var j = 0; j < datainfo.hapModuleNames.length; j++) {
expect(datainfo.hapModuleNames[j].length).assertLarger(0)
}
expect(datainfo.moduleNames.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleNames.length; j++) {
expect(datainfo.moduleNames[j].length).assertLarger(0)
}
expect(datainfo.modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.modulePublicDirs.length; j++) {
expect(datainfo.modulePublicDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleDirs.length; j++) {
expect(datainfo.moduleDirs[j].length).assertLarger(0)
}
}
done()
})
it('getBundleArchiveInfo_0300', 0, async function (done) {
var info = await demo.getBundleManager()
var datainfo = await info.getBundleArchiveInfo('/data/abc2.hap', 1)
expect(datainfo.entryModuleName.length).assertLarger(0)
expect(datainfo.compatibleVersion).assertEqual(5)
expect(datainfo.targetVersion).assertEqual(5)
expect(datainfo.isKeepAlive).assertEqual(false)
expect(datainfo.isNativeApp).assertEqual(false)
expect(datainfo.hapModuleNames.length).assertLarger(0)
// for(var j = 0; j < datainfo.hapModuleNames.length; j++) {
// expect(datainfo.hapModuleNames[j].length).assertLarger(0)
// }
// expect(datainfo.moduleNames.length).assertLarger(0)
// for(var j = 0; j < datainfo.moduleNames.length; j++) {
// expect(datainfo.moduleNames[j].length).assertLarger(0)
// }
// expect(datainfo.modulePublicDirs.length).assertLarger(0)
// for(var j = 0; j < datainfo.modulePublicDirs.length; j++) {
// expect(datainfo.modulePublicDirs[j].length).assertLarger(0)
// }
// expect(datainfo.moduleDirs.length).assertLarger(0)
// for(var j = 0; j < datainfo.moduleDirs.length; j++) {
// expect(datainfo.moduleDirs[j].length).assertLarger(0)
// }
done()
})
it('getBundleArchiveInfo_0800', 0, async function (done) {
var info = await demo.getBundleManager()
await info.getBundleArchiveInfo('/data/abc2.hap', 1, OnReceiveEvent)
function OnReceiveEvent(datainfo) {
console.info('**************************getBundleInfo_01********************************')
expect(datainfo.entryModuleName.length).assertLarger(0)
expect(datainfo.compatibleVersion).assertEqual(5)
expect(datainfo.targetVersion).assertEqual(5)
expect(datainfo.isKeepAlive).assertEqual(false)
expect(datainfo.isNativeApp).assertEqual(false)
done()
}
})
it('queryAbilityByWant_0300', 0, async function (done) {
var info = await demo.getBundleManager()
var datainfo =
info.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "com.example.myapplicationInstall2",
abilityName: "com.example.myapplication.MainAbility",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
})
console.info('**************************queryAbilityByWant_01********************************')
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.iconPath.length).assertLarger(0)
expect(datainfo.visible.length).assertLarger(0)
expect(datainfo.kind.length).assertLarger(0)
expect(datainfo.package.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.moduleName.length).assertLarger(0)
expect(datainfo.applicationName.length).assertLarger(0)
expect(datainfo.resourcePath.length).assertLarger(0)
expect(datainfo.deviceTypes.length).assertLarger(0)
for (var j = 0; j < datainfo.deviceTypes.length; j++) {
expect(datainfo.deviceTypes[j].length).assertLarger(0)
}
expect(datainfo.deviceCapabilities.length).assertLarger(0)
for (var j = 0; j < datainfo.deviceCapabilities.length; j++) {
expect(datainfo.deviceCapabilities[j].length).assertLarger(0)
}
expect(datainfo.applicationInfo.name.length).assertLarger(0)
expect(datainfo.applicationInfo.bundleName.length).assertLarger(0)
done();
})
it('queryAbilityByWant_0800', 0, async function (done) {
var info = await demo.getBundleManager()
await info.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "com.example.myapplicationInstall2",
abilityName: "com.example.myapplication.MainAbility",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
}, OnReceiveEvent)
function OnReceiveEvent(datainfo) {
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.iconPath.length).assertLarger(0)
expect(datainfo.visible.length).assertLarger(0)
expect(datainfo.kind.length).assertLarger(0)
expect(datainfo.package.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.moduleName.length).assertLarger(0)
expect(datainfo.applicationName.length).assertLarger(0)
expect(datainfo.resourcePath.length).assertLarger(0)
expect(datainfo.deviceTypes.length).assertLarger(0)
for (var j = 0; j < datainfo.deviceTypes.length; j++) {
expect(datainfo.deviceTypes[j].length).assertLarger(0)
}
expect(datainfo.deviceCapabilities.length).assertLarger(0)
for (var j = 0; j < datainfo.deviceCapabilities.length; j++) {
expect(datainfo.deviceCapabilities[j].length).assertLarger(0)
}
expect(datainfo.applicationInfo.name.length).assertLarger(0)
expect(datainfo.applicationInfo.bundleName.length).assertLarger(0)
done()
}
})
it('install_0300', 0, async function (done) {
demo.getBundleInstaller().then((data) => {
data.install(['/data/abc4.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
data.install(['/data/abc5.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
data.install(['/data/abc6.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(infos) {
expect(typeof infos).assertEqual("object");
expect(infos.status).assertEqual(0);
expect(infos.statusMessage).assertEqual("SUCCESS");
}
});
done();
})
it('uninstall_0300', 0, async function (done) {
demo.getBundleInstaller().then((data) => {
data.uninstall('com.example.myapplication4', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
// data.uninstall('com.example.myapplication4', {
// param: {
// userId: 0,
// isKeepData: false
// }
// }, OnReceiveinstallEvent);
data.uninstall('com.example.myapplication5', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(data) {
expect(typeof data).assertEqual("object");
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
}
});
done();
})
})
\ No newline at end of file
require('./ExampleJsunit.test.js')
\ No newline at end of file
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/config/ohos/rules.gni")
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("hjs_demo_test6") {
test_hap_name = "bmsJstest6.hap"
hap_source_path = "hap/bmsJstest6.hap"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"package": "ohos.acts.aafwk.ability",
"shell-timeout": "21600000"
},
"kits": [
{
"test-file-name": [
"AbilityDemo.hap",
"$module.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
import file from '@system.file'
import app from '@system.app'
import device from '@system.device'
import router from '@system.router'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
// const instrumentLog = new InstrumentLog({
// 'id': 'report'
// })
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
// core.addService('report', instrumentLog)
core.init()
// core.subscribeEvent('spec', instrumentLog)
// core.subscribeEvent('suite', instrumentLog)
// core.subscribeEvent('task', instrumentLog)
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
import app from '@system.app'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import demo from '@ohos.bundle_mgr'
describe('appInfoTest', function () {
it('getApplicationInfos_0300', 0, async function (done) {
var datainfo = await demo.getApplicationInfos(8, 0);
checkgetApplicationInfos(datainfo)
done();
})
function checkgetApplicationInfos(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].bundleName.length).assertLarger(0)
expect(datainfo[i].supportedModes).assertEqual(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) {
expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo[i].moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleInfos.length; j++) {
expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].codePath.length).assertLarger(0)
expect(datainfo[i].dataDir.length).assertLarger(0)
expect(datainfo[i].dataBaseDir.length).assertLarger(0)
expect(datainfo[i].cacheDir.length).assertLarger(0)
}
}
it('getApplicationInfos_0500', 0, async function (done) {
var datainfo = await demo.getApplicationInfos(8, 0);
checkgetApplicationInfos(datainfo)
done();
})
function checkgetApplicationInfos(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].bundleName.length).assertLarger(0)
expect(datainfo[i].supportedModes).assertEqual(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) {
expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo[i].moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleInfos.length; j++) {
expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].codePath.length).assertLarger(0)
expect(datainfo[i].dataDir.length).assertLarger(0)
expect(datainfo[i].dataBaseDir.length).assertLarger(0)
expect(datainfo[i].cacheDir.length).assertLarger(0)
}
}
it('getApplicationInfos_0800', 0, async function (done) {
await demo.getApplicationInfos(8, 0, OnReceiveEvent);
function OnReceiveEvent(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].bundleName.length).assertLarger(0)
expect(datainfo[i].supportedModes).assertEqual(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) {
expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo[i].moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleInfos.length; j++) {
expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].codePath.length).assertLarger(0)
expect(datainfo[i].dataDir.length).assertLarger(0)
expect(datainfo[i].dataBaseDir.length).assertLarger(0)
expect(datainfo[i].cacheDir.length).assertLarger(0)
}
}
done();
})
it('getApplicationInfos_1000', 0, async function (done) {
await demo.getApplicationInfos(8, 0, OnReceiveEvent);
function OnReceiveEvent(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].bundleName.length).assertLarger(0)
expect(datainfo[i].supportedModes).assertEqual(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) {
expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo[i].moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo[i].moduleInfos.length; j++) {
expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].codePath.length).assertLarger(0)
expect(datainfo[i].dataDir.length).assertLarger(0)
expect(datainfo[i].dataBaseDir.length).assertLarger(0)
expect(datainfo[i].cacheDir.length).assertLarger(0)
}
}
done();
})
it('getApplicationInfo_0300', 0, async function (done) {
var datainfo = await demo.getApplicationInfo('com.example.napi_test_suite', 8, 1);
checkgetApplicationInfo(datainfo)
done();
})
function checkgetApplicationInfo(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.supportedModes).assertEqual(0)
expect(datainfo.moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) {
expect(datainfo.moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleInfos.length; j++) {
expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo.entryDir.length).assertLarger(0)
expect(datainfo.codePath.length).assertLarger(0)
expect(datainfo.dataDir.length).assertLarger(0)
expect(datainfo.dataBaseDir.length).assertLarger(0)
expect(datainfo.cacheDir.length).assertLarger(0)
}
it('getApplicationInfo_0800', 0, async function (done) {
await demo.getApplicationInfo('com.example.napi_test_suite3', 8, 1, OnReceiveEvent);
function OnReceiveEvent(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.supportedModes).assertEqual(0)
expect(datainfo.moduleSourceDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) {
expect(datainfo.moduleSourceDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleInfos.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleInfos.length; j++) {
expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0)
expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
expect(datainfo.entryDir.length).assertLarger(0)
expect(datainfo.codePath.length).assertLarger(0)
expect(datainfo.dataDir.length).assertLarger(0)
expect(datainfo.dataBaseDir.length).assertLarger(0)
expect(datainfo.cacheDir.length).assertLarger(0)
}
done();
})
it('getBundleInfos_0300', 0, async function () {
var data = await demo.getBundleInfos(8)
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].applicationInfo.name.length).assertLarger(0)
expect(data[i].applicationInfo.bundleName.length).assertLarger(0)
expect(data[i].hapModuleNames.length).assertLarger(0)
for (var j = 0; j < data[i].hapModuleNames.length; j++) {
expect(data[i].hapModuleNames[j].length).assertLarger(0)
}
expect(data[i].moduleNames.length).assertLarger(0)
for (var j = 0; j < data[i].moduleNames.length; j++) {
expect(data[i].moduleNames[j].length).assertLarger(0)
}
expect(data[i].modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
expect(data[i].modulePublicDirs[j].length).assertLarger(0)
}
expect(data[i].moduleDirs.length).assertLarger(0)
for (var j = 0; j < data[i].moduleDirs.length; j++) {
expect(data[i].moduleDirs[j].length).assertLarger(0)
}
expect(data[i].moduleResPaths.length).assertLarger(0)
for (var j = 0; j < data[i].moduleResPaths.length; j++) {
expect(data[i].moduleResPaths[j].length).assertLarger(0)
}
expect(data[i].abilityInfos.length).assertLarger(0)
for (var j = 0; j < data[i].abilityInfos.length; j++) {
expect(data[i].abilityInfos[j].name.length).assertLarger(0)
expect(data[i].abilityInfos[j].package.length).assertLarger(0)
}
}
})
it('getBundleInfos_0500', 0, async function () {
var data = await demo.getBundleInfos(8)
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].applicationInfo.name.length).assertLarger(0)
expect(data[i].applicationInfo.bundleName.length).assertLarger(0)
expect(data[i].hapModuleNames.length).assertLarger(0)
for (var j = 0; j < data[i].hapModuleNames.length; j++) {
expect(data[i].hapModuleNames[j].length).assertLarger(0)
}
expect(data[i].moduleNames.length).assertLarger(0)
for (var j = 0; j < data[i].moduleNames.length; j++) {
expect(data[i].moduleNames[j].length).assertLarger(0)
}
expect(data[i].modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
expect(data[i].modulePublicDirs[j].length).assertLarger(0)
}
expect(data[i].moduleDirs.length).assertLarger(0)
for (var j = 0; j < data[i].moduleDirs.length; j++) {
expect(data[i].moduleDirs[j].length).assertLarger(0)
}
expect(data[i].moduleResPaths.length).assertLarger(0)
for (var j = 0; j < data[i].moduleResPaths.length; j++) {
expect(data[i].moduleResPaths[j].length).assertLarger(0)
}
expect(data[i].abilityInfos.length).assertLarger(0)
for (var j = 0; j < data[i].abilityInfos.length; j++) {
expect(data[i].abilityInfos[j].name.length).assertLarger(0)
expect(data[i].abilityInfos[j].package.length).assertLarger(0)
}
}
})
it('getBundleInfos_0800', 0, async function () {
await demo.getBundleInfos(8, OnReceiveEvent)
function OnReceiveEvent(data) {
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].applicationInfo.name.length).assertLarger(0)
expect(data[i].applicationInfo.bundleName.length).assertLarger(0)
expect(data[i].hapModuleNames.length).assertLarger(0)
for (var j = 0; j < data[i].hapModuleNames.length; j++) {
expect(data[i].hapModuleNames[j].length).assertLarger(0)
}
expect(data[i].moduleNames.length).assertLarger(0)
for (var j = 0; j < data[i].moduleNames.length; j++) {
expect(data[i].moduleNames[j].length).assertLarger(0)
}
expect(data[i].modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
expect(data[i].modulePublicDirs[j].length).assertLarger(0)
}
expect(data[i].moduleDirs.length).assertLarger(0)
for (var j = 0; j < data[i].moduleDirs.length; j++) {
expect(data[i].moduleDirs[j].length).assertLarger(0)
}
expect(data[i].moduleResPaths.length).assertLarger(0)
for (var j = 0; j < data[i].moduleResPaths.length; j++) {
expect(data[i].moduleResPaths[j].length).assertLarger(0)
}
expect(data[i].abilityInfos.length).assertLarger(0)
for (var j = 0; j < data[i].abilityInfos.length; j++) {
expect(data[i].abilityInfos[j].name.length).assertLarger(0)
expect(data[i].abilityInfos[j].package.length).assertLarger(0)
}
}
}
})
it('getBundleInfos_1000', 0, async function () {
await demo.getBundleInfos(8, OnReceiveEvent)
function OnReceiveEvent(data) {
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].applicationInfo.name.length).assertLarger(0)
expect(data[i].applicationInfo.bundleName.length).assertLarger(0)
expect(data[i].hapModuleNames.length).assertLarger(0)
for (var j = 0; j < data[i].hapModuleNames.length; j++) {
expect(data[i].hapModuleNames[j].length).assertLarger(0)
}
expect(data[i].moduleNames.length).assertLarger(0)
for (var j = 0; j < data[i].moduleNames.length; j++) {
expect(data[i].moduleNames[j].length).assertLarger(0)
}
expect(data[i].modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
expect(data[i].modulePublicDirs[j].length).assertLarger(0)
}
expect(data[i].moduleDirs.length).assertLarger(0)
for (var j = 0; j < data[i].moduleDirs.length; j++) {
expect(data[i].moduleDirs[j].length).assertLarger(0)
}
expect(data[i].moduleResPaths.length).assertLarger(0)
for (var j = 0; j < data[i].moduleResPaths.length; j++) {
expect(data[i].moduleResPaths[j].length).assertLarger(0)
}
expect(data[i].abilityInfos.length).assertLarger(0)
for (var j = 0; j < data[i].abilityInfos.length; j++) {
expect(data[i].abilityInfos[j].name.length).assertLarger(0)
expect(data[i].abilityInfos[j].package.length).assertLarger(0)
}
}
}
})
it('getBundleInfo_0300', 0, async function (done) {
var info = await demo.getBundleManager()
var datainfo = await info.getBundleInfo('com.example.napi_test_suite3', 1)
console.info('**************************getBundleInfo_01********************************')
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.minSdkVersion).assertEqual(0)
expect(datainfo.maxSdkVersion).assertEqual(0)
expect(datainfo.hapModuleNames.length).assertLarger(0)
for (var j = 0; j < datainfo.hapModuleNames.length; j++) {
expect(datainfo.hapModuleNames[j].length).assertLarger(0)
}
expect(datainfo.moduleNames.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleNames.length; j++) {
expect(datainfo.moduleNames[j].length).assertLarger(0)
}
expect(datainfo.modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.modulePublicDirs.length; j++) {
expect(datainfo.modulePublicDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleDirs.length; j++) {
expect(datainfo.moduleDirs[j].length).assertLarger(0)
}
done()
})
it('getBundleInfo_0800', 0, async function (done) {
var info = await demo.getBundleManager()
await info.getBundleInfo('com.example.napi_test_suite3', 1, OnReceiveEvent)
function OnReceiveEvent(datainfo) {
console.info('**************************getBundleInfo_01********************************')
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.minSdkVersion).assertEqual(0)
expect(datainfo.maxSdkVersion).assertEqual(0)
expect(datainfo.hapModuleNames.length).assertLarger(0)
for (var j = 0; j < datainfo.hapModuleNames.length; j++) {
expect(datainfo.hapModuleNames[j].length).assertLarger(0)
}
expect(datainfo.moduleNames.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleNames.length; j++) {
expect(datainfo.moduleNames[j].length).assertLarger(0)
}
expect(datainfo.modulePublicDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.modulePublicDirs.length; j++) {
expect(datainfo.modulePublicDirs[j].length).assertLarger(0)
}
expect(datainfo.moduleDirs.length).assertLarger(0)
for (var j = 0; j < datainfo.moduleDirs.length; j++) {
expect(datainfo.moduleDirs[j].length).assertLarger(0)
}
}
done()
})
it('getBundleArchiveInfo_0300', 0, async function (done) {
var info = await demo.getBundleManager()
var datainfo = await info.getBundleArchiveInfo('/data/abc2.hap', 1)
expect(datainfo.entryModuleName.length).assertLarger(0)
expect(datainfo.compatibleVersion).assertEqual(5)
expect(datainfo.targetVersion).assertEqual(5)
expect(datainfo.isKeepAlive).assertEqual(false)
expect(datainfo.isNativeApp).assertEqual(false)
expect(datainfo.hapModuleNames.length).assertLarger(0)
// for(var j = 0; j < datainfo.hapModuleNames.length; j++) {
// expect(datainfo.hapModuleNames[j].length).assertLarger(0)
// }
// expect(datainfo.moduleNames.length).assertLarger(0)
// for(var j = 0; j < datainfo.moduleNames.length; j++) {
// expect(datainfo.moduleNames[j].length).assertLarger(0)
// }
// expect(datainfo.modulePublicDirs.length).assertLarger(0)
// for(var j = 0; j < datainfo.modulePublicDirs.length; j++) {
// expect(datainfo.modulePublicDirs[j].length).assertLarger(0)
// }
// expect(datainfo.moduleDirs.length).assertLarger(0)
// for(var j = 0; j < datainfo.moduleDirs.length; j++) {
// expect(datainfo.moduleDirs[j].length).assertLarger(0)
// }
done()
})
it('getBundleArchiveInfo_0800', 0, async function (done) {
var info = await demo.getBundleManager()
await info.getBundleArchiveInfo('/data/abc2.hap', 1, OnReceiveEvent)
function OnReceiveEvent(datainfo) {
console.info('**************************getBundleInfo_01********************************')
expect(datainfo.entryModuleName.length).assertLarger(0)
expect(datainfo.compatibleVersion).assertEqual(5)
expect(datainfo.targetVersion).assertEqual(5)
expect(datainfo.isKeepAlive).assertEqual(false)
expect(datainfo.isNativeApp).assertEqual(false)
done()
}
})
it('queryAbilityByWant_0300', 0, async function (done) {
var info = await demo.getBundleManager()
var datainfo =
info.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "com.example.myapplicationInstall2",
abilityName: "com.example.myapplication.MainAbility",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
})
console.info('**************************queryAbilityByWant_01********************************')
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.iconPath.length).assertLarger(0)
expect(datainfo.visible.length).assertLarger(0)
expect(datainfo.kind.length).assertLarger(0)
expect(datainfo.package.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.moduleName.length).assertLarger(0)
expect(datainfo.applicationName.length).assertLarger(0)
expect(datainfo.resourcePath.length).assertLarger(0)
expect(datainfo.deviceTypes.length).assertLarger(0)
for (var j = 0; j < datainfo.deviceTypes.length; j++) {
expect(datainfo.deviceTypes[j].length).assertLarger(0)
}
expect(datainfo.deviceCapabilities.length).assertLarger(0)
for (var j = 0; j < datainfo.deviceCapabilities.length; j++) {
expect(datainfo.deviceCapabilities[j].length).assertLarger(0)
}
expect(datainfo.applicationInfo.name.length).assertLarger(0)
expect(datainfo.applicationInfo.bundleName.length).assertLarger(0)
done();
})
it('queryAbilityByWant_0800', 0, async function (done) {
var info = await demo.getBundleManager()
await info.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "com.example.myapplicationInstall2",
abilityName: "com.example.myapplication.MainAbility",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
}, OnReceiveEvent)
function OnReceiveEvent(datainfo) {
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.iconPath.length).assertLarger(0)
expect(datainfo.visible.length).assertLarger(0)
expect(datainfo.kind.length).assertLarger(0)
expect(datainfo.package.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.moduleName.length).assertLarger(0)
expect(datainfo.applicationName.length).assertLarger(0)
expect(datainfo.resourcePath.length).assertLarger(0)
expect(datainfo.deviceTypes.length).assertLarger(0)
for (var j = 0; j < datainfo.deviceTypes.length; j++) {
expect(datainfo.deviceTypes[j].length).assertLarger(0)
}
expect(datainfo.deviceCapabilities.length).assertLarger(0)
for (var j = 0; j < datainfo.deviceCapabilities.length; j++) {
expect(datainfo.deviceCapabilities[j].length).assertLarger(0)
}
expect(datainfo.applicationInfo.name.length).assertLarger(0)
expect(datainfo.applicationInfo.bundleName.length).assertLarger(0)
done()
}
})
it('install_0300', 0, async function (done) {
demo.getBundleInstaller().then((data) => {
data.install(['/data/abc4.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
data.install(['/data/abc5.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
data.install(['/data/abc6.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(infos) {
expect(typeof infos).assertEqual("object");
expect(infos.status).assertEqual(0);
expect(infos.statusMessage).assertEqual("SUCCESS");
}
});
done();
})
it('uninstall_0300', 0, async function (done) {
demo.getBundleInstaller().then((data) => {
data.uninstall('com.example.myapplication4', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
// data.uninstall('com.example.myapplication4', {
// param: {
// userId: 0,
// isKeepData: false
// }
// }, OnReceiveinstallEvent);
data.uninstall('com.example.myapplication5', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(data) {
expect(typeof data).assertEqual("object");
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS");
}
});
done();
})
})
\ No newline at end of file
require('./ExampleJsunit.test.js')
\ No newline at end of file
......@@ -13,7 +13,10 @@
import("//build/config/ohos/rules.gni")
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("hjs_demo_test4") {
test_hap_name = "bmsJstest4.hap"
hap_source_path = "hap/bmsJstest4.hap"
ohos_js_hap_suite("ActsBundleManagerTest") {
test_hap_name = "ActsBundleManagerTest"
hap_source_path = "hap/napi_test_suite_scene1.hap"
hap_source_path = "hap/napi_test_suite_scene2.hap"
hap_source_path = "hap/napi_test_suite_scene3.hap"
hap_source_path = "hap/napi_test_suite_scene4.hap"
}
\ No newline at end of file
......@@ -3,13 +3,13 @@
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"package": "ohos.acts.aafwk.ability",
"package": "ohos.acts.appexecfwk.bundlemanager",
"shell-timeout": "21600000"
},
"kits": [
{
"test-file-name": [
"AbilityDemo.hap",
"BundleManagerDemo.hap",
"$module.hap"
],
"type": "AppInstallKit",
......
......@@ -18,17 +18,9 @@ export default {
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
// const instrumentLog = new InstrumentLog({
// 'id': 'report'
// })
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
// core.addService('report', instrumentLog)
core.init()
// core.subscribeEvent('spec', instrumentLog)
// core.subscribeEvent('suite', instrumentLog)
// core.subscribeEvent('task', instrumentLog)
const configService = core.getDefaultService('config')
configService.setConfig(this)
......
import app from '@system.app'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import demo from '@ohos.bundle'
describe('appInfoTest', function () {
it('getApplicationInfos_0100', 0, async function (done) {
var datainfo = await demo.getApplicationInfos(8, 0)
checkgetApplicationInfos(datainfo)
done()
})
function checkgetApplicationInfos(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].description.length).assertLarger(0)
expect(datainfo[i].icon.length).assertLarger(0)
expect(datainfo[i].label.length).assertLarger(0)
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
expect(datainfo[i].moduleInfos.length).assertLarger(0)
}
}
it('getApplicationInfos_0600', 0, async function (done) {
await demo.getApplicationInfos(8, 0, (error, datainfo) => {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].description.length).assertLarger(0)
expect(datainfo[i].icon.length).assertLarger(0)
expect(datainfo[i].label.length).assertLarger(0)
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
expect(datainfo[i].moduleInfos.length).assertLarger(0)
}
});
done()
})
it('getApplicationInfo_0100', 0, async function (done) {
var datainfo = await demo.getApplicationInfo('com.example.myapplication1', 8, 1)
expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.icon.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.entryDir.length).assertLarger(0)
expect(datainfo.moduleSourceDirs.length).assertLarger(0)
expect(datainfo.moduleInfos.length).assertLarger(0)
done()
})
it('getApplicationInfo_0600', 0, async function (done) {
await demo.getApplicationInfo('com.example.myapplication1', 8, 1, (error, datainfo) => {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.icon.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.entryDir.length).assertLarger(0)
expect(datainfo.moduleSourceDirs.length).assertLarger(0)
expect(datainfo.moduleInfos.length).assertLarger(0)
})
done()
})
it('getBundleInfos_0100', 0, async function () {
var data = await demo.getBundleInfos(8)
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].entryModuleName.length).assertLarger(0)
expect(typeof data[i].appInfo).assertEqual("object")
expect(data[i].abilityInfos.length).assertLarger(0)
}
})
it('getBundleInfos_0600', 0, async function () {
await demo.getBundleInfos(8, (error, datainfo) => {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].entryModuleName.length).assertLarger(0)
expect(typeof datainfo[i].appInfo).assertEqual("object")
expect(datainfo[i].abilityInfos.length).assertLarger(0)
}
})
})
it('getApplicationInfo_0400', 0, async function (done) {
var datainfo = await demo.getApplicationInfo('com.example.napi_test_suitee', 8, 1)
checkgetApplicationInfoe(datainfo)
done()
})
function checkgetApplicationInfoe(datainfo) {
expect(datainfo.name.length).assertEqual(0)
}
it('getApplicationInfo_0500', 0, async function (done) {
await demo.getApplicationInfo('', 8, 1, (error, datainfo) => {
expect(datainfo.name.length).assertEqual(0)
})
done()
})
it('getApplicationInfo_0900', 0, async function (done) {
await demo.getApplicationInfo('com.example.napi_test_suitee', 8, 1, (error, datainfo) => {
expect(datainfo.name.length).assertEqual(0)
})
done()
})
it('getApplicationInfo_1000', 0, async function (done) {
await demo.getApplicationInfo('', 8, 1, (error, datainfo) => {
expect(datainfo.name.length).assertEqual(0)
})
done()
})
})
\ No newline at end of file
......@@ -18,17 +18,9 @@ export default {
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
// const instrumentLog = new InstrumentLog({
// 'id': 'report'
// })
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
// core.addService('report', instrumentLog)
core.init()
// core.subscribeEvent('spec', instrumentLog)
// core.subscribeEvent('suite', instrumentLog)
// core.subscribeEvent('task', instrumentLog)
const configService = core.getDefaultService('config')
configService.setConfig(this)
......
import app from '@system.app'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import demo from '@ohos.bundle'
describe('appInfoTest', function () {
it('getApplicationInfos_0200', 0, async function (done) {
var datainfo = await demo.getApplicationInfos(8, 0)
checkgetApplicationInfos(datainfo)
done()
})
function checkgetApplicationInfos(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].description.length).assertLarger(0)
expect(datainfo[i].icon.length).assertLarger(0)
expect(datainfo[i].label.length).assertLarger(0)
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
expect(datainfo[i].moduleInfos.length).assertLarger(0)
}
}
it('getApplicationInfos_0400', 0, async function (done) {
var datainfo = await demo.getApplicationInfos(8, 0)
checkgetApplicationInfos(datainfo)
done()
})
function checkgetApplicationInfos(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].description.length).assertLarger(0)
expect(datainfo[i].icon.length).assertLarger(0)
expect(datainfo[i].label.length).assertLarger(0)
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
expect(datainfo[i].moduleInfos.length).assertLarger(0)
}
}
it('getApplicationInfos_0700', 0, async function (done) {
await demo.getApplicationInfos(8, 0, (error, datainfo) => {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].description.length).assertLarger(0)
expect(datainfo[i].icon.length).assertLarger(0)
expect(datainfo[i].label.length).assertLarger(0)
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
expect(datainfo[i].moduleInfos.length).assertLarger(0)
}
});
done()
})
it('getApplicationInfos_0900', 0, async function (done) {
await demo.getApplicationInfos(8, 0, (error, datainfo) => {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].description.length).assertLarger(0)
expect(datainfo[i].icon.length).assertLarger(0)
expect(datainfo[i].label.length).assertLarger(0)
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
expect(datainfo[i].moduleInfos.length).assertLarger(0)
}
});
done()
})
it('getBundleInfos_0200', 0, async function () {
var data = await demo.getBundleInfos(8)
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].entryModuleName.length).assertLarger(0)
expect(typeof data[i].appInfo).assertEqual("object")
expect(data[i].abilityInfos.length).assertLarger(0)
}
})
it('getBundleInfos_0400', 0, async function () {
var data = await demo.getBundleInfos(8)
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].entryModuleName.length).assertLarger(0)
expect(typeof data[i].appInfo).assertEqual("object")
expect(data[i].abilityInfos.length).assertLarger(0)
}
})
it('getBundleInfos_0700', 0, async function () {
await demo.getBundleInfos(8, (error, datainfo) => {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].entryModuleName.length).assertLarger(0)
expect(typeof datainfo[i].appInfo).assertEqual("object")
expect(datainfo[i].abilityInfos.length).assertLarger(0)
}
})
})
it('getBundleInfos_0900', 0, async function () {
await demo.getBundleInfos(8, (error, datainfo) => {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].entryModuleName.length).assertLarger(0)
expect(typeof datainfo[i].appInfo).assertEqual("object")
expect(datainfo[i].abilityInfos.length).assertLarger(0)
}
})
})
it('getApplicationInfo_0200', 0, async function (done) {
var datainfo = await demo.getApplicationInfo('com.example.myapplication1', 8, 1)
expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.icon.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.entryDir.length).assertLarger(0)
expect(datainfo.moduleSourceDirs.length).assertLarger(0)
expect(datainfo.moduleInfos.length).assertLarger(0)
done()
})
it('getApplicationInfo_0700', 0, async function (done) {
await demo.getApplicationInfo('com.example.myapplication1', 8, 1, (error, datainfo) => {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.icon.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.entryDir.length).assertLarger(0)
expect(datainfo.moduleSourceDirs.length).assertLarger(0)
expect(datainfo.moduleInfos.length).assertLarger(0)
})
done()
})
})
\ No newline at end of file
......@@ -18,17 +18,9 @@ export default {
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
// const instrumentLog = new InstrumentLog({
// 'id': 'report'
// })
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
// core.addService('report', instrumentLog)
core.init()
// core.subscribeEvent('spec', instrumentLog)
// core.subscribeEvent('suite', instrumentLog)
// core.subscribeEvent('task', instrumentLog)
const configService = core.getDefaultService('config')
configService.setConfig(this)
......
import app from '@system.app'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import demo from '@ohos.bundle'
describe('appInfoTest', function () {
it('getApplicationInfos_0300', 0, async function (done) {
var datainfo = await demo.getApplicationInfos(8, 0)
checkgetApplicationInfos(datainfo)
done()
})
function checkgetApplicationInfos(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].description.length).assertLarger(0)
expect(datainfo[i].icon.length).assertLarger(0)
expect(datainfo[i].label.length).assertLarger(0)
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
expect(datainfo[i].moduleInfos.length).assertLarger(0)
}
}
it('getApplicationInfos_0500', 0, async function (done) {
var datainfo = await demo.getApplicationInfos(8, 0)
checkgetApplicationInfos(datainfo)
done()
})
function checkgetApplicationInfos(datainfo) {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].description.length).assertLarger(0)
expect(datainfo[i].icon.length).assertLarger(0)
expect(datainfo[i].label.length).assertLarger(0)
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
expect(datainfo[i].moduleInfos.length).assertLarger(0)
}
}
it('getApplicationInfos_0800', 0, async function (done) {
await demo.getApplicationInfos(8, 0, (error, datainfo) => {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].description.length).assertLarger(0)
expect(datainfo[i].icon.length).assertLarger(0)
expect(datainfo[i].label.length).assertLarger(0)
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
expect(datainfo[i].moduleInfos.length).assertLarger(0)
}
});
done()
})
it('getApplicationInfos_1000', 0, async function (done) {
await demo.getApplicationInfos(8, 0, (error, datainfo) => {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].description.length).assertLarger(0)
expect(datainfo[i].icon.length).assertLarger(0)
expect(datainfo[i].label.length).assertLarger(0)
expect(datainfo[i].entryDir.length).assertLarger(0)
expect(datainfo[i].moduleSourceDirs.length).assertLarger(0)
expect(datainfo[i].moduleInfos.length).assertLarger(0)
}
});
done()
})
it('getBundleInfos_0300', 0, async function () {
var data = await demo.getBundleInfos(8)
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].entryModuleName.length).assertLarger(0)
expect(typeof data[i].appInfo).assertEqual("object")
expect(data[i].abilityInfos.length).assertLarger(0)
}
})
it('getBundleInfos_0500', 0, async function () {
var data = await demo.getBundleInfos(8)
expect(typeof data).assertEqual("object")
expect(data.length).assertLarger(0)
for (var i = 0; i < data.length; i++) {
expect(data[i].name.length).assertLarger(0)
expect(data[i].entryModuleName.length).assertLarger(0)
expect(typeof data[i].appInfo).assertEqual("object")
expect(data[i].abilityInfos.length).assertLarger(0)
}
})
it('getBundleInfos_0800', 0, async function () {
await demo.getBundleInfos(8, (error, datainfo) => {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].entryModuleName.length).assertLarger(0)
expect(typeof datainfo[i].appInfo).assertEqual("object")
expect(datainfo[i].abilityInfos.length).assertLarger(0)
}
})
})
it('getBundleInfos_1000', 0, async function () {
await demo.getBundleInfos(8, (error, datainfo) => {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.length).assertLarger(0)
for (var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].name.length).assertLarger(0)
expect(datainfo[i].entryModuleName.length).assertLarger(0)
expect(typeof datainfo[i].appInfo).assertEqual("object")
expect(datainfo[i].abilityInfos.length).assertLarger(0)
}
})
})
it('getApplicationInfo_0300', 0, async function (done) {
var datainfo = await demo.getApplicationInfo('com.example.myapplication1', 8, 1)
expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.icon.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.entryDir.length).assertLarger(0)
expect(datainfo.moduleSourceDirs.length).assertLarger(0)
expect(datainfo.moduleInfos.length).assertLarger(0)
done()
})
it('getApplicationInfo_0800', 0, async function (done) {
await demo.getApplicationInfo('com.example.myapplication1', 8, 1, (error, datainfo) => {
expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.icon.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.entryDir.length).assertLarger(0)
expect(datainfo.moduleSourceDirs.length).assertLarger(0)
expect(datainfo.moduleInfos.length).assertLarger(0)
})
done()
})
})
\ No newline at end of file
{
"app": {
"bundleName": "com.example.myapplication1",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.myapplication1",
"name": ".MyApplication1",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": ".MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "standard",
"language": "C++"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
export default {
onCreate() {
console.info('AceApplication onCreate start');
//console.info('AceApplication onCreate add ' + demo.add(123,456));
//console.info('AceApplication onCreate getApplicationInfos ' + demo.getApplicationInfos(0,0));
//demo.getApplicationInfosPromise().then(function (data) {console.info('AceApplication onCreate GetApplicationInfosPromise');});
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
transform: translate(-10px,-10px);
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
<text class="title" style="transform : translate({{x}}px,{{y}}px);">
{{title}}
</text>
</div>
import demo from '@ohos.bundle'
export default {
data: {
title: "AI",
realHrValue: 0,
x: 0,
y: 100,
d: ","
},
onInit() {
this.title = this.$t('strings.world');
console.log("BmsApplication test for ams");
this.updateTime();
this.timer = setInterval(this.updateTime, 17)
},
updateTime: function () {
},
onDestroy() {
clearInterval(this.timer)
}
}
//
//import {Core} from 'deccjsunit/lite'
//const core=Core.getInstance()
//core.init()
//require('../../../test/List.test.js')
//core.execute()
import demo from '@ohos.bundle'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
console.log("BmsApplication test for ams");
demo.getBundleInstaller().then((data) => {
data.install(['/data/test1.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err,data) {
console.info("==============================install async install1==============================");
console.info("neu========================name: for begin");
console.info("neu========================install result code:" + err.code);
console.info("neu========================install result code:" + data.status);
console.info("neu========================install result msg:" + data.statusMessage);
}
});
demo.getBundleInstaller().then((data) => {
data.install(['/data/test.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err,data) {
console.info("==============================install async install2==============================");
console.info("neu========================name: for begin");
console.info("neu========================install result code:" + err.code);
console.info("neu========================install result code:" + data.status);
console.info("neu========================install result msg:" + data.statusMessage);
}
});
demo.getBundleInstaller().then((data) => {
data.uninstall('com.example.myapplicationInstall3', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err,data) {
console.info("==============================uninstall async uninstall==============================");
console.info("neu========================name: for begin");
console.info("neu========================uninstall result code:" + err.code);
console.info("neu========================uninstall result code:" + data.status);
console.info("neu========================uninstall result msg:" + data.statusMessage);
}
});
demo.getBundleInfos(8, OnReceiveEvent1);
function OnReceiveEvent1(err,data) {
console.info("neuXXXXXXXgetBundleInfosXXXXXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================data.length:" + data.length);
for (var i = 0; i < data.length; i++) {
console.info("neu========================data[i].name.length:" + data[i].name.length);
console.info("neu========================data[i].appInfo.name.length" + data[i].appInfo.name.length);
console.info("neu========================data[i].hapModuleInfos.length" + data[i].hapModuleInfos.length);
for (var j = 0; j < data[i].hapModuleInfos.length; j++) {
console.info("neu========================data[i].hapModuleInfos[j].length" + data[i].hapModuleInfos[j].length);
}
console.info("neu========================data[i].abilityInfos.length" + data[i].abilityInfos.length);
for (var j = 0; j < data[i].abilityInfos.length; j++) {
console.info("neu========================data[i].abilityInfos[j].name.length" + data[i].abilityInfos[j].name.length);
}
}
}
demo.getBundleInfo('com.example.myapplication',1,OnReceiveEvent2);
function OnReceiveEvent2(err,data) {
console.info("neuXXXXgetBundleInfoXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================err.code:" + err.code);
console.info("neu========================data.name:::" + data.name);
}
demo.getApplicationInfos(8, 0, OnReceiveEvent3);
function OnReceiveEvent3(err,datainfo) {
console.info("neuXXXXXXXgetApplicationInfosXXXXXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================datainfo.length:::" + datainfo.length);
for (var i = 0; i < datainfo.length; i++) {
console.info("neu========================datainfo[i].name" + datainfo[i].name);
}
}
demo.getApplicationInfo('com.example.myapplication', 8, 1, OnReceiveEvent4);
function OnReceiveEvent4(err,datainfo) {
console.info("neu========================err.code:" + err.code);
console.info("neuXXXXXXgetApplicationInfoXXXXXXX.name: for begin");
console.info("neu========================ddatainfo.name:::" + datainfo.name);
}
demo.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
},OnReceiveEvent5);
function OnReceiveEvent5(err,datainfo) {
console.info("neuXXXXXXqueryAbilityByWantXXXXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================datainfo.name:" + datainfo.name);
}
demo.getPermissionDef("com.permission.CAMERA",OnReceiveEvent6);
function OnReceiveEvent6(err,data) {
console.info('**************************getPermissionDef********************************');
console.info("neu========================err.code:" + err.code);
console.info("neu========================permissionName:" + data.permissionName);
}
demo.getBundleArchiveInfo('/data/test.hap',OnReceiveEvent7);
function OnReceiveEvent7(err,data) {
console.info('**************************getBundleArchiveInfo********************************');
console.info("neu========================err.code:" + err.code);
console.info("neu========================name:" + data.name);
}
}
}
//import abilitymanager from '@ohos.napi_ability_manager2'
//console.log('**************************getApplicationInfos********************************');
//describe('AbilityManagerTest', function () {
// it('get_all_running_processes_test_001', 0, function () {
//// var promise = abilitymanager.getAllRunningProcesses();
//// expect(typeof(promise)).zassertEqual("object");
// console.log('**************************getApplicationInfos********************************');
//// demo.getApplicationInfos().then((data) => {
//// console.info('**************************getApplicationInfos********************************');
//// console.info('xxx getApplicationInfos data length [' + data.length + ']');
//// for (var i = 0; i < data.length; i++) {
//// console.info("neu========================index[" + i + "].name: for begin");
//// console.info("neu========================index[" + i + "].name:" + data[i].name);
//// console.info("neu========================index[" + i + "].bundleName:" + data[i].bundleName);
//// console.info("neu========================index[" + i + "].description:" + data[i].description);
//// console.info("neu========================index[" + i + "].descriptionId:" + data[i].descriptionId);
//// console.info("neu========================index[" + i + "].iconPath:" + data[i].iconPath);
//// console.info("neu========================index[" + i + "].iconId:" + data[i].iconId);
//// console.info("neu========================index[" + i + "].label:" + data[i].label);
//// console.info("neu========================index[" + i + "].labelId:" + data[i].labelId);
//// console.info("neu========================index[" + i + "].deviceId:" + data[i].deviceId);
//// console.info("neu========================index[" + i + "].signatureKey:" + data[i].signatureKey);
//// console.info("neu========================index[" + i + "].process:" + data[i].process);
//// console.info("neu========================index[" + i + "].isSystemApp:" + data[i].isSystemApp);
//// console.info("neu========================index[" + i + "].isLauncherApp:" + data[i].isLauncherApp);
//// console.info("neu========================index[" + i + "].supportedModes:" + data[i].supportedModes);
////
//// console.info('getApplicationInfosAsync permissions length [' + data[i].permissions.length + ']');
//// for(var j = 0; j < data[i].permissions.length; j++) {
//// console.info("neu====================index[" + i + "]permissions[" + j + "]:" + data[i].permissions[j]);
//// }
//// console.info('getApplicationInfosAsync moduleSourceDirs length [' + data[i].moduleSourceDirs.length + ']');
//// for(var j = 0; j < data[i].moduleSourceDirs.length; j++) {
//// console.info("neu====================index[" + i + "]moduleSourceDirs[" + j + "]:" + data[i].moduleSourceDirs[j]);
//// }
//// console.info('getApplicationInfosAsync moduleInfos length [' + data[i].moduleInfos.length + ']');
//// for(var j = 0; j < data[i].moduleInfos.length; j++) {
//// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleName:" + data[i].moduleInfos[j].moduleName);
//// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleSourceDir:" + data[i].moduleInfos[j].moduleSourceDir);
//// }
//// console.info("neu========================index[" + i + "].entryDir:" + data[i].entryDir);
//// console.info("neu========================index[" + i + "].codePath:" + data[i].codePath);
//// console.info("neu========================index[" + i + "].dataDir:" + data[i].dataDir);
//// console.info("neu========================index[" + i + "].dataBaseDir:" + data[i].dataBaseDir);
//// console.info("neu========================index[" + i + "].cacheDir:" + data[i].cacheDir);
//// }
//// });
//
//
// })
//// it('get_all_running_processes_test_002', 0, async function (done) {
//// var info = await abilitymanager.getAllRunningProcesses();
//// expect(info[0].processName.length).assertLarger(0);
//// done();
//// })
//})
//import demo from '@ohos.bundle_mgr'
//
//describe('appInfoTest', function () {
//
// it('app_info_test_001', 0, function () {
//
//
// demo.getApplicationInfos(8, 0).then((data) => {
// console.info('**************************getApplicationInfos1********************************');
// console.info('xxx getApplicationInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].bundleName:" + data[i].bundleName);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].descriptionId:" + data[i].descriptionId);
// console.info("neu========================index[" + i + "].iconPath:" + data[i].iconPath);
// console.info("neu========================index[" + i + "].iconId:" + data[i].iconId);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].labelId:" + data[i].labelId);
// console.info("neu========================index[" + i + "].deviceId:" + data[i].deviceId);
// console.info("neu========================index[" + i + "].signatureKey:" + data[i].signatureKey);
// console.info("neu========================index[" + i + "].process:" + data[i].process);
// console.info("neu========================index[" + i + "].isSystemApp:" + data[i].isSystemApp);
// console.info("neu========================index[" + i + "].isLauncherApp:" + data[i].isLauncherApp);
// console.info("neu========================index[" + i + "].supportedModes:" + data[i].supportedModes);
//
// console.info('getApplicationInfosAsync permissions length [' + data[i].permissions.length + ']');
// for (var j = 0; j < data[i].permissions.length; j++) {
// console.info("neu====================index[" + i + "]permissions[" + j + "]:" + data[i].permissions[j]);
// }
// console.info('getApplicationInfosAsync moduleSourceDirs length [' + data[i].moduleSourceDirs.length + ']');
// for (var j = 0; j < data[i].moduleSourceDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleSourceDirs[" + j + "]:" + data[i].moduleSourceDirs[j]);
// }
// console.info('getApplicationInfosAsync moduleInfos length [' + data[i].moduleInfos.length + ']');
// for (var j = 0; j < data[i].moduleInfos.length; j++) {
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleName:" + data[i].moduleInfos[j].moduleName);
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleSourceDir:" + data[i].moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================index[" + i + "].entryDir:" + data[i].entryDir);
// console.info("neu========================index[" + i + "].codePath:" + data[i].codePath);
// console.info("neu========================index[" + i + "].dataDir:" + data[i].dataDir);
// console.info("neu========================index[" + i + "].dataBaseDir:" + data[i].dataBaseDir);
// console.info("neu========================index[" + i + "].cacheDir:" + data[i].cacheDir);
// }
// })
// })
//
// it('app_info_test_002', 0, function () {
//
// demo.getApplicationInfos(8, 0, OnReceiveEvent);
//
// function OnReceiveEvent(data) {
// console.info('**************************getApplicationInfos2********************************');
// console.info('xxx getApplicationInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].bundleName:" + data[i].bundleName);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].descriptionId:" + data[i].descriptionId);
// console.info("neu========================index[" + i + "].iconPath:" + data[i].iconPath);
// console.info("neu========================index[" + i + "].iconId:" + data[i].iconId);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].labelId:" + data[i].labelId);
// console.info("neu========================index[" + i + "].deviceId:" + data[i].deviceId);
// console.info("neu========================index[" + i + "].signatureKey:" + data[i].signatureKey);
// console.info("neu========================index[" + i + "].process:" + data[i].process);
// console.info("neu========================index[" + i + "].isSystemApp:" + data[i].isSystemApp);
// console.info("neu========================index[" + i + "].isLauncherApp:" + data[i].isLauncherApp);
// console.info("neu========================index[" + i + "].supportedModes:" + data[i].supportedModes);
//
// console.info('getApplicationInfosAsync permissions length [' + data[i].permissions.length + ']');
// for (var j = 0; j < data[i].permissions.length; j++) {
// console.info("neu====================index[" + i + "]permissions[" + j + "]:" + data[i].permissions[j]);
// }
// console.info('getApplicationInfosAsync moduleSourceDirs length [' + data[i].moduleSourceDirs.length + ']');
// for (var j = 0; j < data[i].moduleSourceDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleSourceDirs[" + j + "]:" + data[i].moduleSourceDirs[j]);
// }
// console.info('getApplicationInfosAsync moduleInfos length [' + data[i].moduleInfos.length + ']');
// for (var j = 0; j < data[i].moduleInfos.length; j++) {
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleName:" + data[i].moduleInfos[j].moduleName);
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleSourceDir:" + data[i].moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================index[" + i + "].entryDir:" + data[i].entryDir);
// console.info("neu========================index[" + i + "].codePath:" + data[i].codePath);
// console.info("neu========================index[" + i + "].dataDir:" + data[i].dataDir);
// console.info("neu========================index[" + i + "].dataBaseDir:" + data[i].dataBaseDir);
// console.info("neu========================index[" + i + "].cacheDir:" + data[i].cacheDir);
// }
// }
// })
//
//
// it('app_info_test_003', 0, function () {
//
// demo.getApplicationInfo('com.example.myapplicationInstall', 8, 0).then((data) => {
// console.info('**************************getApplicationInfo1********************************');
// console.info("neu========================name: for begin");
// console.info("neu========================name:" + data.name);
// console.info("neu========================bundleName:" + data.bundleName);
// console.info("neu========================description:" + data.description);
// console.info("neu========================descriptionId:" + data.descriptionId);
// console.info("neu========================iconPath:" + data.iconPath);
// console.info("neu========================iconId:" + data.iconId);
// console.info("neu========================label:" + data.label);
// console.info("neu========================labelId:" + data.labelId);
// console.info("neu========================deviceId:" + data.deviceId);
// console.info("neu========================signatureKey:" + data.signatureKey);
// console.info("neu========================process:" + data.process);
// console.info("neu========================isSystemApp:" + data.isSystemApp);
// console.info("neu========================isLauncherApp:" + data.isLauncherApp);
// console.info("neu========================supportedModes:" + data.supportedModes);
//
// console.info('getApplicationInfo permissions length [' + data.permissions.length + ']');
// for (var j = 0; j < data.permissions.length; j++) {
// console.info("neu====================permissions[" + j + "]:" + data.permissions[j]);
// }
// console.info('getApplicationInfo moduleSourceDirs length [' + data.moduleSourceDirs.length + ']');
// for (var j = 0; j < data.moduleSourceDirs.length; j++) {
// console.info("neu====================moduleSourceDirs[" + j + "]:" + data.moduleSourceDirs[j]);
// }
// console.info('getApplicationInfo moduleInfos length [' + data.moduleInfos.length + ']');
// for (var j = 0; j < data.moduleInfos.length; j++) {
// console.info("neu====================moduleInfos[" + j + "]moduleName:" + data.moduleInfos[j].moduleName);
// console.info("neu====================moduleInfos[" + j + "]moduleSourceDir:" + data.moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================entryDir:" + data.entryDir);
// console.info("neu========================codePath:" + data.codePath);
// console.info("neu========================dataDir:" + data.dataDir);
// console.info("neu========================dataBaseDir:" + data.dataBaseDir);
// console.info("neu========================cacheDir:" + data.cacheDir);
// })
// })
//
//
// it('app_info_test_004', 0, function () {
//
// demo.getApplicationInfo('com.example.myapplicationInstall', 8, 0, OnReceiveEvent);
//
// function OnReceiveEvent(data) {
// console.info('**************************getApplicationInfo2********************************');
// console.info("neu========================name: for begin");
// console.info("neu========================name:" + data.name);
// console.info("neu========================bundleName:" + data.bundleName);
// console.info("neu========================description:" + data.description);
// console.info("neu========================descriptionId:" + data.descriptionId);
// console.info("neu========================iconPath:" + data.iconPath);
// console.info("neu========================iconId:" + data.iconId);
// console.info("neu========================label:" + data.label);
// console.info("neu========================labelId:" + data.labelId);
// console.info("neu========================deviceId:" + data.deviceId);
// console.info("neu========================signatureKey:" + data.signatureKey);
// console.info("neu========================process:" + data.process);
// console.info("neu========================isSystemApp:" + data.isSystemApp);
// console.info("neu========================isLauncherApp:" + data.isLauncherApp);
// console.info("neu========================supportedModes:" + data.supportedModes);
//
// console.info('getApplicationInfo permissions length [' + data.permissions.length + ']');
// for (var j = 0; j < data.permissions.length; j++) {
// console.info("neu====================permissions[" + j + "]:" + data.permissions[j]);
// }
// console.info('getApplicationInfo moduleSourceDirs length [' + data.moduleSourceDirs.length + ']');
// for (var j = 0; j < data.moduleSourceDirs.length; j++) {
// console.info("neu====================moduleSourceDirs[" + j + "]:" + data.moduleSourceDirs[j]);
// }
// console.info('getApplicationInfo moduleInfos length [' + data.moduleInfos.length + ']');
// for (var j = 0; j < data.moduleInfos.length; j++) {
// console.info("neu====================moduleInfos[" + j + "]moduleName:" + data.moduleInfos[j].moduleName);
// console.info("neu====================moduleInfos[" + j + "]moduleSourceDir:" + data.moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================entryDir:" + data.entryDir);
// console.info("neu========================codePath:" + data.codePath);
// console.info("neu========================dataDir:" + data.dataDir);
// console.info("neu========================dataBaseDir:" + data.dataBaseDir);
// console.info("neu========================cacheDir:" + data.cacheDir);
// }
//
// })
//
//
// it('app_info_test_005', 0, function () {
// demo.getBundleInfos(8).then((data) => {
// console.info('**************************getBundleInfos1********************************');
// console.info('xxx getBundleInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].vendor:" + data[i].vendor);
// console.info("neu========================index[" + i + "].versionCode:" + data[i].versionCode);
// console.info("neu========================index[" + i + "].versionName:" + data[i].versionName);
// console.info("neu========================index[" + i + "].jointUserId:" + data[i].jointUserId);
// console.info("neu========================index[" + i + "].minSdkVersion:" + data[i].minSdkVersion);
// console.info("neu========================index[" + i + "].maxSdkVersion:" + data[i].maxSdkVersion);
// console.info("neu========================index[" + i + "].mainEntry:" + data[i].mainEntry);
// console.info("neu========================index[" + i + "].cpuAbi:" + data[i].cpuAbi);
// console.info("neu========================index[" + i + "].appId:" + data[i].appId);
// console.info("neu========================index[" + i + "].compatibleVersion:" + data[i].compatibleVersion);
// console.info("neu========================index[" + i + "].targetVersion:" + data[i].targetVersion);
// console.info("neu========================index[" + i + "].releaseType:" + data[i].releaseType);
// console.info("neu========================index[" + i + "].uid:" + data[i].uid);
// console.info("neu========================index[" + i + "].gid:" + data[i].gid);
// console.info("neu========================index[" + i + "].seInfo:" + data[i].seInfo);
// console.info("neu========================index[" + i + "].entryModuleName:" + data[i].entryModuleName);
// console.info("neu========================index[" + i + "].isKeepAlive:" + data[i].isKeepAlive);
// console.info("neu========================index[" + i + "].isNativeApp:" + data[i].isNativeApp);
// console.info("neu========================index[" + i + "].installTime:" + data[i].installTime);
// console.info("neu========================index[" + i + "].updateTime:" + data[i].updateTime);
// console.info("neu========================index[" + i + "].appInfo.name:" + data[i].applicationInfo.name);
// console.info("neu========================index[" + i + "].appInfo.bundleName:" + data[i].applicationInfo.bundleName);
// console.info('getBundleInfos reqPermissions length [' + data[i].reqPermissions.length + ']');
// for (var j = 0; j < data[i].reqPermissions.length; j++) {
// console.info("neu====================index[" + i + "]reqPermissions[" + j + "]:" + data[i].reqPermissions[j]);
// }
// console.info('getBundleInfos defPermissions length [' + data[i].defPermissions.length + ']');
// for (var j = 0; j < data[i].defPermissions.length; j++) {
// console.info("neu====================index[" + i + "]defPermissions[" + j + "]:" + data[i].defPermissions[j]);
// }
//
// console.info('getBundleInfos hapModuleNames length [' + data[i].hapModuleNames.length + ']');
// for (var j = 0; j < data[i].hapModuleNames.length; j++) {
// console.info("neu====================index[" + i + "]hapModuleNames[" + j + "]:" + data[i].hapModuleNames[j]);
// }
// console.info('getBundleInfos moduleNames length [' + data[i].moduleNames.length + ']');
// for (var j = 0; j < data[i].moduleNames.length; j++) {
// console.info("neu====================index[" + i + "]moduleNames[" + j + "]:" + data[i].moduleNames[j]);
// }
// console.info('getBundleInfos modulePublicDirs length [' + data[i].modulePublicDirs.length + ']');
// for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
// console.info("neu====================index[" + i + "]modulePublicDirs[" + j + "]:" + data[i].modulePublicDirs[j]);
// }
// console.info('getBundleInfos moduleDirs length [' + data[i].moduleDirs.length + ']');
// for (var j = 0; j < data[i].moduleDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleDirs[" + j + "]:" + data[i].moduleDirs[j]);
// }
// console.info('getBundleInfos moduleResPaths length [' + data[i].moduleResPaths.length + ']');
// for (var j = 0; j < data[i].moduleResPaths.length; j++) {
// console.info("neu====================index[" + i + "]moduleResPaths[" + j + "]:" + data[i].moduleResPaths[j]);
// }
// console.info('getBundleInfos abilityInfo length [' + data[i].abilityInfos.length + ']');
// for (var j = 0; j < data[i].abilityInfos.length; j++) {
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]name:" + data[i].abilityInfos[j].name);
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]package:" + data[i].abilityInfos[j].package);
// }
// }
// })
// })
//
// it('app_info_test_006', 0, function () {
//
// demo.getBundleInfos(8, OnReceiveEvent);
//
// function OnReceiveEvent(data) {
// console.info('**************************getBundleInfos2********************************');
// console.info('xxx getBundleInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].vendor:" + data[i].vendor);
// console.info("neu========================index[" + i + "].versionCode:" + data[i].versionCode);
// console.info("neu========================index[" + i + "].versionName:" + data[i].versionName);
// console.info("neu========================index[" + i + "].jointUserId:" + data[i].jointUserId);
// console.info("neu========================index[" + i + "].minSdkVersion:" + data[i].minSdkVersion);
// console.info("neu========================index[" + i + "].maxSdkVersion:" + data[i].maxSdkVersion);
// console.info("neu========================index[" + i + "].mainEntry:" + data[i].mainEntry);
// console.info("neu========================index[" + i + "].cpuAbi:" + data[i].cpuAbi);
// console.info("neu========================index[" + i + "].appId:" + data[i].appId);
// console.info("neu========================index[" + i + "].compatibleVersion:" + data[i].compatibleVersion);
// console.info("neu========================index[" + i + "].targetVersion:" + data[i].targetVersion);
// console.info("neu========================index[" + i + "].releaseType:" + data[i].releaseType);
// console.info("neu========================index[" + i + "].uid:" + data[i].uid);
// console.info("neu========================index[" + i + "].gid:" + data[i].gid);
// console.info("neu========================index[" + i + "].seInfo:" + data[i].seInfo);
// console.info("neu========================index[" + i + "].entryModuleName:" + data[i].entryModuleName);
// console.info("neu========================index[" + i + "].isKeepAlive:" + data[i].isKeepAlive);
// console.info("neu========================index[" + i + "].isNativeApp:" + data[i].isNativeApp);
// console.info("neu========================index[" + i + "].installTime:" + data[i].installTime);
// console.info("neu========================index[" + i + "].updateTime:" + data[i].updateTime);
// console.info("neu========================index[" + i + "].appInfo.name:" + data[i].applicationInfo.name);
// console.info("neu========================index[" + i + "].appInfo.bundleName:" + data[i].applicationInfo.bundleName);
// console.info('getBundleInfos reqPermissions length [' + data[i].reqPermissions.length + ']');
// for (var j = 0; j < data[i].reqPermissions.length; j++) {
// console.info("neu====================index[" + i + "]reqPermissions[" + j + "]:" + data[i].reqPermissions[j]);
// }
// console.info('getBundleInfos defPermissions length [' + data[i].defPermissions.length + ']');
// for (var j = 0; j < data[i].defPermissions.length; j++) {
// console.info("neu====================index[" + i + "]defPermissions[" + j + "]:" + data[i].defPermissions[j]);
// }
//
// console.info('getBundleInfos hapModuleNames length [' + data[i].hapModuleNames.length + ']');
// for (var j = 0; j < data[i].hapModuleNames.length; j++) {
// console.info("neu====================index[" + i + "]hapModuleNames[" + j + "]:" + data[i].hapModuleNames[j]);
// }
// console.info('getBundleInfos moduleNames length [' + data[i].moduleNames.length + ']');
// for (var j = 0; j < data[i].moduleNames.length; j++) {
// console.info("neu====================index[" + i + "]moduleNames[" + j + "]:" + data[i].moduleNames[j]);
// }
// console.info('getBundleInfos modulePublicDirs length [' + data[i].modulePublicDirs.length + ']');
// for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
// console.info("neu====================index[" + i + "]modulePublicDirs[" + j + "]:" + data[i].modulePublicDirs[j]);
// }
// console.info('getBundleInfos moduleDirs length [' + data[i].moduleDirs.length + ']');
// for (var j = 0; j < data[i].moduleDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleDirs[" + j + "]:" + data[i].moduleDirs[j]);
// }
// console.info('getBundleInfos moduleResPaths length [' + data[i].moduleResPaths.length + ']');
// for (var j = 0; j < data[i].moduleResPaths.length; j++) {
// console.info("neu====================index[" + i + "]moduleResPaths[" + j + "]:" + data[i].moduleResPaths[j]);
// }
// console.info('getBundleInfos abilityInfo length [' + data[i].abilityInfos.length + ']');
// for (var j = 0; j < data[i].abilityInfos.length; j++) {
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]name:" + data[i].abilityInfos[j].name);
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]package:" + data[i].abilityInfos[j].package);
// }
// }
//
// }
//
// })
//
//
//})
//
//
//
//
//
//require('./Context.test.js')
//require('./AbilityManager.test.js')
\ No newline at end of file
{
"app": {
"bundleName": "com.example.napi_test_suite",
"bundleName": "com.example.myapplication2",
"vendor": "example",
"version": {
"code": 1,
......@@ -14,9 +14,7 @@
},
"deviceConfig": {},
"module": {
"package": "com.example.napi_test_suite",
"package": "com.example.myapplication2",
"name": ".MyApplication2",
"deviceType": [
"phone"
......@@ -38,35 +36,14 @@
]
}
],
"name": "com.example.napi_test_suite.MainAbility",
"name": ".MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"defPermissions": [
{
"name": "com.permission.CAMERA",
"grantMode": "system_grant",
"availableScope": ["signature"],
"label": "CAMERA permission",
"description": "CAMERA permission in detail"
},
{
"name": "com.permission.music",
"grantMode": "system_grant",
"availableScope": ["signature"],
"label": "music permission",
"description": "music permission in detail"
},
{
"name": "com.permission.WeChat",
"grantMode": "system_grant",
"availableScope": ["signature"],
"label": "WeChat permission",
"description": "WeChat permission in detail"
"isVisible": "true",
"launchType": "standard",
"language": "C++"
}
],
"js": [
......
export default {
onCreate() {
console.info('AceApplication onCreate start');
//console.info('AceApplication onCreate add ' + demo.add(123,456));
//console.info('AceApplication onCreate getApplicationInfos ' + demo.getApplicationInfos(0,0));
//demo.getApplicationInfosPromise().then(function (data) {console.info('AceApplication onCreate GetApplicationInfosPromise');});
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
.container {
}
.title {
font-size: 100px;
transform: translate(-10px,-10px);
}
<div class="container">
<text class="title" style="transform : translate({{x}}px,{{y}}px);">
{{title}}
</text>
</div>
import demo from '@ohos.bundle'
export default {
data: {
title: "AI",
realHrValue: 0,
x: 0,
y: 100,
d: ","
},
onInit() {
this.title = this.$t('strings.world');
console.log("BmsApplication test for ams");
this.updateTime();
this.timer = setInterval(this.updateTime, 17)
},
updateTime: function () {
},
onDestroy() {
clearInterval(this.timer)
}
}
//
//import {Core} from 'deccjsunit/lite'
//const core=Core.getInstance()
//core.init()
//require('../../../test/List.test.js')
//core.execute()
import demo from '@ohos.bundle'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
console.log("BmsApplication test for ams");
demo.getBundleInstaller().then((data) => {
data.install(['/data/test1.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err,data) {
console.info("==============================install async install1==============================");
console.info("neu========================name: for begin");
console.info("neu========================install result code:" + err.code);
console.info("neu========================install result code:" + data.status);
console.info("neu========================install result msg:" + data.statusMessage);
}
});
demo.getBundleInstaller().then((data) => {
data.install(['/data/test.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err,data) {
console.info("==============================install async install2==============================");
console.info("neu========================name: for begin");
console.info("neu========================install result code:" + err.code);
console.info("neu========================install result code:" + data.status);
console.info("neu========================install result msg:" + data.statusMessage);
}
});
demo.getBundleInstaller().then((data) => {
data.uninstall('com.example.myapplicationInstall3', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err,data) {
console.info("==============================uninstall async uninstall==============================");
console.info("neu========================name: for begin");
console.info("neu========================uninstall result code:" + err.code);
console.info("neu========================uninstall result code:" + data.status);
console.info("neu========================uninstall result msg:" + data.statusMessage);
}
});
demo.getBundleInfos(8, OnReceiveEvent1);
function OnReceiveEvent1(err,data) {
console.info("neuXXXXXXXgetBundleInfosXXXXXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================data.length:" + data.length);
for (var i = 0; i < data.length; i++) {
console.info("neu========================data[i].name.length:" + data[i].name.length);
console.info("neu========================data[i].appInfo.name.length" + data[i].appInfo.name.length);
console.info("neu========================data[i].hapModuleInfos.length" + data[i].hapModuleInfos.length);
for (var j = 0; j < data[i].hapModuleInfos.length; j++) {
console.info("neu========================data[i].hapModuleInfos[j].length" + data[i].hapModuleInfos[j].length);
}
console.info("neu========================data[i].abilityInfos.length" + data[i].abilityInfos.length);
for (var j = 0; j < data[i].abilityInfos.length; j++) {
console.info("neu========================data[i].abilityInfos[j].name.length" + data[i].abilityInfos[j].name.length);
}
}
}
demo.getBundleInfo('com.example.myapplication',1,OnReceiveEvent2);
function OnReceiveEvent2(err,data) {
console.info("neuXXXXgetBundleInfoXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================err.code:" + err.code);
console.info("neu========================data.name:::" + data.name);
}
demo.getApplicationInfos(8, 0, OnReceiveEvent3);
function OnReceiveEvent3(err,datainfo) {
console.info("neuXXXXXXXgetApplicationInfosXXXXXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================datainfo.length:::" + datainfo.length);
for (var i = 0; i < datainfo.length; i++) {
console.info("neu========================datainfo[i].name" + datainfo[i].name);
}
}
demo.getApplicationInfo('com.example.myapplication', 8, 1, OnReceiveEvent4);
function OnReceiveEvent4(err,datainfo) {
console.info("neu========================err.code:" + err.code);
console.info("neuXXXXXXgetApplicationInfoXXXXXXX.name: for begin");
console.info("neu========================ddatainfo.name:::" + datainfo.name);
}
demo.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
},OnReceiveEvent5);
function OnReceiveEvent5(err,datainfo) {
console.info("neuXXXXXXqueryAbilityByWantXXXXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================datainfo.name:" + datainfo.name);
}
demo.getPermissionDef("com.permission.CAMERA",OnReceiveEvent6);
function OnReceiveEvent6(err,data) {
console.info('**************************getPermissionDef********************************');
console.info("neu========================err.code:" + err.code);
console.info("neu========================permissionName:" + data.permissionName);
}
demo.getBundleArchiveInfo('/data/test.hap',OnReceiveEvent7);
function OnReceiveEvent7(err,data) {
console.info('**************************getBundleArchiveInfo********************************');
console.info("neu========================err.code:" + err.code);
console.info("neu========================name:" + data.name);
}
}
}
//import abilitymanager from '@ohos.napi_ability_manager2'
//console.log('**************************getApplicationInfos********************************');
//describe('AbilityManagerTest', function () {
// it('get_all_running_processes_test_001', 0, function () {
//// var promise = abilitymanager.getAllRunningProcesses();
//// expect(typeof(promise)).zassertEqual("object");
// console.log('**************************getApplicationInfos********************************');
//// demo.getApplicationInfos().then((data) => {
//// console.info('**************************getApplicationInfos********************************');
//// console.info('xxx getApplicationInfos data length [' + data.length + ']');
//// for (var i = 0; i < data.length; i++) {
//// console.info("neu========================index[" + i + "].name: for begin");
//// console.info("neu========================index[" + i + "].name:" + data[i].name);
//// console.info("neu========================index[" + i + "].bundleName:" + data[i].bundleName);
//// console.info("neu========================index[" + i + "].description:" + data[i].description);
//// console.info("neu========================index[" + i + "].descriptionId:" + data[i].descriptionId);
//// console.info("neu========================index[" + i + "].iconPath:" + data[i].iconPath);
//// console.info("neu========================index[" + i + "].iconId:" + data[i].iconId);
//// console.info("neu========================index[" + i + "].label:" + data[i].label);
//// console.info("neu========================index[" + i + "].labelId:" + data[i].labelId);
//// console.info("neu========================index[" + i + "].deviceId:" + data[i].deviceId);
//// console.info("neu========================index[" + i + "].signatureKey:" + data[i].signatureKey);
//// console.info("neu========================index[" + i + "].process:" + data[i].process);
//// console.info("neu========================index[" + i + "].isSystemApp:" + data[i].isSystemApp);
//// console.info("neu========================index[" + i + "].isLauncherApp:" + data[i].isLauncherApp);
//// console.info("neu========================index[" + i + "].supportedModes:" + data[i].supportedModes);
////
//// console.info('getApplicationInfosAsync permissions length [' + data[i].permissions.length + ']');
//// for(var j = 0; j < data[i].permissions.length; j++) {
//// console.info("neu====================index[" + i + "]permissions[" + j + "]:" + data[i].permissions[j]);
//// }
//// console.info('getApplicationInfosAsync moduleSourceDirs length [' + data[i].moduleSourceDirs.length + ']');
//// for(var j = 0; j < data[i].moduleSourceDirs.length; j++) {
//// console.info("neu====================index[" + i + "]moduleSourceDirs[" + j + "]:" + data[i].moduleSourceDirs[j]);
//// }
//// console.info('getApplicationInfosAsync moduleInfos length [' + data[i].moduleInfos.length + ']');
//// for(var j = 0; j < data[i].moduleInfos.length; j++) {
//// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleName:" + data[i].moduleInfos[j].moduleName);
//// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleSourceDir:" + data[i].moduleInfos[j].moduleSourceDir);
//// }
//// console.info("neu========================index[" + i + "].entryDir:" + data[i].entryDir);
//// console.info("neu========================index[" + i + "].codePath:" + data[i].codePath);
//// console.info("neu========================index[" + i + "].dataDir:" + data[i].dataDir);
//// console.info("neu========================index[" + i + "].dataBaseDir:" + data[i].dataBaseDir);
//// console.info("neu========================index[" + i + "].cacheDir:" + data[i].cacheDir);
//// }
//// });
//
//
// })
//// it('get_all_running_processes_test_002', 0, async function (done) {
//// var info = await abilitymanager.getAllRunningProcesses();
//// expect(info[0].processName.length).assertLarger(0);
//// done();
//// })
//})
//import demo from '@ohos.bundle_mgr'
//
//describe('appInfoTest', function () {
//
// it('app_info_test_001', 0, function () {
//
//
// demo.getApplicationInfos(8, 0).then((data) => {
// console.info('**************************getApplicationInfos1********************************');
// console.info('xxx getApplicationInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].bundleName:" + data[i].bundleName);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].descriptionId:" + data[i].descriptionId);
// console.info("neu========================index[" + i + "].iconPath:" + data[i].iconPath);
// console.info("neu========================index[" + i + "].iconId:" + data[i].iconId);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].labelId:" + data[i].labelId);
// console.info("neu========================index[" + i + "].deviceId:" + data[i].deviceId);
// console.info("neu========================index[" + i + "].signatureKey:" + data[i].signatureKey);
// console.info("neu========================index[" + i + "].process:" + data[i].process);
// console.info("neu========================index[" + i + "].isSystemApp:" + data[i].isSystemApp);
// console.info("neu========================index[" + i + "].isLauncherApp:" + data[i].isLauncherApp);
// console.info("neu========================index[" + i + "].supportedModes:" + data[i].supportedModes);
//
// console.info('getApplicationInfosAsync permissions length [' + data[i].permissions.length + ']');
// for (var j = 0; j < data[i].permissions.length; j++) {
// console.info("neu====================index[" + i + "]permissions[" + j + "]:" + data[i].permissions[j]);
// }
// console.info('getApplicationInfosAsync moduleSourceDirs length [' + data[i].moduleSourceDirs.length + ']');
// for (var j = 0; j < data[i].moduleSourceDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleSourceDirs[" + j + "]:" + data[i].moduleSourceDirs[j]);
// }
// console.info('getApplicationInfosAsync moduleInfos length [' + data[i].moduleInfos.length + ']');
// for (var j = 0; j < data[i].moduleInfos.length; j++) {
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleName:" + data[i].moduleInfos[j].moduleName);
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleSourceDir:" + data[i].moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================index[" + i + "].entryDir:" + data[i].entryDir);
// console.info("neu========================index[" + i + "].codePath:" + data[i].codePath);
// console.info("neu========================index[" + i + "].dataDir:" + data[i].dataDir);
// console.info("neu========================index[" + i + "].dataBaseDir:" + data[i].dataBaseDir);
// console.info("neu========================index[" + i + "].cacheDir:" + data[i].cacheDir);
// }
// })
// })
//
// it('app_info_test_002', 0, function () {
//
// demo.getApplicationInfos(8, 0, OnReceiveEvent);
//
// function OnReceiveEvent(data) {
// console.info('**************************getApplicationInfos2********************************');
// console.info('xxx getApplicationInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].bundleName:" + data[i].bundleName);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].descriptionId:" + data[i].descriptionId);
// console.info("neu========================index[" + i + "].iconPath:" + data[i].iconPath);
// console.info("neu========================index[" + i + "].iconId:" + data[i].iconId);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].labelId:" + data[i].labelId);
// console.info("neu========================index[" + i + "].deviceId:" + data[i].deviceId);
// console.info("neu========================index[" + i + "].signatureKey:" + data[i].signatureKey);
// console.info("neu========================index[" + i + "].process:" + data[i].process);
// console.info("neu========================index[" + i + "].isSystemApp:" + data[i].isSystemApp);
// console.info("neu========================index[" + i + "].isLauncherApp:" + data[i].isLauncherApp);
// console.info("neu========================index[" + i + "].supportedModes:" + data[i].supportedModes);
//
// console.info('getApplicationInfosAsync permissions length [' + data[i].permissions.length + ']');
// for (var j = 0; j < data[i].permissions.length; j++) {
// console.info("neu====================index[" + i + "]permissions[" + j + "]:" + data[i].permissions[j]);
// }
// console.info('getApplicationInfosAsync moduleSourceDirs length [' + data[i].moduleSourceDirs.length + ']');
// for (var j = 0; j < data[i].moduleSourceDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleSourceDirs[" + j + "]:" + data[i].moduleSourceDirs[j]);
// }
// console.info('getApplicationInfosAsync moduleInfos length [' + data[i].moduleInfos.length + ']');
// for (var j = 0; j < data[i].moduleInfos.length; j++) {
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleName:" + data[i].moduleInfos[j].moduleName);
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleSourceDir:" + data[i].moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================index[" + i + "].entryDir:" + data[i].entryDir);
// console.info("neu========================index[" + i + "].codePath:" + data[i].codePath);
// console.info("neu========================index[" + i + "].dataDir:" + data[i].dataDir);
// console.info("neu========================index[" + i + "].dataBaseDir:" + data[i].dataBaseDir);
// console.info("neu========================index[" + i + "].cacheDir:" + data[i].cacheDir);
// }
// }
// })
//
//
// it('app_info_test_003', 0, function () {
//
// demo.getApplicationInfo('com.example.myapplicationInstall', 8, 0).then((data) => {
// console.info('**************************getApplicationInfo1********************************');
// console.info("neu========================name: for begin");
// console.info("neu========================name:" + data.name);
// console.info("neu========================bundleName:" + data.bundleName);
// console.info("neu========================description:" + data.description);
// console.info("neu========================descriptionId:" + data.descriptionId);
// console.info("neu========================iconPath:" + data.iconPath);
// console.info("neu========================iconId:" + data.iconId);
// console.info("neu========================label:" + data.label);
// console.info("neu========================labelId:" + data.labelId);
// console.info("neu========================deviceId:" + data.deviceId);
// console.info("neu========================signatureKey:" + data.signatureKey);
// console.info("neu========================process:" + data.process);
// console.info("neu========================isSystemApp:" + data.isSystemApp);
// console.info("neu========================isLauncherApp:" + data.isLauncherApp);
// console.info("neu========================supportedModes:" + data.supportedModes);
//
// console.info('getApplicationInfo permissions length [' + data.permissions.length + ']');
// for (var j = 0; j < data.permissions.length; j++) {
// console.info("neu====================permissions[" + j + "]:" + data.permissions[j]);
// }
// console.info('getApplicationInfo moduleSourceDirs length [' + data.moduleSourceDirs.length + ']');
// for (var j = 0; j < data.moduleSourceDirs.length; j++) {
// console.info("neu====================moduleSourceDirs[" + j + "]:" + data.moduleSourceDirs[j]);
// }
// console.info('getApplicationInfo moduleInfos length [' + data.moduleInfos.length + ']');
// for (var j = 0; j < data.moduleInfos.length; j++) {
// console.info("neu====================moduleInfos[" + j + "]moduleName:" + data.moduleInfos[j].moduleName);
// console.info("neu====================moduleInfos[" + j + "]moduleSourceDir:" + data.moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================entryDir:" + data.entryDir);
// console.info("neu========================codePath:" + data.codePath);
// console.info("neu========================dataDir:" + data.dataDir);
// console.info("neu========================dataBaseDir:" + data.dataBaseDir);
// console.info("neu========================cacheDir:" + data.cacheDir);
// })
// })
//
//
// it('app_info_test_004', 0, function () {
//
// demo.getApplicationInfo('com.example.myapplicationInstall', 8, 0, OnReceiveEvent);
//
// function OnReceiveEvent(data) {
// console.info('**************************getApplicationInfo2********************************');
// console.info("neu========================name: for begin");
// console.info("neu========================name:" + data.name);
// console.info("neu========================bundleName:" + data.bundleName);
// console.info("neu========================description:" + data.description);
// console.info("neu========================descriptionId:" + data.descriptionId);
// console.info("neu========================iconPath:" + data.iconPath);
// console.info("neu========================iconId:" + data.iconId);
// console.info("neu========================label:" + data.label);
// console.info("neu========================labelId:" + data.labelId);
// console.info("neu========================deviceId:" + data.deviceId);
// console.info("neu========================signatureKey:" + data.signatureKey);
// console.info("neu========================process:" + data.process);
// console.info("neu========================isSystemApp:" + data.isSystemApp);
// console.info("neu========================isLauncherApp:" + data.isLauncherApp);
// console.info("neu========================supportedModes:" + data.supportedModes);
//
// console.info('getApplicationInfo permissions length [' + data.permissions.length + ']');
// for (var j = 0; j < data.permissions.length; j++) {
// console.info("neu====================permissions[" + j + "]:" + data.permissions[j]);
// }
// console.info('getApplicationInfo moduleSourceDirs length [' + data.moduleSourceDirs.length + ']');
// for (var j = 0; j < data.moduleSourceDirs.length; j++) {
// console.info("neu====================moduleSourceDirs[" + j + "]:" + data.moduleSourceDirs[j]);
// }
// console.info('getApplicationInfo moduleInfos length [' + data.moduleInfos.length + ']');
// for (var j = 0; j < data.moduleInfos.length; j++) {
// console.info("neu====================moduleInfos[" + j + "]moduleName:" + data.moduleInfos[j].moduleName);
// console.info("neu====================moduleInfos[" + j + "]moduleSourceDir:" + data.moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================entryDir:" + data.entryDir);
// console.info("neu========================codePath:" + data.codePath);
// console.info("neu========================dataDir:" + data.dataDir);
// console.info("neu========================dataBaseDir:" + data.dataBaseDir);
// console.info("neu========================cacheDir:" + data.cacheDir);
// }
//
// })
//
//
// it('app_info_test_005', 0, function () {
// demo.getBundleInfos(8).then((data) => {
// console.info('**************************getBundleInfos1********************************');
// console.info('xxx getBundleInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].vendor:" + data[i].vendor);
// console.info("neu========================index[" + i + "].versionCode:" + data[i].versionCode);
// console.info("neu========================index[" + i + "].versionName:" + data[i].versionName);
// console.info("neu========================index[" + i + "].jointUserId:" + data[i].jointUserId);
// console.info("neu========================index[" + i + "].minSdkVersion:" + data[i].minSdkVersion);
// console.info("neu========================index[" + i + "].maxSdkVersion:" + data[i].maxSdkVersion);
// console.info("neu========================index[" + i + "].mainEntry:" + data[i].mainEntry);
// console.info("neu========================index[" + i + "].cpuAbi:" + data[i].cpuAbi);
// console.info("neu========================index[" + i + "].appId:" + data[i].appId);
// console.info("neu========================index[" + i + "].compatibleVersion:" + data[i].compatibleVersion);
// console.info("neu========================index[" + i + "].targetVersion:" + data[i].targetVersion);
// console.info("neu========================index[" + i + "].releaseType:" + data[i].releaseType);
// console.info("neu========================index[" + i + "].uid:" + data[i].uid);
// console.info("neu========================index[" + i + "].gid:" + data[i].gid);
// console.info("neu========================index[" + i + "].seInfo:" + data[i].seInfo);
// console.info("neu========================index[" + i + "].entryModuleName:" + data[i].entryModuleName);
// console.info("neu========================index[" + i + "].isKeepAlive:" + data[i].isKeepAlive);
// console.info("neu========================index[" + i + "].isNativeApp:" + data[i].isNativeApp);
// console.info("neu========================index[" + i + "].installTime:" + data[i].installTime);
// console.info("neu========================index[" + i + "].updateTime:" + data[i].updateTime);
// console.info("neu========================index[" + i + "].appInfo.name:" + data[i].applicationInfo.name);
// console.info("neu========================index[" + i + "].appInfo.bundleName:" + data[i].applicationInfo.bundleName);
// console.info('getBundleInfos reqPermissions length [' + data[i].reqPermissions.length + ']');
// for (var j = 0; j < data[i].reqPermissions.length; j++) {
// console.info("neu====================index[" + i + "]reqPermissions[" + j + "]:" + data[i].reqPermissions[j]);
// }
// console.info('getBundleInfos defPermissions length [' + data[i].defPermissions.length + ']');
// for (var j = 0; j < data[i].defPermissions.length; j++) {
// console.info("neu====================index[" + i + "]defPermissions[" + j + "]:" + data[i].defPermissions[j]);
// }
//
// console.info('getBundleInfos hapModuleNames length [' + data[i].hapModuleNames.length + ']');
// for (var j = 0; j < data[i].hapModuleNames.length; j++) {
// console.info("neu====================index[" + i + "]hapModuleNames[" + j + "]:" + data[i].hapModuleNames[j]);
// }
// console.info('getBundleInfos moduleNames length [' + data[i].moduleNames.length + ']');
// for (var j = 0; j < data[i].moduleNames.length; j++) {
// console.info("neu====================index[" + i + "]moduleNames[" + j + "]:" + data[i].moduleNames[j]);
// }
// console.info('getBundleInfos modulePublicDirs length [' + data[i].modulePublicDirs.length + ']');
// for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
// console.info("neu====================index[" + i + "]modulePublicDirs[" + j + "]:" + data[i].modulePublicDirs[j]);
// }
// console.info('getBundleInfos moduleDirs length [' + data[i].moduleDirs.length + ']');
// for (var j = 0; j < data[i].moduleDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleDirs[" + j + "]:" + data[i].moduleDirs[j]);
// }
// console.info('getBundleInfos moduleResPaths length [' + data[i].moduleResPaths.length + ']');
// for (var j = 0; j < data[i].moduleResPaths.length; j++) {
// console.info("neu====================index[" + i + "]moduleResPaths[" + j + "]:" + data[i].moduleResPaths[j]);
// }
// console.info('getBundleInfos abilityInfo length [' + data[i].abilityInfos.length + ']');
// for (var j = 0; j < data[i].abilityInfos.length; j++) {
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]name:" + data[i].abilityInfos[j].name);
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]package:" + data[i].abilityInfos[j].package);
// }
// }
// })
// })
//
// it('app_info_test_006', 0, function () {
//
// demo.getBundleInfos(8, OnReceiveEvent);
//
// function OnReceiveEvent(data) {
// console.info('**************************getBundleInfos2********************************');
// console.info('xxx getBundleInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].vendor:" + data[i].vendor);
// console.info("neu========================index[" + i + "].versionCode:" + data[i].versionCode);
// console.info("neu========================index[" + i + "].versionName:" + data[i].versionName);
// console.info("neu========================index[" + i + "].jointUserId:" + data[i].jointUserId);
// console.info("neu========================index[" + i + "].minSdkVersion:" + data[i].minSdkVersion);
// console.info("neu========================index[" + i + "].maxSdkVersion:" + data[i].maxSdkVersion);
// console.info("neu========================index[" + i + "].mainEntry:" + data[i].mainEntry);
// console.info("neu========================index[" + i + "].cpuAbi:" + data[i].cpuAbi);
// console.info("neu========================index[" + i + "].appId:" + data[i].appId);
// console.info("neu========================index[" + i + "].compatibleVersion:" + data[i].compatibleVersion);
// console.info("neu========================index[" + i + "].targetVersion:" + data[i].targetVersion);
// console.info("neu========================index[" + i + "].releaseType:" + data[i].releaseType);
// console.info("neu========================index[" + i + "].uid:" + data[i].uid);
// console.info("neu========================index[" + i + "].gid:" + data[i].gid);
// console.info("neu========================index[" + i + "].seInfo:" + data[i].seInfo);
// console.info("neu========================index[" + i + "].entryModuleName:" + data[i].entryModuleName);
// console.info("neu========================index[" + i + "].isKeepAlive:" + data[i].isKeepAlive);
// console.info("neu========================index[" + i + "].isNativeApp:" + data[i].isNativeApp);
// console.info("neu========================index[" + i + "].installTime:" + data[i].installTime);
// console.info("neu========================index[" + i + "].updateTime:" + data[i].updateTime);
// console.info("neu========================index[" + i + "].appInfo.name:" + data[i].applicationInfo.name);
// console.info("neu========================index[" + i + "].appInfo.bundleName:" + data[i].applicationInfo.bundleName);
// console.info('getBundleInfos reqPermissions length [' + data[i].reqPermissions.length + ']');
// for (var j = 0; j < data[i].reqPermissions.length; j++) {
// console.info("neu====================index[" + i + "]reqPermissions[" + j + "]:" + data[i].reqPermissions[j]);
// }
// console.info('getBundleInfos defPermissions length [' + data[i].defPermissions.length + ']');
// for (var j = 0; j < data[i].defPermissions.length; j++) {
// console.info("neu====================index[" + i + "]defPermissions[" + j + "]:" + data[i].defPermissions[j]);
// }
//
// console.info('getBundleInfos hapModuleNames length [' + data[i].hapModuleNames.length + ']');
// for (var j = 0; j < data[i].hapModuleNames.length; j++) {
// console.info("neu====================index[" + i + "]hapModuleNames[" + j + "]:" + data[i].hapModuleNames[j]);
// }
// console.info('getBundleInfos moduleNames length [' + data[i].moduleNames.length + ']');
// for (var j = 0; j < data[i].moduleNames.length; j++) {
// console.info("neu====================index[" + i + "]moduleNames[" + j + "]:" + data[i].moduleNames[j]);
// }
// console.info('getBundleInfos modulePublicDirs length [' + data[i].modulePublicDirs.length + ']');
// for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
// console.info("neu====================index[" + i + "]modulePublicDirs[" + j + "]:" + data[i].modulePublicDirs[j]);
// }
// console.info('getBundleInfos moduleDirs length [' + data[i].moduleDirs.length + ']');
// for (var j = 0; j < data[i].moduleDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleDirs[" + j + "]:" + data[i].moduleDirs[j]);
// }
// console.info('getBundleInfos moduleResPaths length [' + data[i].moduleResPaths.length + ']');
// for (var j = 0; j < data[i].moduleResPaths.length; j++) {
// console.info("neu====================index[" + i + "]moduleResPaths[" + j + "]:" + data[i].moduleResPaths[j]);
// }
// console.info('getBundleInfos abilityInfo length [' + data[i].abilityInfos.length + ']');
// for (var j = 0; j < data[i].abilityInfos.length; j++) {
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]name:" + data[i].abilityInfos[j].name);
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]package:" + data[i].abilityInfos[j].package);
// }
// }
//
// }
//
// })
//
//
//})
//
//
//
//
//
//require('./Context.test.js')
//require('./AbilityManager.test.js')
\ No newline at end of file
{
"app": {
"bundleName": "com.example.myapplication2",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.myapplication3",
"name": ".MyApplication3",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": ".MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "standard",
"language": "C++"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
export default {
onCreate() {
console.info('AceApplication onCreate start');
//console.info('AceApplication onCreate add ' + demo.add(123,456));
//console.info('AceApplication onCreate getApplicationInfos ' + demo.getApplicationInfos(0,0));
//demo.getApplicationInfosPromise().then(function (data) {console.info('AceApplication onCreate GetApplicationInfosPromise');});
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
.container {
}
.title {
font-size: 100px;
transform: translate(-10px,-10px);
}
<div class="container">
<text class="title" style="transform : translate({{x}}px,{{y}}px);">
{{title}}
</text>
</div>
import demo from '@ohos.bundle'
export default {
data: {
title: "AI",
realHrValue: 0,
x: 0,
y: 100,
d: ","
},
onInit() {
this.title = this.$t('strings.world');
console.log("BmsApplication test for ams");
this.updateTime();
this.timer = setInterval(this.updateTime, 17)
},
updateTime: function () {
},
onDestroy() {
clearInterval(this.timer)
}
}
//
//import {Core} from 'deccjsunit/lite'
//const core=Core.getInstance()
//core.init()
//require('../../../test/List.test.js')
//core.execute()
import demo from '@ohos.bundle'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
console.log("BmsApplication test for ams");
demo.getBundleInstaller().then((data) => {
data.install(['/data/test1.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err,data) {
console.info("==============================install async install1==============================");
console.info("neu========================name: for begin");
console.info("neu========================install result code:" + err.code);
console.info("neu========================install result code:" + data.status);
console.info("neu========================install result msg:" + data.statusMessage);
}
});
demo.getBundleInstaller().then((data) => {
data.install(['/data/test.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err,data) {
console.info("==============================install async install2==============================");
console.info("neu========================name: for begin");
console.info("neu========================install result code:" + err.code);
console.info("neu========================install result code:" + data.status);
console.info("neu========================install result msg:" + data.statusMessage);
}
});
demo.getBundleInstaller().then((data) => {
data.uninstall('com.example.myapplicationInstall3', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err,data) {
console.info("==============================uninstall async uninstall==============================");
console.info("neu========================name: for begin");
console.info("neu========================uninstall result code:" + err.code);
console.info("neu========================uninstall result code:" + data.status);
console.info("neu========================uninstall result msg:" + data.statusMessage);
}
});
demo.getBundleInfos(8, OnReceiveEvent1);
function OnReceiveEvent1(err,data) {
console.info("neuXXXXXXXgetBundleInfosXXXXXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================data.length:" + data.length);
for (var i = 0; i < data.length; i++) {
console.info("neu========================data[i].name.length:" + data[i].name.length);
console.info("neu========================data[i].appInfo.name.length" + data[i].appInfo.name.length);
console.info("neu========================data[i].hapModuleInfos.length" + data[i].hapModuleInfos.length);
for (var j = 0; j < data[i].hapModuleInfos.length; j++) {
console.info("neu========================data[i].hapModuleInfos[j].length" + data[i].hapModuleInfos[j].length);
}
console.info("neu========================data[i].abilityInfos.length" + data[i].abilityInfos.length);
for (var j = 0; j < data[i].abilityInfos.length; j++) {
console.info("neu========================data[i].abilityInfos[j].name.length" + data[i].abilityInfos[j].name.length);
}
}
}
demo.getBundleInfo('com.example.myapplication',1,OnReceiveEvent2);
function OnReceiveEvent2(err,data) {
console.info("neuXXXXgetBundleInfoXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================err.code:" + err.code);
console.info("neu========================data.name:::" + data.name);
}
demo.getApplicationInfos(8, 0, OnReceiveEvent3);
function OnReceiveEvent3(err,datainfo) {
console.info("neuXXXXXXXgetApplicationInfosXXXXXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================datainfo.length:::" + datainfo.length);
for (var i = 0; i < datainfo.length; i++) {
console.info("neu========================datainfo[i].name" + datainfo[i].name);
}
}
demo.getApplicationInfo('com.example.myapplication', 8, 1, OnReceiveEvent4);
function OnReceiveEvent4(err,datainfo) {
console.info("neu========================err.code:" + err.code);
console.info("neuXXXXXXgetApplicationInfoXXXXXXX.name: for begin");
console.info("neu========================ddatainfo.name:::" + datainfo.name);
}
demo.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
},OnReceiveEvent5);
function OnReceiveEvent5(err,datainfo) {
console.info("neuXXXXXXqueryAbilityByWantXXXXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================datainfo.name:" + datainfo.name);
}
demo.getPermissionDef("com.permission.CAMERA",OnReceiveEvent6);
function OnReceiveEvent6(err,data) {
console.info('**************************getPermissionDef********************************');
console.info("neu========================err.code:" + err.code);
console.info("neu========================permissionName:" + data.permissionName);
}
demo.getBundleArchiveInfo('/data/test.hap',OnReceiveEvent7);
function OnReceiveEvent7(err,data) {
console.info('**************************getBundleArchiveInfo********************************');
console.info("neu========================err.code:" + err.code);
console.info("neu========================name:" + data.name);
}
}
}
//import abilitymanager from '@ohos.napi_ability_manager2'
//console.log('**************************getApplicationInfos********************************');
//describe('AbilityManagerTest', function () {
// it('get_all_running_processes_test_001', 0, function () {
//// var promise = abilitymanager.getAllRunningProcesses();
//// expect(typeof(promise)).zassertEqual("object");
// console.log('**************************getApplicationInfos********************************');
//// demo.getApplicationInfos().then((data) => {
//// console.info('**************************getApplicationInfos********************************');
//// console.info('xxx getApplicationInfos data length [' + data.length + ']');
//// for (var i = 0; i < data.length; i++) {
//// console.info("neu========================index[" + i + "].name: for begin");
//// console.info("neu========================index[" + i + "].name:" + data[i].name);
//// console.info("neu========================index[" + i + "].bundleName:" + data[i].bundleName);
//// console.info("neu========================index[" + i + "].description:" + data[i].description);
//// console.info("neu========================index[" + i + "].descriptionId:" + data[i].descriptionId);
//// console.info("neu========================index[" + i + "].iconPath:" + data[i].iconPath);
//// console.info("neu========================index[" + i + "].iconId:" + data[i].iconId);
//// console.info("neu========================index[" + i + "].label:" + data[i].label);
//// console.info("neu========================index[" + i + "].labelId:" + data[i].labelId);
//// console.info("neu========================index[" + i + "].deviceId:" + data[i].deviceId);
//// console.info("neu========================index[" + i + "].signatureKey:" + data[i].signatureKey);
//// console.info("neu========================index[" + i + "].process:" + data[i].process);
//// console.info("neu========================index[" + i + "].isSystemApp:" + data[i].isSystemApp);
//// console.info("neu========================index[" + i + "].isLauncherApp:" + data[i].isLauncherApp);
//// console.info("neu========================index[" + i + "].supportedModes:" + data[i].supportedModes);
////
//// console.info('getApplicationInfosAsync permissions length [' + data[i].permissions.length + ']');
//// for(var j = 0; j < data[i].permissions.length; j++) {
//// console.info("neu====================index[" + i + "]permissions[" + j + "]:" + data[i].permissions[j]);
//// }
//// console.info('getApplicationInfosAsync moduleSourceDirs length [' + data[i].moduleSourceDirs.length + ']');
//// for(var j = 0; j < data[i].moduleSourceDirs.length; j++) {
//// console.info("neu====================index[" + i + "]moduleSourceDirs[" + j + "]:" + data[i].moduleSourceDirs[j]);
//// }
//// console.info('getApplicationInfosAsync moduleInfos length [' + data[i].moduleInfos.length + ']');
//// for(var j = 0; j < data[i].moduleInfos.length; j++) {
//// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleName:" + data[i].moduleInfos[j].moduleName);
//// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleSourceDir:" + data[i].moduleInfos[j].moduleSourceDir);
//// }
//// console.info("neu========================index[" + i + "].entryDir:" + data[i].entryDir);
//// console.info("neu========================index[" + i + "].codePath:" + data[i].codePath);
//// console.info("neu========================index[" + i + "].dataDir:" + data[i].dataDir);
//// console.info("neu========================index[" + i + "].dataBaseDir:" + data[i].dataBaseDir);
//// console.info("neu========================index[" + i + "].cacheDir:" + data[i].cacheDir);
//// }
//// });
//
//
// })
//// it('get_all_running_processes_test_002', 0, async function (done) {
//// var info = await abilitymanager.getAllRunningProcesses();
//// expect(info[0].processName.length).assertLarger(0);
//// done();
//// })
//})
//import demo from '@ohos.bundle_mgr'
//
//describe('appInfoTest', function () {
//
// it('app_info_test_001', 0, function () {
//
//
// demo.getApplicationInfos(8, 0).then((data) => {
// console.info('**************************getApplicationInfos1********************************');
// console.info('xxx getApplicationInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].bundleName:" + data[i].bundleName);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].descriptionId:" + data[i].descriptionId);
// console.info("neu========================index[" + i + "].iconPath:" + data[i].iconPath);
// console.info("neu========================index[" + i + "].iconId:" + data[i].iconId);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].labelId:" + data[i].labelId);
// console.info("neu========================index[" + i + "].deviceId:" + data[i].deviceId);
// console.info("neu========================index[" + i + "].signatureKey:" + data[i].signatureKey);
// console.info("neu========================index[" + i + "].process:" + data[i].process);
// console.info("neu========================index[" + i + "].isSystemApp:" + data[i].isSystemApp);
// console.info("neu========================index[" + i + "].isLauncherApp:" + data[i].isLauncherApp);
// console.info("neu========================index[" + i + "].supportedModes:" + data[i].supportedModes);
//
// console.info('getApplicationInfosAsync permissions length [' + data[i].permissions.length + ']');
// for (var j = 0; j < data[i].permissions.length; j++) {
// console.info("neu====================index[" + i + "]permissions[" + j + "]:" + data[i].permissions[j]);
// }
// console.info('getApplicationInfosAsync moduleSourceDirs length [' + data[i].moduleSourceDirs.length + ']');
// for (var j = 0; j < data[i].moduleSourceDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleSourceDirs[" + j + "]:" + data[i].moduleSourceDirs[j]);
// }
// console.info('getApplicationInfosAsync moduleInfos length [' + data[i].moduleInfos.length + ']');
// for (var j = 0; j < data[i].moduleInfos.length; j++) {
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleName:" + data[i].moduleInfos[j].moduleName);
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleSourceDir:" + data[i].moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================index[" + i + "].entryDir:" + data[i].entryDir);
// console.info("neu========================index[" + i + "].codePath:" + data[i].codePath);
// console.info("neu========================index[" + i + "].dataDir:" + data[i].dataDir);
// console.info("neu========================index[" + i + "].dataBaseDir:" + data[i].dataBaseDir);
// console.info("neu========================index[" + i + "].cacheDir:" + data[i].cacheDir);
// }
// })
// })
//
// it('app_info_test_002', 0, function () {
//
// demo.getApplicationInfos(8, 0, OnReceiveEvent);
//
// function OnReceiveEvent(data) {
// console.info('**************************getApplicationInfos2********************************');
// console.info('xxx getApplicationInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].bundleName:" + data[i].bundleName);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].descriptionId:" + data[i].descriptionId);
// console.info("neu========================index[" + i + "].iconPath:" + data[i].iconPath);
// console.info("neu========================index[" + i + "].iconId:" + data[i].iconId);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].labelId:" + data[i].labelId);
// console.info("neu========================index[" + i + "].deviceId:" + data[i].deviceId);
// console.info("neu========================index[" + i + "].signatureKey:" + data[i].signatureKey);
// console.info("neu========================index[" + i + "].process:" + data[i].process);
// console.info("neu========================index[" + i + "].isSystemApp:" + data[i].isSystemApp);
// console.info("neu========================index[" + i + "].isLauncherApp:" + data[i].isLauncherApp);
// console.info("neu========================index[" + i + "].supportedModes:" + data[i].supportedModes);
//
// console.info('getApplicationInfosAsync permissions length [' + data[i].permissions.length + ']');
// for (var j = 0; j < data[i].permissions.length; j++) {
// console.info("neu====================index[" + i + "]permissions[" + j + "]:" + data[i].permissions[j]);
// }
// console.info('getApplicationInfosAsync moduleSourceDirs length [' + data[i].moduleSourceDirs.length + ']');
// for (var j = 0; j < data[i].moduleSourceDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleSourceDirs[" + j + "]:" + data[i].moduleSourceDirs[j]);
// }
// console.info('getApplicationInfosAsync moduleInfos length [' + data[i].moduleInfos.length + ']');
// for (var j = 0; j < data[i].moduleInfos.length; j++) {
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleName:" + data[i].moduleInfos[j].moduleName);
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleSourceDir:" + data[i].moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================index[" + i + "].entryDir:" + data[i].entryDir);
// console.info("neu========================index[" + i + "].codePath:" + data[i].codePath);
// console.info("neu========================index[" + i + "].dataDir:" + data[i].dataDir);
// console.info("neu========================index[" + i + "].dataBaseDir:" + data[i].dataBaseDir);
// console.info("neu========================index[" + i + "].cacheDir:" + data[i].cacheDir);
// }
// }
// })
//
//
// it('app_info_test_003', 0, function () {
//
// demo.getApplicationInfo('com.example.myapplicationInstall', 8, 0).then((data) => {
// console.info('**************************getApplicationInfo1********************************');
// console.info("neu========================name: for begin");
// console.info("neu========================name:" + data.name);
// console.info("neu========================bundleName:" + data.bundleName);
// console.info("neu========================description:" + data.description);
// console.info("neu========================descriptionId:" + data.descriptionId);
// console.info("neu========================iconPath:" + data.iconPath);
// console.info("neu========================iconId:" + data.iconId);
// console.info("neu========================label:" + data.label);
// console.info("neu========================labelId:" + data.labelId);
// console.info("neu========================deviceId:" + data.deviceId);
// console.info("neu========================signatureKey:" + data.signatureKey);
// console.info("neu========================process:" + data.process);
// console.info("neu========================isSystemApp:" + data.isSystemApp);
// console.info("neu========================isLauncherApp:" + data.isLauncherApp);
// console.info("neu========================supportedModes:" + data.supportedModes);
//
// console.info('getApplicationInfo permissions length [' + data.permissions.length + ']');
// for (var j = 0; j < data.permissions.length; j++) {
// console.info("neu====================permissions[" + j + "]:" + data.permissions[j]);
// }
// console.info('getApplicationInfo moduleSourceDirs length [' + data.moduleSourceDirs.length + ']');
// for (var j = 0; j < data.moduleSourceDirs.length; j++) {
// console.info("neu====================moduleSourceDirs[" + j + "]:" + data.moduleSourceDirs[j]);
// }
// console.info('getApplicationInfo moduleInfos length [' + data.moduleInfos.length + ']');
// for (var j = 0; j < data.moduleInfos.length; j++) {
// console.info("neu====================moduleInfos[" + j + "]moduleName:" + data.moduleInfos[j].moduleName);
// console.info("neu====================moduleInfos[" + j + "]moduleSourceDir:" + data.moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================entryDir:" + data.entryDir);
// console.info("neu========================codePath:" + data.codePath);
// console.info("neu========================dataDir:" + data.dataDir);
// console.info("neu========================dataBaseDir:" + data.dataBaseDir);
// console.info("neu========================cacheDir:" + data.cacheDir);
// })
// })
//
//
// it('app_info_test_004', 0, function () {
//
// demo.getApplicationInfo('com.example.myapplicationInstall', 8, 0, OnReceiveEvent);
//
// function OnReceiveEvent(data) {
// console.info('**************************getApplicationInfo2********************************');
// console.info("neu========================name: for begin");
// console.info("neu========================name:" + data.name);
// console.info("neu========================bundleName:" + data.bundleName);
// console.info("neu========================description:" + data.description);
// console.info("neu========================descriptionId:" + data.descriptionId);
// console.info("neu========================iconPath:" + data.iconPath);
// console.info("neu========================iconId:" + data.iconId);
// console.info("neu========================label:" + data.label);
// console.info("neu========================labelId:" + data.labelId);
// console.info("neu========================deviceId:" + data.deviceId);
// console.info("neu========================signatureKey:" + data.signatureKey);
// console.info("neu========================process:" + data.process);
// console.info("neu========================isSystemApp:" + data.isSystemApp);
// console.info("neu========================isLauncherApp:" + data.isLauncherApp);
// console.info("neu========================supportedModes:" + data.supportedModes);
//
// console.info('getApplicationInfo permissions length [' + data.permissions.length + ']');
// for (var j = 0; j < data.permissions.length; j++) {
// console.info("neu====================permissions[" + j + "]:" + data.permissions[j]);
// }
// console.info('getApplicationInfo moduleSourceDirs length [' + data.moduleSourceDirs.length + ']');
// for (var j = 0; j < data.moduleSourceDirs.length; j++) {
// console.info("neu====================moduleSourceDirs[" + j + "]:" + data.moduleSourceDirs[j]);
// }
// console.info('getApplicationInfo moduleInfos length [' + data.moduleInfos.length + ']');
// for (var j = 0; j < data.moduleInfos.length; j++) {
// console.info("neu====================moduleInfos[" + j + "]moduleName:" + data.moduleInfos[j].moduleName);
// console.info("neu====================moduleInfos[" + j + "]moduleSourceDir:" + data.moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================entryDir:" + data.entryDir);
// console.info("neu========================codePath:" + data.codePath);
// console.info("neu========================dataDir:" + data.dataDir);
// console.info("neu========================dataBaseDir:" + data.dataBaseDir);
// console.info("neu========================cacheDir:" + data.cacheDir);
// }
//
// })
//
//
// it('app_info_test_005', 0, function () {
// demo.getBundleInfos(8).then((data) => {
// console.info('**************************getBundleInfos1********************************');
// console.info('xxx getBundleInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].vendor:" + data[i].vendor);
// console.info("neu========================index[" + i + "].versionCode:" + data[i].versionCode);
// console.info("neu========================index[" + i + "].versionName:" + data[i].versionName);
// console.info("neu========================index[" + i + "].jointUserId:" + data[i].jointUserId);
// console.info("neu========================index[" + i + "].minSdkVersion:" + data[i].minSdkVersion);
// console.info("neu========================index[" + i + "].maxSdkVersion:" + data[i].maxSdkVersion);
// console.info("neu========================index[" + i + "].mainEntry:" + data[i].mainEntry);
// console.info("neu========================index[" + i + "].cpuAbi:" + data[i].cpuAbi);
// console.info("neu========================index[" + i + "].appId:" + data[i].appId);
// console.info("neu========================index[" + i + "].compatibleVersion:" + data[i].compatibleVersion);
// console.info("neu========================index[" + i + "].targetVersion:" + data[i].targetVersion);
// console.info("neu========================index[" + i + "].releaseType:" + data[i].releaseType);
// console.info("neu========================index[" + i + "].uid:" + data[i].uid);
// console.info("neu========================index[" + i + "].gid:" + data[i].gid);
// console.info("neu========================index[" + i + "].seInfo:" + data[i].seInfo);
// console.info("neu========================index[" + i + "].entryModuleName:" + data[i].entryModuleName);
// console.info("neu========================index[" + i + "].isKeepAlive:" + data[i].isKeepAlive);
// console.info("neu========================index[" + i + "].isNativeApp:" + data[i].isNativeApp);
// console.info("neu========================index[" + i + "].installTime:" + data[i].installTime);
// console.info("neu========================index[" + i + "].updateTime:" + data[i].updateTime);
// console.info("neu========================index[" + i + "].appInfo.name:" + data[i].applicationInfo.name);
// console.info("neu========================index[" + i + "].appInfo.bundleName:" + data[i].applicationInfo.bundleName);
// console.info('getBundleInfos reqPermissions length [' + data[i].reqPermissions.length + ']');
// for (var j = 0; j < data[i].reqPermissions.length; j++) {
// console.info("neu====================index[" + i + "]reqPermissions[" + j + "]:" + data[i].reqPermissions[j]);
// }
// console.info('getBundleInfos defPermissions length [' + data[i].defPermissions.length + ']');
// for (var j = 0; j < data[i].defPermissions.length; j++) {
// console.info("neu====================index[" + i + "]defPermissions[" + j + "]:" + data[i].defPermissions[j]);
// }
//
// console.info('getBundleInfos hapModuleNames length [' + data[i].hapModuleNames.length + ']');
// for (var j = 0; j < data[i].hapModuleNames.length; j++) {
// console.info("neu====================index[" + i + "]hapModuleNames[" + j + "]:" + data[i].hapModuleNames[j]);
// }
// console.info('getBundleInfos moduleNames length [' + data[i].moduleNames.length + ']');
// for (var j = 0; j < data[i].moduleNames.length; j++) {
// console.info("neu====================index[" + i + "]moduleNames[" + j + "]:" + data[i].moduleNames[j]);
// }
// console.info('getBundleInfos modulePublicDirs length [' + data[i].modulePublicDirs.length + ']');
// for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
// console.info("neu====================index[" + i + "]modulePublicDirs[" + j + "]:" + data[i].modulePublicDirs[j]);
// }
// console.info('getBundleInfos moduleDirs length [' + data[i].moduleDirs.length + ']');
// for (var j = 0; j < data[i].moduleDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleDirs[" + j + "]:" + data[i].moduleDirs[j]);
// }
// console.info('getBundleInfos moduleResPaths length [' + data[i].moduleResPaths.length + ']');
// for (var j = 0; j < data[i].moduleResPaths.length; j++) {
// console.info("neu====================index[" + i + "]moduleResPaths[" + j + "]:" + data[i].moduleResPaths[j]);
// }
// console.info('getBundleInfos abilityInfo length [' + data[i].abilityInfos.length + ']');
// for (var j = 0; j < data[i].abilityInfos.length; j++) {
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]name:" + data[i].abilityInfos[j].name);
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]package:" + data[i].abilityInfos[j].package);
// }
// }
// })
// })
//
// it('app_info_test_006', 0, function () {
//
// demo.getBundleInfos(8, OnReceiveEvent);
//
// function OnReceiveEvent(data) {
// console.info('**************************getBundleInfos2********************************');
// console.info('xxx getBundleInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].vendor:" + data[i].vendor);
// console.info("neu========================index[" + i + "].versionCode:" + data[i].versionCode);
// console.info("neu========================index[" + i + "].versionName:" + data[i].versionName);
// console.info("neu========================index[" + i + "].jointUserId:" + data[i].jointUserId);
// console.info("neu========================index[" + i + "].minSdkVersion:" + data[i].minSdkVersion);
// console.info("neu========================index[" + i + "].maxSdkVersion:" + data[i].maxSdkVersion);
// console.info("neu========================index[" + i + "].mainEntry:" + data[i].mainEntry);
// console.info("neu========================index[" + i + "].cpuAbi:" + data[i].cpuAbi);
// console.info("neu========================index[" + i + "].appId:" + data[i].appId);
// console.info("neu========================index[" + i + "].compatibleVersion:" + data[i].compatibleVersion);
// console.info("neu========================index[" + i + "].targetVersion:" + data[i].targetVersion);
// console.info("neu========================index[" + i + "].releaseType:" + data[i].releaseType);
// console.info("neu========================index[" + i + "].uid:" + data[i].uid);
// console.info("neu========================index[" + i + "].gid:" + data[i].gid);
// console.info("neu========================index[" + i + "].seInfo:" + data[i].seInfo);
// console.info("neu========================index[" + i + "].entryModuleName:" + data[i].entryModuleName);
// console.info("neu========================index[" + i + "].isKeepAlive:" + data[i].isKeepAlive);
// console.info("neu========================index[" + i + "].isNativeApp:" + data[i].isNativeApp);
// console.info("neu========================index[" + i + "].installTime:" + data[i].installTime);
// console.info("neu========================index[" + i + "].updateTime:" + data[i].updateTime);
// console.info("neu========================index[" + i + "].appInfo.name:" + data[i].applicationInfo.name);
// console.info("neu========================index[" + i + "].appInfo.bundleName:" + data[i].applicationInfo.bundleName);
// console.info('getBundleInfos reqPermissions length [' + data[i].reqPermissions.length + ']');
// for (var j = 0; j < data[i].reqPermissions.length; j++) {
// console.info("neu====================index[" + i + "]reqPermissions[" + j + "]:" + data[i].reqPermissions[j]);
// }
// console.info('getBundleInfos defPermissions length [' + data[i].defPermissions.length + ']');
// for (var j = 0; j < data[i].defPermissions.length; j++) {
// console.info("neu====================index[" + i + "]defPermissions[" + j + "]:" + data[i].defPermissions[j]);
// }
//
// console.info('getBundleInfos hapModuleNames length [' + data[i].hapModuleNames.length + ']');
// for (var j = 0; j < data[i].hapModuleNames.length; j++) {
// console.info("neu====================index[" + i + "]hapModuleNames[" + j + "]:" + data[i].hapModuleNames[j]);
// }
// console.info('getBundleInfos moduleNames length [' + data[i].moduleNames.length + ']');
// for (var j = 0; j < data[i].moduleNames.length; j++) {
// console.info("neu====================index[" + i + "]moduleNames[" + j + "]:" + data[i].moduleNames[j]);
// }
// console.info('getBundleInfos modulePublicDirs length [' + data[i].modulePublicDirs.length + ']');
// for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
// console.info("neu====================index[" + i + "]modulePublicDirs[" + j + "]:" + data[i].modulePublicDirs[j]);
// }
// console.info('getBundleInfos moduleDirs length [' + data[i].moduleDirs.length + ']');
// for (var j = 0; j < data[i].moduleDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleDirs[" + j + "]:" + data[i].moduleDirs[j]);
// }
// console.info('getBundleInfos moduleResPaths length [' + data[i].moduleResPaths.length + ']');
// for (var j = 0; j < data[i].moduleResPaths.length; j++) {
// console.info("neu====================index[" + i + "]moduleResPaths[" + j + "]:" + data[i].moduleResPaths[j]);
// }
// console.info('getBundleInfos abilityInfo length [' + data[i].abilityInfos.length + ']');
// for (var j = 0; j < data[i].abilityInfos.length; j++) {
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]name:" + data[i].abilityInfos[j].name);
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]package:" + data[i].abilityInfos[j].package);
// }
// }
//
// }
//
// })
//
//
//})
//
//
//
//
//
//require('./Context.test.js')
//require('./AbilityManager.test.js')
\ No newline at end of file
{
"app": {
"bundleName": "com.example.napi_test_suite3",
"bundleName": "com.example.myapplication4",
"vendor": "example",
"version": {
"code": 1,
......@@ -14,9 +14,7 @@
},
"deviceConfig": {},
"module": {
"package": "com.example.napi_test_suite3",
"package": "com.example.myapplication",
"name": ".MyApplication",
"deviceType": [
"phone"
......@@ -38,35 +36,14 @@
]
}
],
"name": "com.example.napi_test_suite3.MainAbility",
"name": ".MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"defPermissions": [
{
"name": "com.permission.CAMERA",
"grantMode": "system_grant",
"availableScope": ["signature"],
"label": "CAMERA permission",
"description": "CAMERA permission in detail"
},
{
"name": "com.permission.music",
"grantMode": "system_grant",
"availableScope": ["signature"],
"label": "music permission",
"description": "music permission in detail"
},
{
"name": "com.permission.WeChat",
"grantMode": "system_grant",
"availableScope": ["signature"],
"label": "WeChat permission",
"description": "WeChat permission in detail"
"isVisible": "true",
"launchType": "standard",
"language": "C++"
}
],
"js": [
......
export default {
onCreate() {
console.info('AceApplication onCreate start');
//console.info('AceApplication onCreate add ' + demo.add(123,456));
//console.info('AceApplication onCreate getApplicationInfos ' + demo.getApplicationInfos(0,0));
//demo.getApplicationInfosPromise().then(function (data) {console.info('AceApplication onCreate GetApplicationInfosPromise');});
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
}
.title {
font-size: 100px;
transform: translate(-10px,-10px);
}
<div class="container">
<text class="title" style="transform : translate({{x}}px,{{y}}px);">
{{title}}
</text>
</div>
import demo from '@ohos.bundle'
export default {
data: {
title: "AI",
realHrValue: 0,
x: 0,
y: 100,
d: ","
},
onInit() {
this.title = this.$t('strings.world');
console.log("BmsApplication test for ams");
this.updateTime();
this.timer = setInterval(this.updateTime, 17)
},
updateTime: function () {
},
onDestroy() {
clearInterval(this.timer)
}
}
//
//import {Core} from 'deccjsunit/lite'
//const core=Core.getInstance()
//core.init()
//require('../../../test/List.test.js')
//core.execute()
import demo from '@ohos.bundle'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
console.log("BmsApplication test for ams");
demo.getBundleInstaller().then((data) => {
data.install(['/data/test1.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err,data) {
console.info("==============================install async install1==============================");
console.info("neu========================name: for begin");
console.info("neu========================install result code:" + err.code);
console.info("neu========================install result code:" + data.status);
console.info("neu========================install result msg:" + data.statusMessage);
}
});
demo.getBundleInstaller().then((data) => {
data.install(['/data/test.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err,data) {
console.info("==============================install async install2==============================");
console.info("neu========================name: for begin");
console.info("neu========================install result code:" + err.code);
console.info("neu========================install result code:" + data.status);
console.info("neu========================install result msg:" + data.statusMessage);
}
});
demo.getBundleInstaller().then((data) => {
data.uninstall('com.example.myapplicationInstall3', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err,data) {
console.info("==============================uninstall async uninstall==============================");
console.info("neu========================name: for begin");
console.info("neu========================uninstall result code:" + err.code);
console.info("neu========================uninstall result code:" + data.status);
console.info("neu========================uninstall result msg:" + data.statusMessage);
}
});
demo.getBundleInfos(8, OnReceiveEvent1);
function OnReceiveEvent1(err,data) {
console.info("neuXXXXXXXgetBundleInfosXXXXXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================data.length:" + data.length);
for (var i = 0; i < data.length; i++) {
console.info("neu========================data[i].name.length:" + data[i].name.length);
console.info("neu========================data[i].appInfo.name.length" + data[i].appInfo.name.length);
console.info("neu========================data[i].hapModuleInfos.length" + data[i].hapModuleInfos.length);
for (var j = 0; j < data[i].hapModuleInfos.length; j++) {
console.info("neu========================data[i].hapModuleInfos[j].length" + data[i].hapModuleInfos[j].length);
}
console.info("neu========================data[i].abilityInfos.length" + data[i].abilityInfos.length);
for (var j = 0; j < data[i].abilityInfos.length; j++) {
console.info("neu========================data[i].abilityInfos[j].name.length" + data[i].abilityInfos[j].name.length);
}
}
}
demo.getBundleInfo('com.example.myapplication',1,OnReceiveEvent2);
function OnReceiveEvent2(err,data) {
console.info("neuXXXXgetBundleInfoXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================err.code:" + err.code);
console.info("neu========================data.name:::" + data.name);
}
demo.getApplicationInfos(8, 0, OnReceiveEvent3);
function OnReceiveEvent3(err,datainfo) {
console.info("neuXXXXXXXgetApplicationInfosXXXXXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================datainfo.length:::" + datainfo.length);
for (var i = 0; i < datainfo.length; i++) {
console.info("neu========================datainfo[i].name" + datainfo[i].name);
}
}
demo.getApplicationInfo('com.example.myapplication', 8, 1, OnReceiveEvent4);
function OnReceiveEvent4(err,datainfo) {
console.info("neu========================err.code:" + err.code);
console.info("neuXXXXXXgetApplicationInfoXXXXXXX.name: for begin");
console.info("neu========================ddatainfo.name:::" + datainfo.name);
}
demo.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
},OnReceiveEvent5);
function OnReceiveEvent5(err,datainfo) {
console.info("neuXXXXXXqueryAbilityByWantXXXXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================datainfo.name:" + datainfo.name);
}
demo.getPermissionDef("com.permission.CAMERA",OnReceiveEvent6);
function OnReceiveEvent6(err,data) {
console.info('**************************getPermissionDef********************************');
console.info("neu========================err.code:" + err.code);
console.info("neu========================permissionName:" + data.permissionName);
}
demo.getBundleArchiveInfo('/data/test.hap',OnReceiveEvent7);
function OnReceiveEvent7(err,data) {
console.info('**************************getBundleArchiveInfo********************************');
console.info("neu========================err.code:" + err.code);
console.info("neu========================name:" + data.name);
}
}
}
//import abilitymanager from '@ohos.napi_ability_manager2'
//console.log('**************************getApplicationInfos********************************');
//describe('AbilityManagerTest', function () {
// it('get_all_running_processes_test_001', 0, function () {
//// var promise = abilitymanager.getAllRunningProcesses();
//// expect(typeof(promise)).zassertEqual("object");
// console.log('**************************getApplicationInfos********************************');
//// demo.getApplicationInfos().then((data) => {
//// console.info('**************************getApplicationInfos********************************');
//// console.info('xxx getApplicationInfos data length [' + data.length + ']');
//// for (var i = 0; i < data.length; i++) {
//// console.info("neu========================index[" + i + "].name: for begin");
//// console.info("neu========================index[" + i + "].name:" + data[i].name);
//// console.info("neu========================index[" + i + "].bundleName:" + data[i].bundleName);
//// console.info("neu========================index[" + i + "].description:" + data[i].description);
//// console.info("neu========================index[" + i + "].descriptionId:" + data[i].descriptionId);
//// console.info("neu========================index[" + i + "].iconPath:" + data[i].iconPath);
//// console.info("neu========================index[" + i + "].iconId:" + data[i].iconId);
//// console.info("neu========================index[" + i + "].label:" + data[i].label);
//// console.info("neu========================index[" + i + "].labelId:" + data[i].labelId);
//// console.info("neu========================index[" + i + "].deviceId:" + data[i].deviceId);
//// console.info("neu========================index[" + i + "].signatureKey:" + data[i].signatureKey);
//// console.info("neu========================index[" + i + "].process:" + data[i].process);
//// console.info("neu========================index[" + i + "].isSystemApp:" + data[i].isSystemApp);
//// console.info("neu========================index[" + i + "].isLauncherApp:" + data[i].isLauncherApp);
//// console.info("neu========================index[" + i + "].supportedModes:" + data[i].supportedModes);
////
//// console.info('getApplicationInfosAsync permissions length [' + data[i].permissions.length + ']');
//// for(var j = 0; j < data[i].permissions.length; j++) {
//// console.info("neu====================index[" + i + "]permissions[" + j + "]:" + data[i].permissions[j]);
//// }
//// console.info('getApplicationInfosAsync moduleSourceDirs length [' + data[i].moduleSourceDirs.length + ']');
//// for(var j = 0; j < data[i].moduleSourceDirs.length; j++) {
//// console.info("neu====================index[" + i + "]moduleSourceDirs[" + j + "]:" + data[i].moduleSourceDirs[j]);
//// }
//// console.info('getApplicationInfosAsync moduleInfos length [' + data[i].moduleInfos.length + ']');
//// for(var j = 0; j < data[i].moduleInfos.length; j++) {
//// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleName:" + data[i].moduleInfos[j].moduleName);
//// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleSourceDir:" + data[i].moduleInfos[j].moduleSourceDir);
//// }
//// console.info("neu========================index[" + i + "].entryDir:" + data[i].entryDir);
//// console.info("neu========================index[" + i + "].codePath:" + data[i].codePath);
//// console.info("neu========================index[" + i + "].dataDir:" + data[i].dataDir);
//// console.info("neu========================index[" + i + "].dataBaseDir:" + data[i].dataBaseDir);
//// console.info("neu========================index[" + i + "].cacheDir:" + data[i].cacheDir);
//// }
//// });
//
//
// })
//// it('get_all_running_processes_test_002', 0, async function (done) {
//// var info = await abilitymanager.getAllRunningProcesses();
//// expect(info[0].processName.length).assertLarger(0);
//// done();
//// })
//})
//import demo from '@ohos.bundle_mgr'
//
//describe('appInfoTest', function () {
//
// it('app_info_test_001', 0, function () {
//
//
// demo.getApplicationInfos(8, 0).then((data) => {
// console.info('**************************getApplicationInfos1********************************');
// console.info('xxx getApplicationInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].bundleName:" + data[i].bundleName);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].descriptionId:" + data[i].descriptionId);
// console.info("neu========================index[" + i + "].iconPath:" + data[i].iconPath);
// console.info("neu========================index[" + i + "].iconId:" + data[i].iconId);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].labelId:" + data[i].labelId);
// console.info("neu========================index[" + i + "].deviceId:" + data[i].deviceId);
// console.info("neu========================index[" + i + "].signatureKey:" + data[i].signatureKey);
// console.info("neu========================index[" + i + "].process:" + data[i].process);
// console.info("neu========================index[" + i + "].isSystemApp:" + data[i].isSystemApp);
// console.info("neu========================index[" + i + "].isLauncherApp:" + data[i].isLauncherApp);
// console.info("neu========================index[" + i + "].supportedModes:" + data[i].supportedModes);
//
// console.info('getApplicationInfosAsync permissions length [' + data[i].permissions.length + ']');
// for (var j = 0; j < data[i].permissions.length; j++) {
// console.info("neu====================index[" + i + "]permissions[" + j + "]:" + data[i].permissions[j]);
// }
// console.info('getApplicationInfosAsync moduleSourceDirs length [' + data[i].moduleSourceDirs.length + ']');
// for (var j = 0; j < data[i].moduleSourceDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleSourceDirs[" + j + "]:" + data[i].moduleSourceDirs[j]);
// }
// console.info('getApplicationInfosAsync moduleInfos length [' + data[i].moduleInfos.length + ']');
// for (var j = 0; j < data[i].moduleInfos.length; j++) {
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleName:" + data[i].moduleInfos[j].moduleName);
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleSourceDir:" + data[i].moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================index[" + i + "].entryDir:" + data[i].entryDir);
// console.info("neu========================index[" + i + "].codePath:" + data[i].codePath);
// console.info("neu========================index[" + i + "].dataDir:" + data[i].dataDir);
// console.info("neu========================index[" + i + "].dataBaseDir:" + data[i].dataBaseDir);
// console.info("neu========================index[" + i + "].cacheDir:" + data[i].cacheDir);
// }
// })
// })
//
// it('app_info_test_002', 0, function () {
//
// demo.getApplicationInfos(8, 0, OnReceiveEvent);
//
// function OnReceiveEvent(data) {
// console.info('**************************getApplicationInfos2********************************');
// console.info('xxx getApplicationInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].bundleName:" + data[i].bundleName);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].descriptionId:" + data[i].descriptionId);
// console.info("neu========================index[" + i + "].iconPath:" + data[i].iconPath);
// console.info("neu========================index[" + i + "].iconId:" + data[i].iconId);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].labelId:" + data[i].labelId);
// console.info("neu========================index[" + i + "].deviceId:" + data[i].deviceId);
// console.info("neu========================index[" + i + "].signatureKey:" + data[i].signatureKey);
// console.info("neu========================index[" + i + "].process:" + data[i].process);
// console.info("neu========================index[" + i + "].isSystemApp:" + data[i].isSystemApp);
// console.info("neu========================index[" + i + "].isLauncherApp:" + data[i].isLauncherApp);
// console.info("neu========================index[" + i + "].supportedModes:" + data[i].supportedModes);
//
// console.info('getApplicationInfosAsync permissions length [' + data[i].permissions.length + ']');
// for (var j = 0; j < data[i].permissions.length; j++) {
// console.info("neu====================index[" + i + "]permissions[" + j + "]:" + data[i].permissions[j]);
// }
// console.info('getApplicationInfosAsync moduleSourceDirs length [' + data[i].moduleSourceDirs.length + ']');
// for (var j = 0; j < data[i].moduleSourceDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleSourceDirs[" + j + "]:" + data[i].moduleSourceDirs[j]);
// }
// console.info('getApplicationInfosAsync moduleInfos length [' + data[i].moduleInfos.length + ']');
// for (var j = 0; j < data[i].moduleInfos.length; j++) {
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleName:" + data[i].moduleInfos[j].moduleName);
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleSourceDir:" + data[i].moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================index[" + i + "].entryDir:" + data[i].entryDir);
// console.info("neu========================index[" + i + "].codePath:" + data[i].codePath);
// console.info("neu========================index[" + i + "].dataDir:" + data[i].dataDir);
// console.info("neu========================index[" + i + "].dataBaseDir:" + data[i].dataBaseDir);
// console.info("neu========================index[" + i + "].cacheDir:" + data[i].cacheDir);
// }
// }
// })
//
//
// it('app_info_test_003', 0, function () {
//
// demo.getApplicationInfo('com.example.myapplicationInstall', 8, 0).then((data) => {
// console.info('**************************getApplicationInfo1********************************');
// console.info("neu========================name: for begin");
// console.info("neu========================name:" + data.name);
// console.info("neu========================bundleName:" + data.bundleName);
// console.info("neu========================description:" + data.description);
// console.info("neu========================descriptionId:" + data.descriptionId);
// console.info("neu========================iconPath:" + data.iconPath);
// console.info("neu========================iconId:" + data.iconId);
// console.info("neu========================label:" + data.label);
// console.info("neu========================labelId:" + data.labelId);
// console.info("neu========================deviceId:" + data.deviceId);
// console.info("neu========================signatureKey:" + data.signatureKey);
// console.info("neu========================process:" + data.process);
// console.info("neu========================isSystemApp:" + data.isSystemApp);
// console.info("neu========================isLauncherApp:" + data.isLauncherApp);
// console.info("neu========================supportedModes:" + data.supportedModes);
//
// console.info('getApplicationInfo permissions length [' + data.permissions.length + ']');
// for (var j = 0; j < data.permissions.length; j++) {
// console.info("neu====================permissions[" + j + "]:" + data.permissions[j]);
// }
// console.info('getApplicationInfo moduleSourceDirs length [' + data.moduleSourceDirs.length + ']');
// for (var j = 0; j < data.moduleSourceDirs.length; j++) {
// console.info("neu====================moduleSourceDirs[" + j + "]:" + data.moduleSourceDirs[j]);
// }
// console.info('getApplicationInfo moduleInfos length [' + data.moduleInfos.length + ']');
// for (var j = 0; j < data.moduleInfos.length; j++) {
// console.info("neu====================moduleInfos[" + j + "]moduleName:" + data.moduleInfos[j].moduleName);
// console.info("neu====================moduleInfos[" + j + "]moduleSourceDir:" + data.moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================entryDir:" + data.entryDir);
// console.info("neu========================codePath:" + data.codePath);
// console.info("neu========================dataDir:" + data.dataDir);
// console.info("neu========================dataBaseDir:" + data.dataBaseDir);
// console.info("neu========================cacheDir:" + data.cacheDir);
// })
// })
//
//
// it('app_info_test_004', 0, function () {
//
// demo.getApplicationInfo('com.example.myapplicationInstall', 8, 0, OnReceiveEvent);
//
// function OnReceiveEvent(data) {
// console.info('**************************getApplicationInfo2********************************');
// console.info("neu========================name: for begin");
// console.info("neu========================name:" + data.name);
// console.info("neu========================bundleName:" + data.bundleName);
// console.info("neu========================description:" + data.description);
// console.info("neu========================descriptionId:" + data.descriptionId);
// console.info("neu========================iconPath:" + data.iconPath);
// console.info("neu========================iconId:" + data.iconId);
// console.info("neu========================label:" + data.label);
// console.info("neu========================labelId:" + data.labelId);
// console.info("neu========================deviceId:" + data.deviceId);
// console.info("neu========================signatureKey:" + data.signatureKey);
// console.info("neu========================process:" + data.process);
// console.info("neu========================isSystemApp:" + data.isSystemApp);
// console.info("neu========================isLauncherApp:" + data.isLauncherApp);
// console.info("neu========================supportedModes:" + data.supportedModes);
//
// console.info('getApplicationInfo permissions length [' + data.permissions.length + ']');
// for (var j = 0; j < data.permissions.length; j++) {
// console.info("neu====================permissions[" + j + "]:" + data.permissions[j]);
// }
// console.info('getApplicationInfo moduleSourceDirs length [' + data.moduleSourceDirs.length + ']');
// for (var j = 0; j < data.moduleSourceDirs.length; j++) {
// console.info("neu====================moduleSourceDirs[" + j + "]:" + data.moduleSourceDirs[j]);
// }
// console.info('getApplicationInfo moduleInfos length [' + data.moduleInfos.length + ']');
// for (var j = 0; j < data.moduleInfos.length; j++) {
// console.info("neu====================moduleInfos[" + j + "]moduleName:" + data.moduleInfos[j].moduleName);
// console.info("neu====================moduleInfos[" + j + "]moduleSourceDir:" + data.moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================entryDir:" + data.entryDir);
// console.info("neu========================codePath:" + data.codePath);
// console.info("neu========================dataDir:" + data.dataDir);
// console.info("neu========================dataBaseDir:" + data.dataBaseDir);
// console.info("neu========================cacheDir:" + data.cacheDir);
// }
//
// })
//
//
// it('app_info_test_005', 0, function () {
// demo.getBundleInfos(8).then((data) => {
// console.info('**************************getBundleInfos1********************************');
// console.info('xxx getBundleInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].vendor:" + data[i].vendor);
// console.info("neu========================index[" + i + "].versionCode:" + data[i].versionCode);
// console.info("neu========================index[" + i + "].versionName:" + data[i].versionName);
// console.info("neu========================index[" + i + "].jointUserId:" + data[i].jointUserId);
// console.info("neu========================index[" + i + "].minSdkVersion:" + data[i].minSdkVersion);
// console.info("neu========================index[" + i + "].maxSdkVersion:" + data[i].maxSdkVersion);
// console.info("neu========================index[" + i + "].mainEntry:" + data[i].mainEntry);
// console.info("neu========================index[" + i + "].cpuAbi:" + data[i].cpuAbi);
// console.info("neu========================index[" + i + "].appId:" + data[i].appId);
// console.info("neu========================index[" + i + "].compatibleVersion:" + data[i].compatibleVersion);
// console.info("neu========================index[" + i + "].targetVersion:" + data[i].targetVersion);
// console.info("neu========================index[" + i + "].releaseType:" + data[i].releaseType);
// console.info("neu========================index[" + i + "].uid:" + data[i].uid);
// console.info("neu========================index[" + i + "].gid:" + data[i].gid);
// console.info("neu========================index[" + i + "].seInfo:" + data[i].seInfo);
// console.info("neu========================index[" + i + "].entryModuleName:" + data[i].entryModuleName);
// console.info("neu========================index[" + i + "].isKeepAlive:" + data[i].isKeepAlive);
// console.info("neu========================index[" + i + "].isNativeApp:" + data[i].isNativeApp);
// console.info("neu========================index[" + i + "].installTime:" + data[i].installTime);
// console.info("neu========================index[" + i + "].updateTime:" + data[i].updateTime);
// console.info("neu========================index[" + i + "].appInfo.name:" + data[i].applicationInfo.name);
// console.info("neu========================index[" + i + "].appInfo.bundleName:" + data[i].applicationInfo.bundleName);
// console.info('getBundleInfos reqPermissions length [' + data[i].reqPermissions.length + ']');
// for (var j = 0; j < data[i].reqPermissions.length; j++) {
// console.info("neu====================index[" + i + "]reqPermissions[" + j + "]:" + data[i].reqPermissions[j]);
// }
// console.info('getBundleInfos defPermissions length [' + data[i].defPermissions.length + ']');
// for (var j = 0; j < data[i].defPermissions.length; j++) {
// console.info("neu====================index[" + i + "]defPermissions[" + j + "]:" + data[i].defPermissions[j]);
// }
//
// console.info('getBundleInfos hapModuleNames length [' + data[i].hapModuleNames.length + ']');
// for (var j = 0; j < data[i].hapModuleNames.length; j++) {
// console.info("neu====================index[" + i + "]hapModuleNames[" + j + "]:" + data[i].hapModuleNames[j]);
// }
// console.info('getBundleInfos moduleNames length [' + data[i].moduleNames.length + ']');
// for (var j = 0; j < data[i].moduleNames.length; j++) {
// console.info("neu====================index[" + i + "]moduleNames[" + j + "]:" + data[i].moduleNames[j]);
// }
// console.info('getBundleInfos modulePublicDirs length [' + data[i].modulePublicDirs.length + ']');
// for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
// console.info("neu====================index[" + i + "]modulePublicDirs[" + j + "]:" + data[i].modulePublicDirs[j]);
// }
// console.info('getBundleInfos moduleDirs length [' + data[i].moduleDirs.length + ']');
// for (var j = 0; j < data[i].moduleDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleDirs[" + j + "]:" + data[i].moduleDirs[j]);
// }
// console.info('getBundleInfos moduleResPaths length [' + data[i].moduleResPaths.length + ']');
// for (var j = 0; j < data[i].moduleResPaths.length; j++) {
// console.info("neu====================index[" + i + "]moduleResPaths[" + j + "]:" + data[i].moduleResPaths[j]);
// }
// console.info('getBundleInfos abilityInfo length [' + data[i].abilityInfos.length + ']');
// for (var j = 0; j < data[i].abilityInfos.length; j++) {
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]name:" + data[i].abilityInfos[j].name);
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]package:" + data[i].abilityInfos[j].package);
// }
// }
// })
// })
//
// it('app_info_test_006', 0, function () {
//
// demo.getBundleInfos(8, OnReceiveEvent);
//
// function OnReceiveEvent(data) {
// console.info('**************************getBundleInfos2********************************');
// console.info('xxx getBundleInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].vendor:" + data[i].vendor);
// console.info("neu========================index[" + i + "].versionCode:" + data[i].versionCode);
// console.info("neu========================index[" + i + "].versionName:" + data[i].versionName);
// console.info("neu========================index[" + i + "].jointUserId:" + data[i].jointUserId);
// console.info("neu========================index[" + i + "].minSdkVersion:" + data[i].minSdkVersion);
// console.info("neu========================index[" + i + "].maxSdkVersion:" + data[i].maxSdkVersion);
// console.info("neu========================index[" + i + "].mainEntry:" + data[i].mainEntry);
// console.info("neu========================index[" + i + "].cpuAbi:" + data[i].cpuAbi);
// console.info("neu========================index[" + i + "].appId:" + data[i].appId);
// console.info("neu========================index[" + i + "].compatibleVersion:" + data[i].compatibleVersion);
// console.info("neu========================index[" + i + "].targetVersion:" + data[i].targetVersion);
// console.info("neu========================index[" + i + "].releaseType:" + data[i].releaseType);
// console.info("neu========================index[" + i + "].uid:" + data[i].uid);
// console.info("neu========================index[" + i + "].gid:" + data[i].gid);
// console.info("neu========================index[" + i + "].seInfo:" + data[i].seInfo);
// console.info("neu========================index[" + i + "].entryModuleName:" + data[i].entryModuleName);
// console.info("neu========================index[" + i + "].isKeepAlive:" + data[i].isKeepAlive);
// console.info("neu========================index[" + i + "].isNativeApp:" + data[i].isNativeApp);
// console.info("neu========================index[" + i + "].installTime:" + data[i].installTime);
// console.info("neu========================index[" + i + "].updateTime:" + data[i].updateTime);
// console.info("neu========================index[" + i + "].appInfo.name:" + data[i].applicationInfo.name);
// console.info("neu========================index[" + i + "].appInfo.bundleName:" + data[i].applicationInfo.bundleName);
// console.info('getBundleInfos reqPermissions length [' + data[i].reqPermissions.length + ']');
// for (var j = 0; j < data[i].reqPermissions.length; j++) {
// console.info("neu====================index[" + i + "]reqPermissions[" + j + "]:" + data[i].reqPermissions[j]);
// }
// console.info('getBundleInfos defPermissions length [' + data[i].defPermissions.length + ']');
// for (var j = 0; j < data[i].defPermissions.length; j++) {
// console.info("neu====================index[" + i + "]defPermissions[" + j + "]:" + data[i].defPermissions[j]);
// }
//
// console.info('getBundleInfos hapModuleNames length [' + data[i].hapModuleNames.length + ']');
// for (var j = 0; j < data[i].hapModuleNames.length; j++) {
// console.info("neu====================index[" + i + "]hapModuleNames[" + j + "]:" + data[i].hapModuleNames[j]);
// }
// console.info('getBundleInfos moduleNames length [' + data[i].moduleNames.length + ']');
// for (var j = 0; j < data[i].moduleNames.length; j++) {
// console.info("neu====================index[" + i + "]moduleNames[" + j + "]:" + data[i].moduleNames[j]);
// }
// console.info('getBundleInfos modulePublicDirs length [' + data[i].modulePublicDirs.length + ']');
// for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
// console.info("neu====================index[" + i + "]modulePublicDirs[" + j + "]:" + data[i].modulePublicDirs[j]);
// }
// console.info('getBundleInfos moduleDirs length [' + data[i].moduleDirs.length + ']');
// for (var j = 0; j < data[i].moduleDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleDirs[" + j + "]:" + data[i].moduleDirs[j]);
// }
// console.info('getBundleInfos moduleResPaths length [' + data[i].moduleResPaths.length + ']');
// for (var j = 0; j < data[i].moduleResPaths.length; j++) {
// console.info("neu====================index[" + i + "]moduleResPaths[" + j + "]:" + data[i].moduleResPaths[j]);
// }
// console.info('getBundleInfos abilityInfo length [' + data[i].abilityInfos.length + ']');
// for (var j = 0; j < data[i].abilityInfos.length; j++) {
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]name:" + data[i].abilityInfos[j].name);
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]package:" + data[i].abilityInfos[j].package);
// }
// }
//
// }
//
// })
//
//
//})
//
//
//
//
//
//require('./Context.test.js')
//require('./AbilityManager.test.js')
\ No newline at end of file
{
"app": {
"bundleName": "com.example.myapplication5",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.myapplication",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": ".MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "standard",
"language": "C++"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
export default {
onCreate() {
console.info('AceApplication onCreate start');
//console.info('AceApplication onCreate add ' + demo.add(123,456));
//console.info('AceApplication onCreate getApplicationInfos ' + demo.getApplicationInfos(0,0));
//demo.getApplicationInfosPromise().then(function (data) {console.info('AceApplication onCreate GetApplicationInfosPromise');});
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
}
.title {
font-size: 100px;
transform: translate(-10px,-10px);
}
<div class="container">
<text class="title" style="transform : translate({{x}}px,{{y}}px);">
{{title}}
</text>
</div>
import demo from '@ohos.bundle'
export default {
data: {
title: "AI",
realHrValue: 0,
x: 0,
y: 100,
d: ","
},
onInit() {
this.title = this.$t('strings.world');
console.log("BmsApplication test for ams");
this.updateTime();
this.timer = setInterval(this.updateTime, 17)
},
updateTime: function () {
},
onDestroy() {
clearInterval(this.timer)
}
}
//
//import {Core} from 'deccjsunit/lite'
//const core=Core.getInstance()
//core.init()
//require('../../../test/List.test.js')
//core.execute()
import demo from '@ohos.bundle'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
console.log("BmsApplication test for ams");
demo.getBundleInstaller().then((data) => {
data.install(['/data/test1.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err,data) {
console.info("==============================install async install1==============================");
console.info("neu========================name: for begin");
console.info("neu========================install result code:" + err.code);
console.info("neu========================install result code:" + data.status);
console.info("neu========================install result msg:" + data.statusMessage);
}
});
demo.getBundleInstaller().then((data) => {
data.install(['/data/test.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err,data) {
console.info("==============================install async install2==============================");
console.info("neu========================name: for begin");
console.info("neu========================install result code:" + err.code);
console.info("neu========================install result code:" + data.status);
console.info("neu========================install result msg:" + data.statusMessage);
}
});
demo.getBundleInstaller().then((data) => {
data.uninstall('com.example.myapplicationInstall3', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err,data) {
console.info("==============================uninstall async uninstall==============================");
console.info("neu========================name: for begin");
console.info("neu========================uninstall result code:" + err.code);
console.info("neu========================uninstall result code:" + data.status);
console.info("neu========================uninstall result msg:" + data.statusMessage);
}
});
demo.getBundleInfos(8, OnReceiveEvent1);
function OnReceiveEvent1(err,data) {
console.info("neuXXXXXXXgetBundleInfosXXXXXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================data.length:" + data.length);
for (var i = 0; i < data.length; i++) {
console.info("neu========================data[i].name.length:" + data[i].name.length);
console.info("neu========================data[i].appInfo.name.length" + data[i].appInfo.name.length);
console.info("neu========================data[i].hapModuleInfos.length" + data[i].hapModuleInfos.length);
for (var j = 0; j < data[i].hapModuleInfos.length; j++) {
console.info("neu========================data[i].hapModuleInfos[j].length" + data[i].hapModuleInfos[j].length);
}
console.info("neu========================data[i].abilityInfos.length" + data[i].abilityInfos.length);
for (var j = 0; j < data[i].abilityInfos.length; j++) {
console.info("neu========================data[i].abilityInfos[j].name.length" + data[i].abilityInfos[j].name.length);
}
}
}
demo.getBundleInfo('com.example.myapplication',1,OnReceiveEvent2);
function OnReceiveEvent2(err,data) {
console.info("neuXXXXgetBundleInfoXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================err.code:" + err.code);
console.info("neu========================data.name:::" + data.name);
}
demo.getApplicationInfos(8, 0, OnReceiveEvent3);
function OnReceiveEvent3(err,datainfo) {
console.info("neuXXXXXXXgetApplicationInfosXXXXXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================datainfo.length:::" + datainfo.length);
for (var i = 0; i < datainfo.length; i++) {
console.info("neu========================datainfo[i].name" + datainfo[i].name);
}
}
demo.getApplicationInfo('com.example.myapplication', 8, 1, OnReceiveEvent4);
function OnReceiveEvent4(err,datainfo) {
console.info("neu========================err.code:" + err.code);
console.info("neuXXXXXXgetApplicationInfoXXXXXXX.name: for begin");
console.info("neu========================ddatainfo.name:::" + datainfo.name);
}
demo.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
},OnReceiveEvent5);
function OnReceiveEvent5(err,datainfo) {
console.info("neuXXXXXXqueryAbilityByWantXXXXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================datainfo.name:" + datainfo.name);
}
demo.getPermissionDef("com.permission.CAMERA",OnReceiveEvent6);
function OnReceiveEvent6(err,data) {
console.info('**************************getPermissionDef********************************');
console.info("neu========================err.code:" + err.code);
console.info("neu========================permissionName:" + data.permissionName);
}
demo.getBundleArchiveInfo('/data/test.hap',OnReceiveEvent7);
function OnReceiveEvent7(err,data) {
console.info('**************************getBundleArchiveInfo********************************');
console.info("neu========================err.code:" + err.code);
console.info("neu========================name:" + data.name);
}
}
}
//import abilitymanager from '@ohos.napi_ability_manager2'
//console.log('**************************getApplicationInfos********************************');
//describe('AbilityManagerTest', function () {
// it('get_all_running_processes_test_001', 0, function () {
//// var promise = abilitymanager.getAllRunningProcesses();
//// expect(typeof(promise)).zassertEqual("object");
// console.log('**************************getApplicationInfos********************************');
//// demo.getApplicationInfos().then((data) => {
//// console.info('**************************getApplicationInfos********************************');
//// console.info('xxx getApplicationInfos data length [' + data.length + ']');
//// for (var i = 0; i < data.length; i++) {
//// console.info("neu========================index[" + i + "].name: for begin");
//// console.info("neu========================index[" + i + "].name:" + data[i].name);
//// console.info("neu========================index[" + i + "].bundleName:" + data[i].bundleName);
//// console.info("neu========================index[" + i + "].description:" + data[i].description);
//// console.info("neu========================index[" + i + "].descriptionId:" + data[i].descriptionId);
//// console.info("neu========================index[" + i + "].iconPath:" + data[i].iconPath);
//// console.info("neu========================index[" + i + "].iconId:" + data[i].iconId);
//// console.info("neu========================index[" + i + "].label:" + data[i].label);
//// console.info("neu========================index[" + i + "].labelId:" + data[i].labelId);
//// console.info("neu========================index[" + i + "].deviceId:" + data[i].deviceId);
//// console.info("neu========================index[" + i + "].signatureKey:" + data[i].signatureKey);
//// console.info("neu========================index[" + i + "].process:" + data[i].process);
//// console.info("neu========================index[" + i + "].isSystemApp:" + data[i].isSystemApp);
//// console.info("neu========================index[" + i + "].isLauncherApp:" + data[i].isLauncherApp);
//// console.info("neu========================index[" + i + "].supportedModes:" + data[i].supportedModes);
////
//// console.info('getApplicationInfosAsync permissions length [' + data[i].permissions.length + ']');
//// for(var j = 0; j < data[i].permissions.length; j++) {
//// console.info("neu====================index[" + i + "]permissions[" + j + "]:" + data[i].permissions[j]);
//// }
//// console.info('getApplicationInfosAsync moduleSourceDirs length [' + data[i].moduleSourceDirs.length + ']');
//// for(var j = 0; j < data[i].moduleSourceDirs.length; j++) {
//// console.info("neu====================index[" + i + "]moduleSourceDirs[" + j + "]:" + data[i].moduleSourceDirs[j]);
//// }
//// console.info('getApplicationInfosAsync moduleInfos length [' + data[i].moduleInfos.length + ']');
//// for(var j = 0; j < data[i].moduleInfos.length; j++) {
//// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleName:" + data[i].moduleInfos[j].moduleName);
//// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleSourceDir:" + data[i].moduleInfos[j].moduleSourceDir);
//// }
//// console.info("neu========================index[" + i + "].entryDir:" + data[i].entryDir);
//// console.info("neu========================index[" + i + "].codePath:" + data[i].codePath);
//// console.info("neu========================index[" + i + "].dataDir:" + data[i].dataDir);
//// console.info("neu========================index[" + i + "].dataBaseDir:" + data[i].dataBaseDir);
//// console.info("neu========================index[" + i + "].cacheDir:" + data[i].cacheDir);
//// }
//// });
//
//
// })
//// it('get_all_running_processes_test_002', 0, async function (done) {
//// var info = await abilitymanager.getAllRunningProcesses();
//// expect(info[0].processName.length).assertLarger(0);
//// done();
//// })
//})
//import demo from '@ohos.bundle_mgr'
//
//describe('appInfoTest', function () {
//
// it('app_info_test_001', 0, function () {
//
//
// demo.getApplicationInfos(8, 0).then((data) => {
// console.info('**************************getApplicationInfos1********************************');
// console.info('xxx getApplicationInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].bundleName:" + data[i].bundleName);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].descriptionId:" + data[i].descriptionId);
// console.info("neu========================index[" + i + "].iconPath:" + data[i].iconPath);
// console.info("neu========================index[" + i + "].iconId:" + data[i].iconId);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].labelId:" + data[i].labelId);
// console.info("neu========================index[" + i + "].deviceId:" + data[i].deviceId);
// console.info("neu========================index[" + i + "].signatureKey:" + data[i].signatureKey);
// console.info("neu========================index[" + i + "].process:" + data[i].process);
// console.info("neu========================index[" + i + "].isSystemApp:" + data[i].isSystemApp);
// console.info("neu========================index[" + i + "].isLauncherApp:" + data[i].isLauncherApp);
// console.info("neu========================index[" + i + "].supportedModes:" + data[i].supportedModes);
//
// console.info('getApplicationInfosAsync permissions length [' + data[i].permissions.length + ']');
// for (var j = 0; j < data[i].permissions.length; j++) {
// console.info("neu====================index[" + i + "]permissions[" + j + "]:" + data[i].permissions[j]);
// }
// console.info('getApplicationInfosAsync moduleSourceDirs length [' + data[i].moduleSourceDirs.length + ']');
// for (var j = 0; j < data[i].moduleSourceDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleSourceDirs[" + j + "]:" + data[i].moduleSourceDirs[j]);
// }
// console.info('getApplicationInfosAsync moduleInfos length [' + data[i].moduleInfos.length + ']');
// for (var j = 0; j < data[i].moduleInfos.length; j++) {
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleName:" + data[i].moduleInfos[j].moduleName);
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleSourceDir:" + data[i].moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================index[" + i + "].entryDir:" + data[i].entryDir);
// console.info("neu========================index[" + i + "].codePath:" + data[i].codePath);
// console.info("neu========================index[" + i + "].dataDir:" + data[i].dataDir);
// console.info("neu========================index[" + i + "].dataBaseDir:" + data[i].dataBaseDir);
// console.info("neu========================index[" + i + "].cacheDir:" + data[i].cacheDir);
// }
// })
// })
//
// it('app_info_test_002', 0, function () {
//
// demo.getApplicationInfos(8, 0, OnReceiveEvent);
//
// function OnReceiveEvent(data) {
// console.info('**************************getApplicationInfos2********************************');
// console.info('xxx getApplicationInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].bundleName:" + data[i].bundleName);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].descriptionId:" + data[i].descriptionId);
// console.info("neu========================index[" + i + "].iconPath:" + data[i].iconPath);
// console.info("neu========================index[" + i + "].iconId:" + data[i].iconId);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].labelId:" + data[i].labelId);
// console.info("neu========================index[" + i + "].deviceId:" + data[i].deviceId);
// console.info("neu========================index[" + i + "].signatureKey:" + data[i].signatureKey);
// console.info("neu========================index[" + i + "].process:" + data[i].process);
// console.info("neu========================index[" + i + "].isSystemApp:" + data[i].isSystemApp);
// console.info("neu========================index[" + i + "].isLauncherApp:" + data[i].isLauncherApp);
// console.info("neu========================index[" + i + "].supportedModes:" + data[i].supportedModes);
//
// console.info('getApplicationInfosAsync permissions length [' + data[i].permissions.length + ']');
// for (var j = 0; j < data[i].permissions.length; j++) {
// console.info("neu====================index[" + i + "]permissions[" + j + "]:" + data[i].permissions[j]);
// }
// console.info('getApplicationInfosAsync moduleSourceDirs length [' + data[i].moduleSourceDirs.length + ']');
// for (var j = 0; j < data[i].moduleSourceDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleSourceDirs[" + j + "]:" + data[i].moduleSourceDirs[j]);
// }
// console.info('getApplicationInfosAsync moduleInfos length [' + data[i].moduleInfos.length + ']');
// for (var j = 0; j < data[i].moduleInfos.length; j++) {
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleName:" + data[i].moduleInfos[j].moduleName);
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleSourceDir:" + data[i].moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================index[" + i + "].entryDir:" + data[i].entryDir);
// console.info("neu========================index[" + i + "].codePath:" + data[i].codePath);
// console.info("neu========================index[" + i + "].dataDir:" + data[i].dataDir);
// console.info("neu========================index[" + i + "].dataBaseDir:" + data[i].dataBaseDir);
// console.info("neu========================index[" + i + "].cacheDir:" + data[i].cacheDir);
// }
// }
// })
//
//
// it('app_info_test_003', 0, function () {
//
// demo.getApplicationInfo('com.example.myapplicationInstall', 8, 0).then((data) => {
// console.info('**************************getApplicationInfo1********************************');
// console.info("neu========================name: for begin");
// console.info("neu========================name:" + data.name);
// console.info("neu========================bundleName:" + data.bundleName);
// console.info("neu========================description:" + data.description);
// console.info("neu========================descriptionId:" + data.descriptionId);
// console.info("neu========================iconPath:" + data.iconPath);
// console.info("neu========================iconId:" + data.iconId);
// console.info("neu========================label:" + data.label);
// console.info("neu========================labelId:" + data.labelId);
// console.info("neu========================deviceId:" + data.deviceId);
// console.info("neu========================signatureKey:" + data.signatureKey);
// console.info("neu========================process:" + data.process);
// console.info("neu========================isSystemApp:" + data.isSystemApp);
// console.info("neu========================isLauncherApp:" + data.isLauncherApp);
// console.info("neu========================supportedModes:" + data.supportedModes);
//
// console.info('getApplicationInfo permissions length [' + data.permissions.length + ']');
// for (var j = 0; j < data.permissions.length; j++) {
// console.info("neu====================permissions[" + j + "]:" + data.permissions[j]);
// }
// console.info('getApplicationInfo moduleSourceDirs length [' + data.moduleSourceDirs.length + ']');
// for (var j = 0; j < data.moduleSourceDirs.length; j++) {
// console.info("neu====================moduleSourceDirs[" + j + "]:" + data.moduleSourceDirs[j]);
// }
// console.info('getApplicationInfo moduleInfos length [' + data.moduleInfos.length + ']');
// for (var j = 0; j < data.moduleInfos.length; j++) {
// console.info("neu====================moduleInfos[" + j + "]moduleName:" + data.moduleInfos[j].moduleName);
// console.info("neu====================moduleInfos[" + j + "]moduleSourceDir:" + data.moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================entryDir:" + data.entryDir);
// console.info("neu========================codePath:" + data.codePath);
// console.info("neu========================dataDir:" + data.dataDir);
// console.info("neu========================dataBaseDir:" + data.dataBaseDir);
// console.info("neu========================cacheDir:" + data.cacheDir);
// })
// })
//
//
// it('app_info_test_004', 0, function () {
//
// demo.getApplicationInfo('com.example.myapplicationInstall', 8, 0, OnReceiveEvent);
//
// function OnReceiveEvent(data) {
// console.info('**************************getApplicationInfo2********************************');
// console.info("neu========================name: for begin");
// console.info("neu========================name:" + data.name);
// console.info("neu========================bundleName:" + data.bundleName);
// console.info("neu========================description:" + data.description);
// console.info("neu========================descriptionId:" + data.descriptionId);
// console.info("neu========================iconPath:" + data.iconPath);
// console.info("neu========================iconId:" + data.iconId);
// console.info("neu========================label:" + data.label);
// console.info("neu========================labelId:" + data.labelId);
// console.info("neu========================deviceId:" + data.deviceId);
// console.info("neu========================signatureKey:" + data.signatureKey);
// console.info("neu========================process:" + data.process);
// console.info("neu========================isSystemApp:" + data.isSystemApp);
// console.info("neu========================isLauncherApp:" + data.isLauncherApp);
// console.info("neu========================supportedModes:" + data.supportedModes);
//
// console.info('getApplicationInfo permissions length [' + data.permissions.length + ']');
// for (var j = 0; j < data.permissions.length; j++) {
// console.info("neu====================permissions[" + j + "]:" + data.permissions[j]);
// }
// console.info('getApplicationInfo moduleSourceDirs length [' + data.moduleSourceDirs.length + ']');
// for (var j = 0; j < data.moduleSourceDirs.length; j++) {
// console.info("neu====================moduleSourceDirs[" + j + "]:" + data.moduleSourceDirs[j]);
// }
// console.info('getApplicationInfo moduleInfos length [' + data.moduleInfos.length + ']');
// for (var j = 0; j < data.moduleInfos.length; j++) {
// console.info("neu====================moduleInfos[" + j + "]moduleName:" + data.moduleInfos[j].moduleName);
// console.info("neu====================moduleInfos[" + j + "]moduleSourceDir:" + data.moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================entryDir:" + data.entryDir);
// console.info("neu========================codePath:" + data.codePath);
// console.info("neu========================dataDir:" + data.dataDir);
// console.info("neu========================dataBaseDir:" + data.dataBaseDir);
// console.info("neu========================cacheDir:" + data.cacheDir);
// }
//
// })
//
//
// it('app_info_test_005', 0, function () {
// demo.getBundleInfos(8).then((data) => {
// console.info('**************************getBundleInfos1********************************');
// console.info('xxx getBundleInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].vendor:" + data[i].vendor);
// console.info("neu========================index[" + i + "].versionCode:" + data[i].versionCode);
// console.info("neu========================index[" + i + "].versionName:" + data[i].versionName);
// console.info("neu========================index[" + i + "].jointUserId:" + data[i].jointUserId);
// console.info("neu========================index[" + i + "].minSdkVersion:" + data[i].minSdkVersion);
// console.info("neu========================index[" + i + "].maxSdkVersion:" + data[i].maxSdkVersion);
// console.info("neu========================index[" + i + "].mainEntry:" + data[i].mainEntry);
// console.info("neu========================index[" + i + "].cpuAbi:" + data[i].cpuAbi);
// console.info("neu========================index[" + i + "].appId:" + data[i].appId);
// console.info("neu========================index[" + i + "].compatibleVersion:" + data[i].compatibleVersion);
// console.info("neu========================index[" + i + "].targetVersion:" + data[i].targetVersion);
// console.info("neu========================index[" + i + "].releaseType:" + data[i].releaseType);
// console.info("neu========================index[" + i + "].uid:" + data[i].uid);
// console.info("neu========================index[" + i + "].gid:" + data[i].gid);
// console.info("neu========================index[" + i + "].seInfo:" + data[i].seInfo);
// console.info("neu========================index[" + i + "].entryModuleName:" + data[i].entryModuleName);
// console.info("neu========================index[" + i + "].isKeepAlive:" + data[i].isKeepAlive);
// console.info("neu========================index[" + i + "].isNativeApp:" + data[i].isNativeApp);
// console.info("neu========================index[" + i + "].installTime:" + data[i].installTime);
// console.info("neu========================index[" + i + "].updateTime:" + data[i].updateTime);
// console.info("neu========================index[" + i + "].appInfo.name:" + data[i].applicationInfo.name);
// console.info("neu========================index[" + i + "].appInfo.bundleName:" + data[i].applicationInfo.bundleName);
// console.info('getBundleInfos reqPermissions length [' + data[i].reqPermissions.length + ']');
// for (var j = 0; j < data[i].reqPermissions.length; j++) {
// console.info("neu====================index[" + i + "]reqPermissions[" + j + "]:" + data[i].reqPermissions[j]);
// }
// console.info('getBundleInfos defPermissions length [' + data[i].defPermissions.length + ']');
// for (var j = 0; j < data[i].defPermissions.length; j++) {
// console.info("neu====================index[" + i + "]defPermissions[" + j + "]:" + data[i].defPermissions[j]);
// }
//
// console.info('getBundleInfos hapModuleNames length [' + data[i].hapModuleNames.length + ']');
// for (var j = 0; j < data[i].hapModuleNames.length; j++) {
// console.info("neu====================index[" + i + "]hapModuleNames[" + j + "]:" + data[i].hapModuleNames[j]);
// }
// console.info('getBundleInfos moduleNames length [' + data[i].moduleNames.length + ']');
// for (var j = 0; j < data[i].moduleNames.length; j++) {
// console.info("neu====================index[" + i + "]moduleNames[" + j + "]:" + data[i].moduleNames[j]);
// }
// console.info('getBundleInfos modulePublicDirs length [' + data[i].modulePublicDirs.length + ']');
// for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
// console.info("neu====================index[" + i + "]modulePublicDirs[" + j + "]:" + data[i].modulePublicDirs[j]);
// }
// console.info('getBundleInfos moduleDirs length [' + data[i].moduleDirs.length + ']');
// for (var j = 0; j < data[i].moduleDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleDirs[" + j + "]:" + data[i].moduleDirs[j]);
// }
// console.info('getBundleInfos moduleResPaths length [' + data[i].moduleResPaths.length + ']');
// for (var j = 0; j < data[i].moduleResPaths.length; j++) {
// console.info("neu====================index[" + i + "]moduleResPaths[" + j + "]:" + data[i].moduleResPaths[j]);
// }
// console.info('getBundleInfos abilityInfo length [' + data[i].abilityInfos.length + ']');
// for (var j = 0; j < data[i].abilityInfos.length; j++) {
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]name:" + data[i].abilityInfos[j].name);
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]package:" + data[i].abilityInfos[j].package);
// }
// }
// })
// })
//
// it('app_info_test_006', 0, function () {
//
// demo.getBundleInfos(8, OnReceiveEvent);
//
// function OnReceiveEvent(data) {
// console.info('**************************getBundleInfos2********************************');
// console.info('xxx getBundleInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].vendor:" + data[i].vendor);
// console.info("neu========================index[" + i + "].versionCode:" + data[i].versionCode);
// console.info("neu========================index[" + i + "].versionName:" + data[i].versionName);
// console.info("neu========================index[" + i + "].jointUserId:" + data[i].jointUserId);
// console.info("neu========================index[" + i + "].minSdkVersion:" + data[i].minSdkVersion);
// console.info("neu========================index[" + i + "].maxSdkVersion:" + data[i].maxSdkVersion);
// console.info("neu========================index[" + i + "].mainEntry:" + data[i].mainEntry);
// console.info("neu========================index[" + i + "].cpuAbi:" + data[i].cpuAbi);
// console.info("neu========================index[" + i + "].appId:" + data[i].appId);
// console.info("neu========================index[" + i + "].compatibleVersion:" + data[i].compatibleVersion);
// console.info("neu========================index[" + i + "].targetVersion:" + data[i].targetVersion);
// console.info("neu========================index[" + i + "].releaseType:" + data[i].releaseType);
// console.info("neu========================index[" + i + "].uid:" + data[i].uid);
// console.info("neu========================index[" + i + "].gid:" + data[i].gid);
// console.info("neu========================index[" + i + "].seInfo:" + data[i].seInfo);
// console.info("neu========================index[" + i + "].entryModuleName:" + data[i].entryModuleName);
// console.info("neu========================index[" + i + "].isKeepAlive:" + data[i].isKeepAlive);
// console.info("neu========================index[" + i + "].isNativeApp:" + data[i].isNativeApp);
// console.info("neu========================index[" + i + "].installTime:" + data[i].installTime);
// console.info("neu========================index[" + i + "].updateTime:" + data[i].updateTime);
// console.info("neu========================index[" + i + "].appInfo.name:" + data[i].applicationInfo.name);
// console.info("neu========================index[" + i + "].appInfo.bundleName:" + data[i].applicationInfo.bundleName);
// console.info('getBundleInfos reqPermissions length [' + data[i].reqPermissions.length + ']');
// for (var j = 0; j < data[i].reqPermissions.length; j++) {
// console.info("neu====================index[" + i + "]reqPermissions[" + j + "]:" + data[i].reqPermissions[j]);
// }
// console.info('getBundleInfos defPermissions length [' + data[i].defPermissions.length + ']');
// for (var j = 0; j < data[i].defPermissions.length; j++) {
// console.info("neu====================index[" + i + "]defPermissions[" + j + "]:" + data[i].defPermissions[j]);
// }
//
// console.info('getBundleInfos hapModuleNames length [' + data[i].hapModuleNames.length + ']');
// for (var j = 0; j < data[i].hapModuleNames.length; j++) {
// console.info("neu====================index[" + i + "]hapModuleNames[" + j + "]:" + data[i].hapModuleNames[j]);
// }
// console.info('getBundleInfos moduleNames length [' + data[i].moduleNames.length + ']');
// for (var j = 0; j < data[i].moduleNames.length; j++) {
// console.info("neu====================index[" + i + "]moduleNames[" + j + "]:" + data[i].moduleNames[j]);
// }
// console.info('getBundleInfos modulePublicDirs length [' + data[i].modulePublicDirs.length + ']');
// for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
// console.info("neu====================index[" + i + "]modulePublicDirs[" + j + "]:" + data[i].modulePublicDirs[j]);
// }
// console.info('getBundleInfos moduleDirs length [' + data[i].moduleDirs.length + ']');
// for (var j = 0; j < data[i].moduleDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleDirs[" + j + "]:" + data[i].moduleDirs[j]);
// }
// console.info('getBundleInfos moduleResPaths length [' + data[i].moduleResPaths.length + ']');
// for (var j = 0; j < data[i].moduleResPaths.length; j++) {
// console.info("neu====================index[" + i + "]moduleResPaths[" + j + "]:" + data[i].moduleResPaths[j]);
// }
// console.info('getBundleInfos abilityInfo length [' + data[i].abilityInfos.length + ']');
// for (var j = 0; j < data[i].abilityInfos.length; j++) {
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]name:" + data[i].abilityInfos[j].name);
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]package:" + data[i].abilityInfos[j].package);
// }
// }
//
// }
//
// })
//
//
//})
//
//
//
//
//
//require('./Context.test.js')
//require('./AbilityManager.test.js')
\ No newline at end of file
{
"app": {
"bundleName": "com.example.myapplication6",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.myapplication",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": ".MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "standard",
"language": "C++"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
export default {
onCreate() {
console.info('AceApplication onCreate start');
//console.info('AceApplication onCreate add ' + demo.add(123,456));
//console.info('AceApplication onCreate getApplicationInfos ' + demo.getApplicationInfos(0,0));
//demo.getApplicationInfosPromise().then(function (data) {console.info('AceApplication onCreate GetApplicationInfosPromise');});
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
}
.title {
font-size: 100px;
transform: translate(-10px,-10px);
}
<div class="container">
<text class="title" style="transform : translate({{x}}px,{{y}}px);">
{{title}}
</text>
</div>
import demo from '@ohos.bundle'
export default {
data: {
title: "AI",
realHrValue: 0,
x: 0,
y: 100,
d: ","
},
onInit() {
this.title = this.$t('strings.world');
console.log("BmsApplication test for ams");
this.updateTime();
this.timer = setInterval(this.updateTime, 17)
},
updateTime: function () {
},
onDestroy() {
clearInterval(this.timer)
}
}
//
//import {Core} from 'deccjsunit/lite'
//const core=Core.getInstance()
//core.init()
//require('../../../test/List.test.js')
//core.execute()
import demo from '@ohos.bundle'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
console.log("BmsApplication test for ams");
demo.getBundleInstaller().then((data) => {
data.install(['/data/test1.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err,data) {
console.info("==============================install async install1==============================");
console.info("neu========================name: for begin");
console.info("neu========================install result code:" + err.code);
console.info("neu========================install result code:" + data.status);
console.info("neu========================install result msg:" + data.statusMessage);
}
});
demo.getBundleInstaller().then((data) => {
data.install(['/data/test.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err,data) {
console.info("==============================install async install2==============================");
console.info("neu========================name: for begin");
console.info("neu========================install result code:" + err.code);
console.info("neu========================install result code:" + data.status);
console.info("neu========================install result msg:" + data.statusMessage);
}
});
demo.getBundleInstaller().then((data) => {
data.uninstall('com.example.myapplicationInstall3', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err,data) {
console.info("==============================uninstall async uninstall==============================");
console.info("neu========================name: for begin");
console.info("neu========================uninstall result code:" + err.code);
console.info("neu========================uninstall result code:" + data.status);
console.info("neu========================uninstall result msg:" + data.statusMessage);
}
});
demo.getBundleInfos(8, OnReceiveEvent1);
function OnReceiveEvent1(err,data) {
console.info("neuXXXXXXXgetBundleInfosXXXXXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================data.length:" + data.length);
for (var i = 0; i < data.length; i++) {
console.info("neu========================data[i].name.length:" + data[i].name.length);
console.info("neu========================data[i].appInfo.name.length" + data[i].appInfo.name.length);
console.info("neu========================data[i].hapModuleInfos.length" + data[i].hapModuleInfos.length);
for (var j = 0; j < data[i].hapModuleInfos.length; j++) {
console.info("neu========================data[i].hapModuleInfos[j].length" + data[i].hapModuleInfos[j].length);
}
console.info("neu========================data[i].abilityInfos.length" + data[i].abilityInfos.length);
for (var j = 0; j < data[i].abilityInfos.length; j++) {
console.info("neu========================data[i].abilityInfos[j].name.length" + data[i].abilityInfos[j].name.length);
}
}
}
demo.getBundleInfo('com.example.myapplication',1,OnReceiveEvent2);
function OnReceiveEvent2(err,data) {
console.info("neuXXXXgetBundleInfoXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================err.code:" + err.code);
console.info("neu========================data.name:::" + data.name);
}
demo.getApplicationInfos(8, 0, OnReceiveEvent3);
function OnReceiveEvent3(err,datainfo) {
console.info("neuXXXXXXXgetApplicationInfosXXXXXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================datainfo.length:::" + datainfo.length);
for (var i = 0; i < datainfo.length; i++) {
console.info("neu========================datainfo[i].name" + datainfo[i].name);
}
}
demo.getApplicationInfo('com.example.myapplication', 8, 1, OnReceiveEvent4);
function OnReceiveEvent4(err,datainfo) {
console.info("neu========================err.code:" + err.code);
console.info("neuXXXXXXgetApplicationInfoXXXXXXX.name: for begin");
console.info("neu========================ddatainfo.name:::" + datainfo.name);
}
demo.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
},OnReceiveEvent5);
function OnReceiveEvent5(err,datainfo) {
console.info("neuXXXXXXqueryAbilityByWantXXXXXXX.name: for begin");
console.info("neu========================err.code:" + err.code);
console.info("neu========================datainfo.name:" + datainfo.name);
}
demo.getPermissionDef("com.permission.CAMERA",OnReceiveEvent6);
function OnReceiveEvent6(err,data) {
console.info('**************************getPermissionDef********************************');
console.info("neu========================err.code:" + err.code);
console.info("neu========================permissionName:" + data.permissionName);
}
demo.getBundleArchiveInfo('/data/test.hap',OnReceiveEvent7);
function OnReceiveEvent7(err,data) {
console.info('**************************getBundleArchiveInfo********************************');
console.info("neu========================err.code:" + err.code);
console.info("neu========================name:" + data.name);
}
}
}
//import abilitymanager from '@ohos.napi_ability_manager2'
//console.log('**************************getApplicationInfos********************************');
//describe('AbilityManagerTest', function () {
// it('get_all_running_processes_test_001', 0, function () {
//// var promise = abilitymanager.getAllRunningProcesses();
//// expect(typeof(promise)).zassertEqual("object");
// console.log('**************************getApplicationInfos********************************');
//// demo.getApplicationInfos().then((data) => {
//// console.info('**************************getApplicationInfos********************************');
//// console.info('xxx getApplicationInfos data length [' + data.length + ']');
//// for (var i = 0; i < data.length; i++) {
//// console.info("neu========================index[" + i + "].name: for begin");
//// console.info("neu========================index[" + i + "].name:" + data[i].name);
//// console.info("neu========================index[" + i + "].bundleName:" + data[i].bundleName);
//// console.info("neu========================index[" + i + "].description:" + data[i].description);
//// console.info("neu========================index[" + i + "].descriptionId:" + data[i].descriptionId);
//// console.info("neu========================index[" + i + "].iconPath:" + data[i].iconPath);
//// console.info("neu========================index[" + i + "].iconId:" + data[i].iconId);
//// console.info("neu========================index[" + i + "].label:" + data[i].label);
//// console.info("neu========================index[" + i + "].labelId:" + data[i].labelId);
//// console.info("neu========================index[" + i + "].deviceId:" + data[i].deviceId);
//// console.info("neu========================index[" + i + "].signatureKey:" + data[i].signatureKey);
//// console.info("neu========================index[" + i + "].process:" + data[i].process);
//// console.info("neu========================index[" + i + "].isSystemApp:" + data[i].isSystemApp);
//// console.info("neu========================index[" + i + "].isLauncherApp:" + data[i].isLauncherApp);
//// console.info("neu========================index[" + i + "].supportedModes:" + data[i].supportedModes);
////
//// console.info('getApplicationInfosAsync permissions length [' + data[i].permissions.length + ']');
//// for(var j = 0; j < data[i].permissions.length; j++) {
//// console.info("neu====================index[" + i + "]permissions[" + j + "]:" + data[i].permissions[j]);
//// }
//// console.info('getApplicationInfosAsync moduleSourceDirs length [' + data[i].moduleSourceDirs.length + ']');
//// for(var j = 0; j < data[i].moduleSourceDirs.length; j++) {
//// console.info("neu====================index[" + i + "]moduleSourceDirs[" + j + "]:" + data[i].moduleSourceDirs[j]);
//// }
//// console.info('getApplicationInfosAsync moduleInfos length [' + data[i].moduleInfos.length + ']');
//// for(var j = 0; j < data[i].moduleInfos.length; j++) {
//// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleName:" + data[i].moduleInfos[j].moduleName);
//// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleSourceDir:" + data[i].moduleInfos[j].moduleSourceDir);
//// }
//// console.info("neu========================index[" + i + "].entryDir:" + data[i].entryDir);
//// console.info("neu========================index[" + i + "].codePath:" + data[i].codePath);
//// console.info("neu========================index[" + i + "].dataDir:" + data[i].dataDir);
//// console.info("neu========================index[" + i + "].dataBaseDir:" + data[i].dataBaseDir);
//// console.info("neu========================index[" + i + "].cacheDir:" + data[i].cacheDir);
//// }
//// });
//
//
// })
//// it('get_all_running_processes_test_002', 0, async function (done) {
//// var info = await abilitymanager.getAllRunningProcesses();
//// expect(info[0].processName.length).assertLarger(0);
//// done();
//// })
//})
//import demo from '@ohos.bundle_mgr'
//
//describe('appInfoTest', function () {
//
// it('app_info_test_001', 0, function () {
//
//
// demo.getApplicationInfos(8, 0).then((data) => {
// console.info('**************************getApplicationInfos1********************************');
// console.info('xxx getApplicationInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].bundleName:" + data[i].bundleName);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].descriptionId:" + data[i].descriptionId);
// console.info("neu========================index[" + i + "].iconPath:" + data[i].iconPath);
// console.info("neu========================index[" + i + "].iconId:" + data[i].iconId);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].labelId:" + data[i].labelId);
// console.info("neu========================index[" + i + "].deviceId:" + data[i].deviceId);
// console.info("neu========================index[" + i + "].signatureKey:" + data[i].signatureKey);
// console.info("neu========================index[" + i + "].process:" + data[i].process);
// console.info("neu========================index[" + i + "].isSystemApp:" + data[i].isSystemApp);
// console.info("neu========================index[" + i + "].isLauncherApp:" + data[i].isLauncherApp);
// console.info("neu========================index[" + i + "].supportedModes:" + data[i].supportedModes);
//
// console.info('getApplicationInfosAsync permissions length [' + data[i].permissions.length + ']');
// for (var j = 0; j < data[i].permissions.length; j++) {
// console.info("neu====================index[" + i + "]permissions[" + j + "]:" + data[i].permissions[j]);
// }
// console.info('getApplicationInfosAsync moduleSourceDirs length [' + data[i].moduleSourceDirs.length + ']');
// for (var j = 0; j < data[i].moduleSourceDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleSourceDirs[" + j + "]:" + data[i].moduleSourceDirs[j]);
// }
// console.info('getApplicationInfosAsync moduleInfos length [' + data[i].moduleInfos.length + ']');
// for (var j = 0; j < data[i].moduleInfos.length; j++) {
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleName:" + data[i].moduleInfos[j].moduleName);
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleSourceDir:" + data[i].moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================index[" + i + "].entryDir:" + data[i].entryDir);
// console.info("neu========================index[" + i + "].codePath:" + data[i].codePath);
// console.info("neu========================index[" + i + "].dataDir:" + data[i].dataDir);
// console.info("neu========================index[" + i + "].dataBaseDir:" + data[i].dataBaseDir);
// console.info("neu========================index[" + i + "].cacheDir:" + data[i].cacheDir);
// }
// })
// })
//
// it('app_info_test_002', 0, function () {
//
// demo.getApplicationInfos(8, 0, OnReceiveEvent);
//
// function OnReceiveEvent(data) {
// console.info('**************************getApplicationInfos2********************************');
// console.info('xxx getApplicationInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].bundleName:" + data[i].bundleName);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].descriptionId:" + data[i].descriptionId);
// console.info("neu========================index[" + i + "].iconPath:" + data[i].iconPath);
// console.info("neu========================index[" + i + "].iconId:" + data[i].iconId);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].labelId:" + data[i].labelId);
// console.info("neu========================index[" + i + "].deviceId:" + data[i].deviceId);
// console.info("neu========================index[" + i + "].signatureKey:" + data[i].signatureKey);
// console.info("neu========================index[" + i + "].process:" + data[i].process);
// console.info("neu========================index[" + i + "].isSystemApp:" + data[i].isSystemApp);
// console.info("neu========================index[" + i + "].isLauncherApp:" + data[i].isLauncherApp);
// console.info("neu========================index[" + i + "].supportedModes:" + data[i].supportedModes);
//
// console.info('getApplicationInfosAsync permissions length [' + data[i].permissions.length + ']');
// for (var j = 0; j < data[i].permissions.length; j++) {
// console.info("neu====================index[" + i + "]permissions[" + j + "]:" + data[i].permissions[j]);
// }
// console.info('getApplicationInfosAsync moduleSourceDirs length [' + data[i].moduleSourceDirs.length + ']');
// for (var j = 0; j < data[i].moduleSourceDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleSourceDirs[" + j + "]:" + data[i].moduleSourceDirs[j]);
// }
// console.info('getApplicationInfosAsync moduleInfos length [' + data[i].moduleInfos.length + ']');
// for (var j = 0; j < data[i].moduleInfos.length; j++) {
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleName:" + data[i].moduleInfos[j].moduleName);
// console.info("neu====================index[" + i + "]moduleInfos[" + j + "]moduleSourceDir:" + data[i].moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================index[" + i + "].entryDir:" + data[i].entryDir);
// console.info("neu========================index[" + i + "].codePath:" + data[i].codePath);
// console.info("neu========================index[" + i + "].dataDir:" + data[i].dataDir);
// console.info("neu========================index[" + i + "].dataBaseDir:" + data[i].dataBaseDir);
// console.info("neu========================index[" + i + "].cacheDir:" + data[i].cacheDir);
// }
// }
// })
//
//
// it('app_info_test_003', 0, function () {
//
// demo.getApplicationInfo('com.example.myapplicationInstall', 8, 0).then((data) => {
// console.info('**************************getApplicationInfo1********************************');
// console.info("neu========================name: for begin");
// console.info("neu========================name:" + data.name);
// console.info("neu========================bundleName:" + data.bundleName);
// console.info("neu========================description:" + data.description);
// console.info("neu========================descriptionId:" + data.descriptionId);
// console.info("neu========================iconPath:" + data.iconPath);
// console.info("neu========================iconId:" + data.iconId);
// console.info("neu========================label:" + data.label);
// console.info("neu========================labelId:" + data.labelId);
// console.info("neu========================deviceId:" + data.deviceId);
// console.info("neu========================signatureKey:" + data.signatureKey);
// console.info("neu========================process:" + data.process);
// console.info("neu========================isSystemApp:" + data.isSystemApp);
// console.info("neu========================isLauncherApp:" + data.isLauncherApp);
// console.info("neu========================supportedModes:" + data.supportedModes);
//
// console.info('getApplicationInfo permissions length [' + data.permissions.length + ']');
// for (var j = 0; j < data.permissions.length; j++) {
// console.info("neu====================permissions[" + j + "]:" + data.permissions[j]);
// }
// console.info('getApplicationInfo moduleSourceDirs length [' + data.moduleSourceDirs.length + ']');
// for (var j = 0; j < data.moduleSourceDirs.length; j++) {
// console.info("neu====================moduleSourceDirs[" + j + "]:" + data.moduleSourceDirs[j]);
// }
// console.info('getApplicationInfo moduleInfos length [' + data.moduleInfos.length + ']');
// for (var j = 0; j < data.moduleInfos.length; j++) {
// console.info("neu====================moduleInfos[" + j + "]moduleName:" + data.moduleInfos[j].moduleName);
// console.info("neu====================moduleInfos[" + j + "]moduleSourceDir:" + data.moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================entryDir:" + data.entryDir);
// console.info("neu========================codePath:" + data.codePath);
// console.info("neu========================dataDir:" + data.dataDir);
// console.info("neu========================dataBaseDir:" + data.dataBaseDir);
// console.info("neu========================cacheDir:" + data.cacheDir);
// })
// })
//
//
// it('app_info_test_004', 0, function () {
//
// demo.getApplicationInfo('com.example.myapplicationInstall', 8, 0, OnReceiveEvent);
//
// function OnReceiveEvent(data) {
// console.info('**************************getApplicationInfo2********************************');
// console.info("neu========================name: for begin");
// console.info("neu========================name:" + data.name);
// console.info("neu========================bundleName:" + data.bundleName);
// console.info("neu========================description:" + data.description);
// console.info("neu========================descriptionId:" + data.descriptionId);
// console.info("neu========================iconPath:" + data.iconPath);
// console.info("neu========================iconId:" + data.iconId);
// console.info("neu========================label:" + data.label);
// console.info("neu========================labelId:" + data.labelId);
// console.info("neu========================deviceId:" + data.deviceId);
// console.info("neu========================signatureKey:" + data.signatureKey);
// console.info("neu========================process:" + data.process);
// console.info("neu========================isSystemApp:" + data.isSystemApp);
// console.info("neu========================isLauncherApp:" + data.isLauncherApp);
// console.info("neu========================supportedModes:" + data.supportedModes);
//
// console.info('getApplicationInfo permissions length [' + data.permissions.length + ']');
// for (var j = 0; j < data.permissions.length; j++) {
// console.info("neu====================permissions[" + j + "]:" + data.permissions[j]);
// }
// console.info('getApplicationInfo moduleSourceDirs length [' + data.moduleSourceDirs.length + ']');
// for (var j = 0; j < data.moduleSourceDirs.length; j++) {
// console.info("neu====================moduleSourceDirs[" + j + "]:" + data.moduleSourceDirs[j]);
// }
// console.info('getApplicationInfo moduleInfos length [' + data.moduleInfos.length + ']');
// for (var j = 0; j < data.moduleInfos.length; j++) {
// console.info("neu====================moduleInfos[" + j + "]moduleName:" + data.moduleInfos[j].moduleName);
// console.info("neu====================moduleInfos[" + j + "]moduleSourceDir:" + data.moduleInfos[j].moduleSourceDir);
// }
// console.info("neu========================entryDir:" + data.entryDir);
// console.info("neu========================codePath:" + data.codePath);
// console.info("neu========================dataDir:" + data.dataDir);
// console.info("neu========================dataBaseDir:" + data.dataBaseDir);
// console.info("neu========================cacheDir:" + data.cacheDir);
// }
//
// })
//
//
// it('app_info_test_005', 0, function () {
// demo.getBundleInfos(8).then((data) => {
// console.info('**************************getBundleInfos1********************************');
// console.info('xxx getBundleInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].vendor:" + data[i].vendor);
// console.info("neu========================index[" + i + "].versionCode:" + data[i].versionCode);
// console.info("neu========================index[" + i + "].versionName:" + data[i].versionName);
// console.info("neu========================index[" + i + "].jointUserId:" + data[i].jointUserId);
// console.info("neu========================index[" + i + "].minSdkVersion:" + data[i].minSdkVersion);
// console.info("neu========================index[" + i + "].maxSdkVersion:" + data[i].maxSdkVersion);
// console.info("neu========================index[" + i + "].mainEntry:" + data[i].mainEntry);
// console.info("neu========================index[" + i + "].cpuAbi:" + data[i].cpuAbi);
// console.info("neu========================index[" + i + "].appId:" + data[i].appId);
// console.info("neu========================index[" + i + "].compatibleVersion:" + data[i].compatibleVersion);
// console.info("neu========================index[" + i + "].targetVersion:" + data[i].targetVersion);
// console.info("neu========================index[" + i + "].releaseType:" + data[i].releaseType);
// console.info("neu========================index[" + i + "].uid:" + data[i].uid);
// console.info("neu========================index[" + i + "].gid:" + data[i].gid);
// console.info("neu========================index[" + i + "].seInfo:" + data[i].seInfo);
// console.info("neu========================index[" + i + "].entryModuleName:" + data[i].entryModuleName);
// console.info("neu========================index[" + i + "].isKeepAlive:" + data[i].isKeepAlive);
// console.info("neu========================index[" + i + "].isNativeApp:" + data[i].isNativeApp);
// console.info("neu========================index[" + i + "].installTime:" + data[i].installTime);
// console.info("neu========================index[" + i + "].updateTime:" + data[i].updateTime);
// console.info("neu========================index[" + i + "].appInfo.name:" + data[i].applicationInfo.name);
// console.info("neu========================index[" + i + "].appInfo.bundleName:" + data[i].applicationInfo.bundleName);
// console.info('getBundleInfos reqPermissions length [' + data[i].reqPermissions.length + ']');
// for (var j = 0; j < data[i].reqPermissions.length; j++) {
// console.info("neu====================index[" + i + "]reqPermissions[" + j + "]:" + data[i].reqPermissions[j]);
// }
// console.info('getBundleInfos defPermissions length [' + data[i].defPermissions.length + ']');
// for (var j = 0; j < data[i].defPermissions.length; j++) {
// console.info("neu====================index[" + i + "]defPermissions[" + j + "]:" + data[i].defPermissions[j]);
// }
//
// console.info('getBundleInfos hapModuleNames length [' + data[i].hapModuleNames.length + ']');
// for (var j = 0; j < data[i].hapModuleNames.length; j++) {
// console.info("neu====================index[" + i + "]hapModuleNames[" + j + "]:" + data[i].hapModuleNames[j]);
// }
// console.info('getBundleInfos moduleNames length [' + data[i].moduleNames.length + ']');
// for (var j = 0; j < data[i].moduleNames.length; j++) {
// console.info("neu====================index[" + i + "]moduleNames[" + j + "]:" + data[i].moduleNames[j]);
// }
// console.info('getBundleInfos modulePublicDirs length [' + data[i].modulePublicDirs.length + ']');
// for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
// console.info("neu====================index[" + i + "]modulePublicDirs[" + j + "]:" + data[i].modulePublicDirs[j]);
// }
// console.info('getBundleInfos moduleDirs length [' + data[i].moduleDirs.length + ']');
// for (var j = 0; j < data[i].moduleDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleDirs[" + j + "]:" + data[i].moduleDirs[j]);
// }
// console.info('getBundleInfos moduleResPaths length [' + data[i].moduleResPaths.length + ']');
// for (var j = 0; j < data[i].moduleResPaths.length; j++) {
// console.info("neu====================index[" + i + "]moduleResPaths[" + j + "]:" + data[i].moduleResPaths[j]);
// }
// console.info('getBundleInfos abilityInfo length [' + data[i].abilityInfos.length + ']');
// for (var j = 0; j < data[i].abilityInfos.length; j++) {
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]name:" + data[i].abilityInfos[j].name);
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]package:" + data[i].abilityInfos[j].package);
// }
// }
// })
// })
//
// it('app_info_test_006', 0, function () {
//
// demo.getBundleInfos(8, OnReceiveEvent);
//
// function OnReceiveEvent(data) {
// console.info('**************************getBundleInfos2********************************');
// console.info('xxx getBundleInfos data length [' + data.length + ']');
// for (var i = 0; i < data.length; i++) {
// console.info("neu========================index[" + i + "].name: for begin");
// console.info("neu========================index[" + i + "].name:" + data[i].name);
// console.info("neu========================index[" + i + "].label:" + data[i].label);
// console.info("neu========================index[" + i + "].description:" + data[i].description);
// console.info("neu========================index[" + i + "].vendor:" + data[i].vendor);
// console.info("neu========================index[" + i + "].versionCode:" + data[i].versionCode);
// console.info("neu========================index[" + i + "].versionName:" + data[i].versionName);
// console.info("neu========================index[" + i + "].jointUserId:" + data[i].jointUserId);
// console.info("neu========================index[" + i + "].minSdkVersion:" + data[i].minSdkVersion);
// console.info("neu========================index[" + i + "].maxSdkVersion:" + data[i].maxSdkVersion);
// console.info("neu========================index[" + i + "].mainEntry:" + data[i].mainEntry);
// console.info("neu========================index[" + i + "].cpuAbi:" + data[i].cpuAbi);
// console.info("neu========================index[" + i + "].appId:" + data[i].appId);
// console.info("neu========================index[" + i + "].compatibleVersion:" + data[i].compatibleVersion);
// console.info("neu========================index[" + i + "].targetVersion:" + data[i].targetVersion);
// console.info("neu========================index[" + i + "].releaseType:" + data[i].releaseType);
// console.info("neu========================index[" + i + "].uid:" + data[i].uid);
// console.info("neu========================index[" + i + "].gid:" + data[i].gid);
// console.info("neu========================index[" + i + "].seInfo:" + data[i].seInfo);
// console.info("neu========================index[" + i + "].entryModuleName:" + data[i].entryModuleName);
// console.info("neu========================index[" + i + "].isKeepAlive:" + data[i].isKeepAlive);
// console.info("neu========================index[" + i + "].isNativeApp:" + data[i].isNativeApp);
// console.info("neu========================index[" + i + "].installTime:" + data[i].installTime);
// console.info("neu========================index[" + i + "].updateTime:" + data[i].updateTime);
// console.info("neu========================index[" + i + "].appInfo.name:" + data[i].applicationInfo.name);
// console.info("neu========================index[" + i + "].appInfo.bundleName:" + data[i].applicationInfo.bundleName);
// console.info('getBundleInfos reqPermissions length [' + data[i].reqPermissions.length + ']');
// for (var j = 0; j < data[i].reqPermissions.length; j++) {
// console.info("neu====================index[" + i + "]reqPermissions[" + j + "]:" + data[i].reqPermissions[j]);
// }
// console.info('getBundleInfos defPermissions length [' + data[i].defPermissions.length + ']');
// for (var j = 0; j < data[i].defPermissions.length; j++) {
// console.info("neu====================index[" + i + "]defPermissions[" + j + "]:" + data[i].defPermissions[j]);
// }
//
// console.info('getBundleInfos hapModuleNames length [' + data[i].hapModuleNames.length + ']');
// for (var j = 0; j < data[i].hapModuleNames.length; j++) {
// console.info("neu====================index[" + i + "]hapModuleNames[" + j + "]:" + data[i].hapModuleNames[j]);
// }
// console.info('getBundleInfos moduleNames length [' + data[i].moduleNames.length + ']');
// for (var j = 0; j < data[i].moduleNames.length; j++) {
// console.info("neu====================index[" + i + "]moduleNames[" + j + "]:" + data[i].moduleNames[j]);
// }
// console.info('getBundleInfos modulePublicDirs length [' + data[i].modulePublicDirs.length + ']');
// for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
// console.info("neu====================index[" + i + "]modulePublicDirs[" + j + "]:" + data[i].modulePublicDirs[j]);
// }
// console.info('getBundleInfos moduleDirs length [' + data[i].moduleDirs.length + ']');
// for (var j = 0; j < data[i].moduleDirs.length; j++) {
// console.info("neu====================index[" + i + "]moduleDirs[" + j + "]:" + data[i].moduleDirs[j]);
// }
// console.info('getBundleInfos moduleResPaths length [' + data[i].moduleResPaths.length + ']');
// for (var j = 0; j < data[i].moduleResPaths.length; j++) {
// console.info("neu====================index[" + i + "]moduleResPaths[" + j + "]:" + data[i].moduleResPaths[j]);
// }
// console.info('getBundleInfos abilityInfo length [' + data[i].abilityInfos.length + ']');
// for (var j = 0; j < data[i].abilityInfos.length; j++) {
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]name:" + data[i].abilityInfos[j].name);
// console.info("neu====================index[" + i + "]abilityInfos[" + j + "]package:" + data[i].abilityInfos[j].package);
// }
// }
//
// }
//
// })
//
//
//})
//
//
//
//
//
//require('./Context.test.js')
//require('./AbilityManager.test.js')
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册