提交 c372c2e5 编写于 作者: D dy

监视意见修改

Signed-off-by: Ndy <dingyao5@huawei.com>
上级 ca8b7a37
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index.ets';
import {describe, it, expect} from 'deccjsunit/index.ets';
import Utils from './Utils';
import Bundle from '@ohos.bundle';
......@@ -29,16 +29,6 @@ const ABILITY_NAME_ERROR = 'com.ohos.acepackage.error.MainAbility'
export default function getAbilityLabelJsUnit() {
describe('context_getAbilityLabel_test', function () {
beforeEach(async function (done) {
console.info('context_getAbilityLabel_test before each called');
done()
});
afterEach(async function () {
await Utils.sleep(2000);
console.info('context_getAbilityLabel_test after each called');
});
/*
* @tc.number: context_getAbilityLabel_test_0100
* @tc.name: getAbilityLabel : Gets the specified ability label
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import {describe, beforeEach, afterEach, it, expect} from 'deccjsunit/index.ets';
import {describe, it, expect} from 'deccjsunit/index.ets';
import Utils from './Utils';
import bundleManager from '@ohos.bundle';
......@@ -21,54 +21,44 @@ export default function GetabilityInfo() {
describe('GetabilityInfo', function () {
let bundleName = "com.open.harmony.packagemag";
let abilityName = "com.open.harmony.packagemag.MainAbility";
let bundleName_other = "com.ohos.acecollaboration";
let abilityName_other = "com.ohos.acecollaboration.MainAbility";
let bundleName1 = "com.harmony.packagemag";
let abilityName1 = "com.harmony.packagemag1.MainAbility";
beforeEach(async function (done) {
console.info('GetabilityInfo before each called');
done()
});
afterEach(async function () {
await Utils.sleep(2000);
console.info('GetabilityInfo after each called');
});
/*
* @tc.number: bundle_getAllApplicationInfo_test_0100
* @tc.number: bundle_GetabilityInfo_test_0100
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
*/
it('bundle_GetabilityInfo_test_0100', 0, async function (done) {
await Utils.sleep(1000);
let mData;
var timeOldStamp = await Utils.getNowTime();
bundleManager.getAbilityInfo(bundleName, abilityName)
await bundleManager.getAbilityInfo(bundleName, abilityName)
.then((data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('bundle_GetabilityInfo_test_0100', timeOldStamp, timeNewStamp)
console.info('[bundle_GetabilityInfo_test_0100] getApplicationInfo in ');
console.info('[bundle_GetabilityInfo_test_0100] getApplicationInfo promise data is: ' + JSON.stringify(data));
expect(typeof (data)).assertEqual("object");
mData = data;
}).catch((error) => {
console.error('[bundle_GetabilityInfo_test_0100]Operation failed. Cause: ' + JSON.stringify(error));
expect(error).assertFail();
})
var promise = await bundleManager.getAbilityInfo(bundleName, abilityName);
checkAbilityInfo(promise);
checkAbilityInfo(mData);
done();
});
/*
* @tc.number: bundle_getAbilityInfo_test_0200
* @tc.number: bundle_GetabilityInfo_test_0200
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.desc: Check the return value of the interface (by callback)
* @tc.level 0
*/
it('bundle_GetabilityInfo_test_0200', 0, async function (done) {
await Utils.sleep(1000);
let mData;
var timeOldStamp = await Utils.getNowTime();
await bundleManager.getAbilityInfo(bundleName, abilityName, (err, data) => {
......@@ -87,51 +77,44 @@ export default function GetabilityInfo() {
});
/*
* @tc.number: bundle_getAllApplicationInfo_test_0300
* @tc.number: bundle_GetabilityInfo_test_0300
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
*/
it('bundle_GetabilityInfo_test_0300', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
let err = null
var mData
let err;
var mData;
await bundleManager.getAbilityInfo(bundleName_other, abilityName_other)
.then((data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('bundle_GetabilityInfo_test_0300',timeOldStamp,timeNewStamp)
mData = data
console.info('[bundle_GetabilityInfo_test_0300] getApplicationInfo in ');
console.info('[bundle_GetabilityInfo_test_0300] getApplicationInfo promise data is: ' + JSON.stringify(data));
expect(typeof (mData)).assertEqual("object");
checkAbilityInfo_other(mData);
}).catch((error) => {
err = error
console.error('[bundle_GetabilityInfo_test_0300]Operation failed. Cause: ' + JSON.stringify(error));
expect(err).assertEqual(1);
});
if(err != null) {
await expect(err).assertEqual(1);
}else{
checkAbilityInfo_other(mData);
}
done();
});
/*
* @tc.number: bundle_getAllApplicationInfo_test_0400
* @tc.number: bundle_GetabilityInfo_test_0400
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
*/
it('bundle_GetabilityInfo_test_0400', 0, async function (done) {
let error1;
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
bundleManager.getAbilityInfo(bundleName1, abilityName)
.then((data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('bundle_GetabilityInfo_test_0400', timeOldStamp, timeNewStamp)
console.info('[bundle_GetabilityInfo_test_0400] getApplicationInfo in ');
console.info('[bundle_GetabilityInfo_test_0400] getApplicationInfo data is: ' + JSON.stringify(data));
expect(typeof (data)).assertEqual("object");
}).catch((error) => {
......@@ -144,7 +127,7 @@ export default function GetabilityInfo() {
});
/*
* @tc.number: bundle_getAllApplicationInfo_test_0500
* @tc.number: bundle_GetabilityInfo_test_0500
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.desc: Check the return value of the interface (by callback)
* @tc.level 0
......@@ -163,7 +146,7 @@ export default function GetabilityInfo() {
});
/*
* @tc.number: bundle_getAllApplicationInfo_test_0600
* @tc.number: bundle_GetabilityInfo_test_0600
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
......@@ -171,13 +154,11 @@ export default function GetabilityInfo() {
let bundleName2 = "";
it('bundle_GetabilityInfo_test_0600', 0, async function (done) {
let error1;
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
bundleManager.getAbilityInfo(bundleName2, abilityName)
.then((data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('bundle_GetabilityInfo_test_0600', timeOldStamp, timeNewStamp)
console.info('[bundle_GetabilityInfo_test_0600] getApplicationInfo in ');
console.info('[bundle_GetabilityInfo_test_0600] getApplicationInfo data promise is: ' + JSON.stringify(data));
expect(typeof (data)).assertEqual("object");
}).catch((error) => {
......
......@@ -12,13 +12,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index.ets';
import {describe, it, expect} from 'deccjsunit/index.ets';
import Utils from './Utils';
import Bundle from '@ohos.bundle';
const BUNDLE_NAME = 'com.open.harmony.packagemag'
const ABILITY_NAME = 'com.open.harmony.packagemag.MainAbility'
const ABILITY = {
bundleName: BUNDLE_NAME,
name: ABILITY_NAME
......@@ -26,7 +25,6 @@ const ABILITY = {
const BUNDLE_NAME_ERROR = 'com.ohos.acepackage.error'
const ABILITY_NAME_ERROR = 'com.ohos.acepackage.error.MainAbility'
const ABILITY_ERROR = {
bundleName: BUNDLE_NAME_ERROR,
name: ABILITY_NAME_ERROR
......@@ -34,16 +32,6 @@ const ABILITY_ERROR = {
export default function isAbilityEnabledETSUnit() {
describe('context_isAbilityEnabled_test', function () {
beforeEach(async function (done) {
console.info('context_isAbilityEnabled_test before each called');
done()
});
afterEach(async function () {
await Utils.sleep(2000);
console.info('context_isAbilityEnabled_test after each called');
});
/*
* @tc.number: context_isAbilityEnabled_test_0100
* @tc.name: isAbilityEnabled : Get whether to enable a specified ability
......@@ -51,7 +39,6 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0
*/
it('context_isAbilityEnabled_test_0100', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
let mData;
await Bundle.isAbilityEnabled(ABILITY)
......@@ -59,7 +46,6 @@ export default function isAbilityEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0100]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isAbilityEnabled_test_0100] promise in ');
console.info('[context_isAbilityEnabled_test_0100] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
......@@ -77,7 +63,6 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0
*/
it('context_isAbilityEnabled_test_0200', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
let mData;
Bundle.isAbilityEnabled(ABILITY, (error, data) => {
......@@ -88,7 +73,6 @@ export default function isAbilityEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0200]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isAbilityEnabled_test_0200] callBack in');
console.info('[context_isAbilityEnabled_test_0200] callBack error: ' + error);
console.info('[context_isAbilityEnabled_test_0200] callBack data is:' + JSON.stringify(data));
});
......@@ -104,7 +88,6 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0
*/
it('context_isAbilityEnabled_test_0300', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
let mData;
await Bundle.isAbilityEnabled(ABILITY_ERROR)
......@@ -112,7 +95,6 @@ export default function isAbilityEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isAbilityEnabled_test_0300] promise in ');
console.info('[context_isAbilityEnabled_test_0300] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
......@@ -132,10 +114,8 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0
*/
it('context_isAbilityEnabled_test_0400', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
let mData;
console.info('[context_isAbilityEnabled_test_0400] start c++ callBack ');
Bundle.isAbilityEnabled(ABILITY_ERROR, (error, data) => {
if(error){
console.error('[context_isAbilityEnabled_test_0400]Operation failed. Cause: ' + JSON.stringify(error));
......@@ -143,12 +123,10 @@ export default function isAbilityEnabledETSUnit() {
}
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp);
console.info('[context_isAbilityEnabled_test_0400] callBack in');
mData = data;
console.info('[context_isAbilityEnabled_test_0400] callBack error: ' + error);
console.info('[context_isAbilityEnabled_test_0400] callBack data is:' + JSON.stringify(data));
});
console.info('[context_isAbilityEnabled_test_0400] end c++ callBack ');
await Utils.sleep(2000);
console.info('[context_isAbilityEnabled_test_0400] Failure ');
getAbilityEnabledFalse('[context_isAbilityEnabled_test_0300]', mData);
......@@ -163,10 +141,8 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0
*/
it('context_isAbilityEnabled_test_0500', 0, async function (done) {
await Utils.sleep(1000);
await Bundle.setAbilityEnabled(ABILITY, true)
.then((data) => {
console.info('[context_isAbilityEnabled_test_0500] set enable true ');
console.info('[context_isAbilityEnabled_test_0500] set enable true data is: ' + JSON.stringify(data));
}).catch((error) => {
console.info('[context_isAbilityEnabled_test_0500] set enable true error is: ' + error);
......@@ -180,7 +156,6 @@ export default function isAbilityEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0500]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isAbilityEnabled_test_0500] promise in ');
console.info('[context_isAbilityEnabled_test_0500] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
......@@ -198,11 +173,8 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0
*/
it('context_isAbilityEnabled_test_0600', 0, async function (done) {
await Utils.sleep(1000);
await Bundle.setAbilityEnabled(ABILITY, false)
.then((data) => {
console.info('[context_isAbilityEnabled_test_0600] set enable false ');
console.info('[context_isAbilityEnabled_test_0600] set enable false data is: ' + JSON.stringify(data));
}).catch((error) => {
console.info('[context_isAbilityEnabled_test_0600] set enable false error is: ' + error);
......@@ -216,7 +188,6 @@ export default function isAbilityEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0600]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isAbilityEnabled_test_0600] promise in ');
console.info('[context_isAbilityEnabled_test_0600] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
......@@ -234,10 +205,8 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0
*/
it('context_isAbilityEnabled_test_0700', 0, async function (done) {
await Utils.sleep(1000);
await Bundle.setAbilityEnabled(ABILITY, true)
.then((data) => {
console.info('[context_isAbilityEnabled_test_0700] set enable true ');
console.info('[context_isAbilityEnabled_test_0700] set enable true data is: ' + JSON.stringify(data));
}).catch((error) => {
console.info('[context_isAbilityEnabled_test_0700] set enable true error is: ' + error);
......@@ -254,7 +223,6 @@ export default function isAbilityEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0700]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isAbilityEnabled_test_0700] callBack in');
console.info('[context_isAbilityEnabled_test_0700] callBack error: ' + error);
console.info('[context_isAbilityEnabled_test_0700] callBack data is:' + JSON.stringify(data));
});
......@@ -270,10 +238,8 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0
*/
it('context_isAbilityEnabled_test_0800', 0, async function (done) {
await Utils.sleep(1000);
await Bundle.setAbilityEnabled(ABILITY, false)
.then((data) => {
console.info('[context_isAbilityEnabled_test_0800] set enable false ');
console.info('[context_isAbilityEnabled_test_0800] set enable false data is: ' + JSON.stringify(data));
}).catch((error) => {
console.info('[context_isAbilityEnabled_test_0800] set enable false error is: ' + error);
......@@ -290,7 +256,6 @@ export default function isAbilityEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0800]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isAbilityEnabled_test_0800] callBack in');
console.info('[context_isAbilityEnabled_test_0800] callBack error: ' + error);
console.info('[context_isAbilityEnabled_test_0800] callBack data is:' + JSON.stringify(data));
});
......
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index.ets';
import {describe, it, expect} from 'deccjsunit/index.ets';
import Utils from './Utils';
import Bundle from '@ohos.bundle';
......@@ -22,16 +22,6 @@ const BUNDLE_NAME_ERROR = 'com.ohos.acepackage.error'
export default function IsApplicationEnabledETSUnit() {
describe('context_isApplicationEnabled_test', function () {
beforeEach(async function (done) {
console.info('context_isApplicationEnabled_test before each called');
done()
});
afterEach(async function () {
await Utils.sleep(2000);
console.info('context_isApplicationEnabled_test after each called');
});
/*
* @tc.number: context_isApplicationEnabled_test_0100
* @tc.name: isApplicationEnabled : Get whether to enable a specified application
......@@ -39,7 +29,6 @@ export default function IsApplicationEnabledETSUnit() {
* @tc.level 0
*/
it('context_isApplicationEnabled_test_0100', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
let mData;
await Bundle.isApplicationEnabled(BUNDLE_NAME)
......@@ -47,7 +36,6 @@ export default function IsApplicationEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0100]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isApplicationEnabled_test_0100] promise in ');
console.info('[context_isApplicationEnabled_test_0100] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
......@@ -65,7 +53,6 @@ export default function IsApplicationEnabledETSUnit() {
* @tc.level 0
*/
it('context_isApplicationEnabled_test_0200', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
let mData;
Bundle.isApplicationEnabled(BUNDLE_NAME, (error, data) => {
......@@ -76,7 +63,6 @@ export default function IsApplicationEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0200]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isApplicationEnabled_test_0200] callBack in');
console.info('[context_isApplicationEnabled_test_0200] callBack error: ' + error);
console.info('[context_isApplicationEnabled_test_0200] callBack data is:' + JSON.stringify(data));
});
......@@ -92,7 +78,6 @@ export default function IsApplicationEnabledETSUnit() {
* @tc.level 0
*/
it('context_isApplicationEnabled_test_0300', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
let mData;
await Bundle.isApplicationEnabled(BUNDLE_NAME_ERROR)
......@@ -100,7 +85,6 @@ export default function IsApplicationEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0300]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isApplicationEnabled_test_0300] promise in ');
console.info('[context_isApplicationEnabled_test_0300] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
......@@ -120,7 +104,6 @@ export default function IsApplicationEnabledETSUnit() {
* @tc.level 0
*/
it('context_isApplicationEnabled_test_0400', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
let mData;
Bundle.isApplicationEnabled(BUNDLE_NAME_ERROR, (error, data) => {
......@@ -131,7 +114,6 @@ export default function IsApplicationEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0400]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isApplicationEnabled_test_0400] callBack in');
console.info('[context_isApplicationEnabled_test_0400] callBack error: ' + error);
console.info('[context_isApplicationEnabled_test_0400] callBack data is:' + JSON.stringify(data));
});
......@@ -150,7 +132,6 @@ export default function IsApplicationEnabledETSUnit() {
it('context_isApplicationEnabled_test_0500', 0, async function (done) {
await Bundle.setApplicationEnabled(BUNDLE_NAME, true)
.then((data) => {
console.info('[context_isApplicationEnabled_test_0500] set enable true ');
console.info('[context_isApplicationEnabled_test_0500] set enable true data is: ' + JSON.stringify(data));
}).catch((error) => {
console.info('[context_isApplicationEnabled_test_0500] set enable true error is: ' + error);
......@@ -164,7 +145,6 @@ export default function IsApplicationEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0500]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isApplicationEnabled_test_0500] promise in ');
console.info('[context_isApplicationEnabled_test_0500] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
......@@ -184,7 +164,6 @@ export default function IsApplicationEnabledETSUnit() {
it('context_isApplicationEnabled_test_0600', 0, async function (done) {
await Bundle.setApplicationEnabled(BUNDLE_NAME, false)
.then((data) => {
console.info('[context_isApplicationEnabled_test_0600] set enable false ');
console.info('[context_isApplicationEnabled_test_0600] set enable false data is: ' + JSON.stringify(data));
}).catch((error) => {
console.info('[context_isApplicationEnabled_test_0600] set enable false error is: ' + error);
......@@ -202,7 +181,6 @@ export default function IsApplicationEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0600]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isApplicationEnabled_test_0600] callBack in');
console.info('[context_isApplicationEnabled_test_0600] callBack error: ' + error);
console.info('[context_isApplicationEnabled_test_0600] callBack data is:' + JSON.stringify(data));
});
......
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, beforeEach, afterEach, it, expect} from 'deccjsunit/index.ets';
import {describe, it, expect} from 'deccjsunit/index.ets';
import Utils from './Utils';
import Bundle from '@ohos.bundle';
......@@ -27,21 +27,9 @@ const TAG_TEST_0400_001 = ' bundle_getAllApplicationInfo_test_0400_008 ';
const TAG_TEST_0500_001 = ' bundle_getAllApplicationInfo_test_0500_009 ';
const TAG_TEST_0500_002 = ' bundle_getAllApplicationInfo_test_0500_0010 ';
const USER_ID_100 = 100;
const SLEEP_TIME_1000 = 1000;
const SLEEP_TIME_2000 = 2000;
export default function applicationBundleJsunit() {
describe('appInfoTest', function () {
beforeEach(async function (done) {
console.info('applicationBundle before each called');
done()
});
afterEach(async function () {
await Utils.sleep(SLEEP_TIME_2000);
console.info('applicationBundle after each called');
});
/**
* @tc.number: bundle_getApplicationInfo_test_0100_001
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
......@@ -49,7 +37,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
*/
it(TAG_TEST_0100_001, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USER_ID_100)
.catch((error) => {
......@@ -71,7 +58,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
*/
it(TAG_TEST_0100_002, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_ALL_APPLICATION_INFO, USER_ID_100)
.catch((error) => {
......@@ -93,7 +79,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
*/
it(TAG_TEST_0100_003, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE, USER_ID_100)
.catch((error) => {
......@@ -116,7 +101,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
*/
it(TAG_TEST_0200_001, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION)
.catch((error) => {
......@@ -138,7 +122,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
*/
it(TAG_TEST_0200_002, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_ALL_APPLICATION_INFO)
.catch((error) => {
......@@ -160,7 +143,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
*/
it(TAG_TEST_0200_003, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE)
.catch((error) => {
......@@ -182,7 +164,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
*/
it(TAG_TEST_0300_001, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
let datas;
var startTime = await Utils.getNowTime();
Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USER_ID_100,
......@@ -193,7 +174,6 @@ export default function applicationBundleJsunit() {
expect(error).assertFail();
console.info(TAG_TEST_0300_001 + 'UserId callBack error: ' + error);
}
console.info(TAG_TEST_0300_001 + 'UserId callBack in');
console.info(TAG_TEST_0300_001 + 'UserId callBack error: ' + error);
console.info(TAG_TEST_0300_001 + 'UserId callBack data is:' + JSON.stringify(data));
datas = data;
......@@ -221,7 +201,6 @@ export default function applicationBundleJsunit() {
expect(error).assertFail();
console.info(TAG_TEST_0400_001 + 'UserId callBack error: ' + error);
}
console.info(TAG_TEST_0400_001 + 'noUserId callBack in');
console.info(TAG_TEST_0400_001 + 'noUserId callBack error: ' + error);
console.info(TAG_TEST_0400_001 + 'noUserId callBack data is:' + JSON.stringify(data));
datas = data;
......@@ -240,7 +219,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
*/
it(TAG_TEST_0500_001, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
let errors;
var startTime = await Utils.getNowTime();
await Bundle.getAllApplicationInfo('0')
......@@ -265,7 +243,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
*/
it(TAG_TEST_0500_002, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
let errors;
var startTime = await Utils.getNowTime();
await Bundle.getAllApplicationInfo('0', USER_ID_100)
......
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, beforeEach, afterEach, it, expect} from 'deccjsunit/index.ets';
import {describe, it, expect} from 'deccjsunit/index.ets';
import Utils from './Utils';
import Bundle from '@ohos.bundle';
......@@ -32,21 +32,10 @@ const TAG_TEST_0600_003 = ' bundle_getApplicationInfo_test_0600_0013 ';
const BUNDLE_NAME = 'com.open.harmony.packagemag';
const BUNDLE_NAME_OTHER = 'com.ohos.acepackage';
const USER_ID_100 = 100;
const SLEEP_TIME_1000 = 1000;
const SLEEP_TIME_2000 = 2000;
export default function applicationBundleJsunit() {
describe('appInfoTest', function () {
beforeEach(async function (done) {
console.info('applicationBundle before each called');
done()
});
afterEach(async function () {
await Utils.sleep(SLEEP_TIME_2000);
console.info('applicationBundle after each called');
});
/**
* @tc.number: bundle_getApplicationInfo_test_0100_001
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
......@@ -54,8 +43,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
*/
it(TAG_TEST_0100_001, 0, async function (done) {
console.info(TAG_TEST_0100_001 + 'promise START');
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION,
USER_ID_100)
......@@ -69,7 +56,6 @@ export default function applicationBundleJsunit() {
expectData(TAG_TEST_0100_001, data);
getApplicationInfoSuccess(TAG_TEST_0100_001, data);
done();
console.log('------------------ ' + TAG_TEST_0100_001 + ' end -------------------');
});
/**
......@@ -79,8 +65,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
*/
it(TAG_TEST_0100_002, 0, async function (done) {
console.info(TAG_TEST_0100_002 + 'promise START');
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_ALL_APPLICATION_INFO, USER_ID_100)
.catch((error) => {
......@@ -93,7 +77,6 @@ export default function applicationBundleJsunit() {
expectData(TAG_TEST_0100_002, data);
getApplicationInfoSuccess_plus(TAG_TEST_0100_002, data);
done();
console.log('------------------ ' + TAG_TEST_0100_002 + ' end -------------------');
});
/**
......@@ -103,8 +86,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
*/
it(TAG_TEST_0100_003, 0, async function (done) {
console.info(TAG_TEST_0100_003 + 'promise START');
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE,
USER_ID_100)
......@@ -116,13 +97,8 @@ export default function applicationBundleJsunit() {
Utils.getDurationTime(TAG_TEST_0100_003, startTime, endTime);
console.info(TAG_TEST_0100_003 + ' UserId promise data is: ' + JSON.stringify(data));
expectData(TAG_TEST_0100_003, data);
if ('' === data.name) {
getApplicationInfoFail(TAG_TEST_0100_003, data);
} else {
getApplicationInfoSuccess_plus(TAG_TEST_0100_003, data);
}
getApplicationInfoSuccess_plus(TAG_TEST_0100_003, data);
done();
console.log('------------------ ' + TAG_TEST_0100_003 + ' end -------------------');
});
......@@ -133,8 +109,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
*/
it(TAG_TEST_0200_001, 0, async function (done) {
console.info(TAG_TEST_0200_001 + 'promise START');
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION)
.catch((error) => {
......@@ -145,9 +119,8 @@ export default function applicationBundleJsunit() {
Utils.getDurationTime(TAG_TEST_0200_001, startTime, endTime);
console.info(TAG_TEST_0200_001 + ' onUserId promise data is: ' + JSON.stringify(data));
expectData(TAG_TEST_0200_001, data);
getApplicationInfoSuccess(TAG_TEST_0200_001, data);
getApplicationInfoSuccess(TAG_TEST_0200_001, data);
done();
console.log('------------------ ' + TAG_TEST_0200_001 + ' end -------------------');
});
/**
......@@ -157,8 +130,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
*/
it(TAG_TEST_0200_002, 0, async function (done) {
console.info(TAG_TEST_0200_002 + 'promise START');
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_ALL_APPLICATION_INFO)
.catch((error) => {
......@@ -169,9 +140,8 @@ export default function applicationBundleJsunit() {
Utils.getDurationTime(TAG_TEST_0200_002, startTime, endTime);
console.info(TAG_TEST_0200_002 + ' onUserId promise data is: ' + JSON.stringify(data));
expectData(TAG_TEST_0200_002, data);
getApplicationInfoSuccess_plus(TAG_TEST_0200_002, data);
getApplicationInfoSuccess_plus(TAG_TEST_0200_002, data);
done();
console.log('------------------ ' + TAG_TEST_0200_002 + ' end -------------------');
});
/**
......@@ -181,8 +151,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
*/
it(TAG_TEST_0200_003, 0, async function (done) {
console.info(TAG_TEST_0200_003 + 'promise START');
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE)
.catch((error) => {
......@@ -193,9 +161,8 @@ export default function applicationBundleJsunit() {
Utils.getDurationTime(TAG_TEST_0200_003, startTime, endTime);
console.info(TAG_TEST_0200_003 + ' onUserId promise data is: ' + JSON.stringify(data));
expectData(TAG_TEST_0200_003, data);
getApplicationInfoSuccess_plus(TAG_TEST_0200_003, data);
getApplicationInfoSuccess_plus(TAG_TEST_0200_003, data);
done();
console.log('------------------ ' + TAG_TEST_0200_003 + ' end -------------------');
});
/**
......@@ -205,8 +172,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
*/
it(TAG_TEST_0300_001, 0, async function (done) {
console.info(TAG_TEST_0300_001 + 'callBack START');
await Utils.sleep(SLEEP_TIME_1000);
let errors;
let datas;
var startTime = await Utils.getNowTime();
......@@ -219,16 +184,14 @@ export default function applicationBundleJsunit() {
expect(errors).assertFail();
console.info(TAG_TEST_0300_001 + 'UserId callBack error: ' + error);
}
console.info(TAG_TEST_0300_001 + 'UserId callBack in');
console.info(TAG_TEST_0300_001 + 'UserId callBack data is:' + JSON.stringify(data));
datas = data;
});
await Utils.sleep(2000);
console.info(TAG_TEST_0300_001 + 'UserId callBack data is: ' + JSON.stringify(datas));
expectData(TAG_TEST_0300_001, datas);
getApplicationInfoSuccess(TAG_TEST_0300_001, datas);
getApplicationInfoSuccess(TAG_TEST_0300_001, datas);
done();
console.log('------------------ ' + TAG_TEST_0300_001 + ' end -------------------');
});
/**
......@@ -238,7 +201,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
*/
it(TAG_TEST_0400_001, 0, async function (done) {
console.info(TAG_TEST_0400_001 + 'callBack START');
let errors;
let datas;
var startTime = await Utils.getNowTime();
......@@ -250,16 +212,14 @@ export default function applicationBundleJsunit() {
console.info(TAG_TEST_0400_001 + 'UserId callBack error: ' + error);
}
Utils.getDurationTime(TAG_TEST_0400_001, startTime, endTime);
console.info(TAG_TEST_0400_001 + 'noUserId callBack in');
console.info(TAG_TEST_0400_001 + 'noUserId callBack data is:' + JSON.stringify(data));
datas = data;
});
await Utils.sleep(2000);
console.info(TAG_TEST_0400_001 + 'noUserId callBack data is: ' + JSON.stringify(datas));
expectData(TAG_TEST_0400_001, datas);
getApplicationInfoSuccess(TAG_TEST_0400_001, datas);
getApplicationInfoSuccess(TAG_TEST_0400_001, datas);
done();
console.log('------------------ ' + TAG_TEST_0400_001 + ' end -------------------');
});
/**
......@@ -269,8 +229,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
*/
it(TAG_TEST_0500_001, 0, async function (done) {
console.info(TAG_TEST_0500_001 + 'promise START');
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
await Bundle.getApplicationInfo('', 0)
.then((data) => {
......@@ -284,7 +242,6 @@ export default function applicationBundleJsunit() {
var endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0500_001, startTime, endTime);
done();
console.log('------------------ ' + TAG_TEST_0500_001 + ' end -------------------');
});
/**
......@@ -294,8 +251,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
*/
it(TAG_TEST_0500_002, 0, async function (done) {
console.info(TAG_TEST_0500_002 + 'promise START');
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
await Bundle.getApplicationInfo('', '0', USER_ID_100)
.then((data) => {
......@@ -309,7 +264,6 @@ export default function applicationBundleJsunit() {
var endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0500_002, startTime, endTime);
done();
console.log('------------------ ' + TAG_TEST_0500_002 + ' end -------------------');
});
/**
......@@ -319,8 +273,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
*/
it(TAG_TEST_0600_001, 0, async function (done) {
console.info(TAG_TEST_0600_001 + 'promise START');
await Utils.sleep(SLEEP_TIME_1000);
let errors
var startTime = await Utils.getNowTime();
await Bundle.getApplicationInfo(BUNDLE_NAME_OTHER,
......@@ -337,7 +289,6 @@ export default function applicationBundleJsunit() {
var endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0600_001, startTime, endTime);
done();
console.log('------------------ ' + TAG_TEST_0600_001 + ' end -------------------');
});
/**
......@@ -347,8 +298,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
*/
it(TAG_TEST_0600_002, 0, async function (done) {
console.info(TAG_TEST_0600_002 + 'promise START');
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
let errors
await Bundle.getApplicationInfo(BUNDLE_NAME_OTHER, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION,
......@@ -365,7 +314,6 @@ export default function applicationBundleJsunit() {
var endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0600_002, startTime, endTime);
done();
console.log('------------------ ' + TAG_TEST_0600_002 + ' end -------------------');
});
/**
......@@ -375,8 +323,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
*/
it(TAG_TEST_0600_003, 0, async function (done) {
console.info(TAG_TEST_0600_003 + 'promise START');
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
await Bundle.getApplicationInfo(BUNDLE_NAME, 0)
.then((data) => {
......@@ -392,7 +338,6 @@ export default function applicationBundleJsunit() {
expect(error).assertFail();
});
done();
console.log('------------------ ' + TAG_TEST_0600_003 + ' end -------------------');
});
......@@ -496,28 +441,5 @@ export default function applicationBundleJsunit() {
'com.open.harmony.packagemag/com.open.harmony.packagemag');
console.log(msg + ' end ' + JSON.stringify(data));
}
/**
* expect属性值
* @param msg log信息
* @param data 数据源
*/
function getApplicationInfoFail(msg, data) {
expect(data.name).assertEqual('');
expect(data.codePath).assertEqual('');
expect(data.description).assertEqual('');
expect(data.descriptionId).assertEqual(0);
expect(data.icon).assertEqual('');
expect(data.iconId).assertEqual(0);
expect(data.label).assertEqual('');
expect(data.labelId).assertEqual(0);
expect(data.systemApp).assertEqual(false);
expect(data.supportedModes).assertEqual(0);
expect(data.entryDir).assertEqual('');
expect(data.enabled).assertEqual(false);
expect(data.entityType).assertEqual('');
expect(data.removable).assertEqual(true);
console.log(msg + ' end ' + JSON.stringify(data));
}
});
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册