提交 9a4f3692 编写于 作者: Z zhaoyuan17

Add sleep to delay major thread next do

Signed-off-by: Nzhaoyuan17 <zhaoyuan17@huawei.com>
上级 a796de4a
......@@ -23,6 +23,13 @@ describe('ActsSubscriberTestUnorderSystem', async function (done) {
console.info("==========================>publishCallback");
}
function sleep(delay) {
var start = (new Date()).getTime();
while((new Date()).getTime() - start < delay) {
continue;
}
}
/*
* @tc.number : ActsSubscriberTestUnorderSystem_0100
* @tc.name : verify subscribe and publish : Check subscribe and publish common event data
......@@ -32,7 +39,7 @@ describe('ActsSubscriberTestUnorderSystem', async function (done) {
it('ActsSubscriberTestUnorderSystem_0100', 0, async function (done) {
console.info("===============ActsSubscriberTestUnorderSystem_0100==========================>");
var commonEventSubscribeInfo = {
events: ["publish_event0100"],
events: ["Subscriber.Support.COMMON_EVENT_BATTERY_CHANGED"],
publisherDeviceId: "PublishDeviceId0100",
priority: 10,
};
......@@ -52,7 +59,7 @@ describe('ActsSubscriberTestUnorderSystem', async function (done) {
function subscriberCallBack001(err, data) {
console.info("==========================>subscriberCallBack001");
expect(data.event).assertEqual("publish_event0100");
expect(data.event).assertEqual("Subscriber.Support.COMMON_EVENT_BATTERY_CHANGED");
expect(data.bundleName).assertEqual("PublishBundleName0100");
expect(data.code).assertEqual(55);
expect(data.data).assertEqual("PublishData0100");
......@@ -67,7 +74,10 @@ describe('ActsSubscriberTestUnorderSystem', async function (done) {
data.getSubscribeInfo().then(function (data) {
console.info("===============ActsSubscriberTestUnorderSystem_0100=========getSubscribeInfo promise");
Subscriber.subscribe(commonEventSubscriber, subscriberCallBack001);
Subscriber.publish("publish_event0100", commonEventPublishData, publishCallback);
sleep(10);
Subscriber.publish("Subscriber.Support.COMMON_EVENT_BATTERY_CHANGED",
commonEventPublishData,
publishCallback);
});
})
setTimeout(function (){
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册