提交 4a7dcfea 编写于 作者: K kirl75

Format Xts code

Signed-off-by: Nkirl75 <kirl.liu@huawei.com>
上级 d5d54be2
......@@ -24,55 +24,6 @@
"moduleName": "entry",
"moduleType": "entry"
},
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "publish_event0800_permission"
},
{
"availableScope": [],
"grantMode": "system_grant",
"name": "publish_event0900_subscriberPermissions"
},
{
"availableScope": [],
"grantMode": "system_grant",
"name": "publish_event0900_publisherPermission"
},
{
"availableScope": [],
"grantMode": "system_grant",
"name": "publish_event1000_permission"
},
{
"availableScope": [],
"grantMode": "system_grant",
"name": "permission.COMMONEVENT_STICKY"
}
],
"reqPermissions": [
{
"name": "publish_event0800_permission",
"reason": "ceshi"
},
{
"name": "publish_event0900_subscriberPermissions",
"reason": "ceshi"
},
{
"name": "publish_event0900_publisherPermission",
"reason": "ceshi"
},
{
"name": "publish_event1000_permission",
"reason": "ceshi"
},
{
"name": "permission.COMMONEVENT_STICKY",
"reason": "ceshi"
}
],
"abilities": [
{
"skills": [
......
......@@ -85,7 +85,7 @@ describe('ActsSubscriberTestOrder', function () {
console.info("===============>subscriberCallBack0100 setCodeAndData promise");
})
commonEventSubscriber0100.getAbortCommonEvent().then(function(data) {
commonEventSubscriber0100.getAbortCommonEvent().then((data)=>{
console.info(
"===============>subscriberCallBack0100 getAbortCommonEvent promise abort: " + data);
})
......@@ -94,7 +94,7 @@ describe('ActsSubscriberTestOrder', function () {
console.info("===============>subscriberCallBack0100 clearAbortCommonEvent promise");
})
commonEventSubscriber0100.getAbortCommonEvent().then(function(data) {
commonEventSubscriber0100.getAbortCommonEvent().then((data)=>{
console.info(
"===============>subscriberCallBack0100 getAbortCommonEvent promise abort: " + data);
})
......@@ -113,26 +113,26 @@ describe('ActsSubscriberTestOrder', function () {
expect(data.event).assertEqual("publish_event0100");
console.info("===============>subscriberCallBack0101=========1 code "+ data.code);
expect(data.code).assertEqual(2);
commonEventSubscriber0101.getCode().then(function(data) {
commonEventSubscriber0101.getCode().then((data)=>{
console.info("===============>subscriberCallBack0101 getCode promise code: "+ data);
})
expect(data.data).assertEqual("publish_event1001_change");
commonEventSubscriber0100.getData().then(function(data) {
commonEventSubscriber0100.getData().then((data)=>{
console.info("===============>subscriberCallBack0101 getData promise data: "+ data);
})
expect(data.bundleName).assertEqual("publish_event0100_bundleName");
commonEventSubscriber0101.finishCommonEvent().then(()=>{
console.info("===============>subscriberCallBack0101 finishCommonEvent promise");
})
done();
})
}
Subscriber.createSubscriber(
commonEventSubscribeInfo1
).then(function (data) {
).then((data)=>{
console.info("===============ActsSubscriberTestOrder_0100==========createSubscriber promise1");
commonEventSubscriber0100 = data;
data.getSubscribeInfo().then(function (data) {
data.getSubscribeInfo().then(()=>{
console.info("===============ActsSubscriberTestOrder_0100=========getSubscribeInfo promise1");
Subscriber.subscribe(commonEventSubscriber0100, subscriberCallBack0100);
});
......@@ -140,13 +140,13 @@ describe('ActsSubscriberTestOrder', function () {
Subscriber.createSubscriber(
commonEventSubscribeInfo2
).then(function (data) {
).then((data)=>{
console.info("===============ActsSubscriberTestOrder_0100==========createSubscriber promise2");
commonEventSubscriber0101 = data;
data.getSubscribeInfo().then(function (data) {
data.getSubscribeInfo().then(()=>{
console.info("===============ActsSubscriberTestOrder_0100=========getSubscribeInfo promise2");
Subscriber.subscribe(commonEventSubscriber0101, subscriberCallBack0101);
setTimeout(function () {
setTimeout(function(){
console.debug("===================ActsSubscriberTestOrder_0100 delay 100ms==================");
Subscriber.publish("publish_event0100", commonEventPublishData, publishCallback);
}, 100);
......@@ -227,16 +227,16 @@ describe('ActsSubscriberTestOrder', function () {
expect(data.bundleName).assertEqual("publish_event0201_bundleName");
commonEventSubscriber0201.finishCommonEvent().then(()=>{
console.info("===============>subscriberCallBack0201:finishCommonEvent promise");
})
done();
})
}
Subscriber.createSubscriber(
commonEventSubscribeInfo1,
).then(function (data) {
).then((data)=>{
console.info("===============ActsSubscriberTestOrder_0200==========createSubscriber promise1");
commonEventSubscriber0200 = data;
data.getSubscribeInfo().then(function (data) {
data.getSubscribeInfo().then(()=>{
console.info("===============ActsSubscriberTestOrder_0200=========getSubscribeInfo promise1");
Subscriber.subscribe(commonEventSubscriber0200, subscriberCallBack0200);
});
......@@ -244,21 +244,21 @@ describe('ActsSubscriberTestOrder', function () {
Subscriber.createSubscriber(
commonEventSubscribeInfo2,
).then(function (data) {
).then((data)=>{
console.info("===============ActsSubscriberTestOrder_0200==========createSubscriber promise2");
commonEventSubscriber0201 = data;
data.getSubscribeInfo().then(function (data) {
data.getSubscribeInfo().then(()=>{
console.info("===============ActsSubscriberTestOrder_0200=========getSubscribeInfo promise2");
Subscriber.subscribe(commonEventSubscriber0201, subscriberCallBack0201);
setTimeout(function () {
setTimeout(function(){
console.debug("===================ActsSubscriberTestOrder_0200 delay 100ms==================");
Subscriber.unsubscribe(commonEventSubscriber0200, unsubscribeCallback);
}, 100);
setTimeout(function () {
setTimeout(function(){
console.debug("===================ActsSubscriberTestOrder_0200 delay 100ms==================");
Subscriber.publish("publish_event0200", commonEventPublishData1, publishCallback);
}, 100);
setTimeout(function () {
setTimeout(function(){
console.debug("===================ActsSubscriberTestOrder_0200 delay 100ms==================");
Subscriber.publish("publish_event0201", commonEventPublishData2, publishCallback);
}, 100);
......@@ -310,7 +310,7 @@ describe('ActsSubscriberTestOrder', function () {
order = false;
}
commonEventSubscriber0300.isOrderedCommonEvent().then(function(data) {
commonEventSubscriber0300.isOrderedCommonEvent().then((data)=>{
console.info("========>subscriberCallBack0300 isOrderedCommonEvent promise " + data);
expect(data).assertEqual(true);
})
......@@ -340,7 +340,7 @@ describe('ActsSubscriberTestOrder', function () {
order = true;
}
commonEventSubscriber0301.isOrderedCommonEvent().then(function(data) {
commonEventSubscriber0301.isOrderedCommonEvent().then((data)=>{
console.info("===============>subscriberCallBack0301 isOrderedCommonEvent promise" + data);
expect(data).assertEqual(true);
})
......@@ -351,10 +351,10 @@ describe('ActsSubscriberTestOrder', function () {
Subscriber.createSubscriber(
commonEventSubscribeInfo1,
).then(function (data) {
).then((data)=>{
console.info("===============ActsSubscriberTestOrder_0300==========createSubscriber promise1");
commonEventSubscriber0300 = data;
data.getSubscribeInfo().then(function (data) {
data.getSubscribeInfo().then(()=>{
console.info("===============ActsSubscriberTestOrder_0300=========getSubscribeInfo promise1");
Subscriber.subscribe(commonEventSubscriber0300, subscriberCallBack0300);
});
......@@ -362,15 +362,15 @@ describe('ActsSubscriberTestOrder', function () {
Subscriber.createSubscriber(
commonEventSubscribeInfo2,
).then(function (data) {
).then((data)=>{
console.info("===============ActsSubscriberTestOrder_0300==========createSubscriber promise2");
commonEventSubscriber0301 = data;
data.getSubscribeInfo().then(function (data) {
data.getSubscribeInfo().then(()=>{
console.info("===============ActsSubscriberTestOrder_0300=========getSubscribeInfo promise2");
Subscriber.subscribe(commonEventSubscriber0301, subscriberCallBack0301);
var numindex = 0;
for (; numindex < 3; ++numindex) {
setTimeout(function () {
setTimeout(function(){
console.debug("===================ActsSubscriberTestOrder_0300 delay 100ms==================");
Subscriber.publish("publish_event0301", commonEventPublishData2, publishCallback);
}, 100);
......@@ -383,18 +383,18 @@ describe('ActsSubscriberTestOrder', function () {
* @tc.number : ActsSubscriberTestOrder_0400
* @tc.name : verify subscribe and publish : Check subscribe same events
* and publish common ordered events and check abort event
* @tc.desc : Check the subscriber can receive event "publish_event0400" type of the interface (by promise)
* @tc.desc : Check the subscriber can receive event "publish_eventOrder0400" type of the interface by promise
*/
it ('ActsSubscriberTestOrder_0400', 0, async function (done) {
console.info("===============ActsSubscriberTestOrder_0400===============>");
var commonEventSubscribeInfo1 = {
events: ["publish_event0400"],
events: ["publish_eventOrder0400"],
priority: 10
};
var commonEventSubscribeInfo2 = {
events: ["publish_event0400"],
events: ["publish_eventOrder0400"],
priority: 9
};
......@@ -410,24 +410,24 @@ describe('ActsSubscriberTestOrder', function () {
console.info("===============>subscriberCallBack0400========bundleName: " + data.bundleName);
console.info("===============>subscriberCallBack0400=========code: " + data.code);
console.info("===============>subscriberCallBack0400=========data: " + data.data);
expect(data.event).assertEqual("publish_event0400");
expect(data.event).assertEqual("publish_eventOrder0400");
expect(data.code).assertEqual(1);
expect(data.data).assertEqual("publish_event0400_init");
expect(data.bundleName).assertEqual("publish_event0400_bundleName");
commonEventSubscriber0400.getAbortCommonEvent().then(function(data) {
commonEventSubscriber0400.getAbortCommonEvent().then((data)=>{
console.info("===============>subscriberCallBack0400 getAbortCommonEvent promise abort2: " + data);
});
commonEventSubscriber0400.abortCommonEvent().then(() => {
console.info("===============>subscriberCallBack0400 abortCommonEvent promise");
});
commonEventSubscriber0400.getAbortCommonEvent().then(function(data) {
commonEventSubscriber0400.getAbortCommonEvent().then((data)=>{
console.info(
"===============>subscriberCallBack0400 getAbortCommonEvent promise abort2: " + data);
});
commonEventSubscriber0400.finishCommonEvent().then(()=> {
console.info("===============>subscriberCallBack0400 finishCommonEvent promise");
});
done();
});
}
async function subscriberCallBack0401(err, data) {
......@@ -437,28 +437,28 @@ describe('ActsSubscriberTestOrder', function () {
Subscriber.createSubscriber(
commonEventSubscribeInfo1
).then(function (data) {
).then((data)=>{
console.info("===============ActsSubscriberTestOrder_0400==========createSubscriber promise1");
commonEventSubscriber0400 = data;
data.getSubscribeInfo().then(function (data) {
data.getSubscribeInfo().then((data)=>{
console.info("===============ActsSubscriberTestOrder_0400=========getSubscribeInfo promise1");
expect(data.events[0]).assertEqual("publish_event0400");
expect(data.events[0]).assertEqual("publish_eventOrder0400");
Subscriber.subscribe(commonEventSubscriber0400, subscriberCallBack0400);
})
})
Subscriber.createSubscriber(
commonEventSubscribeInfo2
).then(function (data) {
).then((data)=>{
console.info("===============ActsSubscriberTestOrder_0400==========createSubscriber promise2");
commonEventSubscriber0401 = data;
data.getSubscribeInfo().then(function (data) {
data.getSubscribeInfo().then((data)=>{
console.info("===============ActsSubscriberTestOrder_0400=========getSubscribeInfo promise2");
expect(data.events[0]).assertEqual("publish_event0400");
expect(data.events[0]).assertEqual("publish_eventOrder0400");
Subscriber.subscribe(commonEventSubscriber0401, subscriberCallBack0401);
setTimeout(function () {
setTimeout(function(){
console.debug("===================ActsSubscriberTestOrder_0400 delay 100mss==================");
Subscriber.publish("publish_event0400", commonEventPublishData, publishCallback);
Subscriber.publish("publish_eventOrder0400", commonEventPublishData, publishCallback);
}, 100);
})
})
......@@ -467,7 +467,6 @@ describe('ActsSubscriberTestOrder', function () {
/*
* @tc.number : ActsSubscriberTestOrder_0500
* @tc.name : verify subscribe and publish : Check subscriber same events
* and publish common ordered events and check subscriberInfo priority
* @tc.desc : Check the subscriber can receive event "publish_event0500" type of the interface (by promise)
*/
it ('ActsSubscriberTestOrder_0500', 0, async function (done) {
......@@ -515,16 +514,16 @@ describe('ActsSubscriberTestOrder', function () {
expect(data.bundleName).assertEqual("publish_event0500_bundleName");
commonEventSubscriber0501.finishCommonEvent().then(() => {
console.info("===============>subscriberCallBack0501 finishCommonEvent promise");
});
done();
});
}
Subscriber.createSubscriber(
commonEventSubscribeInfo1
).then(function (data) {
).then((data)=>{
console.info("===============ActsSubscriberTestOrder_0500==========createSubscriber promise1");
commonEventSubscriber0500 = data;
data.getSubscribeInfo().then(function (data) {
data.getSubscribeInfo().then((data)=>{
console.info("===============ActsSubscriberTestOrder_0500==========getSubscribeInfo promise1");
expect(data.events[0]).assertEqual("publish_event0500");
Subscriber.subscribe(commonEventSubscriber0500, subscriberCallBack0500);
......@@ -533,14 +532,14 @@ describe('ActsSubscriberTestOrder', function () {
Subscriber.createSubscriber(
commonEventSubscribeInfo2
).then(function (data) {
).then((data)=>{
console.info("===============ActsSubscriberTestOrder_0500==========createSubscriber promise2");
commonEventSubscriber0501 = data;
data.getSubscribeInfo().then(function (data) {
data.getSubscribeInfo().then((data)=>{
console.info("===============ActsSubscriberTestOrder_0500==========getSubscribeInfo promise2");
expect(data.events[0]).assertEqual("publish_event0500");
Subscriber.subscribe(commonEventSubscriber0501, subscriberCallBack0501);
setTimeout(function () {
setTimeout(function(){
console.debug("===================ActsSubscriberTestOrder_0500 delay 100ms==================");
Subscriber.publish("publish_event0500", commonEventPublishData, publishCallback);
}, 100);
......
......@@ -107,6 +107,8 @@ describe('ActsSubscriberTestUnorderSystem', async function (done) {
Subscriber.Support.COMMON_EVENT_AIRPLANE_MODE_CHANGED,
Subscriber.Support.COMMON_EVENT_SMS_RECEIVE_COMPLETED,
Subscriber.Support.COMMON_EVENT_SPN_INFO_UPDATED,
Subscriber.Support.COMMON_EVENT_BOOT_COMPLETED,
Subscriber.Support.COMMON_EVENT_SPLIT_SCREEN
];
function publishCallback(err) {
......@@ -204,15 +206,15 @@ describe('ActsSubscriberTestUnorderSystem', async function (done) {
Subscriber.createSubscriber(
commonEventSubscribeInfo
).then(function (data) {
).then((data)=>{
console.info("===============>ActsSubscriberTestUnorderSystem_0100=========createSubscriber promise");
commonEventSubscriber1 = data;
Subscriber.subscribe(commonEventSubscriber1, subscriberCallBack001);
for (var i = 0; i < 50; ++i) {
console.debug("===============>ActsSubscriberTestUnorderSystem_0100 delay 1s==================");
console.info("Subscriber.publish is run at:" + commonEventSubscribeInfo.events[i]);
console.info("Subscriber type:" + typeof(commonEventSubscribeInfo.events[i]));
for (let i = 0; i < 50; ++i) {
setTimeout(function (){
console.debug("===============>ActsSubscriberTestUnorderSystem_0100 delay 1s=========i:"+i);
Subscriber.publish(commonEventSubscribeInfo.events[i], publishCallback);
}, 1000);
}
})
})
......@@ -281,22 +283,22 @@ describe('ActsSubscriberTestUnorderSystem', async function (done) {
Subscriber.createSubscriber(
commonEventSubscribeInfo
).then(function (data) {
).then((data)=>{
console.info("===============>ActsSubscriberTestUnorderSystem_0200=========createSubscriber promise");
commonEventSubscriber2 = data;
Subscriber.subscribe(commonEventSubscriber2, subscriberCallBack002);
for (var i = 0; i < 36; ++i) {
console.debug("===============>ActsSubscriberTestUnorderSystem_0200 delay 1s==================");
console.info("Subscriber.publish is run at:" + commonEventSubscribeInfo.events[i]);
console.info("Subscriber type:" + typeof(commonEventSubscribeInfo.events[i]));
for (let i = 0; i < 36; ++i) {
setTimeout(function (){
console.debug("===============>ActsSubscriberTestUnorderSystem_0200 delay 1s===========i:"+i);
Subscriber.publish(commonEventSubscribeInfo.events[i], publishCallback);
}, 1000);
}
})
})
/*
* @tc.number : ActsSubscriberTestUnorderSystem_0300
* @tc.name : verify subscribe and publish : Check subscribe and publish system event data with permission
* @tc.name : verify subscribe and publish : Check subscribe and publish system event data without permission
* : including multiple permissions
* @tc.desc : Check the subscriber can receive event "publish_event0100" type of the interface (by Promise)
*/
......@@ -375,7 +377,7 @@ describe('ActsSubscriberTestUnorderSystem', async function (done) {
Subscriber.createSubscriber(
commonEventSubscribeInfo
).then(function (data) {
).then((data)=>{
console.info("===============>ActsSubscriberTestUnorderSystem_0300=========createSubscriber promise");
commonEventSubscriber3 = data;
Subscriber.subscribe(commonEventSubscriber3, subscriberCallBack003);
......
......@@ -24,41 +24,16 @@
"moduleName": "entry",
"moduleType": "entry"
},
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "publish_event0700_permission"
},
{
"availableScope": [],
"grantMode": "system_grant",
"name": "publish_event0800_publisherPermission"
},
{
"availableScope": [],
"grantMode": "system_grant",
"name": "publish_event0900_permission"
},
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.COMMONEVENT_STICKY"
}
],
"reqPermissions": [
{
"name": "publish_event0700_permission",
"reason": "ceshi"
"name": "ohos.permission.USE_BLUETOOTH",
"reason": "use ohos.permission.USE_BLUETOOTH"
},
{
"name": "publish_event0800_publisherPermission",
"reason": "ceshi"
},
{
"name": "publish_event0900_permission",
"reason": "ceshi"
},
{
"name": "ohos.permission.COMMONEVENT_STICKY",
"reason": "ceshi"
......
......@@ -24,9 +24,7 @@ describe('ActsSubscriberTestUnorder', async function (done) {
var commonEventSubscriber0051;
var commonEventSubscriber0052;
var commonEventSubscriber006;
var commonEventSubscriber007;
var commonEventSubscriber008;
var commonEventSubscriber009;
var commonEventSubscriber0101;
var commonEventSubscriber0102;
var commonEventSubscriber011;
......@@ -70,10 +68,10 @@ describe('ActsSubscriberTestUnorder', async function (done) {
Subscriber.createSubscriber(
commonEventSubscribeInfo
).then(function (data) {
).then((data)=>{
console.info("===============ActsSubscriberTestUnorder_0100=========createSubscriber promise");
commonEventSubscriber001 = data;
data.getSubscribeInfo().then(function (data){
data.getSubscribeInfo().then(()=>{
console.info("===============ActsSubscriberTestUnorder_0100=========getSubscribeInfo promise");
Subscriber.subscribe(commonEventSubscriber001, subscriberCallBack001);
setTimeout(function (){
......@@ -108,10 +106,10 @@ describe('ActsSubscriberTestUnorder', async function (done) {
Subscriber.createSubscriber(
commonEventSubscribeInfo
).then(function (data) {
).then((data)=>{
console.info("===============ActsSubscriberTestUnorder_0200=========createSubscriber promise");
commonEventSubscriber002 = data;
data.getSubscribeInfo().then(function (data){
data.getSubscribeInfo().then(()=>{
console.info("===============ActsSubscriberTestUnorder_0200=========getSubscribeInfo promise");
Subscriber.subscribe(commonEventSubscriber002, subscriberCallBack002);
setTimeout(function (){
......@@ -160,10 +158,10 @@ describe('ActsSubscriberTestUnorder', async function (done) {
Subscriber.createSubscriber(
commonEventSubscribeInfo
).then(function (data) {
).then((data)=>{
console.info("===============ActsSubscriberTestUnorder_0300=========createSubscriber promise");
commonEventSubscriber003 = data;
data.getSubscribeInfo().then(function (data) {
data.getSubscribeInfo().then(()=>{
console.info("===============ActsSubscriberTestUnorder_0300=========getSubscribeInfo promise");
Subscriber.subscribe(commonEventSubscriber003, subscriberCallBack003);
setTimeout(function (){
......@@ -182,7 +180,7 @@ describe('ActsSubscriberTestUnorder', async function (done) {
it('ActsSubscriberTestUnorder_0400', 0, async function (done) {
console.info("===============ActsSubscriberTestUnorder_0400==========================>");
var commonEventSubscribeInfo = {
events: ["publish_event0400"]
events: ["publish_eventSticky0400"]
};
var commonEventPublishData = {
......@@ -198,7 +196,7 @@ describe('ActsSubscriberTestUnorder', async function (done) {
function subscriberCallBack004(err, data) {
console.info("==========================>subscriberCallBack0400");
expect(data.event).assertEqual("publish_event0400");
expect(data.event).assertEqual("publish_eventSticky0400");
expect(data.bundleName).assertEqual("");
expect(data.code).assertEqual(0);
expect(data.data).assertEqual("");
......@@ -207,15 +205,15 @@ describe('ActsSubscriberTestUnorder', async function (done) {
Subscriber.createSubscriber(
commonEventSubscribeInfo
).then(function (data) {
).then((data)=>{
console.info("===============ActsSubscriberTestUnorder_0400=========createSubscriber promise");
commonEventSubscriber004 = data;
data.getSubscribeInfo().then(function (data){
data.getSubscribeInfo().then(()=>{
console.info("===============ActsSubscriberTestUnorder_0400=========getSubscribeInfo promise");
Subscriber.subscribe(commonEventSubscriber004, subscriberCallBack004);
setTimeout(function (){
console.info("==========ActsSubscriberTestUnorder_0400 publish start============");
Subscriber.publish("publish_event0400", commonEventPublishData, publishCallback);
Subscriber.publish("publish_eventSticky0400", commonEventPublishData, publishCallback);
}, 1000);
});
})
......@@ -249,10 +247,10 @@ describe('ActsSubscriberTestUnorder', async function (done) {
Subscriber.createSubscriber(
commonEventSubscribeInfo
).then(function (data) {
).then((data)=>{
console.info("===============ActsSubscriberTestUnorder_0500_1=========createSubscriber promise");
commonEventSubscriber0051 = data;
data.getSubscribeInfo().then(function (data) {
data.getSubscribeInfo().then(()=>{
console.info("===============ActsSubscriberTestUnorder_0500_1=========getSubscribeInfo promise");
Subscriber.subscribe(commonEventSubscriber0051, subscriberCallBack005);
});
......@@ -260,10 +258,10 @@ describe('ActsSubscriberTestUnorder', async function (done) {
Subscriber.createSubscriber(
commonEventSubscribeInfo
).then(function (data) {
).then((data)=>{
console.info("===============ActsSubscriberTestUnorder_0500_2=========createSubscriber promise");
commonEventSubscriber0052 = data;
data.getSubscribeInfo().then(function (data) {
data.getSubscribeInfo().then(()=>{
console.info("===============ActsSubscriberTestUnorder_0500_2=========getSubscribeInfo promise");
Subscriber.subscribe(commonEventSubscriber0052, subscriberCallBack005);
Subscriber.unsubscribe(commonEventSubscriber0051, unsubscriberCallBack);
......@@ -309,11 +307,11 @@ describe('ActsSubscriberTestUnorder', async function (done) {
console.info("===============ActsSubscriberTestUnorder_0600 11111111111111==========================>");
Subscriber.createSubscriber(
commonEventSubscribeInfo
).then(function (data) {
).then((data)=>{
console.info("===============ActsSubscriberTestUnorder_0600=========createSubscriber promise");
commonEventSubscriber006 = data;
console.info("===============ActsSubscriberTestUnorder_0600 22222222222222==========================>");
data.getSubscribeInfo().then(function (data) {
data.getSubscribeInfo().then(()=>{
console.info("===============ActsSubscriberTestUnorder_0700=========getSubscribeInfo promise");
Subscriber.subscribe(commonEventSubscriber006, subscriberCallBack006);
setTimeout(function (){
......@@ -325,49 +323,6 @@ describe('ActsSubscriberTestUnorder', async function (done) {
})
})
/*
* @tc.number : ActsSubscriberTestUnorder_0700
* @tc.name : verify subscribe and publish : Check subscribe and publish common event with permission
* @tc.desc : Check the subscriber can receive event "publish_event0700" type of the interface (by Promise)
*/
it('ActsSubscriberTestUnorder_0700', 0, async function (done) {
console.info("===============ActsSubscriberTestUnorder_0700==========================>");
var commonEventSubscribeInfo = {
events: ["publish_event0700"],
publisherPermission:"publish_event0700_permission"
};
var commonEventPublishData = {
subscriberPermissions:["publish_event0700_permission"],
isOrdered: false,
isSticky: false,
}
function subscriberCallBack007(err, data) {
console.info("==========================>subscriberCallBack0700");
expect(data.event).assertEqual("publish_event0700");
expect(data.bundleName).assertEqual("");
expect(data.code).assertEqual(0);
expect(data.data).assertEqual("");
done();
}
Subscriber.createSubscriber(
commonEventSubscribeInfo
).then(function (data) {
console.info("=================ActsSubscriberTestUnorder_0700=========createSubscriberPromise0700");
commonEventSubscriber007 = data;
data.getSubscribeInfo().then(function (data) {
console.info("===============ActsSubscriberTestUnorder_0700=========getSubscribeInfo promise");
Subscriber.subscribe(commonEventSubscriber007, subscriberCallBack007);
setTimeout(function (){
console.info("==========ActsSubscriberTestUnorder_0700 publish start============");
Subscriber.publish("publish_event0700", commonEventPublishData, publishCallback);
}, 1000);
});
});
})
/*
* @tc.number : ActsSubscriberTestUnorder_0800
* @tc.name : verify subscribe and publish : Check subscribe and publish common event
......@@ -395,8 +350,7 @@ describe('ActsSubscriberTestUnorder', async function (done) {
function sleep(delay) {
var start = (new Date()).getTime();
while((new Date()).getTime() - start < delay) {
continue;
while ((new Date()).getTime() - start < delay) {
}
done();
}
......@@ -413,10 +367,10 @@ describe('ActsSubscriberTestUnorder', async function (done) {
Subscriber.createSubscriber(
commonEventSubscribeInfo
).then(function (data) {
).then((data)=>{
console.info("==========================>createSubscriberPromise0800=======================>");
commonEventSubscriber008 = data;
data.getSubscribeInfo().then(function (data) {
data.getSubscribeInfo().then(()=>{
console.info("===============ActsSubscriberTestUnorder_0800=========getSubscribeInfo promise");
Subscriber.subscribe(commonEventSubscriber008, subscriberCallBack008);
setTimeout(function (){
......@@ -429,55 +383,6 @@ describe('ActsSubscriberTestUnorder', async function (done) {
sleep(1000);
})
/*
* @tc.number : ActsSubscriberTestUnorder_0900
* @tc.name : verify subscribe and publish : Check subscribe and publish sticky event
* with publishpermission and check IsStickyCommonEvent
* @tc.desc : Check the subscriber can receive event "publish_event0900" type of the interface (by Promise)
*/
it('ActsSubscriberTestUnorder_0900', 0, async function (done) {
console.info("===============ActsSubscriberTestUnorder_0900==========================>");
var commonEventSubscribeInfo = {
events: ["publish_event0900"]
};
var commonEventPublishData = {
subscriberPermissions:["publish_event0900_permission"],
isOrdered: false,
isSticky: true
}
function isStickyCommonEventCallback009(err, data) {
console.info("==========================>isStickyCommonEventCallback009");
expect(data).assertEqual(true);
done();
}
function subscriberCallBack009(err, data) {
console.info("==========================>subscriberCallBack0900");
expect(data.event).assertEqual("publish_event0900");
expect(data.bundleName).assertEqual("");
expect(data.code).assertEqual(0);
expect(data.data).assertEqual("");
commonEventSubscriber009.isStickyCommonEvent(isStickyCommonEventCallback009);
}
Subscriber.createSubscriber(
commonEventSubscribeInfo
).then(function (data) {
console.info("==========================>createSubscriberPromise0900=======================>");
commonEventSubscriber009 = data;
data.getSubscribeInfo().then(function (data) {
console.info("===============ActsSubscriberTestUnorder_0900=========getSubscribeInfo promise=");
Subscriber.subscribe(commonEventSubscriber009, subscriberCallBack009);
setTimeout(function (){
console.info("==========ActsSubscriberTestUnorder_0900 publish start============");
Subscriber.publish("publish_event0900", commonEventPublishData, publishCallback);
}, 1000);
});
});
})
/*
* @tc.number : ActsSubscriberTestUnorder_1000
* @tc.name : verify subscribe and publish : Check different subscribes and publish different common event
......@@ -524,7 +429,7 @@ describe('ActsSubscriberTestUnorder', async function (done) {
expect(data.data).assertEqual("publish_event1000_data");
if (num == 0) {
num++;
}else if (num == 1) {
} else if (num == 1) {
done();
}
}
......@@ -539,28 +444,24 @@ describe('ActsSubscriberTestUnorder', async function (done) {
expect(data.data).assertEqual("publish_event1000_data");
if (num == 0) {
num++;
}else if (num == 1) {
} else if (num == 1) {
done();
}
}
Subscriber.createSubscriber(
commonEventSubscribeInfo1
).then(function (data) {
Subscriber.createSubscriber(commonEventSubscribeInfo1).then((data)=>{
console.info("=================ActsSubscriberTestUnorder_1000=========>createSubscriber Promise1000_1");
commonEventSubscriber0101 = data;
data.getSubscribeInfo().then(function (data) {
data.getSubscribeInfo().then(()=>{
console.info("===============ActsSubscriberTestUnorder_1000=========getSubscribeInfo promise1000_1");
Subscriber.subscribe(commonEventSubscriber0101, subscriberCallBack0101);
});
});
Subscriber.createSubscriber(
commonEventSubscribeInfo2
).then(function (data) {
Subscriber.createSubscriber(commonEventSubscribeInfo2).then((data)=>{
console.info("=================ActsSubscriberTestUnorder_1000=========>createSubscriber Promise1000_2");
commonEventSubscriber0102 = data;
data.getSubscribeInfo().then(function (data) {
data.getSubscribeInfo().then(()=>{
console.info("===============ActsSubscriberTestUnorder_1000=========getSubscribeInfo promise1000_2");
Subscriber.subscribe(commonEventSubscriber0102, subscriberCallBack0102);
setTimeout(function (){
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册