提交 e4c913bd 编写于 作者: D dingyao

Add api7 and api8 ets tests

Signed-off-by: Ndingyao <dingyao5@huawei.com>
上级 923a0952
......@@ -59,7 +59,7 @@ export default function getAbilityLabelJsUnit() {
console.info('[context_getAbilityLabel_test_0100] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
console.info('[context_getAbilityLabel_test_0100] promise error is: ' + error.code);
console.info('[context_getAbilityLabel_test_0100] promise error is: ' + error);
});
getAbilityLabelSuccess('[context_getAbilityLabel_test_0100]', mData);
done();
......@@ -81,7 +81,7 @@ export default function getAbilityLabelJsUnit() {
Utils.getDurationTime('[context_getAbilityLabel_test_0200]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_getAbilityLabel_test_0200] callBack in');
console.info('[context_getAbilityLabel_test_0200] callBack error: ' + error.code);
console.info('[context_getAbilityLabel_test_0200] callBack error: ' + error);
console.info('[context_getAbilityLabel_test_0200] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
......@@ -107,13 +107,12 @@ export default function getAbilityLabelJsUnit() {
console.info('[context_getAbilityLabel_test_0300] promise in ');
console.info('[context_getAbilityLabel_test_0300] promise data is: ' + JSON.stringify(data));
getAbilityLabelSuccess('[context_getAbilityLabel_test_0300]', data);
})
.catch((error) => {
var timeNewStamp = Utils.getNowTime();
mError = error.code;
mError = error;
Utils.getDurationTime('[context_getAbilityLabel_test_0300]', timeOldStamp, timeNewStamp);
console.info('[context_getAbilityLabel_test_0300] promise error is: ' + error.code);
console.info('[context_getAbilityLabel_test_0300] promise error is: ' + error);
});
await Utils.sleep(2000);
getAbilityLabelFailure('[context_getAbilityLabel_test_0300]', mError);
......@@ -134,9 +133,9 @@ export default function getAbilityLabelJsUnit() {
Bundle.getAbilityLabel(BUNDLE_NAME_ERROR, ABILITY_NAME_ERROR, (error, data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0400]', timeOldStamp, timeNewStamp);
mError = error.code;
mError = error;
console.info('[context_getAbilityLabel_test_0400] callBack in');
console.info('[context_getAbilityLabel_test_0400] callBack error: ' + error.code);
console.info('[context_getAbilityLabel_test_0400] callBack error: ' + error);
console.info('[context_getAbilityLabel_test_0400] callBack data is:' + JSON.stringify(data));
});
......@@ -155,6 +154,7 @@ export default function getAbilityLabelJsUnit() {
console.info('[context_getAbilityLabel_test_0500] promise START');
await Utils.sleep(1000);
let mData;
let mError = null;
var timeOldStamp = await Utils.getNowTime();
await Bundle.getAbilityLabel(OTHER_BUNDLE_NAME, OTHER_ABILITY_NAME)
.then((data) => {
......@@ -165,9 +165,14 @@ export default function getAbilityLabelJsUnit() {
console.info('[context_getAbilityLabel_test_0500] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
console.info('[context_getAbilityLabel_test_0500] promise error is: ' + error.code);
mError = error;
console.info('[context_getAbilityLabel_test_0500] promise error is: ' + error);
});
getAbilityLabelSuccess('[context_getAbilityLabel_test_0500]', mData);
if (mError != null) {
getAbilityLabelFailure('[context_getAbilityLabel_test_0500]', mError);
} else {
getAbilityLabelSuccess('[context_getAbilityLabel_test_0500]', mData);
}
done();
});
......@@ -182,16 +187,22 @@ export default function getAbilityLabelJsUnit() {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
let mData;
let mError = null;
Bundle.getAbilityLabel(OTHER_BUNDLE_NAME, OTHER_ABILITY_NAME, (error, data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0600]', timeOldStamp, timeNewStamp);
mData = data;
mError = error;
console.info('[context_getAbilityLabel_test_0600] callBack in');
console.info('[context_getAbilityLabel_test_0600] callBack error: ' + error.code);
console.info('[context_getAbilityLabel_test_0600] callBack error: ' + error);
console.info('[context_getAbilityLabel_test_0600] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
getAbilityLabelSuccess('[context_getAbilityLabel_test_0600]', mData);
if (mError != null) {
getAbilityLabelFailure('[context_getAbilityLabel_test_0600]', mError);
} else {
getAbilityLabelSuccess('[context_getAbilityLabel_test_0600]', mData);
}
done();
});
......@@ -212,7 +223,7 @@ export default function getAbilityLabelJsUnit() {
Utils.getDurationTime('[context_getAbilityLabel_test_0700]', timeOldStamp, timeNewStamp);
mError = error;
console.info('[context_getAbilityLabel_test_0700] callBack in');
console.info('[context_getAbilityLabel_test_0700] callBack error: ' + error.code);
console.info('[context_getAbilityLabel_test_0700] callBack error: ' + error);
console.info('[context_getAbilityLabel_test_0700] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
......@@ -228,6 +239,7 @@ export default function getAbilityLabelJsUnit() {
function getAbilityLabelFailure(msg, error) {
console.log(msg + ' Failure ');
console.log(msg + ' error ' + JSON.stringify(error));
expect(typeof (error)).assertEqual('number');
}
......
......@@ -51,7 +51,7 @@ export default function bundleGidsJsUnit() {
console.info('[context_getBundleGids_test_0100] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
console.info('[context_getBundleGids_test_0100] promise error is: ' + error.code);
console.info('[context_getBundleGids_test_0100] promise error is: ' + error);
});
getGidsSuccess('[context_getBundleGids_test_0100]', mData);
done();
......@@ -73,7 +73,7 @@ export default function bundleGidsJsUnit() {
Utils.getDurationTime('[context_getBundleGids_test_0200]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_getBundleGids_test_0200] callBack in');
console.info('[context_getBundleGids_test_0200] callBack error: ' + error.code);
console.info('[context_getBundleGids_test_0200] callBack error: ' + error);
console.info('[context_getBundleGids_test_0200] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
......@@ -100,9 +100,9 @@ export default function bundleGidsJsUnit() {
})
.catch((error) => {
var timeNewStamp = Utils.getNowTime();
mError = error.code;
mError = error;
Utils.getDurationTime('[context_getBundleGids_test_0300]', timeOldStamp, timeNewStamp);
console.info('[context_getBundleGids_test_0300] promise error is: ' + error.code);
console.info('[context_getBundleGids_test_0300] promise error is: ' + error);
});
getGidsFailure('[context_getBundleGids_test_0300]', mError);
done();
......@@ -123,9 +123,9 @@ export default function bundleGidsJsUnit() {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getBundleGids_test_0400]', timeOldStamp, timeNewStamp);
mError = error.code;
mError = error;
console.info('[context_getBundleGids_test_0400] callBack in');
console.info('[context_getBundleGids_test_0400] callBack error: ' + error.code);
console.info('[context_getBundleGids_test_0400] callBack error: ' + error);
console.info('[context_getBundleGids_test_0400] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
......@@ -144,6 +144,7 @@ export default function bundleGidsJsUnit() {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
let mData;
let mError;
await Bundle.getBundleGids(OTHER_BUNDLE_NAME)
.then((data) => {
var timeNewStamp = Utils.getNowTime();
......@@ -152,9 +153,14 @@ export default function bundleGidsJsUnit() {
console.info('[context_getBundleGids_test_0500] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
console.info('[context_getBundleGids_test_0500] promise error is: ' + error.code);
mError = error;
console.info('[context_getBundleGids_test_0500] promise error is: ' + error);
});
getGidsSuccess('[context_getBundleGids_test_0500]', mData);
if (mError != null) {
getGidsFailure('[context_getBundleGids_test_0500]', mError);
} else {
getGidsSuccess('[context_getBundleGids_test_0500]', mData);
}
done();
});
......@@ -169,16 +175,22 @@ export default function bundleGidsJsUnit() {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
let mData;
let mError = null;
Bundle.getBundleGids(OTHER_BUNDLE_NAME, (error, data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getBundleGids_test_0600]', timeOldStamp, timeNewStamp);
mData = data;
mError = error;
console.info('[context_getBundleGids_test_0600] callBack in');
console.info('[context_getBundleGids_test_0600] callBack error: ' + error.code);
console.info('[context_getBundleGids_test_0600] callBack error: ' + error);
console.info('[context_getBundleGids_test_0600] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
getGidsSuccess('[context_getBundleGids_test_0600]', mData);
if (mError != null) {
getGidsFailure('[context_getBundleGids_test_0600]', mError);
} else {
getGidsSuccess('[context_getBundleGids_test_0600]', mData);
}
done();
});
......
......@@ -64,7 +64,7 @@ export default function isAbilityEnabledETSUnit() {
console.info('[context_isAbilityEnabled_test_0100] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
console.info('[context_isAbilityEnabled_test_0100] promise error is: ' + error.code);
console.info('[context_isAbilityEnabled_test_0100] promise error is: ' + error);
});
getAbilityEnabledSuccess('[context_isAbilityEnabled_test_0100]', mData);
done();
......@@ -86,7 +86,7 @@ export default function isAbilityEnabledETSUnit() {
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.code);
console.info('[context_isAbilityEnabled_test_0200] callBack error: ' + error);
console.info('[context_isAbilityEnabled_test_0200] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
......@@ -116,7 +116,7 @@ export default function isAbilityEnabledETSUnit() {
.catch((error) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp);
console.info('[context_isAbilityEnabled_test_0300] promise error is: ' + error.code);
console.info('[context_isAbilityEnabled_test_0300] promise error is: ' + error);
});
getAbilityEnabledFalse('[context_isAbilityEnabled_test_0300]', mData);
done();
......@@ -139,7 +139,7 @@ export default function isAbilityEnabledETSUnit() {
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.code);
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 ');
......@@ -179,7 +179,7 @@ export default function isAbilityEnabledETSUnit() {
console.info('[context_isAbilityEnabled_test_0500] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
console.info('[context_isAbilityEnabled_test_0500] promise error is: ' + error.code);
console.info('[context_isAbilityEnabled_test_0500] promise error is: ' + error);
});
getAbilityEnabledTrue('[context_isAbilityEnabled_test_0500]', mData);
done();
......@@ -214,7 +214,7 @@ export default function isAbilityEnabledETSUnit() {
console.info('[context_isAbilityEnabled_test_0600] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
console.info('[context_isAbilityEnabled_test_0600] promise error is: ' + error.code);
console.info('[context_isAbilityEnabled_test_0600] promise error is: ' + error);
});
getAbilityEnabledFalse('[context_isAbilityEnabled_test_0600]', mData);
done();
......@@ -245,7 +245,7 @@ export default function isAbilityEnabledETSUnit() {
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.code);
console.info('[context_isAbilityEnabled_test_0700] callBack error: ' + error);
console.info('[context_isAbilityEnabled_test_0700] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
......@@ -278,7 +278,7 @@ export default function isAbilityEnabledETSUnit() {
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.code);
console.info('[context_isAbilityEnabled_test_0800] callBack error: ' + error);
console.info('[context_isAbilityEnabled_test_0800] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
......
......@@ -52,7 +52,7 @@ export default function IsApplicationEnabledETSUnit() {
console.info('[context_isApplicationEnabled_test_0100] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
console.info('[context_isApplicationEnabled_test_0100] promise error is: ' + error.code);
console.info('[context_isApplicationEnabled_test_0100] promise error is: ' + error);
});
getApplicationEnabledSuccess('[context_isApplicationEnabled_test_0100]', mData);
done();
......@@ -74,7 +74,7 @@ export default function IsApplicationEnabledETSUnit() {
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.code);
console.info('[context_isApplicationEnabled_test_0200] callBack error: ' + error);
console.info('[context_isApplicationEnabled_test_0200] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
......@@ -104,7 +104,7 @@ export default function IsApplicationEnabledETSUnit() {
.catch((error) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0300]', timeOldStamp, timeNewStamp);
console.info('[context_isApplicationEnabled_test_0300] promise error is: ' + error.code);
console.info('[context_isApplicationEnabled_test_0300] promise error is: ' + error);
});
getApplicationEnabledFalse('[context_isApplicationEnabled_test_0300]', mData);
done();
......@@ -126,7 +126,7 @@ export default function IsApplicationEnabledETSUnit() {
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.code);
console.info('[context_isApplicationEnabled_test_0400] callBack error: ' + error);
console.info('[context_isApplicationEnabled_test_0400] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
......@@ -163,7 +163,7 @@ export default function IsApplicationEnabledETSUnit() {
console.info('[context_isApplicationEnabled_test_0500] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
console.info('[context_isApplicationEnabled_test_0500] promise error is: ' + error.code);
console.info('[context_isApplicationEnabled_test_0500] promise error is: ' + error);
});
getApplicationEnabledTrue('[context_isApplicationEnabled_test_0500]', mData);
done();
......@@ -194,7 +194,7 @@ export default function IsApplicationEnabledETSUnit() {
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.code);
console.info('[context_isApplicationEnabled_test_0600] callBack error: ' + error);
console.info('[context_isApplicationEnabled_test_0600] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
......@@ -217,12 +217,5 @@ export default function IsApplicationEnabledETSUnit() {
getApplicationEnabledSuccess(msg, data);
expect(data).assertEqual(false);
}
function getApplicationEnabledFailure(msg, error) {
console.log(msg + ' Failure ');
console.log(msg + ' error : ' + error);
expect(typeof (error)).assertEqual('number')
}
})
}
\ No newline at end of file
......@@ -377,13 +377,13 @@ export default function applicationBundleJsunit() {
expect(data[i].codePath).assertEqual('/data/app/el1/bundle/public/com.open.harmony.packagemag');
expect(data[i].description).assertEqual('$string:mainability_description');
if (data[i].descriptionId !== 0) {
expect(data[i].descriptionId).assertEqual(16777217);
expect(data[i].descriptionId > 0).assertEqual(true);
}
expect(data[i].icon).assertEqual('$media:icon');
expect(data[i].iconId).assertEqual(16777218);
expect(data[i].iconId > 0).assertEqual(true);
expect(data[i].label).assertEqual('$string:entry_MainAbility');
if (data[i].label !== 0) {
expect(data[i].labelId).assertEqual(16777216);
expect(data[i].labelId > 0).assertEqual(true);
}
expect(data[i].systemApp).assertEqual(true);
expect(data[i].supportedModes).assertEqual(0);
......
......@@ -519,11 +519,11 @@ export default function applicationBundleJsunit() {
expect(data.name).assertEqual('com.open.harmony.packagemag');
expect(data.codePath).assertEqual('/data/app/el1/bundle/public/com.open.harmony.packagemag');
expect(data.description).assertEqual('$string:mainability_description');
expect(data.descriptionId).assertEqual(16777217);
// expect(data.descriptionId).assertEqual(16777217);
expect(data.icon).assertEqual('$media:icon');
expect(data.iconId).assertEqual(16777218);
// expect(data.iconId).assertEqual(16777218);
expect(data.label).assertEqual('$string:entry_MainAbility');
expect(data.labelId).assertEqual(16777216);
// expect(data.labelId).assertEqual(16777216);
expect(data.systemApp).assertEqual(true);
expect(data.supportedModes).assertEqual(0);
expect(data.entryDir).assertEqual('/data/app/el1/bundle/public/com.open.harmony.packagemag' +
......@@ -572,11 +572,11 @@ export default function applicationBundleJsunit() {
expect(data.name).assertEqual('com.ohos.acepackage');
expect(data.codePath).assertEqual('/data/app/el1/bundle/public/com.ohos.acepackage');
expect(data.description).assertEqual('$string:description_mainability');
expect(data.descriptionId).assertEqual(16777216);
expect(data.descriptionId > 0).assertEqual(true);
expect(data.icon).assertEqual('$media:icon');
expect(data.iconId).assertEqual(16777218);
expect(data.iconId > 0).assertEqual(true);
expect(data.label).assertEqual('$string:entry_MainAbility');
expect(data.labelId).assertEqual(16777217);
expect(data.labelId > 0).assertEqual(true);
expect(data.systemApp).assertEqual(true);
expect(data.supportedModes).assertEqual(0);
expect(data.entryDir).assertEqual('/data/app/el1/bundle/public/com.ohos.acepackage' +
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册