提交 f972d4d5 编写于 作者: Z zhaoyuan17

Update xts code

Signed-off-by: Nzhaoyuan17 <zhaoyuan17@huawei.com>
上级 7a5ebac0
...@@ -27,6 +27,8 @@ group("actsabilitymanagertest") { ...@@ -27,6 +27,8 @@ group("actsabilitymanagertest") {
"actsamstestfourthscene:ActsAmsTestFourthSceneTest", "actsamstestfourthscene:ActsAmsTestFourthSceneTest",
"actsamstestsecondscene:ActsAmsTestSecondSceneTest", "actsamstestsecondscene:ActsAmsTestSecondSceneTest",
"actsamstestthirdscene:ActsAmsTestThirdSceneTest", "actsamstestthirdscene:ActsAmsTestThirdSceneTest",
"sceneProject/clearmissionscallback:ClearMissionsCallBack",
"sceneProject/clearmissionspromise:ClearMissionsPromise",
"sceneProject/simulateEAbility:simulateEAbility", "sceneProject/simulateEAbility:simulateEAbility",
"sceneProject/simulateFAbilityFir:simulateFAbilityFir", "sceneProject/simulateFAbilityFir:simulateFAbilityFir",
"sceneProject/simulateFAbilitySed:simulateFAbilitySed", "sceneProject/simulateFAbilitySed:simulateFAbilitySed",
......
...@@ -17,7 +17,7 @@ import {Core, ExpectExtend} from 'deccjsunit/index' ...@@ -17,7 +17,7 @@ import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
var once = true
export default { export default {
data: { data: {
title: "" title: ""
...@@ -26,6 +26,8 @@ export default { ...@@ -26,6 +26,8 @@ export default {
this.title = this.$t('strings.world'); this.title = this.$t('strings.world');
}, },
onShow() { onShow() {
if (once) {
once = false
console.info('onShow finish') console.info('onShow finish')
const core = Core.getInstance() const core = Core.getInstance()
...@@ -40,6 +42,7 @@ export default { ...@@ -40,6 +42,7 @@ export default {
require('../../../test/List.test') require('../../../test/List.test')
core.execute() core.execute()
}
}, },
onReady() { onReady() {
console.info('onReady'); console.info('onReady');
......
...@@ -18,6 +18,7 @@ import {Core, ExpectExtend} from 'deccjsunit/index' ...@@ -18,6 +18,7 @@ import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
var once = true
export default { export default {
data: { data: {
title: "" title: ""
...@@ -26,6 +27,8 @@ export default { ...@@ -26,6 +27,8 @@ export default {
this.title = this.$t('strings.world'); this.title = this.$t('strings.world');
}, },
onShow() { onShow() {
if (once) {
once = false
console.info('onShow finish') console.info('onShow finish')
const core = Core.getInstance() const core = Core.getInstance()
...@@ -40,6 +43,7 @@ export default { ...@@ -40,6 +43,7 @@ export default {
require('../../../test/List.test') require('../../../test/List.test')
core.execute() core.execute()
}
}, },
onReady() { onReady() {
console.info('onReady'); console.info('onReady');
......
...@@ -17,7 +17,7 @@ import {Core, ExpectExtend} from 'deccjsunit/index' ...@@ -17,7 +17,7 @@ import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
var once = true
export default { export default {
data: { data: {
title: "" title: ""
...@@ -26,6 +26,8 @@ export default { ...@@ -26,6 +26,8 @@ export default {
this.title = this.$t('strings.world'); this.title = this.$t('strings.world');
}, },
onShow() { onShow() {
if (once) {
once = false
console.info('onShow finish') console.info('onShow finish')
const core = Core.getInstance() const core = Core.getInstance()
...@@ -40,6 +42,7 @@ export default { ...@@ -40,6 +42,7 @@ export default {
require('../../../test/List.test') require('../../../test/List.test')
core.execute() core.execute()
}
}, },
onReady() { onReady() {
console.info('onReady'); console.info('onReady');
......
...@@ -17,7 +17,7 @@ import {Core, ExpectExtend} from 'deccjsunit/index' ...@@ -17,7 +17,7 @@ import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
var once = true
export default { export default {
data: { data: {
title: "" title: ""
...@@ -26,6 +26,8 @@ export default { ...@@ -26,6 +26,8 @@ export default {
this.title = this.$t('strings.world'); this.title = this.$t('strings.world');
}, },
onShow() { onShow() {
if (once) {
once = false
console.info('onShow finish') console.info('onShow finish')
const core = Core.getInstance() const core = Core.getInstance()
...@@ -40,6 +42,7 @@ export default { ...@@ -40,6 +42,7 @@ export default {
require('../../../test/List.test') require('../../../test/List.test')
core.execute() core.execute()
}
}, },
onReady() { onReady() {
console.info('onReady'); console.info('onReady');
......
...@@ -17,7 +17,7 @@ import {Core, ExpectExtend} from 'deccjsunit/index' ...@@ -17,7 +17,7 @@ import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
var once = true
export default { export default {
data: { data: {
title: "" title: ""
...@@ -26,6 +26,8 @@ export default { ...@@ -26,6 +26,8 @@ export default {
this.title = this.$t('strings.world'); this.title = this.$t('strings.world');
}, },
onShow() { onShow() {
if (once) {
once = false
console.info('onShow finish') console.info('onShow finish')
const core = Core.getInstance() const core = Core.getInstance()
...@@ -40,6 +42,7 @@ export default { ...@@ -40,6 +42,7 @@ export default {
require('../../../test/List.test') require('../../../test/List.test')
core.execute() core.execute()
}
}, },
onReady() { onReady() {
console.info('onReady'); console.info('onReady');
......
...@@ -17,7 +17,7 @@ import {Core, ExpectExtend} from 'deccjsunit/index' ...@@ -17,7 +17,7 @@ import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
var once = true
export default { export default {
data: { data: {
title: "" title: ""
...@@ -26,6 +26,8 @@ export default { ...@@ -26,6 +26,8 @@ export default {
this.title = this.$t('strings.world'); this.title = this.$t('strings.world');
}, },
onShow() { onShow() {
if (once) {
once = false
console.info('onShow finish') console.info('onShow finish')
const core = Core.getInstance() const core = Core.getInstance()
...@@ -40,6 +42,7 @@ export default { ...@@ -40,6 +42,7 @@ export default {
require('../../../test/List.test') require('../../../test/List.test')
core.execute() core.execute()
}
}, },
onReady() { onReady() {
console.info('onReady'); console.info('onReady');
......
...@@ -17,7 +17,7 @@ import {Core, ExpectExtend} from 'deccjsunit/index' ...@@ -17,7 +17,7 @@ import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
var once = true
export default { export default {
data: { data: {
title: "" title: ""
...@@ -26,6 +26,8 @@ export default { ...@@ -26,6 +26,8 @@ export default {
this.title = this.$t('strings.world'); this.title = this.$t('strings.world');
}, },
onShow() { onShow() {
if (once) {
once = false
console.info('onShow finish') console.info('onShow finish')
const core = Core.getInstance() const core = Core.getInstance()
...@@ -40,6 +42,7 @@ export default { ...@@ -40,6 +42,7 @@ export default {
require('../../../test/List.test') require('../../../test/List.test')
core.execute() core.execute()
}
}, },
onReady() { onReady() {
console.info('onReady'); console.info('onReady');
......
...@@ -17,7 +17,7 @@ import {Core, ExpectExtend} from 'deccjsunit/index' ...@@ -17,7 +17,7 @@ import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
var once = true
export default { export default {
data: { data: {
title: "" title: ""
...@@ -26,6 +26,8 @@ export default { ...@@ -26,6 +26,8 @@ export default {
this.title = this.$t('strings.world'); this.title = this.$t('strings.world');
}, },
onShow() { onShow() {
if (once) {
once = false
console.info('onShow finish') console.info('onShow finish')
const core = Core.getInstance() const core = Core.getInstance()
...@@ -40,6 +42,7 @@ export default { ...@@ -40,6 +42,7 @@ export default {
require('../../../test/List.test') require('../../../test/List.test')
core.execute() core.execute()
}
}, },
onReady() { onReady() {
console.info('onReady'); console.info('onReady');
......
...@@ -17,7 +17,7 @@ import {Core, ExpectExtend} from 'deccjsunit/index' ...@@ -17,7 +17,7 @@ import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
var once = true
export default { export default {
data: { data: {
title: "" title: ""
...@@ -26,6 +26,8 @@ export default { ...@@ -26,6 +26,8 @@ export default {
this.title = this.$t('strings.world'); this.title = this.$t('strings.world');
}, },
onShow() { onShow() {
if (once) {
once = false
console.info('onShow finish') console.info('onShow finish')
const core = Core.getInstance() const core = Core.getInstance()
...@@ -40,6 +42,7 @@ export default { ...@@ -40,6 +42,7 @@ export default {
require('../../../test/List.test') require('../../../test/List.test')
core.execute() core.execute()
}
}, },
onReady() { onReady() {
console.info('onReady'); console.info('onReady');
......
...@@ -17,7 +17,7 @@ import {Core, ExpectExtend} from 'deccjsunit/index' ...@@ -17,7 +17,7 @@ import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
var once = true
export default { export default {
data: { data: {
title: "" title: ""
...@@ -26,6 +26,8 @@ export default { ...@@ -26,6 +26,8 @@ export default {
this.title = this.$t('strings.world'); this.title = this.$t('strings.world');
}, },
onShow() { onShow() {
if (once) {
once = false
console.info('onShow finish') console.info('onShow finish')
const core = Core.getInstance() const core = Core.getInstance()
...@@ -40,6 +42,7 @@ export default { ...@@ -40,6 +42,7 @@ export default {
require('../../../test/List.test') require('../../../test/List.test')
core.execute() core.execute()
}
}, },
onReady() { onReady() {
console.info('onReady'); console.info('onReady');
......
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "120000",
"package": "com.ohos.launcher",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ClearMissionsCallBack.hap",
"verifyIAbility.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "120000",
"package": "com.ohos.launcher",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ClearMissionsPromise.hap",
"verifyIAbility.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
...@@ -12,19 +12,23 @@ ...@@ -12,19 +12,23 @@
# limitations under the License. # limitations under the License.
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ClearMissionsCallBack") { ohos_hap("ClearMissionsCallBack") {
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
hap_name = "ClearMissionsCallBack"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [ deps = [
":hjs_demo_js_assets", ":hjs_demo_js_assets",
":hjs_demo_resources", ":hjs_demo_resources",
] ]
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/systemui.p7b"
hap_name = "ClearMissionsCallBack"
} }
ohos_js_assets("hjs_demo_js_assets") { ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default" source_dir = "./src/main/js/default"
} }
ohos_resources("hjs_demo_resources") { ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ] sources = [ "./src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
} }
{
"description": "Configuration for hjunit demo Tests",
}
...@@ -37,6 +37,7 @@ describe('ActsAmsCallBackSixth Scene', function () { ...@@ -37,6 +37,7 @@ describe('ActsAmsCallBackSixth Scene', function () {
}, },
}, },
); );
sleep(5000)
}); });
/* /*
* @tc.number : Acts_Ams_test_12200 * @tc.number : Acts_Ams_test_12200
...@@ -44,7 +45,6 @@ describe('ActsAmsCallBackSixth Scene', function () { ...@@ -44,7 +45,6 @@ describe('ActsAmsCallBackSixth Scene', function () {
* @tc.desc : Clear Missions(by CallBack) * @tc.desc : Clear Missions(by CallBack)
*/ */
it('Acts_Ams_test_12200', 0, async function (done) { it('Acts_Ams_test_12200', 0, async function (done) {
setTimeout(function (){
abilitymanager.clearMissions( abilitymanager.clearMissions(
(error,info) => { (error,info) => {
console.info('Acts_Ams_test_12200 clearMissions error.code ' + error.code + ',data [' + info + ']' ); console.info('Acts_Ams_test_12200 clearMissions error.code ' + error.code + ',data [' + info + ']' );
...@@ -52,6 +52,5 @@ describe('ActsAmsCallBackSixth Scene', function () { ...@@ -52,6 +52,5 @@ describe('ActsAmsCallBackSixth Scene', function () {
expect(info).assertEqual(0); expect(info).assertEqual(0);
}); });
done(); done();
},5000)
}) })
}) })
...@@ -12,19 +12,23 @@ ...@@ -12,19 +12,23 @@
# limitations under the License. # limitations under the License.
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ClearMissionsPromise") { ohos_hap("ClearMissionsPromise") {
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
hap_name = "ClearMissionsPromise"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [ deps = [
":hjs_demo_js_assets", ":hjs_demo_js_assets",
":hjs_demo_resources", ":hjs_demo_resources",
] ]
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/systemui.p7b"
hap_name = "ClearMissionsPromise"
} }
ohos_js_assets("hjs_demo_js_assets") { ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default" source_dir = "./src/main/js/default"
} }
ohos_resources("hjs_demo_resources") { ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ] sources = [ "./src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
} }
{
"description": "Configuration for hjunit demo Tests",
}
...@@ -37,19 +37,26 @@ describe('ActsAmsCallBackSixth Scene', function () { ...@@ -37,19 +37,26 @@ describe('ActsAmsCallBackSixth Scene', function () {
}, },
}, },
); );
sleep(5000)
}); });
function sleep(delay) {
var start = (new Date()).getTime();
while((new Date()).getTime() - start < delay) {
continue;
}
}
/* /*
* @tc.number : Acts_Ams_test_12100 * @tc.number : Acts_Ams_test_12100
* @tc.name : clearMissions : Clear Missions * @tc.name : clearMissions : Clear Missions
* @tc.desc : Clear Missions(by Promise) * @tc.desc : Clear Missions(by Promise)
*/ */
it('Acts_Ams_test_12100', 0, async function (done) { it('Acts_Ams_test_12100', 0, async function (done) {
setTimeout(async function(){
var info = await abilitymanager.clearMissions(); var info = await abilitymanager.clearMissions();
console.info('Acts_Ams_test_12100 clearMissions data [' + info + ']'); console.info('Acts_Ams_test_12100 clearMissions data [' + info + ']');
expect(typeof(info)).assertEqual("number"); expect(typeof(info)).assertEqual("number");
expect(info).assertEqual(0); expect(info).assertEqual(0);
done(); done();
},5000);
}) })
}) })
...@@ -1432,8 +1432,8 @@ it('FWK_zipFile_3400', 0, async function (done) { ...@@ -1432,8 +1432,8 @@ it('FWK_zipFile_3400', 0, async function (done) {
*/ */
it('FWK_zipFile_3500', 0, async function (done) { it('FWK_zipFile_3500', 0, async function (done) {
console.log("==================FWK_zipFile_3500 start=================="); console.log("==================FWK_zipFile_3500 start==================");
var src = "/data/test/fefsef.txt"; var src = "/data/teste/fefsef.txt";
var dest = "/data/testA/ceshi.txt"; var dest = "/data/testA/sfefsfe.zip";
var options = {} var options = {}
...@@ -1458,6 +1458,7 @@ it('FWK_zipFile_3600', 0, async function (done) { ...@@ -1458,6 +1458,7 @@ it('FWK_zipFile_3600', 0, async function (done) {
console.log("==================FWK_zipFile_3600 start=================="); console.log("==================FWK_zipFile_3600 start==================");
var src = "/data/test/ceshi.txt"; var src = "/data/test/ceshi.txt";
var dest = ""; var dest = "";
var options = {}
zlib.zipFile(src, dest, options).then((data) => { zlib.zipFile(src, dest, options).then((data) => {
console.log("zipFilePromise_3600 data: " + data); console.log("zipFilePromise_3600 data: " + data);
......
...@@ -22,7 +22,6 @@ const STRESSLEVEL = 20; ...@@ -22,7 +22,6 @@ const STRESSLEVEL = 20;
const BUNDLE_NAME = 'com.example.actsbmskittest'; const BUNDLE_NAME = 'com.example.actsbmskittest';
const PERMISSION_NAME = 'com.permission.PERMISSION_A'; const PERMISSION_NAME = 'com.permission.PERMISSION_A';
const START_ABILITY_TIMEOUT = 3000; const START_ABILITY_TIMEOUT = 3000;
const EVENTTIMEOUT = 5000;
var subscriberInfo_0100 = { var subscriberInfo_0100 = {
events: ['ACTS_Third1_Publish_CommonEvent'], events: ['ACTS_Third1_Publish_CommonEvent'],
}; };
...@@ -167,9 +166,6 @@ describe('ActsBmsKitTest', function () { ...@@ -167,9 +166,6 @@ describe('ActsBmsKitTest', function () {
} }
} }
done(); done();
setTimeout(function () {
console.debug('===========ActsBmsKit_getModuleUsageRecordTest_0100===========end');
}, EVENTTIMEOUT)
}) })
/* /*
...@@ -207,13 +203,11 @@ describe('ActsBmsKitTest', function () { ...@@ -207,13 +203,11 @@ describe('ActsBmsKitTest', function () {
console.debug('=============bundleName is=========' + JSON.stringify(data[i].bundleName)); console.debug('=============bundleName is=========' + JSON.stringify(data[i].bundleName));
expect(data[i].bundleName.length).assertLarger(0); expect(data[i].bundleName.length).assertLarger(0);
console.debug('=============appLabelId==============' + JSON.stringify(data[i].appLabelId)); console.debug('=============appLabelId==============' + JSON.stringify(data[i].appLabelId));
if(data[i].bundleName == 'com.example.third1'){ expect(data[i].appLabelId >= 0).assertTrue();
expect(data[i].appLabelId).assertEqual(0); expect(data[i].labelId >= 0).assertTrue();
expect(data[i].labelId).assertEqual(0); expect(data[i].abilityLabelId >= 0).assertTrue();
expect(data[i].abilityLabelId).assertEqual(0); expect(data[i].abilityDescriptionId >= 0).assertTrue();
expect(data[i].abilityDescriptionId).assertEqual(0); expect(data[i].abilityIconId >= 0).assertTrue();
expect(data[i].abilityIconId).assertEqual(0);
}
console.debug('=============name==============' + JSON.stringify(data[i].name)); console.debug('=============name==============' + JSON.stringify(data[i].name));
expect(data[i].name.length).assertLarger(0); expect(data[i].name.length).assertLarger(0);
console.debug('=============labelId==============' + JSON.stringify(data[i].labelId)); console.debug('=============labelId==============' + JSON.stringify(data[i].labelId));
......
...@@ -83,6 +83,27 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -83,6 +83,27 @@ describe('ActsBmsModuleUsageRecordTest', function () {
) )
}); });
}) })
beforeEach(async (done) => {
bundle.getBundleInfo(BUNDLE_NAME, 1, async (err, data) => {
if (err.code != 0 && data.name.length == 0) {
let installer = await bundle.getBundleInstaller();
installer.install(['/data/test/bmsThirdBundleTest1.hap'], {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
console.debug('========install Finish========' + JSON.stringify(data));
done();
});
} else {
console.info("third1 is exist");
done();
}
});
})
/* /*
* @tc.number: bms_getModuleUsageRecordTest_0100 * @tc.number: bms_getModuleUsageRecordTest_0100
* @tc.name: getModuleUsageRecord(maxNum) * @tc.name: getModuleUsageRecord(maxNum)
...@@ -101,14 +122,14 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -101,14 +122,14 @@ describe('ActsBmsModuleUsageRecordTest', function () {
if (dataMap.has(BUNDLE_NAME)) { if (dataMap.has(BUNDLE_NAME)) {
let data = dataMap.get(BUNDLE_NAME); let data = dataMap.get(BUNDLE_NAME);
expect(data.bundleName).assertEqual('com.example.third1'); expect(data.bundleName).assertEqual('com.example.third1');
expect(data.appLabelId).assertEqual(0); expect(data.appLabelId >= 0).assertTrue();
expect(data.name).assertEqual('entry'); expect(data.name).assertEqual('entry');
expect(data.labelId).assertEqual(0); expect(data.labelId >= 0).assertTrue();
expect(data.descriptionId).assertEqual(0); expect(data.descriptionId).assertEqual(0);
expect(data.abilityName).assertEqual('com.example.third1.MainAbility'); expect(data.abilityName).assertEqual('com.example.third1.MainAbility');
expect(data.abilityLabelId).assertEqual(0); expect(data.abilityLabelId >= 0).assertTrue();
expect(data.abilityDescriptionId).assertEqual(0); expect(data.abilityDescriptionId >= 0).assertTrue();
expect(data.abilityIconId).assertEqual(0); expect(data.abilityIconId >= 0).assertTrue();
expect(data.launchedCount).assertEqual(START_COUNT); expect(data.launchedCount).assertEqual(START_COUNT);
expect(data.lastLaunchTime).assertLarger(0); expect(data.lastLaunchTime).assertLarger(0);
expect(data.isRemoved).assertEqual(false); expect(data.isRemoved).assertEqual(false);
...@@ -596,13 +617,11 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -596,13 +617,11 @@ describe('ActsBmsModuleUsageRecordTest', function () {
console.debug('=======All Info========' + JSON.stringify(data[i])); console.debug('=======All Info========' + JSON.stringify(data[i]));
console.debug('=============bundleName is=========' + JSON.stringify(data[i].bundleName)); console.debug('=============bundleName is=========' + JSON.stringify(data[i].bundleName));
expect(data[i].bundleName.length).assertLarger(0); expect(data[i].bundleName.length).assertLarger(0);
if (data[i].bundleName == BUNDLE_NAME) { expect(data[i].appLabelId >= 0).assertTrue();
expect(data[i].appLabelId).assertEqual(0); expect(data[i].labelId >= 0).assertTrue();
expect(data[i].labelId).assertEqual(0); expect(data[i].abilityLabelId >= 0).assertTrue();
expect(data[i].abilityLabelId).assertEqual(0); expect(data[i].abilityDescriptionId >= 0).assertTrue();
expect(data[i].abilityDescriptionId).assertEqual(0); expect(data[i].abilityIconId >= 0).assertTrue();
expect(data[i].abilityIconId).assertEqual(0);
}
console.debug('=============appLabelId==============' + JSON.stringify(data[i].appLabelId)); console.debug('=============appLabelId==============' + JSON.stringify(data[i].appLabelId));
console.debug('=============name==============' + JSON.stringify(data[i].name)); console.debug('=============name==============' + JSON.stringify(data[i].name));
expect(data[i].name.length).assertLarger(0); expect(data[i].name.length).assertLarger(0);
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
import notify from '@ohos.notification' import notify from '@ohos.notification'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var time = 1000 var time = 500
describe('ActsAnsAllActiveTestOne', function () { describe('ActsAnsAllActiveTestOne', function () {
console.info("===========ActsAnsAllActiveTestOne start====================>"); console.info("===========ActsAnsAllActiveTestOne start====================>");
function getAllCallback(err, data){ function getAllCallback(err, data){
...@@ -76,9 +76,9 @@ describe('ActsAnsAllActiveTestOne', function () { ...@@ -76,9 +76,9 @@ describe('ActsAnsAllActiveTestOne', function () {
console.debug("===============Ans_GetAllActive_0100 publish CurrentApp notify end==================>"); console.debug("===============Ans_GetAllActive_0100 publish CurrentApp notify end==================>");
notify.getAllActiveNotifications(getAllCallback); notify.getAllActiveNotifications(getAllCallback);
console.debug("===============Ans_GetAllActive_0100 getAllActiveNotifications end==================>"); console.debug("===============Ans_GetAllActive_0100 getAllActiveNotifications end==================>");
setTimeout(function(){
console.debug("===============Ans_GetAllActive_0100 setTimeout==================>");
done(); done();
setTimeout(async function(){
console.debug("===============Ans_GetAllActive_0100 done==================>");
}, time); }, time);
}) })
...@@ -134,9 +134,9 @@ describe('ActsAnsAllActiveTestOne', function () { ...@@ -134,9 +134,9 @@ describe('ActsAnsAllActiveTestOne', function () {
console.log("============Ans_GetAllActive_0200 label=====>"+promiseData[i].label) console.log("============Ans_GetAllActive_0200 label=====>"+promiseData[i].label)
} }
} }
setTimeout(function(){
console.debug("===============Ans_GetAllActive_0200 setTimeout==================>");
done(); done();
setTimeout(async function(){
console.debug("===============Ans_GetAllActive_0200 done==================>");
}, time); }, time);
}) })
...@@ -186,9 +186,9 @@ describe('ActsAnsAllActiveTestOne', function () { ...@@ -186,9 +186,9 @@ describe('ActsAnsAllActiveTestOne', function () {
await notify.cancel(1, "currentApp_0300"); await notify.cancel(1, "currentApp_0300");
notify.getAllActiveNotifications(getAllCallbackThree); notify.getAllActiveNotifications(getAllCallbackThree);
console.debug("===============Ans_GetAllActive_0300 getAllActiveNotifications end==================>"); console.debug("===============Ans_GetAllActive_0300 getAllActiveNotifications end==================>");
setTimeout(function(){
console.debug("===============Ans_GetAllActive_0300 setTimeout==================>");
done(); done();
setTimeout(async function(){
console.debug("===============Ans_GetAllActive_0300 done==================>");
}, time); }, time);
}) })
...@@ -232,9 +232,9 @@ describe('ActsAnsAllActiveTestOne', function () { ...@@ -232,9 +232,9 @@ describe('ActsAnsAllActiveTestOne', function () {
console.log("============Ans_GetAllActive_0400 label=====>"+promiseData[i].label) console.log("============Ans_GetAllActive_0400 label=====>"+promiseData[i].label)
} }
console.debug("===============Ans_GetAllActive_0400 getAllActiveNotifications end==================>"); console.debug("===============Ans_GetAllActive_0400 getAllActiveNotifications end==================>");
done();
setTimeout(function(){ setTimeout(function(){
console.debug("===============Ans_GetAllActive_0400 done==================>"); console.debug("===============Ans_GetAllActive_0400 setTimeout==================>");
done();
}, time); }, time);
}) })
...@@ -269,9 +269,9 @@ describe('ActsAnsAllActiveTestOne', function () { ...@@ -269,9 +269,9 @@ describe('ActsAnsAllActiveTestOne', function () {
await notify.removeAll(); await notify.removeAll();
notify.getAllActiveNotifications(getAllCallbackFive); notify.getAllActiveNotifications(getAllCallbackFive);
console.debug("===============Ans_GetAllActive_0500 getAllActiveNotifications end==================>"); console.debug("===============Ans_GetAllActive_0500 getAllActiveNotifications end==================>");
setTimeout(function(){
console.debug("===============Ans_GetAllActive_0500 setTimeout==================>");
done(); done();
setTimeout(async function(){
console.debug("===============Ans_GetAllActive_0500 done==================>");
}, time); }, time);
}) })
...@@ -303,9 +303,9 @@ describe('ActsAnsAllActiveTestOne', function () { ...@@ -303,9 +303,9 @@ describe('ActsAnsAllActiveTestOne', function () {
expect(promiseData.length).assertEqual(0); expect(promiseData.length).assertEqual(0);
console.debug("=======Ans_GetAllActive_0600 promiseData.length==========>"+promiseData.length); console.debug("=======Ans_GetAllActive_0600 promiseData.length==========>"+promiseData.length);
console.debug("=======Ans_GetAllActive_0600 promiseData==========>"+JSON.stringify(promiseData)); console.debug("=======Ans_GetAllActive_0600 promiseData==========>"+JSON.stringify(promiseData));
setTimeout(function(){
console.debug("===============Ans_GetAllActive_0600 setTimeout==================>");
done(); done();
setTimeout(async function(){
console.debug("===============Ans_GetAllActive_0600 done==================>");
}, time); }, time);
}) })
...@@ -324,9 +324,9 @@ describe('ActsAnsAllActiveTestOne', function () { ...@@ -324,9 +324,9 @@ describe('ActsAnsAllActiveTestOne', function () {
await notify.removeAll(); await notify.removeAll();
notify.getAllActiveNotifications(getAllCallbackSeven); notify.getAllActiveNotifications(getAllCallbackSeven);
console.debug("===============Ans_GetAllActive_0700 getAllActiveNotifications end==================>"); console.debug("===============Ans_GetAllActive_0700 getAllActiveNotifications end==================>");
setTimeout(function(){
console.debug("===============Ans_GetAllActive_0700 setTimeout==================>");
done(); done();
setTimeout(async function(){
console.debug("===============Ans_GetAllActive_0700 done==================>");
}, time); }, time);
}) })
...@@ -341,9 +341,9 @@ describe('ActsAnsAllActiveTestOne', function () { ...@@ -341,9 +341,9 @@ describe('ActsAnsAllActiveTestOne', function () {
var promiseData = await notify.getAllActiveNotifications(); var promiseData = await notify.getAllActiveNotifications();
console.debug("=========Ans_GetAllActive_0800 promiseData.length=============>"+promiseData.length); console.debug("=========Ans_GetAllActive_0800 promiseData.length=============>"+promiseData.length);
expect(promiseData.length).assertEqual(0); expect(promiseData.length).assertEqual(0);
setTimeout(function(){
console.debug("===============Ans_GetAllActive_0800 setTimeout==================>");
done(); done();
setTimeout(async function(){
console.debug("===============Ans_GetAllActive_0800 done==================>");
}, time); }, time);
}) })
}) })
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
*/ */
import notify from '@ohos.notification' import notify from '@ohos.notification'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var time = 1000 var time = 500
describe('ActsAnsUnSubscriberTest', function () { describe('ActsAnsUnSubscriberTest', function () {
console.debug("===============ActsAnsUnSubscriberTest start=================>"); console.debug("===============ActsAnsUnSubscriberTest start=================>");
function onConnecteOne() { function onConnecteOne() {
...@@ -31,22 +31,19 @@ describe('ActsAnsUnSubscriberTest', function () { ...@@ -31,22 +31,19 @@ describe('ActsAnsUnSubscriberTest', function () {
*/ */
it('Ans_UnSubscriber_0100', 0, async function (done) { it('Ans_UnSubscriber_0100', 0, async function (done) {
console.info("===========Ans_UnSubscriber_0100 start=============>"); console.info("===========Ans_UnSubscriber_0100 start=============>");
function unSubscribeCallbackOne(err) {
console.debug("===========Ans_UnSubscriber_0100 unSubscribeCallbackOne err.code=================>"+err.code);
expect(err.code).assertEqual(0)
done();
}
var subscriber ={ var subscriber ={
onConnect:onConnecteOne, onConnect:onConnecteOne,
onDisconnect:onDisconnectOne onDisconnect:onDisconnectOne
} }
await notify.subscribe(subscriber); notify.subscribe(subscriber);
console.info("===========Ans_UnSubscriber_0100 subscribe=============>"); console.info("===========Ans_UnSubscriber_0100 subscribe=============>");
await notify.unsubscribe(subscriber, unSubscribeCallbackOne); notify.unsubscribe(subscriber, (err)=>{
console.info("===========Ans_UnSubscriber_0100 unsubscribe=============>"); console.debug("===========Ans_UnSubscriber_0100 unsubscribe err.code=================>"+err.code);
expect(err.code).assertEqual(0);
});
setTimeout(function(){ setTimeout(function(){
console.debug("===========Ans_UnSubscriber_0100 done=============>"); console.debug("===========Ans_UnSubscriber_0100 setTimeout=============>");
done();
}, time); }, time);
}) })
...@@ -68,13 +65,16 @@ describe('ActsAnsUnSubscriberTest', function () { ...@@ -68,13 +65,16 @@ describe('ActsAnsUnSubscriberTest', function () {
onConnect:onConnecteTwo, onConnect:onConnecteTwo,
onDisconnect:onDisconnectTwo onDisconnect:onDisconnectTwo
} }
await notify.subscribe(subscriber); notify.subscribe(subscriber);
console.info("===========Ans_UnSubscriber_0200 subscribe=============>"); console.info("===========Ans_UnSubscriber_0200 subscribe=============>");
await notify.unsubscribe(subscriber); notify.unsubscribe(subscriber).then(()=>{
console.info("===========Ans_UnSubscriber_0200 unsubscribe=============>"); console.debug("=======Ans_UnSubscriber_0200 subscribe then==========>");
done(); }).catch((err)=>{
console.debug("=======Ans_UnSubscriber_0200 subscribe catch err==========>"+err.code);
});
setTimeout(function(){ setTimeout(function(){
console.debug("===========Ans_UnSubscriber_0200 done=============>"); console.debug("===========Ans_UnSubscriber_0200 setTimeout=============>");
done();
}, time); }, time);
}) })
...@@ -85,10 +85,6 @@ describe('ActsAnsUnSubscriberTest', function () { ...@@ -85,10 +85,6 @@ describe('ActsAnsUnSubscriberTest', function () {
console.debug("=======Ans_UnSubscriber_0300 onDisconnectThree=================>"); console.debug("=======Ans_UnSubscriber_0300 onDisconnectThree=================>");
expect().assertFail(); expect().assertFail();
} }
function unSubscribeCallbackThree(err){
console.debug("Ans_UnSubscriber_0300 unSubscribeCallbackThree err.code=================>"+err.code);
expect(err.code).assertNotEqual(0);
}
/* /*
* @tc.number: Ans_UnSubscriber_0300 * @tc.number: Ans_UnSubscriber_0300
...@@ -107,11 +103,13 @@ describe('ActsAnsUnSubscriberTest', function () { ...@@ -107,11 +103,13 @@ describe('ActsAnsUnSubscriberTest', function () {
} }
await notify.subscribe(subscriber); await notify.subscribe(subscriber);
console.info("===========Ans_UnSubscriber_0300 subscribe=============>"); console.info("===========Ans_UnSubscriber_0300 subscribe=============>");
await notify.unsubscribe(subscriberErr,unSubscribeCallbackThree); notify.unsubscribe(subscriberErr,(err)=>{
console.info("===========Ans_UnSubscriber_0300 unsubscribe=============>"); console.debug("Ans_UnSubscriber_0300 unsubscribe callback err=========>"+err.code);
done(); expect(err.code != 0).assertEqual(true);
});
setTimeout(function(){ setTimeout(function(){
console.debug("===========Ans_UnSubscriber_0300 done=============>"); console.debug("===========Ans_UnSubscriber_0300 setTimeout=============>");
done();
}, time); }, time);
}) })
...@@ -141,12 +139,12 @@ describe('ActsAnsUnSubscriberTest', function () { ...@@ -141,12 +139,12 @@ describe('ActsAnsUnSubscriberTest', function () {
await notify.subscribe(subscriber); await notify.subscribe(subscriber);
console.info("===========Ans_UnSubscriber_0400 subscribe=============>"); console.info("===========Ans_UnSubscriber_0400 subscribe=============>");
notify.unsubscribe(subscriberErr).then().catch((err)=>{ notify.unsubscribe(subscriberErr).then().catch((err)=>{
console.debug("=======Ans_UnSubscriber_0400 subscribe catch err=================>"+err.code); console.debug("=======Ans_UnSubscriber_0400 subscribe catch err==========>"+err.code);
expect(err.code).assertEqual(67108867) expect(err.code != 0).assertEqual(true);
}); });
done();
setTimeout(function(){ setTimeout(function(){
console.debug("===========Ans_UnSubscriber_0400 done=============>"); console.debug("===========Ans_UnSubscriber_0400 setTimeout=============>");
done();
}, time); }, time);
}) })
...@@ -157,10 +155,6 @@ describe('ActsAnsUnSubscriberTest', function () { ...@@ -157,10 +155,6 @@ describe('ActsAnsUnSubscriberTest', function () {
console.debug("=======Ans_UnSubscriber_0500 onDisconnectFive=================>"); console.debug("=======Ans_UnSubscriber_0500 onDisconnectFive=================>");
expect().assertFail(); expect().assertFail();
} }
function unSubscribeCallbackFive(err){
console.debug("Ans_UnSubscriber_0500 unSubscribeCallbackFive err.code=================>"+err.code);
expect(err.code).assertNotEqual(0);
}
function onConnecteTest() { function onConnecteTest() {
console.debug("=======Ans_UnSubscriber_0500 onConnecteTest=================>"); console.debug("=======Ans_UnSubscriber_0500 onConnecteTest=================>");
expect().assertFail(); expect().assertFail();
...@@ -185,13 +179,16 @@ describe('ActsAnsUnSubscriberTest', function () { ...@@ -185,13 +179,16 @@ describe('ActsAnsUnSubscriberTest', function () {
onConnect:onConnecteTest, onConnect:onConnecteTest,
onDisconnect:onDisconnectTest onDisconnect:onDisconnectTest
} }
await notify.subscribe(subscriber); notify.subscribe(subscriber);
console.info("===========Ans_UnSubscriber_0500 subscribe=============>"); console.info("===========Ans_UnSubscriber_0500 subscribe=============>");
await notify.unsubscribe(subscriberTest,unSubscribeCallbackFive); notify.unsubscribe(subscriberTest,(err)=>{
console.debug("Ans_UnSubscriber_0500 unsubscribe err.code=================>"+err.code);
expect(err.code != 0).assertEqual(true);
});
console.info("===========Ans_UnSubscriber_0500 unsubscribe=============>"); console.info("===========Ans_UnSubscriber_0500 unsubscribe=============>");
done();
setTimeout(function(){ setTimeout(function(){
console.debug("===========Ans_UnSubscriber_0500 done=============>"); console.debug("===========Ans_UnSubscriber_0500 setTimeout=============>");
done();
}, time); }, time);
}) })
...@@ -226,15 +223,15 @@ describe('ActsAnsUnSubscriberTest', function () { ...@@ -226,15 +223,15 @@ describe('ActsAnsUnSubscriberTest', function () {
onConnect:onConnecteTestTwo, onConnect:onConnecteTestTwo,
onDisconnect:onDisconnectTestTwo onDisconnect:onDisconnectTestTwo
} }
await notify.subscribe(subscriber); notify.subscribe(subscriber);
console.info("===========Ans_UnSubscriber_0600 subscribe=============>"); console.info("===========Ans_UnSubscriber_0600 subscribe=============>");
notify.unsubscribe(subscriberTest).then().catch((err)=>{ notify.unsubscribe(subscriberTest).then().catch((err)=>{
console.debug("=======Ans_UnSubscriber_0600 unsubscribe catch err=================>"+err.code); console.debug("=======Ans_UnSubscriber_0600 unsubscribe catch err=================>"+err.code);
expect(err.code).assertNotEqual(0) expect(err.code != 0).assertEqual(true);
}); });
done();
setTimeout(function(){ setTimeout(function(){
console.debug("===========Ans_UnSubscriber_0600 done=============>"); console.debug("===========Ans_UnSubscriber_0600 setTimeout=============>");
done();
}, time); }, time);
}) })
...@@ -249,14 +246,6 @@ describe('ActsAnsUnSubscriberTest', function () { ...@@ -249,14 +246,6 @@ describe('ActsAnsUnSubscriberTest', function () {
expect().assertFail(); expect().assertFail();
} }
} }
function unSubscribeCallbackSevenFirst(err){
console.debug("Ans_UnSubscriber_0700 unSubscribeCallbackSevenFirst err.code=================>"+err.code);
expect(err.code).assertEqual(0)
}
function unSubscribeCallbackSevenSecond(err){
console.debug("Ans_UnSubscriber_0700 unSubscribeCallbackSevenSecond err.code=================>"+err.code);
expect(err.code).assertNotEqual(0);
}
/* /*
* @tc.number: Ans_UnSubscriber_0700 * @tc.number: Ans_UnSubscriber_0700
...@@ -265,21 +254,24 @@ describe('ActsAnsUnSubscriberTest', function () { ...@@ -265,21 +254,24 @@ describe('ActsAnsUnSubscriberTest', function () {
*/ */
it('Ans_UnSubscriber_0700', 0, async function (done) { it('Ans_UnSubscriber_0700', 0, async function (done) {
console.info("===========Ans_UnSubscriber_0700 start=============>"); console.info("===========Ans_UnSubscriber_0700 start=============>");
timesOfOnDis = 0 timesOfOnDis = 0
var subscriber ={ var subscriber ={
onConnect:onConnecteSeven, onConnect:onConnecteSeven,
onDisconnect:onDisconnectSeven onDisconnect:onDisconnectSeven
} }
await notify.subscribe(subscriber); notify.subscribe(subscriber);
console.info("===========Ans_UnSubscriber_0700 subscribe=============>"); console.info("===========Ans_UnSubscriber_0700 subscribe=============>");
await notify.unsubscribe(subscriber, unSubscribeCallbackSevenFirst); notify.unsubscribe(subscriber, (err)=>{
console.info("===========Ans_UnSubscriber_0700 unsubscribe first end=============>"); console.debug("Ans_UnSubscriber_0700 unsubscribe first err.code=================>"+err.code);
await notify.unsubscribe(subscriber, unSubscribeCallbackSevenSecond); expect(err.code).assertEqual(0);
console.info("===========Ans_UnSubscriber_0700 unsubscribe second end=============>"); notify.unsubscribe(subscriber, (err)=>{
done(); console.debug("Ans_UnSubscriber_0700 unsubscribe Second err.code=================>"+err.code);
expect(err.code != 0).assertEqual(true);
});
});
setTimeout(function(){ setTimeout(function(){
console.info("===========Ans_UnSubscriber_0700 done=============>"); console.debug("===========Ans_UnSubscriber_0700 setTimeout=============>");
done();
}, time); }, time);
}) })
...@@ -307,22 +299,22 @@ describe('ActsAnsUnSubscriberTest', function () { ...@@ -307,22 +299,22 @@ describe('ActsAnsUnSubscriberTest', function () {
onConnect:onConnecteEight, onConnect:onConnecteEight,
onDisconnect:onDisconnectEight onDisconnect:onDisconnectEight
} }
await notify.subscribe(subscriber); notify.subscribe(subscriber);
console.info("===========Ans_UnSubscriber_0800 subscribe=============>"); console.info("===========Ans_UnSubscriber_0800 subscribe=============>");
notify.unsubscribe(subscriber).then((err)=>{ notify.unsubscribe(subscriber).then((err)=>{
console.debug("=======Ans_UnSubscriber_0800 subscribe first then err=================>"+err.code); console.debug("=======Ans_UnSubscriber_0800 subscribe first then err=================>"+err.code);
}).catch((err)=>{
console.debug("=======Ans_UnSubscriber_0800 subscribe first catch err=================>"+err.code);
});
notify.unsubscribe(subscriber).then((err)=>{ notify.unsubscribe(subscriber).then((err)=>{
console.debug("=======Ans_UnSubscriber_0800 subscribe second then err=================>"+err.code); console.debug("=======Ans_UnSubscriber_0800 subscribe second then err=================>"+err.code);
}).catch((err)=>{ }).catch((err)=>{
console.debug("=======Ans_UnSubscriber_0800 subscribe second catch err=================>"+err.code); console.debug("=======Ans_UnSubscriber_0800 subscribe second catch err=================>"+err.code);
expect(err.code).assertNotEqual(0) expect(err.code != 0).assertEqual(true);
});
}).catch((err)=>{
console.debug("=======Ans_UnSubscriber_0800 subscribe first catch err=================>"+err.code);
}); });
done();
setTimeout(function(){ setTimeout(function(){
console.info("===========Ans_UnSubscriber_0800 done=============>"); console.debug("===========Ans_UnSubscriber_0800 setTimeout=============>");
done();
}, time); }, time);
}) })
...@@ -330,14 +322,6 @@ describe('ActsAnsUnSubscriberTest', function () { ...@@ -330,14 +322,6 @@ describe('ActsAnsUnSubscriberTest', function () {
console.debug("=======Ans_UnSubscriber_0900 onDisconnectTestNine =================>"); console.debug("=======Ans_UnSubscriber_0900 onDisconnectTestNine =================>");
expect().assertFail(); expect().assertFail();
} }
function subscribeCallbackNine(err){
console.debug("Ans_UnSubscriber_0900 subscribeCallbackNine err.code=================>"+err.code);
expect(err.code).assertNotEqual(0);
}
function unSubscribeCallbackNine(err){
console.debug("Ans_UnSubscriber_0900 unSubscribeCallbackNine err.code=================>"+err.code);
expect(err.code).assertNotEqual(0);
}
/* /*
* @tc.number: Ans_UnSubscriber_0900 * @tc.number: Ans_UnSubscriber_0900
...@@ -350,11 +334,17 @@ describe('ActsAnsUnSubscriberTest', function () { ...@@ -350,11 +334,17 @@ describe('ActsAnsUnSubscriberTest', function () {
onConnect:"", onConnect:"",
onDisconnect:onDisconnectTestNine onDisconnect:onDisconnectTestNine
} }
await notify.subscribe(subscriber, subscribeCallbackNine); notify.subscribe(subscriber, (err)=>{
notify.unsubscribe(subscriber, unSubscribeCallbackNine); console.debug("Ans_UnSubscriber_0900 subscribeCallbackNine err.code=================>"+err.code);
done(); expect(err.code != 0).assertEqual(true);
notify.unsubscribe(subscriber, (err)=>{
console.debug("Ans_UnSubscriber_0900 unsubscribe err.code=================>"+err.code);
expect(err.code != 0).assertEqual(true);
});
});
setTimeout(function(){ setTimeout(function(){
console.info("===========Ans_UnSubscriber_0900 done=============>"); console.debug("===========Ans_UnSubscriber_0900 setTimeout=============>");
done();
}, time); }, time);
}) })
...@@ -362,10 +352,7 @@ describe('ActsAnsUnSubscriberTest', function () { ...@@ -362,10 +352,7 @@ describe('ActsAnsUnSubscriberTest', function () {
console.debug("=======Ans_UnSubscriber_1000 onDisconnectTestTen =================>"); console.debug("=======Ans_UnSubscriber_1000 onDisconnectTestTen =================>");
expect().assertFail(); expect().assertFail();
} }
function subscribeCallbackTen(err){
console.debug("Ans_UnSubscriber_1000 subscribeCallbackTen err.code=================>"+err.code);
expect(err.code).assertNotEqual(0);
}
/* /*
* @tc.number: Ans_UnSubscriber_1000 * @tc.number: Ans_UnSubscriber_1000
* @tc.name: unsubscribe(subscriber: NotificationSubscriber): Promise<void>; * @tc.name: unsubscribe(subscriber: NotificationSubscriber): Promise<void>;
...@@ -377,17 +364,17 @@ describe('ActsAnsUnSubscriberTest', function () { ...@@ -377,17 +364,17 @@ describe('ActsAnsUnSubscriberTest', function () {
onConnect:"", onConnect:"",
onDisconnect:onDisconnectTestTen onDisconnect:onDisconnectTestTen
} }
await notify.subscribe(subscriber, subscribeCallbackTen); notify.subscribe(subscriber, (err)=>{
console.info("===========Ans_UnSubscriber_1000 subscribe end=============>");
notify.unsubscribe(subscriber).then((err)=>{ notify.unsubscribe(subscriber).then((err)=>{
console.debug("=======Ans_UnSubscriber_1000 subscribe then err=================>"+err.code); console.debug("=======Ans_UnSubscriber_1000 subscribe then err=================>"+err.code);
}).catch((err)=>{ }).catch((err)=>{
console.debug("=======Ans_UnSubscriber_1000 subscribe catch err=================>"+err.code); console.debug("=======Ans_UnSubscriber_1000 subscribe catch err=================>"+err.code);
expect(err.code).assertNotEqual(0) expect(err.code != 0).assertEqual(true);
});
}); });
done();
setTimeout(function(){ setTimeout(function(){
console.info("===========Ans_UnSubscriber_1000 done=============>"); console.debug("===========Ans_UnSubscriber_1000 setTimeout=============>");
done();
}, time); }, time);
}) })
...@@ -398,10 +385,6 @@ describe('ActsAnsUnSubscriberTest', function () { ...@@ -398,10 +385,6 @@ describe('ActsAnsUnSubscriberTest', function () {
console.debug("============Ans_UnSubscriber_1100 onDisconnectEleven=================>"); console.debug("============Ans_UnSubscriber_1100 onDisconnectEleven=================>");
expect().assertFail(); expect().assertFail();
} }
function unSubscribeCallbackEleven(err){
console.debug("Ans_UnSubscriber_1100 unSubscribeCallbackEleven err.code=================>"+err.code);
expect(err.code).assertNotEqual(0);
}
/* /*
* @tc.number: Ans_UnSubscriber_1100 * @tc.number: Ans_UnSubscriber_1100
...@@ -411,7 +394,7 @@ describe('ActsAnsUnSubscriberTest', function () { ...@@ -411,7 +394,7 @@ describe('ActsAnsUnSubscriberTest', function () {
*/ */
it('Ans_UnSubscriber_1100', 0, async function (done) { it('Ans_UnSubscriber_1100', 0, async function (done) {
console.info("===========Ans_UnSubscriber_1100 start=============>"); console.info("===========Ans_UnSubscriber_1100 start=============>");
await notify.subscribe({ notify.subscribe({
onConnect:onConnecteEleven, onConnect:onConnecteEleven,
onDisconnect:onDisconnectEleven onDisconnect:onDisconnectEleven
}); });
...@@ -422,11 +405,11 @@ describe('ActsAnsUnSubscriberTest', function () { ...@@ -422,11 +405,11 @@ describe('ActsAnsUnSubscriberTest', function () {
}, },
(err)=>{ (err)=>{
console.debug("Ans_UnSubscriber_1100 unSubscribeCallbackEleven err.code=================>"+err.code); console.debug("Ans_UnSubscriber_1100 unSubscribeCallbackEleven err.code=================>"+err.code);
expect(err.code).assertNotEqual(0); expect(err.code != 0).assertEqual(true);
}); });
done();
setTimeout(function(){ setTimeout(function(){
console.info("===========Ans_UnSubscriber_1100 done=============>"); console.debug("===========Ans_UnSubscriber_1100 setTimeout=============>");
done();
}, time); }, time);
}) })
...@@ -446,7 +429,7 @@ describe('ActsAnsUnSubscriberTest', function () { ...@@ -446,7 +429,7 @@ describe('ActsAnsUnSubscriberTest', function () {
*/ */
it('Ans_UnSubscriber_1200', 0, async function (done) { it('Ans_UnSubscriber_1200', 0, async function (done) {
console.info("===========Ans_UnSubscriber_1200 start=============>"); console.info("===========Ans_UnSubscriber_1200 start=============>");
await notify.subscribe({ notify.subscribe({
onConnect:onConnecteTwelve, onConnect:onConnecteTwelve,
onDisconnect:onConnecteTwelve onDisconnect:onConnecteTwelve
}); });
...@@ -454,14 +437,15 @@ describe('ActsAnsUnSubscriberTest', function () { ...@@ -454,14 +437,15 @@ describe('ActsAnsUnSubscriberTest', function () {
onConnect:onConnecteTwelve, onConnect:onConnecteTwelve,
onDisconnect:onDisconnectTwelve onDisconnect:onDisconnectTwelve
}).then((err)=>{ }).then((err)=>{
console.info("===========Ans_UnSubscriber_1200 unsubscribe then err=============>"+err); console.info("===========Ans_UnSubscriber_1200 unsubscribe then err=============>"+err.code);
}).catch((err)=>{ }).catch((err)=>{
console.info("===========Ans_UnSubscriber_1200 unsubscribe catch err=============>"+err); console.info("===========Ans_UnSubscriber_1200 unsubscribe catch err=============>"+err.code);
expect(err.code).assertNotEqual(0) expect(err.code != 0).assertEqual(true);
}); });
done();
setTimeout(function(){ setTimeout(function(){
console.info("===========Ans_UnSubscriber_1200 done=============>"); console.debug("===========Ans_UnSubscriber_1200 setTimeout=============>");
done();
}, time); }, time);
}); });
}) })
......
...@@ -17,9 +17,8 @@ group("SubscribeAndPublish") { ...@@ -17,9 +17,8 @@ group("SubscribeAndPublish") {
testonly = true testonly = true
if (is_standard_system) { if (is_standard_system) {
deps = [ deps = [
"actssubscriberorderedtest:ActsSubscriberOrderTest",
"actssubscriberunordertest:ActsSubscriberUnorderTest", "actssubscriberunordertest:ActsSubscriberUnorderTest",
#"actssubscriberorderedtest:ActsSubscriberOrderTest",
#"actssubscriberunordersystemtest:ActsSubscriberTestUnorderSystem" #"actssubscriberunordersystemtest:ActsSubscriberTestUnorderSystem"
] ]
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册