提交 9eab3cd4 编写于 作者: I inter515

修改编译问题'

Signed-off-by: Ninter515 <ry.renyi@huawei.com>
上级 42821e95
......@@ -18,6 +18,7 @@ ohos_js_hap_suite("ActsBmsEtsModuleNameTest") {
deps = [
":bms_ets_assets",
":bms_ets_resources",
":bms_ets_test_assets",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
......@@ -26,6 +27,9 @@ ohos_js_hap_suite("ActsBmsEtsModuleNameTest") {
ohos_js_assets("bms_ets_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_js_assets("bms_ets_test_assets") {
source_dir = "./entry/src/main/ets/TestAbility"
}
ohos_resources("bms_ets_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
......
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"type": "OHJSUnitTest",
"test-timeout": "120000",
"package": "com.example.actsbmsmodulenametest",
"bundle-name": "com.example.actsbmsmodulenametest",
"package-name": "com.example.actsbmsmodulenametest",
"shell-timeout": "60000"
},
"kits": [
......
......@@ -17,7 +17,7 @@
"package": "com.example.actsbmsmodulenametest",
"name": ".MyApplication",
"mainAbility": ".MainAbility",
"srcPath": "MainAbility",
"srcPath": "",
"deviceType": [
"phone"
],
......@@ -50,6 +50,19 @@
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
},
{
"orientation": "unspecified",
"visible": true,
"srcPath": "TestAbility",
"name": ".TestAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:TestAbility_desc",
"formsEnabled": false,
"label": "$string:TestAbility_label",
"type": "page",
"launchType": "standard"
}
],
"reqPermissions": [
......@@ -80,6 +93,20 @@
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
......
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('Application onCreate')
......
......@@ -12,44 +12,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"
import testsuite from "../test/List.test.ets"
import featureAbility from "@ohos.ability.featureAbility"
@Entry
@Component
struct MyComponent {
aboutToAppear() {
console.info("start run testcase!!!!")
featureAbility.getWant()
.then((Want) => {
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
const reportExtend = new ReportExtend(file)
core.addService('report', reportExtend)
core.init()
core.subscribeEvent('task', reportExtend)
const configService = core.getDefaultService('config')
const timeout=10000
configService.setConfig(timeout)
console.info('parameters---->' + JSON.stringify(Want.parameters))
configService.setConfig(Want.parameters)
testsuite()
core.execute()
console.info('Operation successful. Data: ' + JSON.stringify(Want));
console.info('Operation successful. Data: ' + JSON.stringify(Want));
})
.catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
}
build() {
......
/*
* Copyright (C) 2022 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('Application onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
/*
* Copyright (C) 2022 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 router from '@system.router';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('TestAbility index aboutToAppear')
}
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (C) 2022 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 TestRunner from '@ohos.application.testRunner'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
var abilityDelegator = undefined
var abilityDelegatorArguments = undefined
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s itName',
'-s level', '-s testType', '-s size', '-s timeout',
'-s package'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
async function onAbilityCreateCallback() {
console.log('onAbilityCreateCallback');
}
async function addAbilityMonitorCallback(err: any) {
console.info('addAbilityMonitorCallback : ' + JSON.stringify(err))
}
export default class OpenHarmonyTestRunner implements TestRunner {
constructor() {
}
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare')
}
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + d.stdResult);
console.info('executeShellCommand : data : ' + d.exitCode);
})
console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext')
var context = abilityDelegator.getAppContext()
console.info('getAppContext : ' + JSON.stringify(context))
console.info('OpenHarmonyTestRunner onRun end')
}
};
\ No newline at end of file
......@@ -7,6 +7,14 @@
{
"name": "description_mainability",
"value": "ETS_Empty Ability"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
......@@ -116,7 +116,7 @@ export default function actsBmsJsUnPermissionTest() {
},
complete: function complete() {
console.info("get hasInstalled complete");
expect(data).assertFail();
expect().assertFail();
done();
}
})
......@@ -142,7 +142,7 @@ export default function actsBmsJsUnPermissionTest() {
},
complete: function complete() {
console.info("get hasInstalled complete");
expect(data).assertFail();
expect().assertFail();
done();
}
})
......
......@@ -35,16 +35,15 @@ export default function getAbilityIcon() {
*/
it('bms_getAbilityIcon_0100', 0, async function (done) {
await bundle.getAbilityIcon(BUNDLE_NAME_OTHER, ABILITIY_NAME_OTHER).then(pixelmap => {
image = pixelmap;
console.log('bms_getAbilityIcon_0100 success: ' + image.getBytesNumberPerRow());
expect(image.getBytesNumberPerRow()).assertLarger(0);
console.log('bms_getAbilityIcon_0100 success: ' + pixelmap.getBytesNumberPerRow());
expect(pixelmap.getBytesNumberPerRow()).assertLarger(0);
}).catch(err => {
console.info("getAbilityIcon fail:" + JSON.stringify(err));
expect(err).assertFail();
});
bundle.getAbilityIcon(BUNDLE_NAME_OTHER, ABILITIY_NAME_OTHER, (err, pixelmap) => {
expect(err).assertEqual(0);
expect(image.getBytesNumberPerRow()).assertLarger(0);
expect(pixelmap.getBytesNumberPerRow()).assertLarger(0);
done();
});
});
......@@ -56,16 +55,15 @@ export default function getAbilityIcon() {
*/
it('bms_getAbilityIcon_0200', 0, async function (done) {
await bundle.getAbilityIcon(BUNDLE_NAME, ABILITIY_NAME).then(pixelmap => {
image = pixelmap;
console.log('bms_getAbilityIcon_0200 success: ' + image.getBytesNumberPerRow());
expect(image.getBytesNumberPerRow()).assertLarger(0);
console.log('bms_getAbilityIcon_0200 success: ' + pixelmap.getBytesNumberPerRow());
expect(pixelmap.getBytesNumberPerRow()).assertLarger(0);
}).catch(err => {
console.info("getAbilityIcon fail:" + JSON.stringify(err));
expect(err).assertFail();
});
bundle.getAbilityIcon(BUNDLE_NAME, ABILITIY_NAME, (err, pixelmap) => {
expect(err).assertEqual(0);
expect(image.getBytesNumberPerRow()).assertLarger(0);
expect(pixelmap.getBytesNumberPerRow()).assertLarger(0);
done();
});
});
......@@ -77,7 +75,7 @@ export default function getAbilityIcon() {
*/
it('bms_getAbilityIcon_0300', 0, async function (done) {
await bundle.getAbilityIcon(BUNDLE_NAME, SERVICE_NAME).then(pixelmap => {
expect(err).assertFail();
expect().assertFail();
}).catch(err => {
console.info("getAbilityIcon fail:" + JSON.stringify(err));
expect(err).assertEqual(1);
......@@ -101,13 +99,13 @@ export default function getAbilityIcon() {
expect(err).assertEqual(1);
});
await bundle.getAbilityIcon(BUNDLE_NAME_ERROR, ABILITIY_NAME).then(pixelmap => {
expect(err).assertFail();
expect().assertFail();
}).catch(err => {
console.info("getAbilityIcon fail:" + JSON.stringify(err))
expect(err).assertEqual(1);
});
await bundle.getAbilityIcon("", "").then(pixelmap => {
expect(err).assertFail();
expect().assertFail();
}).catch(err => {
console.info("getAbilityIcon fail:" + JSON.stringify(err))
expect(err).assertEqual(1);
......
......@@ -28,7 +28,7 @@ export default function getNameForUid() {
* @tc.desc Test getBundleInfo interfaces with other hap.
*/
it('getNameForUid_0100', 0, async function (done) {
let dataInfo = await bundle.getBundleInfo(BUNDLE_NAME1);
let dataInfo = await bundle.getBundleInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_DEFAULT);
await bundle.getNameForUid(dataInfo.uid).then(data => {
expect(data).assertEqual(BUNDLE_NAME1);
}).catch(err => {
......@@ -49,7 +49,7 @@ export default function getNameForUid() {
* @tc.desc Test getBundleInfo interfaces with hap.
*/
it('getNameForUid_0200', 0, async function (done) {
let dataInfo = await bundle.getBundleInfo(BUNDLE_NAME2);
let dataInfo = await bundle.getBundleInfo(BUNDLE_NAME2,bundle.BundleFlag.GET_BUNDLE_DEFAULT);
await bundle.getNameForUid(dataInfo.uid).then(data => {
expect(data).assertEqual(BUNDLE_NAME2);
}).catch(err => {
......
......@@ -14,7 +14,7 @@
*/
import bundle from '@ohos.bundle'
import account from '@ohos.account.osAccount'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index'
const BUNDLE_NAME1 = 'com.example.third1';
const SYSTEM_NAME = 'com.example.system2';
......
......@@ -22,14 +22,6 @@ const BUNDLE_NAME_ERROR = 'com.ohos.acepackage.error';
const ABILITY_NAME = 'com.open.harmony.packagemag.MainAbility';
const ABILITY_NAME_OTHER = 'com.example.l3jsdemo.MainAbility';
const ABILITY_NAME_ERROR = 'com.ohos.acepackage.error.MainAbility';
const ABILITY = {
bundleName: BUNDLE_NAME,
name: ABILITY_NAME
};
const OTHER_ABILITY = {
bundleName: BUNDLE_NAME_OTHER,
name: ABILITY_NAME_OTHER
};
const ABILITY_ERROR1 = {
bundleName: BUNDLE_NAME_ERROR,
name: ABILITY_NAME_ERROR
......@@ -59,6 +51,7 @@ const ABILITY_ERROR7 = {
name: ""
};
export default function isAbilityEnabledETSUnit() {
describe('isAbilityEnabled_test', function () {
......@@ -70,7 +63,8 @@ export default function isAbilityEnabledETSUnit() {
*/
it('isAbilityEnabled_test_0100', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
await Bundle.isAbilityEnabled(ABILITY).then((data) => {
let abilityInfo = generateAbilityInfoForTest(BUNDLE_NAME,ABILITY_NAME);
await Bundle.isAbilityEnabled(abilityInfo).then((data) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[isAbilityEnabled_test_0100]', timeOldStamp, timeNewStamp);
expect(data).assertTrue();
......@@ -78,7 +72,7 @@ export default function isAbilityEnabledETSUnit() {
expect(error).assertFail();
});
timeOldStamp = await Utils.getNowTime();
Bundle.isAbilityEnabled(ABILITY, (error, data) => {
Bundle.isAbilityEnabled(abilityInfo, (error, data) => {
if (error) {
expect(error).assertFail();
}
......@@ -95,36 +89,40 @@ export default function isAbilityEnabledETSUnit() {
* @tc.desc: Check the return value of the interface when bundleName and ability error
*/
it('isAbilityEnabled_test_0200', 0, async function (done) {
await Bundle.isAbilityEnabled(ABILITY_ERROR1).then((data) => {
let abilityInfo1 = generateAbilityInfoForTest(ABILITY_ERROR1.bundleName,ABILITY_ERROR1.name);
let abilityInfo2 = generateAbilityInfoForTest(ABILITY_ERROR2.bundleName,ABILITY_ERROR2.name);
let abilityInfo3 = generateAbilityInfoForTest(ABILITY_ERROR3.bundleName,ABILITY_ERROR3.name);
let abilityInfo7 = generateAbilityInfoForTest(ABILITY_ERROR7.bundleName,ABILITY_ERROR7.name);
Bundle.isAbilityEnabled(abilityInfo1).then((data) => {
expect(data).assertFalse();
}).catch((error) => {
expect(error).assertFail();
});
await Bundle.isAbilityEnabled(ABILITY_ERROR2).then((data) => {
Bundle.isAbilityEnabled(abilityInfo2).then((data) => {
expect(data).assertFalse();
}).catch((error) => {
expect(error).assertFail();
});
await Bundle.isAbilityEnabled(ABILITY_ERROR3).then((data) => {
Bundle.isAbilityEnabled(abilityInfo3).then((data) => {
expect(data).assertFalse();
}).catch((error) => {
expect(error).assertFail();
});
await Bundle.isAbilityEnabled(ABILITY_ERROR7).then((data) => {
Bundle.isAbilityEnabled(abilityInfo7).then((data) => {
expect(data).assertFalse();
}).catch((error) => {
expect(error).assertFail();
});
Bundle.isAbilityEnabled(ABILITY_ERROR1, (error, data) => {
Bundle.isAbilityEnabled(abilityInfo1, (error, data) => {
expect(error).assertEqual(0);
expect(data).assertFalse();
Bundle.isAbilityEnabled(ABILITY_ERROR2, (error, data) => {
Bundle.isAbilityEnabled(abilityInfo2, (error, data) => {
expect(error).assertEqual(0);
expect(data).assertFalse();
Bundle.isAbilityEnabled(ABILITY_ERROR3, (error, data) => {
Bundle.isAbilityEnabled(abilityInfo3, (error, data) => {
expect(error).assertEqual(0);
expect(data).assertFalse();
Bundle.isAbilityEnabled(ABILITY_ERROR7, (error, data) => {
Bundle.isAbilityEnabled(abilityInfo7, (error, data) => {
expect(error).assertEqual(0);
expect(data).assertFalse();
done();
......@@ -140,28 +138,31 @@ export default function isAbilityEnabledETSUnit() {
* @tc.desc: Check the return value of the interface when bundleName and ability error
*/
it('isAbilityEnabled_test_0300', 0, async function (done) {
await Bundle.isAbilityEnabled(ABILITY_ERROR4).then((data) => {
let abilityInfo4 = generateAbilityInfoForTest(ABILITY_ERROR4.bundleName,ABILITY_ERROR4.name);
let abilityInfo5 = generateAbilityInfoForTest(ABILITY_ERROR5.bundleName,ABILITY_ERROR5.name);
let abilityInfo6 = generateAbilityInfoForTest(ABILITY_ERROR6.bundleName,ABILITY_ERROR6.name);
Bundle.isAbilityEnabled(abilityInfo4).then((data) => {
expect(data).assertFail();
}).catch((error) => {
expect(error).assertEqual(2);
});
await Bundle.isAbilityEnabled(ABILITY_ERROR5).then((data) => {
Bundle.isAbilityEnabled(abilityInfo5).then((data) => {
expect(data).assertFail();
}).catch((error) => {
expect(error).assertEqual(2);
});
await Bundle.isAbilityEnabled(ABILITY_ERROR6).then((data) => {
Bundle.isAbilityEnabled(abilityInfo6).then((data) => {
expect(data).assertFail();
}).catch((error) => {
expect(error).assertEqual(2);
});
Bundle.isAbilityEnabled(ABILITY_ERROR4, (error, data) => {
Bundle.isAbilityEnabled(abilityInfo4, (error, data) => {
expect(error).assertEqual(2);
expect(data).assertEqual(undefined);
Bundle.isAbilityEnabled(ABILITY_ERROR5, (error, data) => {
Bundle.isAbilityEnabled(abilityInfo5, (error, data) => {
expect(error).assertEqual(2);
expect(data).assertEqual(undefined);
Bundle.isAbilityEnabled(ABILITY_ERROR6, (error, data) => {
Bundle.isAbilityEnabled(abilityInfo6, (error, data) => {
expect(error).assertEqual(2);
expect(data).assertEqual(undefined);
done();
......@@ -176,16 +177,67 @@ export default function isAbilityEnabledETSUnit() {
* @tc.desc: Check the return value of the interface
*/
it('isAbilityEnabled_test_0400', 0, async function (done) {
await Bundle.isAbilityEnabled(OTHER_ABILITY).then((data) => {
let abilityInfo = generateAbilityInfoForTest(BUNDLE_NAME_OTHER,ABILITY_NAME_OTHER);
await Bundle.isAbilityEnabled(abilityInfo).then((data) => {
expect(data).assertTrue();
}).catch((error) => {
expect(error).assertFail();
});
Bundle.isAbilityEnabled(OTHER_ABILITY, (error, data) => {
Bundle.isAbilityEnabled(abilityInfo, (error, data) => {
expect(error).assertEqual(0);
expect(data).assertTrue();
done();
});
});
function generateAbilityInfoForTest(bundleName, name) {
let map1 = new Map([
["", [{
"name": "", "value": "", "extra": ""
}]]
]);
let map2 = new Map([
["", [{
"name": "", "value": "", "resource": ""
}]]
]);
let abilityInfo = {
bundleName: bundleName,
name: name,
label: "",
description: "",
icon: "",
labelId: 0,
descriptionId: 0,
iconId: 0,
moduleName: "",
process: "",
targetAbility: "",
backgroundModes: 0,
isVisible: true,
formEnabled: true,
type: 0,
subType: 0,
orientation: 0,
launchMode: 0,
permissions: [],
deviceTypes: [],
deviceCapabilities: [],
readPermission: "",
writePermission: "",
applicationInfo: {
name: "", description: "", descriptionId: 0, systemApp: true, enabled: true, label: "",
labelId: "", icon: "", iconId: "", process: "", supportedModes: 0, moduleSourceDirs: [],
permissions: [], moduleInfos: [], entryDir: "", codePath: "", metaData: map1, metadata: map2,
removable: true, accessTokenId: 0, uid: 0, entityType: "", fingerprint: ""
},
uri: "", metaData: [], metadata: [], enabled: true, supportWindowMode: [],
maxWindowRatio: 0, minWindowRatio: 0, maxWindowWidth: 0, minWindowWidth: 0, maxWindowHeight: 0, minWindowHeight: 0
};
return abilityInfo;
}
})
}
\ No newline at end of file
......@@ -309,15 +309,6 @@ export default function QueryExtensionAbilityInfos() {
}).catch(err => {
expect(err).assertEqual(1);
});
await bundle.queryExtensionAbilityInfos(
{
"bundleName": BUNDLE_NAME1,
"abilityName": ABILITY_NAME1
}, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, null).then(data => {
expect(data).assertFail();
}).catch(err => {
expect(err).assertEqual(1);
});
bundle.queryExtensionAbilityInfos(
{
"bundleName": BUNDLE_NAME1,
......
......@@ -229,28 +229,6 @@ export default function getAllApplicationBundleTest() {
done();
});
/**
* @tc.number: bundle_getApplicationInfo_test_0500_0010
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
*/
it(TAG_TEST_0500_002, 0, async function (done) {
let errors;
let startTime = await Utils.getNowTime();
await Bundle.getAllApplicationInfo('Bundle.BundleFlag.GET_BUNDLE_DEFAULT', userId).then((data) => {
console.info(TAG_TEST_0500_002 + 'noUserId promise data is: ' + data);
expect(data).assertFail();
}).catch((error) => {
console.info(TAG_TEST_0500_002 + 'UserId promise error is: ' + error);
errors = error;
expect(errors).assertEqual(1);
});
let endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0500_002, startTime, endTime);
done();
});
/**
* @tc.number: getApplicationInfos_1000
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
......@@ -291,11 +269,6 @@ export default function getAllApplicationBundleTest() {
* @tc.desc: Check the return value of the interface
*/
it('getApplicationInfos_1200', 0, async function (done) {
await Bundle.getAllApplicationInfo('Bundle.BundleFlag.GET_BUNDLE_DEFAULT').then((data) => {
expect(data).assertFail();
}).catch((error) => {
expect(error).assertEqual(1);
});
await Bundle.getAllApplicationInfo(null).then((data) => {
expect(data).assertFail();
}).catch((error) => {
......@@ -309,14 +282,10 @@ export default function getAllApplicationBundleTest() {
Bundle.getAllApplicationInfo(undefined, (err, data) => {
expect(err).assertEqual(1);
expect(data).assertEqual("type mismatch");
Bundle.getAllApplicationInfo('Bundle.BundleFlag.GET_BUNDLE_DEFAULT', (err, data) => {
Bundle.getAllApplicationInfo(null, (err, data) => {
expect(err).assertEqual(1);
expect(data).assertEqual("type mismatch");
Bundle.getAllApplicationInfo(null, (err, data) => {
expect(err).assertEqual(1);
expect(data).assertEqual("type mismatch");
done();
});
done();
});
});
});
......
......@@ -238,26 +238,6 @@ export default function applicationBundleJsunit() {
done();
});
/**
* @tc.number: bundle_getApplicationInfo_test_0500_002
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
*/
it(TAG_TEST_0500_002, 0, async function (done) {
let startTime = await Utils.getNowTime();
await Bundle.getApplicationInfo('', 'Bundle.BundleFlag.GET_BUNDLE_DEFAULT', userId).then((data) => {
console.info(TAG_TEST_0500_002 + 'UserId promise data is: ' + data);
expect(data).assertFail();
}).catch((error) => {
console.info(TAG_TEST_0500_002 + 'UserId promise error is: ' + error);
expect(error).assertEqual(1);
});
let endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0500_002, startTime, endTime);
done();
});
/**
* @tc.number: bundle_getApplicationInfo_test_0600_002
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
......
......@@ -51,9 +51,9 @@ export default function getBundleArchiveInfo() {
expect(datainfo.appInfo.description).assertEqual(APPLICATION_DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(parseInt(datainfo.appInfo.iconId)).assertLarger(0)
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(parseInt(datainfo.appInfo.labelId)).assertLarger(0)
expect(datainfo.appInfo.systemApp).assertEqual(false)
done();
})
......@@ -73,9 +73,9 @@ export default function getBundleArchiveInfo() {
expect(datainfo.appInfo.description).assertEqual(APPLICATION_DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(parseInt(datainfo.appInfo.iconId)).assertLarger(0)
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(parseInt(datainfo.appInfo.labelId)).assertLarger(0)
expect(datainfo.appInfo.systemApp).assertEqual(false)
done();
})
......@@ -95,9 +95,9 @@ export default function getBundleArchiveInfo() {
expect(datainfo.appInfo.description).assertEqual(APPLICATION_DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(parseInt(datainfo.appInfo.iconId)).assertLarger(0)
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(parseInt(datainfo.appInfo.labelId)).assertLarger(0)
expect(datainfo.appInfo.systemApp).assertEqual(false)
done();
})
......@@ -153,9 +153,9 @@ export default function getBundleArchiveInfo() {
expect(datainfo.appInfo.description).assertEqual(APPLICATION_DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(parseInt(datainfo.appInfo.iconId)).assertLarger(0)
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(parseInt(datainfo.appInfo.labelId)).assertLarger(0)
expect(datainfo.appInfo.systemApp).assertEqual(false)
expect(datainfo.appInfo.supportedModes).assertEqual(0)
for (let j = 0; j < datainfo.appInfo.moduleInfos.length; j++) {
......@@ -190,9 +190,9 @@ export default function getBundleArchiveInfo() {
expect(datainfo.appInfo.description).assertEqual(APPLICATION_DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(parseInt(datainfo.appInfo.iconId)).assertLarger(0)
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(parseInt(datainfo.appInfo.labelId)).assertLarger(0)
expect(datainfo.appInfo.systemApp).assertEqual(false)
done();
}
......@@ -214,9 +214,9 @@ export default function getBundleArchiveInfo() {
expect(datainfo.appInfo.description).assertEqual(APPLICATION_DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(parseInt(datainfo.appInfo.iconId)).assertLarger(0)
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(parseInt(datainfo.appInfo.labelId)).assertLarger(0)
expect(datainfo.appInfo.systemApp).assertEqual(false)
done();
}
......@@ -279,9 +279,9 @@ export default function getBundleArchiveInfo() {
expect(datainfo.appInfo.description).assertEqual(APPLICATION_DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(parseInt(datainfo.appInfo.iconId)).assertLarger(0)
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(parseInt(datainfo.appInfo.labelId)).assertLarger(0)
expect(datainfo.appInfo.systemApp).assertEqual(false)
expect(datainfo.appInfo.supportedModes).assertEqual(0)
for (let j = 0; j < datainfo.appInfo.moduleInfos.length; j++) {
......@@ -317,9 +317,9 @@ export default function getBundleArchiveInfo() {
expect(datainfo.appInfo.description).assertEqual(APPLICATION_DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(parseInt(datainfo.appInfo.iconId)).assertLarger(0)
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(parseInt(datainfo.appInfo.labelId)).assertLarger(0)
expect(datainfo.appInfo.systemApp).assertEqual(false)
expect(datainfo.appInfo.supportedModes).assertEqual(0)
for (let j = 0; j < datainfo.appInfo.moduleInfos.length; j++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册