未验证 提交 4f3575f0 编写于 作者: O openharmony_ci 提交者: Gitee

!2616 fix appexecfwk review comments

Merge pull request !2616 from dy/master
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 Utils from './Utils';
import Bundle from '@ohos.bundle'; import Bundle from '@ohos.bundle';
...@@ -29,16 +29,6 @@ const ABILITY_NAME_ERROR = 'com.ohos.acepackage.error.MainAbility' ...@@ -29,16 +29,6 @@ const ABILITY_NAME_ERROR = 'com.ohos.acepackage.error.MainAbility'
export default function getAbilityLabelJsUnit() { export default function getAbilityLabelJsUnit() {
describe('context_getAbilityLabel_test', function () { 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.number: context_getAbilityLabel_test_0100
* @tc.name: getAbilityLabel : Gets the specified ability label * @tc.name: getAbilityLabel : Gets the specified ability label
...@@ -46,7 +36,6 @@ export default function getAbilityLabelJsUnit() { ...@@ -46,7 +36,6 @@ export default function getAbilityLabelJsUnit() {
* @tc.level 0 * @tc.level 0
*/ */
it('context_getAbilityLabel_test_0100', 0, async function (done) { it('context_getAbilityLabel_test_0100', 0, async function (done) {
await Utils.sleep(1000);
let mData; let mData;
var timeOldStamp = await Utils.getNowTime(); var timeOldStamp = await Utils.getNowTime();
await Bundle.getAbilityLabel(BUNDLE_NAME, ABILITY_NAME) await Bundle.getAbilityLabel(BUNDLE_NAME, ABILITY_NAME)
...@@ -54,7 +43,6 @@ export default function getAbilityLabelJsUnit() { ...@@ -54,7 +43,6 @@ export default function getAbilityLabelJsUnit() {
var timeNewStamp = Utils.getNowTime(); var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0100]', timeOldStamp, timeNewStamp); Utils.getDurationTime('[context_getAbilityLabel_test_0100]', timeOldStamp, timeNewStamp);
mData = data; mData = data;
console.info('[context_getAbilityLabel_test_0100] promise in ');
console.info('[context_getAbilityLabel_test_0100] promise data is: ' + JSON.stringify(data)); console.info('[context_getAbilityLabel_test_0100] promise data is: ' + JSON.stringify(data));
}) })
.catch((error) => { .catch((error) => {
...@@ -72,7 +60,6 @@ export default function getAbilityLabelJsUnit() { ...@@ -72,7 +60,6 @@ export default function getAbilityLabelJsUnit() {
* @tc.level 0 * @tc.level 0
*/ */
it('context_getAbilityLabel_test_0200', 0, async function (done) { it('context_getAbilityLabel_test_0200', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime(); var timeOldStamp = await Utils.getNowTime();
let mData; let mData;
Bundle.getAbilityLabel(BUNDLE_NAME, ABILITY_NAME, (error, data) => { Bundle.getAbilityLabel(BUNDLE_NAME, ABILITY_NAME, (error, data) => {
...@@ -83,7 +70,6 @@ export default function getAbilityLabelJsUnit() { ...@@ -83,7 +70,6 @@ export default function getAbilityLabelJsUnit() {
var timeNewStamp = Utils.getNowTime(); var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0200]', timeOldStamp, timeNewStamp); Utils.getDurationTime('[context_getAbilityLabel_test_0200]', timeOldStamp, timeNewStamp);
mData = data; mData = data;
console.info('[context_getAbilityLabel_test_0200] callBack in');
console.info('[context_getAbilityLabel_test_0200] callBack error: ' + error); console.info('[context_getAbilityLabel_test_0200] callBack error: ' + error);
console.info('[context_getAbilityLabel_test_0200] callBack data is:' + JSON.stringify(data)); console.info('[context_getAbilityLabel_test_0200] callBack data is:' + JSON.stringify(data));
}); });
...@@ -99,14 +85,12 @@ export default function getAbilityLabelJsUnit() { ...@@ -99,14 +85,12 @@ export default function getAbilityLabelJsUnit() {
* @tc.level 0 * @tc.level 0
*/ */
it('context_getAbilityLabel_test_0300', 0, async function (done) { it('context_getAbilityLabel_test_0300', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime(); var timeOldStamp = await Utils.getNowTime();
let mError; let mError;
await Bundle.getAbilityLabel(BUNDLE_NAME_ERROR, ABILITY_NAME_ERROR) await Bundle.getAbilityLabel(BUNDLE_NAME_ERROR, ABILITY_NAME_ERROR)
.then((data) => { .then((data) => {
var timeNewStamp = Utils.getNowTime(); var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0300]', timeOldStamp, timeNewStamp); Utils.getDurationTime('[context_getAbilityLabel_test_0300]', timeOldStamp, timeNewStamp);
console.info('[context_getAbilityLabel_test_0300] promise in ');
console.info('[context_getAbilityLabel_test_0300] promise data is: ' + JSON.stringify(data)); console.info('[context_getAbilityLabel_test_0300] promise data is: ' + JSON.stringify(data));
}) })
.catch((error) => { .catch((error) => {
...@@ -128,7 +112,6 @@ export default function getAbilityLabelJsUnit() { ...@@ -128,7 +112,6 @@ export default function getAbilityLabelJsUnit() {
* @tc.level 0 * @tc.level 0
*/ */
it('context_getAbilityLabel_test_0400', 0, async function (done) { it('context_getAbilityLabel_test_0400', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime(); var timeOldStamp = await Utils.getNowTime();
let mError; let mError;
Bundle.getAbilityLabel(BUNDLE_NAME_ERROR, ABILITY_NAME_ERROR, (error, data) => { Bundle.getAbilityLabel(BUNDLE_NAME_ERROR, ABILITY_NAME_ERROR, (error, data) => {
...@@ -139,7 +122,6 @@ export default function getAbilityLabelJsUnit() { ...@@ -139,7 +122,6 @@ export default function getAbilityLabelJsUnit() {
var timeNewStamp = Utils.getNowTime(); var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0400]', timeOldStamp, timeNewStamp); Utils.getDurationTime('[context_getAbilityLabel_test_0400]', timeOldStamp, timeNewStamp);
mError = error; mError = error;
console.info('[context_getAbilityLabel_test_0400] callBack in');
console.info('[context_getAbilityLabel_test_0400] callBack data is:' + JSON.stringify(data)); console.info('[context_getAbilityLabel_test_0400] callBack data is:' + JSON.stringify(data));
}); });
await Utils.sleep(2000); await Utils.sleep(2000);
...@@ -154,7 +136,6 @@ export default function getAbilityLabelJsUnit() { ...@@ -154,7 +136,6 @@ export default function getAbilityLabelJsUnit() {
* @tc.level 0 * @tc.level 0
*/ */
it('context_getAbilityLabel_test_0500', 0, async function (done) { it('context_getAbilityLabel_test_0500', 0, async function (done) {
await Utils.sleep(1000);
let mData; let mData;
let mError = null; let mError = null;
var timeOldStamp = await Utils.getNowTime(); var timeOldStamp = await Utils.getNowTime();
...@@ -164,13 +145,11 @@ export default function getAbilityLabelJsUnit() { ...@@ -164,13 +145,11 @@ export default function getAbilityLabelJsUnit() {
Utils.getDurationTime('[context_getAbilityLabel_test_0500]', timeOldStamp, timeNewStamp); Utils.getDurationTime('[context_getAbilityLabel_test_0500]', timeOldStamp, timeNewStamp);
mData = data; mData = data;
expect(mData).assertFail(); expect(mData).assertFail();
console.info('[context_getAbilityLabel_test_0500] promise in ');
console.info('[context_getAbilityLabel_test_0500] promise data is: ' + JSON.stringify(data)); console.info('[context_getAbilityLabel_test_0500] promise data is: ' + JSON.stringify(data));
}) })
.catch((error) => { .catch((error) => {
mError = error; mError = error;
console.info('[context_getAbilityLabel_test_0500] promise error is: ' + error); console.info('[context_getAbilityLabel_test_0500] promise error is: ' + error);
expect(mError).assertEqual(1);
getAbilityLabelFailure('[context_getAbilityLabel_test_0500]', mError); getAbilityLabelFailure('[context_getAbilityLabel_test_0500]', mError);
}); });
done(); done();
...@@ -183,22 +162,14 @@ export default function getAbilityLabelJsUnit() { ...@@ -183,22 +162,14 @@ export default function getAbilityLabelJsUnit() {
* @tc.level 0 * @tc.level 0
*/ */
it('context_getAbilityLabel_test_0600', 0, async function (done) { it('context_getAbilityLabel_test_0600', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime(); var timeOldStamp = await Utils.getNowTime();
let mError = null;
Bundle.getAbilityLabel(OTHER_BUNDLE_NAME, OTHER_ABILITY_NAME, (error, data) => { Bundle.getAbilityLabel(OTHER_BUNDLE_NAME, OTHER_ABILITY_NAME, (error, data) => {
mError = error;
var timeNewStamp = Utils.getNowTime(); var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0600]', timeOldStamp, timeNewStamp); Utils.getDurationTime('[context_getAbilityLabel_test_0600]', timeOldStamp, timeNewStamp);
if(mError !== null){ console.info('[context_getAbilityLabel_test_0600] callBack error: ' + error);
console.info('[context_getAbilityLabel_test_0600] callBack error: ' + error); getAbilityLabelFailure('[context_getAbilityLabel_test_0600]', error);
expect(mError).assertEqual(1); expect(data).assertEqual(undefined);
getAbilityLabelFailure('[context_getAbilityLabel_test_0600]', mError);
}
console.info('[context_getAbilityLabel_test_0600] callBack in');
console.info('[context_getAbilityLabel_test_0600] callBack data is:' + JSON.stringify(data));
}); });
await Utils.sleep(2000);
done(); done();
}); });
...@@ -210,7 +181,6 @@ export default function getAbilityLabelJsUnit() { ...@@ -210,7 +181,6 @@ export default function getAbilityLabelJsUnit() {
* @tc.level 0 * @tc.level 0
*/ */
it('context_getAbilityLabel_test_0700', 0, async function (done) { it('context_getAbilityLabel_test_0700', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime(); var timeOldStamp = await Utils.getNowTime();
let mError; let mError;
Bundle.getAbilityLabel(BUNDLE_NAME, SERVICE_ABILITY_NAME, (error, data) => { Bundle.getAbilityLabel(BUNDLE_NAME, SERVICE_ABILITY_NAME, (error, data) => {
...@@ -219,10 +189,7 @@ export default function getAbilityLabelJsUnit() { ...@@ -219,10 +189,7 @@ export default function getAbilityLabelJsUnit() {
mError = error; mError = error;
if(mError !== null){ if(mError !== null){
console.info('[context_getAbilityLabel_test_0600] callBack error: ' + error); console.info('[context_getAbilityLabel_test_0600] callBack error: ' + error);
expect(mError).assertEqual(1);
} }
console.info('[context_getAbilityLabel_test_0700] callBack in');
console.info('[context_getAbilityLabel_test_0700] callBack error: ' + error);
console.info('[context_getAbilityLabel_test_0700] callBack data is:' + JSON.stringify(data)); console.info('[context_getAbilityLabel_test_0700] callBack data is:' + JSON.stringify(data));
}); });
await Utils.sleep(2000); await Utils.sleep(2000);
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * 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 Utils from './Utils';
import bundleManager from '@ohos.bundle'; import bundleManager from '@ohos.bundle';
...@@ -21,54 +21,44 @@ export default function GetabilityInfo() { ...@@ -21,54 +21,44 @@ export default function GetabilityInfo() {
describe('GetabilityInfo', function () { describe('GetabilityInfo', function () {
let bundleName = "com.open.harmony.packagemag"; let bundleName = "com.open.harmony.packagemag";
let abilityName = "com.open.harmony.packagemag.MainAbility"; let abilityName = "com.open.harmony.packagemag.MainAbility";
let bundleName_other = "com.ohos.acecollaboration"; let bundleName_other = "com.ohos.acecollaboration";
let abilityName_other = "com.ohos.acecollaboration.MainAbility"; let abilityName_other = "com.ohos.acecollaboration.MainAbility";
let bundleName1 = "com.harmony.packagemag"; let bundleName1 = "com.harmony.packagemag";
let abilityName1 = "com.harmony.packagemag1.MainAbility"; 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.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.desc: Check the return value of the interface (by promise)
* @tc.level 0 * @tc.level 0
*/ */
it('bundle_GetabilityInfo_test_0100', 0, async function (done) { it('bundle_GetabilityInfo_test_0100', 0, async function (done) {
await Utils.sleep(1000); let mData;
var timeOldStamp = await Utils.getNowTime(); var timeOldStamp = await Utils.getNowTime();
bundleManager.getAbilityInfo(bundleName, abilityName) await bundleManager.getAbilityInfo(bundleName, abilityName)
.then((data) => { .then((data) => {
var timeNewStamp = Utils.getNowTime(); var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('bundle_GetabilityInfo_test_0100', timeOldStamp, timeNewStamp) 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)); console.info('[bundle_GetabilityInfo_test_0100] getApplicationInfo promise data is: ' + JSON.stringify(data));
expect(typeof (data)).assertEqual("object"); expect(typeof (data)).assertEqual("object");
mData = data;
}).catch((error) => { }).catch((error) => {
console.error('[bundle_GetabilityInfo_test_0100]Operation failed. Cause: ' + JSON.stringify(error)); console.error('[bundle_GetabilityInfo_test_0100]Operation failed. Cause: ' + JSON.stringify(error));
expect(error).assertFail(); expect(error).assertFail();
}) })
var promise = await bundleManager.getAbilityInfo(bundleName, abilityName); checkAbilityInfo(mData);
checkAbilityInfo(promise);
done(); 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.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.desc: Check the return value of the interface (by callback)
* @tc.level 0 * @tc.level 0
*/ */
it('bundle_GetabilityInfo_test_0200', 0, async function (done) { it('bundle_GetabilityInfo_test_0200', 0, async function (done) {
await Utils.sleep(1000);
let mData; let mData;
var timeOldStamp = await Utils.getNowTime(); var timeOldStamp = await Utils.getNowTime();
await bundleManager.getAbilityInfo(bundleName, abilityName, (err, data) => { await bundleManager.getAbilityInfo(bundleName, abilityName, (err, data) => {
...@@ -87,51 +77,38 @@ export default function GetabilityInfo() { ...@@ -87,51 +77,38 @@ 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.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.desc: Check the return value of the interface (by promise)
* @tc.level 0 * @tc.level 0
*/ */
it('bundle_GetabilityInfo_test_0300', 0, async function (done) { it('bundle_GetabilityInfo_test_0300', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime(); var timeOldStamp = await Utils.getNowTime();
let err = null
var mData
await bundleManager.getAbilityInfo(bundleName_other, abilityName_other) await bundleManager.getAbilityInfo(bundleName_other, abilityName_other)
.then((data) => { .then((data) => {
var timeNewStamp = Utils.getNowTime(); var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('bundle_GetabilityInfo_test_0300',timeOldStamp,timeNewStamp) Utils.getDurationTime('bundle_GetabilityInfo_test_0300',timeOldStamp,timeNewStamp)
mData = data expect(data).assertFail();
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");
}).catch((error) => { }).catch((error) => {
err = error
console.error('[bundle_GetabilityInfo_test_0300]Operation failed. Cause: ' + JSON.stringify(error)); console.error('[bundle_GetabilityInfo_test_0300]Operation failed. Cause: ' + JSON.stringify(error));
expect(error).assertEqual(1);
}); });
if(err != null) {
await expect(err).assertEqual(1);
}else{
checkAbilityInfo_other(mData);
}
done(); 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.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.desc: Check the return value of the interface (by promise)
* @tc.level 0 * @tc.level 0
*/ */
it('bundle_GetabilityInfo_test_0400', 0, async function (done) { it('bundle_GetabilityInfo_test_0400', 0, async function (done) {
let error1; let error1;
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime(); var timeOldStamp = await Utils.getNowTime();
bundleManager.getAbilityInfo(bundleName1, abilityName) bundleManager.getAbilityInfo(bundleName1, abilityName)
.then((data) => { .then((data) => {
var timeNewStamp = Utils.getNowTime(); var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('bundle_GetabilityInfo_test_0400', timeOldStamp, timeNewStamp) 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)); console.info('[bundle_GetabilityInfo_test_0400] getApplicationInfo data is: ' + JSON.stringify(data));
expect(typeof (data)).assertEqual("object"); expect(typeof (data)).assertEqual("object");
}).catch((error) => { }).catch((error) => {
...@@ -144,7 +121,7 @@ export default function GetabilityInfo() { ...@@ -144,7 +121,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.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.desc: Check the return value of the interface (by callback)
* @tc.level 0 * @tc.level 0
...@@ -163,7 +140,7 @@ export default function GetabilityInfo() { ...@@ -163,7 +140,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.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.desc: Check the return value of the interface (by promise)
* @tc.level 0 * @tc.level 0
...@@ -171,13 +148,11 @@ export default function GetabilityInfo() { ...@@ -171,13 +148,11 @@ export default function GetabilityInfo() {
let bundleName2 = ""; let bundleName2 = "";
it('bundle_GetabilityInfo_test_0600', 0, async function (done) { it('bundle_GetabilityInfo_test_0600', 0, async function (done) {
let error1; let error1;
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime(); var timeOldStamp = await Utils.getNowTime();
bundleManager.getAbilityInfo(bundleName2, abilityName) bundleManager.getAbilityInfo(bundleName2, abilityName)
.then((data) => { .then((data) => {
var timeNewStamp = Utils.getNowTime(); var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('bundle_GetabilityInfo_test_0600', timeOldStamp, timeNewStamp) 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)); console.info('[bundle_GetabilityInfo_test_0600] getApplicationInfo data promise is: ' + JSON.stringify(data));
expect(typeof (data)).assertEqual("object"); expect(typeof (data)).assertEqual("object");
}).catch((error) => { }).catch((error) => {
......
...@@ -12,13 +12,12 @@ ...@@ -12,13 +12,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 Utils from './Utils';
import Bundle from '@ohos.bundle'; import Bundle from '@ohos.bundle';
const BUNDLE_NAME = 'com.open.harmony.packagemag' const BUNDLE_NAME = 'com.open.harmony.packagemag'
const ABILITY_NAME = 'com.open.harmony.packagemag.MainAbility' const ABILITY_NAME = 'com.open.harmony.packagemag.MainAbility'
const ABILITY = { const ABILITY = {
bundleName: BUNDLE_NAME, bundleName: BUNDLE_NAME,
name: ABILITY_NAME name: ABILITY_NAME
...@@ -26,7 +25,6 @@ const ABILITY = { ...@@ -26,7 +25,6 @@ const ABILITY = {
const BUNDLE_NAME_ERROR = 'com.ohos.acepackage.error' const BUNDLE_NAME_ERROR = 'com.ohos.acepackage.error'
const ABILITY_NAME_ERROR = 'com.ohos.acepackage.error.MainAbility' const ABILITY_NAME_ERROR = 'com.ohos.acepackage.error.MainAbility'
const ABILITY_ERROR = { const ABILITY_ERROR = {
bundleName: BUNDLE_NAME_ERROR, bundleName: BUNDLE_NAME_ERROR,
name: ABILITY_NAME_ERROR name: ABILITY_NAME_ERROR
...@@ -34,16 +32,6 @@ const ABILITY_ERROR = { ...@@ -34,16 +32,6 @@ const ABILITY_ERROR = {
export default function isAbilityEnabledETSUnit() { export default function isAbilityEnabledETSUnit() {
describe('context_isAbilityEnabled_test', function () { 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.number: context_isAbilityEnabled_test_0100
* @tc.name: isAbilityEnabled : Get whether to enable a specified ability * @tc.name: isAbilityEnabled : Get whether to enable a specified ability
...@@ -51,7 +39,6 @@ export default function isAbilityEnabledETSUnit() { ...@@ -51,7 +39,6 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0 * @tc.level 0
*/ */
it('context_isAbilityEnabled_test_0100', 0, async function (done) { it('context_isAbilityEnabled_test_0100', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime(); var timeOldStamp = await Utils.getNowTime();
let mData; let mData;
await Bundle.isAbilityEnabled(ABILITY) await Bundle.isAbilityEnabled(ABILITY)
...@@ -59,7 +46,6 @@ export default function isAbilityEnabledETSUnit() { ...@@ -59,7 +46,6 @@ export default function isAbilityEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime(); var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0100]', timeOldStamp, timeNewStamp); Utils.getDurationTime('[context_isAbilityEnabled_test_0100]', timeOldStamp, timeNewStamp);
mData = data; mData = data;
console.info('[context_isAbilityEnabled_test_0100] promise in ');
console.info('[context_isAbilityEnabled_test_0100] promise data is: ' + JSON.stringify(data)); console.info('[context_isAbilityEnabled_test_0100] promise data is: ' + JSON.stringify(data));
}) })
.catch((error) => { .catch((error) => {
...@@ -77,7 +63,6 @@ export default function isAbilityEnabledETSUnit() { ...@@ -77,7 +63,6 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0 * @tc.level 0
*/ */
it('context_isAbilityEnabled_test_0200', 0, async function (done) { it('context_isAbilityEnabled_test_0200', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime(); var timeOldStamp = await Utils.getNowTime();
let mData; let mData;
Bundle.isAbilityEnabled(ABILITY, (error, data) => { Bundle.isAbilityEnabled(ABILITY, (error, data) => {
...@@ -88,7 +73,6 @@ export default function isAbilityEnabledETSUnit() { ...@@ -88,7 +73,6 @@ export default function isAbilityEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime(); var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0200]', timeOldStamp, timeNewStamp); Utils.getDurationTime('[context_isAbilityEnabled_test_0200]', timeOldStamp, timeNewStamp);
mData = data; 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 error: ' + error);
console.info('[context_isAbilityEnabled_test_0200] callBack data is:' + JSON.stringify(data)); console.info('[context_isAbilityEnabled_test_0200] callBack data is:' + JSON.stringify(data));
}); });
...@@ -104,7 +88,6 @@ export default function isAbilityEnabledETSUnit() { ...@@ -104,7 +88,6 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0 * @tc.level 0
*/ */
it('context_isAbilityEnabled_test_0300', 0, async function (done) { it('context_isAbilityEnabled_test_0300', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime(); var timeOldStamp = await Utils.getNowTime();
let mData; let mData;
await Bundle.isAbilityEnabled(ABILITY_ERROR) await Bundle.isAbilityEnabled(ABILITY_ERROR)
...@@ -112,7 +95,6 @@ export default function isAbilityEnabledETSUnit() { ...@@ -112,7 +95,6 @@ export default function isAbilityEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime(); var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp); Utils.getDurationTime('[context_isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp);
mData = data; mData = data;
console.info('[context_isAbilityEnabled_test_0300] promise in ');
console.info('[context_isAbilityEnabled_test_0300] promise data is: ' + JSON.stringify(data)); console.info('[context_isAbilityEnabled_test_0300] promise data is: ' + JSON.stringify(data));
}) })
.catch((error) => { .catch((error) => {
...@@ -132,10 +114,8 @@ export default function isAbilityEnabledETSUnit() { ...@@ -132,10 +114,8 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0 * @tc.level 0
*/ */
it('context_isAbilityEnabled_test_0400', 0, async function (done) { it('context_isAbilityEnabled_test_0400', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime(); var timeOldStamp = await Utils.getNowTime();
let mData; let mData;
console.info('[context_isAbilityEnabled_test_0400] start c++ callBack ');
Bundle.isAbilityEnabled(ABILITY_ERROR, (error, data) => { Bundle.isAbilityEnabled(ABILITY_ERROR, (error, data) => {
if(error){ if(error){
console.error('[context_isAbilityEnabled_test_0400]Operation failed. Cause: ' + JSON.stringify(error)); console.error('[context_isAbilityEnabled_test_0400]Operation failed. Cause: ' + JSON.stringify(error));
...@@ -143,12 +123,10 @@ export default function isAbilityEnabledETSUnit() { ...@@ -143,12 +123,10 @@ export default function isAbilityEnabledETSUnit() {
} }
var timeNewStamp = Utils.getNowTime(); var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp); Utils.getDurationTime('[context_isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp);
console.info('[context_isAbilityEnabled_test_0400] callBack in');
mData = data; mData = data;
console.info('[context_isAbilityEnabled_test_0400] callBack error: ' + error); 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] callBack data is:' + JSON.stringify(data));
}); });
console.info('[context_isAbilityEnabled_test_0400] end c++ callBack ');
await Utils.sleep(2000); await Utils.sleep(2000);
console.info('[context_isAbilityEnabled_test_0400] Failure '); console.info('[context_isAbilityEnabled_test_0400] Failure ');
getAbilityEnabledFalse('[context_isAbilityEnabled_test_0300]', mData); getAbilityEnabledFalse('[context_isAbilityEnabled_test_0300]', mData);
...@@ -163,10 +141,8 @@ export default function isAbilityEnabledETSUnit() { ...@@ -163,10 +141,8 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0 * @tc.level 0
*/ */
it('context_isAbilityEnabled_test_0500', 0, async function (done) { it('context_isAbilityEnabled_test_0500', 0, async function (done) {
await Utils.sleep(1000);
await Bundle.setAbilityEnabled(ABILITY, true) await Bundle.setAbilityEnabled(ABILITY, true)
.then((data) => { .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)); console.info('[context_isAbilityEnabled_test_0500] set enable true data is: ' + JSON.stringify(data));
}).catch((error) => { }).catch((error) => {
console.info('[context_isAbilityEnabled_test_0500] set enable true error is: ' + error); console.info('[context_isAbilityEnabled_test_0500] set enable true error is: ' + error);
...@@ -180,7 +156,6 @@ export default function isAbilityEnabledETSUnit() { ...@@ -180,7 +156,6 @@ export default function isAbilityEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime(); var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0500]', timeOldStamp, timeNewStamp); Utils.getDurationTime('[context_isAbilityEnabled_test_0500]', timeOldStamp, timeNewStamp);
mData = data; mData = data;
console.info('[context_isAbilityEnabled_test_0500] promise in ');
console.info('[context_isAbilityEnabled_test_0500] promise data is: ' + JSON.stringify(data)); console.info('[context_isAbilityEnabled_test_0500] promise data is: ' + JSON.stringify(data));
}) })
.catch((error) => { .catch((error) => {
...@@ -198,11 +173,8 @@ export default function isAbilityEnabledETSUnit() { ...@@ -198,11 +173,8 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0 * @tc.level 0
*/ */
it('context_isAbilityEnabled_test_0600', 0, async function (done) { it('context_isAbilityEnabled_test_0600', 0, async function (done) {
await Utils.sleep(1000);
await Bundle.setAbilityEnabled(ABILITY, false) await Bundle.setAbilityEnabled(ABILITY, false)
.then((data) => { .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)); console.info('[context_isAbilityEnabled_test_0600] set enable false data is: ' + JSON.stringify(data));
}).catch((error) => { }).catch((error) => {
console.info('[context_isAbilityEnabled_test_0600] set enable false error is: ' + error); console.info('[context_isAbilityEnabled_test_0600] set enable false error is: ' + error);
...@@ -216,7 +188,6 @@ export default function isAbilityEnabledETSUnit() { ...@@ -216,7 +188,6 @@ export default function isAbilityEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime(); var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0600]', timeOldStamp, timeNewStamp); Utils.getDurationTime('[context_isAbilityEnabled_test_0600]', timeOldStamp, timeNewStamp);
mData = data; mData = data;
console.info('[context_isAbilityEnabled_test_0600] promise in ');
console.info('[context_isAbilityEnabled_test_0600] promise data is: ' + JSON.stringify(data)); console.info('[context_isAbilityEnabled_test_0600] promise data is: ' + JSON.stringify(data));
}) })
.catch((error) => { .catch((error) => {
...@@ -234,10 +205,8 @@ export default function isAbilityEnabledETSUnit() { ...@@ -234,10 +205,8 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0 * @tc.level 0
*/ */
it('context_isAbilityEnabled_test_0700', 0, async function (done) { it('context_isAbilityEnabled_test_0700', 0, async function (done) {
await Utils.sleep(1000);
await Bundle.setAbilityEnabled(ABILITY, true) await Bundle.setAbilityEnabled(ABILITY, true)
.then((data) => { .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)); console.info('[context_isAbilityEnabled_test_0700] set enable true data is: ' + JSON.stringify(data));
}).catch((error) => { }).catch((error) => {
console.info('[context_isAbilityEnabled_test_0700] set enable true error is: ' + error); console.info('[context_isAbilityEnabled_test_0700] set enable true error is: ' + error);
...@@ -254,7 +223,6 @@ export default function isAbilityEnabledETSUnit() { ...@@ -254,7 +223,6 @@ export default function isAbilityEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime(); var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0700]', timeOldStamp, timeNewStamp); Utils.getDurationTime('[context_isAbilityEnabled_test_0700]', timeOldStamp, timeNewStamp);
mData = data; 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 error: ' + error);
console.info('[context_isAbilityEnabled_test_0700] callBack data is:' + JSON.stringify(data)); console.info('[context_isAbilityEnabled_test_0700] callBack data is:' + JSON.stringify(data));
}); });
...@@ -270,10 +238,8 @@ export default function isAbilityEnabledETSUnit() { ...@@ -270,10 +238,8 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0 * @tc.level 0
*/ */
it('context_isAbilityEnabled_test_0800', 0, async function (done) { it('context_isAbilityEnabled_test_0800', 0, async function (done) {
await Utils.sleep(1000);
await Bundle.setAbilityEnabled(ABILITY, false) await Bundle.setAbilityEnabled(ABILITY, false)
.then((data) => { .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)); console.info('[context_isAbilityEnabled_test_0800] set enable false data is: ' + JSON.stringify(data));
}).catch((error) => { }).catch((error) => {
console.info('[context_isAbilityEnabled_test_0800] set enable false error is: ' + error); console.info('[context_isAbilityEnabled_test_0800] set enable false error is: ' + error);
...@@ -290,7 +256,6 @@ export default function isAbilityEnabledETSUnit() { ...@@ -290,7 +256,6 @@ export default function isAbilityEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime(); var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0800]', timeOldStamp, timeNewStamp); Utils.getDurationTime('[context_isAbilityEnabled_test_0800]', timeOldStamp, timeNewStamp);
mData = data; 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 error: ' + error);
console.info('[context_isAbilityEnabled_test_0800] callBack data is:' + JSON.stringify(data)); console.info('[context_isAbilityEnabled_test_0800] callBack data is:' + JSON.stringify(data));
}); });
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 Utils from './Utils';
import Bundle from '@ohos.bundle'; import Bundle from '@ohos.bundle';
...@@ -22,16 +22,6 @@ const BUNDLE_NAME_ERROR = 'com.ohos.acepackage.error' ...@@ -22,16 +22,6 @@ const BUNDLE_NAME_ERROR = 'com.ohos.acepackage.error'
export default function IsApplicationEnabledETSUnit() { export default function IsApplicationEnabledETSUnit() {
describe('context_isApplicationEnabled_test', function () { 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.number: context_isApplicationEnabled_test_0100
* @tc.name: isApplicationEnabled : Get whether to enable a specified application * @tc.name: isApplicationEnabled : Get whether to enable a specified application
...@@ -39,7 +29,6 @@ export default function IsApplicationEnabledETSUnit() { ...@@ -39,7 +29,6 @@ export default function IsApplicationEnabledETSUnit() {
* @tc.level 0 * @tc.level 0
*/ */
it('context_isApplicationEnabled_test_0100', 0, async function (done) { it('context_isApplicationEnabled_test_0100', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime(); var timeOldStamp = await Utils.getNowTime();
let mData; let mData;
await Bundle.isApplicationEnabled(BUNDLE_NAME) await Bundle.isApplicationEnabled(BUNDLE_NAME)
...@@ -47,7 +36,6 @@ export default function IsApplicationEnabledETSUnit() { ...@@ -47,7 +36,6 @@ export default function IsApplicationEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime(); var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0100]', timeOldStamp, timeNewStamp); Utils.getDurationTime('[context_isApplicationEnabled_test_0100]', timeOldStamp, timeNewStamp);
mData = data; mData = data;
console.info('[context_isApplicationEnabled_test_0100] promise in ');
console.info('[context_isApplicationEnabled_test_0100] promise data is: ' + JSON.stringify(data)); console.info('[context_isApplicationEnabled_test_0100] promise data is: ' + JSON.stringify(data));
}) })
.catch((error) => { .catch((error) => {
...@@ -65,7 +53,6 @@ export default function IsApplicationEnabledETSUnit() { ...@@ -65,7 +53,6 @@ export default function IsApplicationEnabledETSUnit() {
* @tc.level 0 * @tc.level 0
*/ */
it('context_isApplicationEnabled_test_0200', 0, async function (done) { it('context_isApplicationEnabled_test_0200', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime(); var timeOldStamp = await Utils.getNowTime();
let mData; let mData;
Bundle.isApplicationEnabled(BUNDLE_NAME, (error, data) => { Bundle.isApplicationEnabled(BUNDLE_NAME, (error, data) => {
...@@ -76,7 +63,6 @@ export default function IsApplicationEnabledETSUnit() { ...@@ -76,7 +63,6 @@ export default function IsApplicationEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime(); var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0200]', timeOldStamp, timeNewStamp); Utils.getDurationTime('[context_isApplicationEnabled_test_0200]', timeOldStamp, timeNewStamp);
mData = data; 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 error: ' + error);
console.info('[context_isApplicationEnabled_test_0200] callBack data is:' + JSON.stringify(data)); console.info('[context_isApplicationEnabled_test_0200] callBack data is:' + JSON.stringify(data));
}); });
...@@ -92,7 +78,6 @@ export default function IsApplicationEnabledETSUnit() { ...@@ -92,7 +78,6 @@ export default function IsApplicationEnabledETSUnit() {
* @tc.level 0 * @tc.level 0
*/ */
it('context_isApplicationEnabled_test_0300', 0, async function (done) { it('context_isApplicationEnabled_test_0300', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime(); var timeOldStamp = await Utils.getNowTime();
let mData; let mData;
await Bundle.isApplicationEnabled(BUNDLE_NAME_ERROR) await Bundle.isApplicationEnabled(BUNDLE_NAME_ERROR)
...@@ -100,7 +85,6 @@ export default function IsApplicationEnabledETSUnit() { ...@@ -100,7 +85,6 @@ export default function IsApplicationEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime(); var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0300]', timeOldStamp, timeNewStamp); Utils.getDurationTime('[context_isApplicationEnabled_test_0300]', timeOldStamp, timeNewStamp);
mData = data; mData = data;
console.info('[context_isApplicationEnabled_test_0300] promise in ');
console.info('[context_isApplicationEnabled_test_0300] promise data is: ' + JSON.stringify(data)); console.info('[context_isApplicationEnabled_test_0300] promise data is: ' + JSON.stringify(data));
}) })
.catch((error) => { .catch((error) => {
...@@ -120,7 +104,6 @@ export default function IsApplicationEnabledETSUnit() { ...@@ -120,7 +104,6 @@ export default function IsApplicationEnabledETSUnit() {
* @tc.level 0 * @tc.level 0
*/ */
it('context_isApplicationEnabled_test_0400', 0, async function (done) { it('context_isApplicationEnabled_test_0400', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime(); var timeOldStamp = await Utils.getNowTime();
let mData; let mData;
Bundle.isApplicationEnabled(BUNDLE_NAME_ERROR, (error, data) => { Bundle.isApplicationEnabled(BUNDLE_NAME_ERROR, (error, data) => {
...@@ -131,7 +114,6 @@ export default function IsApplicationEnabledETSUnit() { ...@@ -131,7 +114,6 @@ export default function IsApplicationEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime(); var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0400]', timeOldStamp, timeNewStamp); Utils.getDurationTime('[context_isApplicationEnabled_test_0400]', timeOldStamp, timeNewStamp);
mData = data; 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 error: ' + error);
console.info('[context_isApplicationEnabled_test_0400] callBack data is:' + JSON.stringify(data)); console.info('[context_isApplicationEnabled_test_0400] callBack data is:' + JSON.stringify(data));
}); });
...@@ -150,7 +132,6 @@ export default function IsApplicationEnabledETSUnit() { ...@@ -150,7 +132,6 @@ export default function IsApplicationEnabledETSUnit() {
it('context_isApplicationEnabled_test_0500', 0, async function (done) { it('context_isApplicationEnabled_test_0500', 0, async function (done) {
await Bundle.setApplicationEnabled(BUNDLE_NAME, true) await Bundle.setApplicationEnabled(BUNDLE_NAME, true)
.then((data) => { .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)); console.info('[context_isApplicationEnabled_test_0500] set enable true data is: ' + JSON.stringify(data));
}).catch((error) => { }).catch((error) => {
console.info('[context_isApplicationEnabled_test_0500] set enable true error is: ' + error); console.info('[context_isApplicationEnabled_test_0500] set enable true error is: ' + error);
...@@ -164,7 +145,6 @@ export default function IsApplicationEnabledETSUnit() { ...@@ -164,7 +145,6 @@ export default function IsApplicationEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime(); var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0500]', timeOldStamp, timeNewStamp); Utils.getDurationTime('[context_isApplicationEnabled_test_0500]', timeOldStamp, timeNewStamp);
mData = data; mData = data;
console.info('[context_isApplicationEnabled_test_0500] promise in ');
console.info('[context_isApplicationEnabled_test_0500] promise data is: ' + JSON.stringify(data)); console.info('[context_isApplicationEnabled_test_0500] promise data is: ' + JSON.stringify(data));
}) })
.catch((error) => { .catch((error) => {
...@@ -184,7 +164,6 @@ export default function IsApplicationEnabledETSUnit() { ...@@ -184,7 +164,6 @@ export default function IsApplicationEnabledETSUnit() {
it('context_isApplicationEnabled_test_0600', 0, async function (done) { it('context_isApplicationEnabled_test_0600', 0, async function (done) {
await Bundle.setApplicationEnabled(BUNDLE_NAME, false) await Bundle.setApplicationEnabled(BUNDLE_NAME, false)
.then((data) => { .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)); console.info('[context_isApplicationEnabled_test_0600] set enable false data is: ' + JSON.stringify(data));
}).catch((error) => { }).catch((error) => {
console.info('[context_isApplicationEnabled_test_0600] set enable false error is: ' + error); console.info('[context_isApplicationEnabled_test_0600] set enable false error is: ' + error);
...@@ -202,7 +181,6 @@ export default function IsApplicationEnabledETSUnit() { ...@@ -202,7 +181,6 @@ export default function IsApplicationEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime(); var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0600]', timeOldStamp, timeNewStamp); Utils.getDurationTime('[context_isApplicationEnabled_test_0600]', timeOldStamp, timeNewStamp);
mData = data; 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 error: ' + error);
console.info('[context_isApplicationEnabled_test_0600] callBack data is:' + JSON.stringify(data)); console.info('[context_isApplicationEnabled_test_0600] callBack data is:' + JSON.stringify(data));
}); });
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 Utils from './Utils';
import Bundle from '@ohos.bundle'; import Bundle from '@ohos.bundle';
...@@ -27,21 +27,9 @@ const TAG_TEST_0400_001 = ' bundle_getAllApplicationInfo_test_0400_008 '; ...@@ -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_001 = ' bundle_getAllApplicationInfo_test_0500_009 ';
const TAG_TEST_0500_002 = ' bundle_getAllApplicationInfo_test_0500_0010 '; const TAG_TEST_0500_002 = ' bundle_getAllApplicationInfo_test_0500_0010 ';
const USER_ID_100 = 100; const USER_ID_100 = 100;
const SLEEP_TIME_1000 = 1000;
const SLEEP_TIME_2000 = 2000;
export default function applicationBundleJsunit() { export default function applicationBundleJsunit() {
describe('appInfoTest', function () { 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.number: bundle_getApplicationInfo_test_0100_001
* @tc.name: getApplicationInfo : Obtains based on a given bundle name. * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
...@@ -49,7 +37,6 @@ export default function applicationBundleJsunit() { ...@@ -49,7 +37,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0 * @tc.level 0
*/ */
it(TAG_TEST_0100_001, 0, async function (done) { it(TAG_TEST_0100_001, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime(); var startTime = await Utils.getNowTime();
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USER_ID_100) let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USER_ID_100)
.catch((error) => { .catch((error) => {
...@@ -71,7 +58,6 @@ export default function applicationBundleJsunit() { ...@@ -71,7 +58,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0 * @tc.level 0
*/ */
it(TAG_TEST_0100_002, 0, async function (done) { it(TAG_TEST_0100_002, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime(); var startTime = await Utils.getNowTime();
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_ALL_APPLICATION_INFO, USER_ID_100) let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_ALL_APPLICATION_INFO, USER_ID_100)
.catch((error) => { .catch((error) => {
...@@ -93,7 +79,6 @@ export default function applicationBundleJsunit() { ...@@ -93,7 +79,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0 * @tc.level 0
*/ */
it(TAG_TEST_0100_003, 0, async function (done) { it(TAG_TEST_0100_003, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime(); var startTime = await Utils.getNowTime();
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE, USER_ID_100) let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE, USER_ID_100)
.catch((error) => { .catch((error) => {
...@@ -116,7 +101,6 @@ export default function applicationBundleJsunit() { ...@@ -116,7 +101,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0 * @tc.level 0
*/ */
it(TAG_TEST_0200_001, 0, async function (done) { it(TAG_TEST_0200_001, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime(); var startTime = await Utils.getNowTime();
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION) let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION)
.catch((error) => { .catch((error) => {
...@@ -138,7 +122,6 @@ export default function applicationBundleJsunit() { ...@@ -138,7 +122,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0 * @tc.level 0
*/ */
it(TAG_TEST_0200_002, 0, async function (done) { it(TAG_TEST_0200_002, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime(); var startTime = await Utils.getNowTime();
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_ALL_APPLICATION_INFO) let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_ALL_APPLICATION_INFO)
.catch((error) => { .catch((error) => {
...@@ -160,7 +143,6 @@ export default function applicationBundleJsunit() { ...@@ -160,7 +143,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0 * @tc.level 0
*/ */
it(TAG_TEST_0200_003, 0, async function (done) { it(TAG_TEST_0200_003, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime(); var startTime = await Utils.getNowTime();
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE) let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE)
.catch((error) => { .catch((error) => {
...@@ -182,7 +164,6 @@ export default function applicationBundleJsunit() { ...@@ -182,7 +164,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0 * @tc.level 0
*/ */
it(TAG_TEST_0300_001, 0, async function (done) { it(TAG_TEST_0300_001, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
let datas; let datas;
var startTime = await Utils.getNowTime(); var startTime = await Utils.getNowTime();
Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USER_ID_100, Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USER_ID_100,
...@@ -193,7 +174,6 @@ export default function applicationBundleJsunit() { ...@@ -193,7 +174,6 @@ export default function applicationBundleJsunit() {
expect(error).assertFail(); expect(error).assertFail();
console.info(TAG_TEST_0300_001 + 'UserId callBack error: ' + error); 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 error: ' + error);
console.info(TAG_TEST_0300_001 + 'UserId callBack data is:' + JSON.stringify(data)); console.info(TAG_TEST_0300_001 + 'UserId callBack data is:' + JSON.stringify(data));
datas = data; datas = data;
...@@ -221,7 +201,6 @@ export default function applicationBundleJsunit() { ...@@ -221,7 +201,6 @@ export default function applicationBundleJsunit() {
expect(error).assertFail(); expect(error).assertFail();
console.info(TAG_TEST_0400_001 + 'UserId callBack error: ' + error); 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 error: ' + error);
console.info(TAG_TEST_0400_001 + 'noUserId callBack data is:' + JSON.stringify(data)); console.info(TAG_TEST_0400_001 + 'noUserId callBack data is:' + JSON.stringify(data));
datas = data; datas = data;
...@@ -240,7 +219,6 @@ export default function applicationBundleJsunit() { ...@@ -240,7 +219,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0 * @tc.level 0
*/ */
it(TAG_TEST_0500_001, 0, async function (done) { it(TAG_TEST_0500_001, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
let errors; let errors;
var startTime = await Utils.getNowTime(); var startTime = await Utils.getNowTime();
await Bundle.getAllApplicationInfo('0') await Bundle.getAllApplicationInfo('0')
...@@ -265,7 +243,6 @@ export default function applicationBundleJsunit() { ...@@ -265,7 +243,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0 * @tc.level 0
*/ */
it(TAG_TEST_0500_002, 0, async function (done) { it(TAG_TEST_0500_002, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
let errors; let errors;
var startTime = await Utils.getNowTime(); var startTime = await Utils.getNowTime();
await Bundle.getAllApplicationInfo('0', USER_ID_100) await Bundle.getAllApplicationInfo('0', USER_ID_100)
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 Utils from './Utils';
import Bundle from '@ohos.bundle'; import Bundle from '@ohos.bundle';
...@@ -32,21 +32,10 @@ const TAG_TEST_0600_003 = ' bundle_getApplicationInfo_test_0600_0013 '; ...@@ -32,21 +32,10 @@ const TAG_TEST_0600_003 = ' bundle_getApplicationInfo_test_0600_0013 ';
const BUNDLE_NAME = 'com.open.harmony.packagemag'; const BUNDLE_NAME = 'com.open.harmony.packagemag';
const BUNDLE_NAME_OTHER = 'com.ohos.acepackage'; const BUNDLE_NAME_OTHER = 'com.ohos.acepackage';
const USER_ID_100 = 100; const USER_ID_100 = 100;
const SLEEP_TIME_1000 = 1000;
const SLEEP_TIME_2000 = 2000;
export default function applicationBundleJsunit() { export default function applicationBundleJsunit() {
describe('appInfoTest', function () { 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.number: bundle_getApplicationInfo_test_0100_001
* @tc.name: getApplicationInfo : Obtains based on a given bundle name. * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
...@@ -54,8 +43,6 @@ export default function applicationBundleJsunit() { ...@@ -54,8 +43,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0 * @tc.level 0
*/ */
it(TAG_TEST_0100_001, 0, async function (done) { 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(); var startTime = await Utils.getNowTime();
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION,
USER_ID_100) USER_ID_100)
...@@ -69,7 +56,6 @@ export default function applicationBundleJsunit() { ...@@ -69,7 +56,6 @@ export default function applicationBundleJsunit() {
expectData(TAG_TEST_0100_001, data); expectData(TAG_TEST_0100_001, data);
getApplicationInfoSuccess(TAG_TEST_0100_001, data); getApplicationInfoSuccess(TAG_TEST_0100_001, data);
done(); done();
console.log('------------------ ' + TAG_TEST_0100_001 + ' end -------------------');
}); });
/** /**
...@@ -79,8 +65,6 @@ export default function applicationBundleJsunit() { ...@@ -79,8 +65,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0 * @tc.level 0
*/ */
it(TAG_TEST_0100_002, 0, async function (done) { 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(); var startTime = await Utils.getNowTime();
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_ALL_APPLICATION_INFO, USER_ID_100) let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_ALL_APPLICATION_INFO, USER_ID_100)
.catch((error) => { .catch((error) => {
...@@ -93,7 +77,6 @@ export default function applicationBundleJsunit() { ...@@ -93,7 +77,6 @@ export default function applicationBundleJsunit() {
expectData(TAG_TEST_0100_002, data); expectData(TAG_TEST_0100_002, data);
getApplicationInfoSuccess_plus(TAG_TEST_0100_002, data); getApplicationInfoSuccess_plus(TAG_TEST_0100_002, data);
done(); done();
console.log('------------------ ' + TAG_TEST_0100_002 + ' end -------------------');
}); });
/** /**
...@@ -103,8 +86,6 @@ export default function applicationBundleJsunit() { ...@@ -103,8 +86,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0 * @tc.level 0
*/ */
it(TAG_TEST_0100_003, 0, async function (done) { 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(); var startTime = await Utils.getNowTime();
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE, let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE,
USER_ID_100) USER_ID_100)
...@@ -116,13 +97,8 @@ export default function applicationBundleJsunit() { ...@@ -116,13 +97,8 @@ export default function applicationBundleJsunit() {
Utils.getDurationTime(TAG_TEST_0100_003, startTime, endTime); Utils.getDurationTime(TAG_TEST_0100_003, startTime, endTime);
console.info(TAG_TEST_0100_003 + ' UserId promise data is: ' + JSON.stringify(data)); console.info(TAG_TEST_0100_003 + ' UserId promise data is: ' + JSON.stringify(data));
expectData(TAG_TEST_0100_003, data); expectData(TAG_TEST_0100_003, data);
if ('' === data.name) { getApplicationInfoSuccess_plus(TAG_TEST_0100_003, data);
getApplicationInfoFail(TAG_TEST_0100_003, data);
} else {
getApplicationInfoSuccess_plus(TAG_TEST_0100_003, data);
}
done(); done();
console.log('------------------ ' + TAG_TEST_0100_003 + ' end -------------------');
}); });
...@@ -133,8 +109,6 @@ export default function applicationBundleJsunit() { ...@@ -133,8 +109,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0 * @tc.level 0
*/ */
it(TAG_TEST_0200_001, 0, async function (done) { 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(); var startTime = await Utils.getNowTime();
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION) let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION)
.catch((error) => { .catch((error) => {
...@@ -145,9 +119,8 @@ export default function applicationBundleJsunit() { ...@@ -145,9 +119,8 @@ export default function applicationBundleJsunit() {
Utils.getDurationTime(TAG_TEST_0200_001, startTime, endTime); Utils.getDurationTime(TAG_TEST_0200_001, startTime, endTime);
console.info(TAG_TEST_0200_001 + ' onUserId promise data is: ' + JSON.stringify(data)); console.info(TAG_TEST_0200_001 + ' onUserId promise data is: ' + JSON.stringify(data));
expectData(TAG_TEST_0200_001, data); expectData(TAG_TEST_0200_001, data);
getApplicationInfoSuccess(TAG_TEST_0200_001, data); getApplicationInfoSuccess(TAG_TEST_0200_001, data);
done(); done();
console.log('------------------ ' + TAG_TEST_0200_001 + ' end -------------------');
}); });
/** /**
...@@ -157,8 +130,6 @@ export default function applicationBundleJsunit() { ...@@ -157,8 +130,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0 * @tc.level 0
*/ */
it(TAG_TEST_0200_002, 0, async function (done) { 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(); var startTime = await Utils.getNowTime();
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_ALL_APPLICATION_INFO) let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_ALL_APPLICATION_INFO)
.catch((error) => { .catch((error) => {
...@@ -169,9 +140,8 @@ export default function applicationBundleJsunit() { ...@@ -169,9 +140,8 @@ export default function applicationBundleJsunit() {
Utils.getDurationTime(TAG_TEST_0200_002, startTime, endTime); Utils.getDurationTime(TAG_TEST_0200_002, startTime, endTime);
console.info(TAG_TEST_0200_002 + ' onUserId promise data is: ' + JSON.stringify(data)); console.info(TAG_TEST_0200_002 + ' onUserId promise data is: ' + JSON.stringify(data));
expectData(TAG_TEST_0200_002, data); expectData(TAG_TEST_0200_002, data);
getApplicationInfoSuccess_plus(TAG_TEST_0200_002, data); getApplicationInfoSuccess_plus(TAG_TEST_0200_002, data);
done(); done();
console.log('------------------ ' + TAG_TEST_0200_002 + ' end -------------------');
}); });
/** /**
...@@ -181,8 +151,6 @@ export default function applicationBundleJsunit() { ...@@ -181,8 +151,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0 * @tc.level 0
*/ */
it(TAG_TEST_0200_003, 0, async function (done) { 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(); var startTime = await Utils.getNowTime();
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE) let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE)
.catch((error) => { .catch((error) => {
...@@ -193,9 +161,8 @@ export default function applicationBundleJsunit() { ...@@ -193,9 +161,8 @@ export default function applicationBundleJsunit() {
Utils.getDurationTime(TAG_TEST_0200_003, startTime, endTime); Utils.getDurationTime(TAG_TEST_0200_003, startTime, endTime);
console.info(TAG_TEST_0200_003 + ' onUserId promise data is: ' + JSON.stringify(data)); console.info(TAG_TEST_0200_003 + ' onUserId promise data is: ' + JSON.stringify(data));
expectData(TAG_TEST_0200_003, data); expectData(TAG_TEST_0200_003, data);
getApplicationInfoSuccess_plus(TAG_TEST_0200_003, data); getApplicationInfoSuccess_plus(TAG_TEST_0200_003, data);
done(); done();
console.log('------------------ ' + TAG_TEST_0200_003 + ' end -------------------');
}); });
/** /**
...@@ -205,8 +172,6 @@ export default function applicationBundleJsunit() { ...@@ -205,8 +172,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0 * @tc.level 0
*/ */
it(TAG_TEST_0300_001, 0, async function (done) { 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 errors;
let datas; let datas;
var startTime = await Utils.getNowTime(); var startTime = await Utils.getNowTime();
...@@ -219,16 +184,14 @@ export default function applicationBundleJsunit() { ...@@ -219,16 +184,14 @@ export default function applicationBundleJsunit() {
expect(errors).assertFail(); expect(errors).assertFail();
console.info(TAG_TEST_0300_001 + 'UserId callBack error: ' + error); 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)); console.info(TAG_TEST_0300_001 + 'UserId callBack data is:' + JSON.stringify(data));
datas = data; datas = data;
}); });
await Utils.sleep(2000); await Utils.sleep(2000);
console.info(TAG_TEST_0300_001 + 'UserId callBack data is: ' + JSON.stringify(datas)); console.info(TAG_TEST_0300_001 + 'UserId callBack data is: ' + JSON.stringify(datas));
expectData(TAG_TEST_0300_001, datas); expectData(TAG_TEST_0300_001, datas);
getApplicationInfoSuccess(TAG_TEST_0300_001, datas); getApplicationInfoSuccess(TAG_TEST_0300_001, datas);
done(); done();
console.log('------------------ ' + TAG_TEST_0300_001 + ' end -------------------');
}); });
/** /**
...@@ -238,7 +201,6 @@ export default function applicationBundleJsunit() { ...@@ -238,7 +201,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0 * @tc.level 0
*/ */
it(TAG_TEST_0400_001, 0, async function (done) { it(TAG_TEST_0400_001, 0, async function (done) {
console.info(TAG_TEST_0400_001 + 'callBack START');
let errors; let errors;
let datas; let datas;
var startTime = await Utils.getNowTime(); var startTime = await Utils.getNowTime();
...@@ -250,16 +212,14 @@ export default function applicationBundleJsunit() { ...@@ -250,16 +212,14 @@ export default function applicationBundleJsunit() {
console.info(TAG_TEST_0400_001 + 'UserId callBack error: ' + error); console.info(TAG_TEST_0400_001 + 'UserId callBack error: ' + error);
} }
Utils.getDurationTime(TAG_TEST_0400_001, startTime, endTime); 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)); console.info(TAG_TEST_0400_001 + 'noUserId callBack data is:' + JSON.stringify(data));
datas = data; datas = data;
}); });
await Utils.sleep(2000); await Utils.sleep(2000);
console.info(TAG_TEST_0400_001 + 'noUserId callBack data is: ' + JSON.stringify(datas)); console.info(TAG_TEST_0400_001 + 'noUserId callBack data is: ' + JSON.stringify(datas));
expectData(TAG_TEST_0400_001, datas); expectData(TAG_TEST_0400_001, datas);
getApplicationInfoSuccess(TAG_TEST_0400_001, datas); getApplicationInfoSuccess(TAG_TEST_0400_001, datas);
done(); done();
console.log('------------------ ' + TAG_TEST_0400_001 + ' end -------------------');
}); });
/** /**
...@@ -269,8 +229,6 @@ export default function applicationBundleJsunit() { ...@@ -269,8 +229,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0 * @tc.level 0
*/ */
it(TAG_TEST_0500_001, 0, async function (done) { 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(); var startTime = await Utils.getNowTime();
await Bundle.getApplicationInfo('', 0) await Bundle.getApplicationInfo('', 0)
.then((data) => { .then((data) => {
...@@ -284,7 +242,6 @@ export default function applicationBundleJsunit() { ...@@ -284,7 +242,6 @@ export default function applicationBundleJsunit() {
var endTime = Utils.getNowTime(); var endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0500_001, startTime, endTime); Utils.getDurationTime(TAG_TEST_0500_001, startTime, endTime);
done(); done();
console.log('------------------ ' + TAG_TEST_0500_001 + ' end -------------------');
}); });
/** /**
...@@ -294,8 +251,6 @@ export default function applicationBundleJsunit() { ...@@ -294,8 +251,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0 * @tc.level 0
*/ */
it(TAG_TEST_0500_002, 0, async function (done) { 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(); var startTime = await Utils.getNowTime();
await Bundle.getApplicationInfo('', '0', USER_ID_100) await Bundle.getApplicationInfo('', '0', USER_ID_100)
.then((data) => { .then((data) => {
...@@ -309,7 +264,6 @@ export default function applicationBundleJsunit() { ...@@ -309,7 +264,6 @@ export default function applicationBundleJsunit() {
var endTime = Utils.getNowTime(); var endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0500_002, startTime, endTime); Utils.getDurationTime(TAG_TEST_0500_002, startTime, endTime);
done(); done();
console.log('------------------ ' + TAG_TEST_0500_002 + ' end -------------------');
}); });
/** /**
...@@ -319,8 +273,6 @@ export default function applicationBundleJsunit() { ...@@ -319,8 +273,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0 * @tc.level 0
*/ */
it(TAG_TEST_0600_001, 0, async function (done) { 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 let errors
var startTime = await Utils.getNowTime(); var startTime = await Utils.getNowTime();
await Bundle.getApplicationInfo(BUNDLE_NAME_OTHER, await Bundle.getApplicationInfo(BUNDLE_NAME_OTHER,
...@@ -337,7 +289,6 @@ export default function applicationBundleJsunit() { ...@@ -337,7 +289,6 @@ export default function applicationBundleJsunit() {
var endTime = Utils.getNowTime(); var endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0600_001, startTime, endTime); Utils.getDurationTime(TAG_TEST_0600_001, startTime, endTime);
done(); done();
console.log('------------------ ' + TAG_TEST_0600_001 + ' end -------------------');
}); });
/** /**
...@@ -347,8 +298,6 @@ export default function applicationBundleJsunit() { ...@@ -347,8 +298,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0 * @tc.level 0
*/ */
it(TAG_TEST_0600_002, 0, async function (done) { 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(); var startTime = await Utils.getNowTime();
let errors let errors
await Bundle.getApplicationInfo(BUNDLE_NAME_OTHER, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, await Bundle.getApplicationInfo(BUNDLE_NAME_OTHER, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION,
...@@ -365,7 +314,6 @@ export default function applicationBundleJsunit() { ...@@ -365,7 +314,6 @@ export default function applicationBundleJsunit() {
var endTime = Utils.getNowTime(); var endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0600_002, startTime, endTime); Utils.getDurationTime(TAG_TEST_0600_002, startTime, endTime);
done(); done();
console.log('------------------ ' + TAG_TEST_0600_002 + ' end -------------------');
}); });
/** /**
...@@ -375,8 +323,6 @@ export default function applicationBundleJsunit() { ...@@ -375,8 +323,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0 * @tc.level 0
*/ */
it(TAG_TEST_0600_003, 0, async function (done) { 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(); var startTime = await Utils.getNowTime();
await Bundle.getApplicationInfo(BUNDLE_NAME, 0) await Bundle.getApplicationInfo(BUNDLE_NAME, 0)
.then((data) => { .then((data) => {
...@@ -392,7 +338,6 @@ export default function applicationBundleJsunit() { ...@@ -392,7 +338,6 @@ export default function applicationBundleJsunit() {
expect(error).assertFail(); expect(error).assertFail();
}); });
done(); done();
console.log('------------------ ' + TAG_TEST_0600_003 + ' end -------------------');
}); });
...@@ -496,28 +441,5 @@ export default function applicationBundleJsunit() { ...@@ -496,28 +441,5 @@ export default function applicationBundleJsunit() {
'com.open.harmony.packagemag/com.open.harmony.packagemag'); 'com.open.harmony.packagemag/com.open.harmony.packagemag');
console.log(msg + ' end ' + JSON.stringify(data)); 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.
先完成此消息的编辑!
想要评论请 注册