提交 f972d4d5 编写于 作者: Z zhaoyuan17

Update xts code

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