Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
566f5de2
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
大约 1 年 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
566f5de2
编写于
4月 29, 2022
作者:
O
openharmony_ci
提交者:
Gitee
4月 29, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3088 【XTS】【事件通知子系统】release部分整改
Merge pull request !3088 from zhijianwen/OpenHarmony-3.1-Release
上级
09fd2325
e7154460
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
4 addition
and
767 deletion
+4
-767
notification/ans_standard/BUILD.gn
notification/ans_standard/BUILD.gn
+1
-1
notification/ans_standard/publish_test/BUILD.gn
notification/ans_standard/publish_test/BUILD.gn
+3
-3
notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/ActsAnsPublishInput.js
...ctivebutton/entry/src/main/js/test/ActsAnsPublishInput.js
+0
-126
notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/List.test.js
...ctivebtn/activebutton/entry/src/main/js/test/List.test.js
+0
-1
notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/publishIcon.js
...ivebtn/activebutton/entry/src/main/js/test/publishIcon.js
+0
-129
notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/publishImage.js
...vebtn/activebutton/entry/src/main/js/test/publishImage.js
+0
-92
notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/entry/src/main/js/test/ActsSubscriber_test_unorder.js
...est/entry/src/main/js/test/ActsSubscriber_test_unorder.js
+0
-75
notification/ces_standard/subscribeandpublish/actssubscriberunordertest/entry/src/main/js/test/ActsSubscriber_test_unorder.js
...est/entry/src/main/js/test/ActsSubscriber_test_unorder.js
+0
-340
未找到文件。
notification/ans_standard/BUILD.gn
浏览文件 @
566f5de2
...
...
@@ -17,7 +17,7 @@ group("ans_standard") {
if (is_standard_system) {
deps = [
#"actsansnotificationcancel:ActsAnsNotificationCancelTest",
"actsansnotificationremove:ActsAnsNotificationRemoveTest",
#
"actsansnotificationremove:ActsAnsNotificationRemoveTest",
"actsansslottest:ActsAnsSlotTest",
"publish_test:publish_test",
]
...
...
notification/ans_standard/publish_test/BUILD.gn
浏览文件 @
566f5de2
...
...
@@ -16,8 +16,8 @@ group("publish_test") {
testonly = true
if (is_standard_system) {
deps = [
"actsanspublishcontroltest:ActsAnsPublishControlTest",
"actsanspublishconversation:ActsAnsConversationTest",
#
"actsanspublishcontroltest:ActsAnsPublishControlTest",
#
"actsanspublishconversation:ActsAnsConversationTest",
"badgedisplayed:badgedisplayed",
"enablenotification:enablenotification",
"getactive:getactive",
...
...
@@ -32,7 +32,7 @@ group("publish_test") {
"ansactscancelgroup:ActsAnsCancelGroupTest",
"ansactsremovegroup:ActsAnsRemoveGroupTest",
"donotdisturbmode:ActsAnsDoNotDisturbTest",
"publish:ActsAnsNotificationPublishXts",
#
"publish:ActsAnsNotificationPublishXts",
"publishsound:ActsAnsPublishSoundTest",
#"publishvibra:ActsAnsPublishVibraTest",
...
...
notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/ActsAnsPublishInput.js
已删除
100644 → 0
浏览文件 @
09fd2325
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
notify
from
'
@ohos.notification
'
;
import
{
OperationType
,
WantAgentFlags
}
from
'
@ohos.wantagent
'
;
import
wantagent
from
'
@ohos.wantAgent
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
var
timeout
=
300
;
describe
(
'
ActsAnsPublishInput
'
,
function
()
{
console
.
info
(
"
===========ActsAnsPublishInput start====================>
"
);
function
onConsumeOne
(
data
)
{
console
.
info
(
"
=========Ans_PublishInput_0100 onConsume start==============>
"
);
console
.
info
(
"
=========Ans_PublishInput_0100 onConsume data:==============>
"
+
JSON
.
stringify
(
data
));
var
inputKey
=
data
.
request
.
actionButtons
[
0
].
userInput
.
inputKey
var
tag
=
data
.
request
.
actionButtons
[
0
].
userInput
.
tag
var
options
=
data
.
request
.
actionButtons
[
0
].
userInput
.
options
var
permitMimeTypes
=
data
.
request
.
actionButtons
[
0
].
userInput
.
permitMimeTypes
var
editType
=
data
.
request
.
actionButtons
[
0
].
userInput
.
editType
var
additionalData
=
data
.
request
.
actionButtons
[
0
].
userInput
.
additionalData
console
.
info
(
"
=========Ans_PublishInput_0100 onConsume inputKey================>
"
+
inputKey
);
console
.
info
(
"
=========Ans_PublishInput_0100 onConsume tag================>
"
+
tag
);
console
.
info
(
"
=========Ans_PublishInput_0100 onConsume options================>
"
+
options
);
console
.
info
(
"
=========Ans_PublishInput_0100 onConsume permitMimeTypes================>
"
+
permitMimeTypes
);
console
.
info
(
"
=========Ans_PublishInput_0100 onConsume editType================>
"
+
editType
);
expect
(
inputKey
).
assertEqual
(
"
inputKey_0100
"
);
expect
(
tag
).
assertEqual
(
"
tag_0100
"
);
expect
(
JSON
.
stringify
(
options
)).
assertEqual
(
JSON
.
stringify
([
"
options_0100
"
]));
expect
(
JSON
.
stringify
(
permitMimeTypes
)).
assertEqual
(
JSON
.
stringify
([
"
permitMimeTypes_0100
"
]));
expect
(
editType
).
assertEqual
(
1
);
expect
(
additionalData
.
key0100
).
assertEqual
(
"
0100
"
);
console
.
info
(
"
=========Ans_PublishInput_0100 onConsume end================>
"
);
}
/*
* @tc.number: Ans_PublishInput_0100
* @tc.name: publish(request: NotificationRequest): Promise<void>;
* @tc.desc: Verify that the inputKey information can be received in the received notification.
*/
it
(
'
Ans_PublishInput_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
==================Ans_PublishInput_0100 start==================>
"
);
var
subscriber
=
{
onConsume
:
onConsumeOne
,
}
var
agentInfo
=
{
wants
:
[
{
deviceId
:
"
deviceId
"
,
bundleName
:
"
com.example.actsanspublishinput
"
,
abilityName
:
"
com.example.actsanspublishinput.MainAbility
"
,
action
:
"
action1
"
,
entities
:
[
"
entity1
"
],
type
:
"
MIMETYPE
"
,
uri
:
"
key={true,true,false}
"
,
parameters
:
{
mykey0
:
2222
,
mykey1
:
[
1
,
2
,
3
],
mykey2
:
"
[1, 2, 3]
"
,
mykey3
:
"
ssssssssssssssssssssssssss
"
,
mykey4
:
[
false
,
true
,
false
],
mykey5
:
[
"
qqqqq
"
,
"
wwwwww
"
,
"
aaaaaaaaaaaaaaaaa
"
],
mykey6
:
true
,
}
}
],
operationType
:
OperationType
.
START_ABILITY
,
requestCode
:
0
,
wantAgentFlags
:[
WantAgentFlags
.
UPDATE_PRESENT_FLAG
]
};
var
wantAgentData
=
await
wantagent
.
getWantAgent
(
agentInfo
);
console
.
info
(
"
===========Ans_PublishInput_0100 getWantAgent promise======>
"
);
var
notificationRequest
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_LONG_TEXT
,
longText
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
,
longText
:
"
long_text
"
,
briefText
:
"
long_briefText
"
,
expandedTitle
:
"
long_expandedTitle
"
},
},
id
:
1
,
slotType
:
notify
.
SlotType
.
SERVICE_INFORMATION
,
wantAgent
:
wantAgentData
,
actionButtons
:
[
{
title
:
"
button1
"
,
wantAgent
:
wantAgentData
,
userInput
:
{
inputKey
:
"
inputKey_0100
"
,
tag
:
"
tag_0100
"
,
options
:
[
"
options_0100
"
],
permitMimeTypes
:[
"
permitMimeTypes_0100
"
],
editType
:
1
,
additionalData
:{
"
key0100
"
:
"
0100
"
}
}
}]
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
===========Ans_PublishInput_0100 subscribe promise======>
"
);
await
notify
.
publish
(
notificationRequest
);
console
.
info
(
"
===========Ans_PublishInput_0100 publish promise========>
"
);
setTimeout
((
async
function
(){
console
.
info
(
"
======Ans_PublishInput_0100 setTimeout==============>
"
);
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======Ans_PublishInput_0100 setTimeout unsubscribe==>
"
);
done
();
}),
timeout
);
})
})
\ No newline at end of file
notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/List.test.js
浏览文件 @
566f5de2
...
...
@@ -14,5 +14,4 @@
*/
require
(
'
./publishIcon.js
'
)
require
(
'
./publishImage.js
'
)
require
(
'
./ActsAnsPublishInput.js
'
)
require
(
'
./ActiveButton.js
'
)
notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/publishIcon.js
浏览文件 @
566f5de2
...
...
@@ -71,135 +71,6 @@ describe('ActsAnsPublishIconTest', function () {
expect
(
err
.
code
).
assertEqual
(
0
)
}
/*
* @tc.number: ACTS_PublishIconTest_0100
* @tc.name: publish()
* @tc.desc: verify the function of publish
*/
it
(
'
ACTS_PublishIconTest_0100
'
,
0
,
async
function
(
done
)
{
var
subInfo
=
{
onConsume
:
consumeCallbackA
,
}
await
notification
.
subscribe
(
subInfo
,
subscribeCallbackA
);
largeBufferA
=
new
ArrayBuffer
(
4
*
100
*
100
);
smallBufferA
=
new
ArrayBuffer
(
4
*
2
*
25
);
largeOptsA
=
{
alphaType
:
0
,
editable
:
true
,
pixelFormat
:
4
,
scaleMode
:
1
,
size
:
{
height
:
100
,
width
:
100
}}
smallOptsA
=
{
alphaType
:
0
,
editable
:
true
,
pixelFormat
:
4
,
scaleMode
:
1
,
size
:
{
height
:
25
,
width
:
2
}}
const
promise_Large
=
image
.
createPixelMap
(
largeBufferA
,
largeOptsA
);
promise_Large
.
then
((
data
)
=>
{
largeIconA
=
data
;
console
.
debug
(
"
===createPixelMapA largeIcon===>
"
+
JSON
.
stringify
(
largeIconA
));
const
promise_Small
=
image
.
createPixelMap
(
smallBufferA
,
smallOptsA
);
promise_Small
.
then
((
data
)
=>
{
smallIconA
=
data
;
console
.
debug
(
"
===createPixelMapA smallIcon===>
"
+
JSON
.
stringify
(
smallIconA
));
notification
.
publish
({
content
:{
contentType
:
notification
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_titleA
"
,
text
:
"
test_textA
"
,
additionalText
:
"
test_additionalTextA
"
},
},
id
:
1
,
slotType
:
notification
.
SlotType
.
OTHER_TYPES
,
isOngoing
:
true
,
isUnremovable
:
false
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
0100_1
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
smallIcon
:
smallIconA
,
largeIcon
:
largeIconA
,
},
publishCallbackA
);
setTimeout
((
async
function
(){
notification
.
unsubscribe
(
subInfo
);
console
.
info
(
"
======ActsPublishImage_test_0100 setTimeout unsubscribe===>
"
);
done
();
}),
300
);
})
});
});
/*
* @tc.number: ACTS_PublishTest_0200
* @tc.name: publish()
* @tc.desc: verify the function of publish
*/
it
(
'
ACTS_PublishIconTest_0200
'
,
0
,
async
function
(
done
)
{
var
subInfo
=
{
onConsume
:
consumeCallbackB
,
}
await
notification
.
subscribe
(
subInfo
,
subscribeCallbackB
);
largeBufferB
=
new
ArrayBuffer
(
4
*
200
*
50
);
smallBufferB
=
new
ArrayBuffer
(
4
*
2
*
25
);
largeOptsB
=
{
alphaType
:
0
,
editable
:
true
,
pixelFormat
:
4
,
scaleMode
:
1
,
size
:
{
height
:
50
,
width
:
200
}}
smallOptsB
=
{
alphaType
:
0
,
editable
:
true
,
pixelFormat
:
4
,
scaleMode
:
1
,
size
:
{
height
:
25
,
width
:
2
}}
const
promise_Large
=
image
.
createPixelMap
(
largeBufferB
,
largeOptsB
);
promise_Large
.
then
((
data
)
=>
{
largeIconB
=
data
;
console
.
debug
(
"
===createPixelMapB largeIcon===>
"
+
JSON
.
stringify
(
largeIconB
));
const
promise_Small
=
image
.
createPixelMap
(
smallBufferB
,
smallOptsB
);
promise_Small
.
then
((
data
)
=>
{
smallIconB
=
data
;
console
.
debug
(
"
===createPixelMapB smallIcon===>
"
+
JSON
.
stringify
(
smallIconB
));
notification
.
publish
({
content
:{
contentType
:
notification
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_titleB
"
,
text
:
"
test_textB
"
,
additionalText
:
"
test_additionalTextB
"
},
},
id
:
2
,
slotType
:
notification
.
SlotType
.
OTHER_TYPES
,
isOngoing
:
true
,
isUnremovable
:
false
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
0100_1
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
smallIcon
:
smallIconB
,
largeIcon
:
largeIconB
,
}).
then
(()
=>
{
console
.
debug
(
"
===ACTS_PublishIconTest_0200 promise===>
"
);
});
setTimeout
((
async
function
(){
notification
.
unsubscribe
(
subInfo
);
console
.
info
(
"
======ActsPublishImage_test_0200 setTimeout unsubscribe===>
"
);
done
();
}),
300
);
})
});
});
/*
* @tc.number: ACTS_PublishIconTest_0300
...
...
notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/publishImage.js
浏览文件 @
566f5de2
...
...
@@ -57,99 +57,7 @@ describe('ActsAnsPublishImageTest', function () {
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
}
/*
* @tc.number: ActsPublishImage_test_0100
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it
(
'
ActsPublishImage_test_0100
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
===ActsDoNotSubscriber_test_0100===begin===>
"
);
var
subInfo
=
{
onConsume
:
consumeCallbackA
,
}
await
notify
.
subscribe
(
subInfo
,
subscribeCallbackA
);
BufferA
=
new
ArrayBuffer
(
32
);
optsA
=
{
alphaType
:
0
,
editable
:
true
,
pixelFormat
:
4
,
scaleMode
:
1
,
size
:
{
height
:
2
,
width
:
3
}}
const
promise_Large
=
image
.
createPixelMap
(
BufferA
,
optsA
);
promise_Large
.
then
((
data
)
=>
{
pubimageA
=
data
;
console
.
debug
(
"
===createPixelMapA image===>
"
+
pubimageA
);
notify
.
publish
({
id
:
1
,
content
:
{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_PICTURE
,
picture
:
{
title
:
"
image_titleA
"
,
text
:
"
image_textA
"
,
additionalText
:
"
image_additionalTextA
"
,
briefText
:
"
image_briefA
"
,
expandedTitle
:
"
expandedTitleA
"
,
picture
:
pubimageA
},
},
slotType
:
notify
.
SlotType
.
SOCIAL_COMMUNICATION
,
classification
:
"
classificationA
"
,
sortingKey
:
"
sortingKeyA
"
,
},
publishCallbackA
);
setTimeout
((
async
function
(){
notify
.
unsubscribe
(
subInfo
);
console
.
info
(
"
======ActsPublishImage_test_0100 setTimeout unsubscribe===>
"
);
done
();
}),
300
);
})
})
/*
* @tc.number: ActsPublishImage_test_0200
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it
(
'
ActsPublishImage_test_0200
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
===ActsPublishImage_test_0200===begin===>
"
);
var
subInfo
=
{
onConsume
:
consumeCallbackB
,
}
await
notify
.
subscribe
(
subInfo
,
subscribeCallbackB
);
BufferB
=
new
ArrayBuffer
(
32
);
optsB
=
{
alphaType
:
0
,
editable
:
true
,
pixelFormat
:
4
,
scaleMode
:
1
,
size
:
{
height
:
2
,
width
:
3
}}
const
promise_Large
=
image
.
createPixelMap
(
BufferB
,
optsB
);
promise_Large
.
then
((
data
)
=>
{
pubimageB
=
data
;
console
.
debug
(
"
===createPixelMapB image===>
"
+
pubimageB
);
notify
.
publish
({
id
:
2
,
content
:
{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_PICTURE
,
picture
:
{
title
:
"
image_titleB
"
,
text
:
"
image_textB
"
,
additionalText
:
"
image_additionalTextB
"
,
briefText
:
"
image_briefB
"
,
expandedTitle
:
"
expandedTitleB
"
,
picture
:
pubimageB
},
},
slotType
:
notify
.
SlotType
.
SOCIAL_COMMUNICATION
,
classification
:
"
classificationB
"
,
sortingKey
:
"
sortingKeyB
"
,
}).
then
(()
=>
{
console
.
debug
(
"
===ActsPublishImage_test_0200 promise===>
"
)
})
setTimeout
((
async
function
(){
notify
.
unsubscribe
(
subInfo
);
console
.
info
(
"
===ActsPublishImage_test_0200 setTimeout unsubscribe===>
"
);
done
();
}),
300
);
})
})
/*
* @tc.number: ActsPublishImage_test_0300
...
...
notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/entry/src/main/js/test/ActsSubscriber_test_unorder.js
浏览文件 @
566f5de2
...
...
@@ -219,82 +219,7 @@ describe('ActsSubscriberTestUnorderSystem', async function (done) {
})
})
/*
* @tc.number : ActsSubscriberTestUnorderSystem_0200
* @tc.name : verify subscribe and publish : Check subscribe and publish system event data without permission
* @tc.desc : Check the subscriber can receive event "publish_event0100" type of the interface (by Promise)
*/
it
(
'
ActsSubscriberTestUnorderSystem_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestUnorderSystem_0200 start==========================>
"
);
let
commonEventSubscribeInfo
=
{
events
:
[
Subscriber
.
Support
.
COMMON_EVENT_WIFI_HOTSPOT_STATE
,
Subscriber
.
Support
.
COMMON_EVENT_BLUETOOTH_A2DPSOURCE_AVRCP_CONNECT_STATE_UPDATE
,
Subscriber
.
Support
.
COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_SDP_RESULT
,
Subscriber
.
Support
.
COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_CANCEL
,
Subscriber
.
Support
.
COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REQ
,
Subscriber
.
Support
.
COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REPLY
,
Subscriber
.
Support
.
COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_CANCEL
,
Subscriber
.
Support
.
COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_CONNECT_STATE_UPDATE
,
Subscriber
.
Support
.
COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AUDIO_STATE_UPDATE
,
Subscriber
.
Support
.
COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_COMMON_EVENT
,
Subscriber
.
Support
.
COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_CALL_STATE_UPDATE
,
Subscriber
.
Support
.
COMMON_EVENT_BLUETOOTH_HOST_REQ_DISCOVERABLE
,
Subscriber
.
Support
.
COMMON_EVENT_NFC_ACTION_ADAPTER_STATE_CHANGED
,
Subscriber
.
Support
.
COMMON_EVENT_DISCHARGING
,
Subscriber
.
Support
.
COMMON_EVENT_CHARGING
,
Subscriber
.
Support
.
COMMON_EVENT_DEVICE_IDLE_MODE_CHANGED
,
Subscriber
.
Support
.
COMMON_EVENT_POWER_SAVE_MODE_CHANGED
,
Subscriber
.
Support
.
COMMON_EVENT_LOCATION_MODE_STATE_CHANGED
,
Subscriber
.
Support
.
COMMON_EVENT_IVI_SLEEP
,
Subscriber
.
Support
.
COMMON_EVENT_IVI_PAUSE
,
Subscriber
.
Support
.
COMMON_EVENT_IVI_STANDBY
,
Subscriber
.
Support
.
COMMON_EVENT_IVI_LASTMODE_SAVE
,
Subscriber
.
Support
.
COMMON_EVENT_IVI_VOLTAGE_ABNORMAL
,
Subscriber
.
Support
.
COMMON_EVENT_IVI_HIGH_TEMPERATURE
,
Subscriber
.
Support
.
COMMON_EVENT_IVI_EXTREME_TEMPERATURE
,
Subscriber
.
Support
.
COMMON_EVENT_IVI_TEMPERATURE_ABNORMAL
,
Subscriber
.
Support
.
COMMON_EVENT_IVI_VOLTAGE_RECOVERY
,
Subscriber
.
Support
.
COMMON_EVENT_IVI_TEMPERATURE_RECOVERY
,
Subscriber
.
Support
.
COMMON_EVENT_IVI_ACTIVE
,
Subscriber
.
Support
.
COMMON_EVENT_USB_DEVICE_ATTACHED
,
Subscriber
.
Support
.
COMMON_EVENT_USB_DEVICE_DETACHED
,
Subscriber
.
Support
.
COMMON_EVENT_USB_ACCESSORY_ATTACHED
,
Subscriber
.
Support
.
COMMON_EVENT_USB_ACCESSORY_DETACHED
,
Subscriber
.
Support
.
COMMON_EVENT_AIRPLANE_MODE_CHANGED
,
Subscriber
.
Support
.
COMMON_EVENT_SMS_RECEIVE_COMPLETED
,
Subscriber
.
Support
.
COMMON_EVENT_SPN_INFO_UPDATED
,
],
};
let
result
=
0
;
function
subscriberCallBack002
(
err
,
data
)
{
console
.
info
(
"
==========================>subscriberCallBack002 event =
"
+
data
.
event
);
result
=
findArray
(
data
.
event
);
if
(
result
==
true
)
{
console
.
info
(
"
==========================>subscriberCallBack002 result == true
"
);
if
(
data
.
event
==
Subscriber
.
Support
.
COMMON_EVENT_SPN_INFO_UPDATED
)
{
done
();
}
}
console
.
info
(
"
==========================>subscriberCallBack002 end
"
);
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
((
data
)
=>
{
console
.
info
(
"
===============>ActsSubscriberTestUnorderSystem_0200=========createSubscriber promise
"
);
commonEventSubscriber2
=
data
;
Subscriber
.
subscribe
(
commonEventSubscriber2
,
subscriberCallBack002
);
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
...
...
notification/ces_standard/subscribeandpublish/actssubscriberunordertest/entry/src/main/js/test/ActsSubscriber_test_unorder.js
浏览文件 @
566f5de2
...
...
@@ -172,53 +172,6 @@ describe('ActsSubscriberTestUnorder', async function (done) {
})
})
/*
* @tc.number : ActsSubscriberTestUnorder_0400
* @tc.name : verify subscribe and publish : Check subscribe and publish sticky event
* @tc.desc : Check the subscriber can receive event "publish_event0400" type of the interface (by Promise)
*/
it
(
'
ActsSubscriberTestUnorder_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0400==========================>
"
);
var
commonEventSubscribeInfo
=
{
events
:
[
"
publish_eventSticky0400
"
]
};
var
commonEventPublishData
=
{
isOrdered
:
false
,
isSticky
:
true
,
}
function
isStickyCommonEventCallback004
(
err
,
data
)
{
console
.
info
(
"
==========================>isStickyCommonEventCallback004 isSticky:
"
+
data
);
expect
(
data
).
assertEqual
(
true
);
done
();
}
function
subscriberCallBack004
(
err
,
data
)
{
console
.
info
(
"
==========================>subscriberCallBack0400
"
);
expect
(
data
.
event
).
assertEqual
(
"
publish_eventSticky0400
"
);
expect
(
data
.
bundleName
).
assertEqual
(
""
);
expect
(
data
.
code
).
assertEqual
(
0
);
expect
(
data
.
data
).
assertEqual
(
""
);
commonEventSubscriber004
.
isStickyCommonEvent
(
isStickyCommonEventCallback004
);
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
((
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0400=========createSubscriber promise
"
);
commonEventSubscriber004
=
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_eventSticky0400
"
,
commonEventPublishData
,
publishCallback
);
},
1000
);
});
})
})
/*
* @tc.number : ActsSubscriberTestUnorder_0500
* @tc.name : verify subscribe and publish : Check the two different subscribe and one publish,
...
...
@@ -272,298 +225,5 @@ describe('ActsSubscriberTestUnorder', async function (done) {
});
})
})
/*
* @tc.number : ActsSubscriberTestUnorder_0600
* @tc.name : verify subscribe and publish : Check one subscribe and twice publish common events
* @tc.desc : Check the subscriber can receive event "publish_event0600" type of the interface (by Promise)
*/
it
(
'
ActsSubscriberTestUnorder_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0600==========================>
"
);
var
num
=
0
;
var
commonEventSubscribeInfo
=
{
events
:
[
"
publish_event0600
"
]
};
var
commonEventPublishData
=
{
isOrdered
:
false
,
isSticky
:
false
,
}
function
subscriberCallBack006
(
err
,
data
)
{
console
.
info
(
"
==========================>subscriberCallBack0600
"
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event0600
"
);
expect
(
data
.
bundleName
).
assertEqual
(
""
);
expect
(
data
.
code
).
assertEqual
(
0
);
expect
(
data
.
data
).
assertEqual
(
""
);
console
.
info
(
"
==========================>subscriberCallBack0600 num =
"
+
num
);
if
(
num
==
0
)
{
num
++
;
}
else
if
(
num
==
1
)
{
num
=
0
;
done
();
}
}
console
.
info
(
"
===============ActsSubscriberTestUnorder_0600 11111111111111==========================>
"
);
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
((
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0600=========createSubscriber promise
"
);
commonEventSubscriber006
=
data
;
console
.
info
(
"
===============ActsSubscriberTestUnorder_0600 22222222222222==========================>
"
);
data
.
getSubscribeInfo
().
then
(()
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0700=========getSubscribeInfo promise
"
);
Subscriber
.
subscribe
(
commonEventSubscriber006
,
subscriberCallBack006
);
setTimeout
(
function
(){
console
.
info
(
"
==========ActsSubscriberTestUnorder_0600 publish start============
"
);
Subscriber
.
publish
(
"
publish_event0600
"
,
commonEventPublishData
,
publishCallback
);
Subscriber
.
publish
(
"
publish_event0600
"
,
commonEventPublishData
,
publishCallback
);
},
1000
);
});
})
})
/*
* @tc.number : ActsSubscriberTestUnorder_0800
* @tc.name : verify subscribe and publish : Check subscribe and publish common event
* with permission and check IsOrderedCommonEvent
* @tc.desc : Check the subscriber can receive event "publish_event0800" type of the interface (by Promise)
*/
it
(
'
ActsSubscriberTestUnorder_0800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0800==========================>
"
);
var
commonEventSubscribeInfo
=
{
events
:
[
"
publish_event0800
"
],
publisherPermission
:
"
publish_event0800_publisherPermission
"
};
var
commonEventPublishData
=
{
subscriberPermissions
:[
"
publish_event0800_subscriberPermissions
"
],
isOrdered
:
false
,
isSticky
:
false
}
function
isOrderedCommonEventCallback009
(
err
,
data
)
{
console
.
info
(
"
==========================>isOrderedCommonEventCallback008
"
);
expect
(
data
).
assertEqual
(
false
);
done
();
}
function
sleep
(
delay
)
{
var
start
=
(
new
Date
()).
getTime
();
while
((
new
Date
()).
getTime
()
-
start
<
delay
)
{
}
done
();
}
function
subscriberCallBack008
(
err
,
data
)
{
console
.
info
(
"
==========================>subscriberCallBack0800
"
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event0800
"
);
expect
(
data
.
bundleName
).
assertEqual
(
""
);
expect
(
data
.
code
).
assertEqual
(
0
);
expect
(
data
.
data
).
assertEqual
(
""
);
expect
().
assertFail
();
commonEventSubscriber008
.
isOrderedCommonEvent
(
isOrderedCommonEventCallback009
);
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>createSubscriberPromise0800=======================>
"
);
commonEventSubscriber008
=
data
;
data
.
getSubscribeInfo
().
then
(()
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0800=========getSubscribeInfo promise
"
);
Subscriber
.
subscribe
(
commonEventSubscriber008
,
subscriberCallBack008
);
setTimeout
(
function
(){
console
.
debug
(
"
==========ActsSubscriberTestUnorder_0800 publish start============
"
);
Subscriber
.
publish
(
"
publish_event0800
"
,
commonEventPublishData
,
publishCallback
);
},
1000
);
});
});
sleep
(
1000
);
})
/*
* @tc.number : ActsSubscriberTestUnorder_1000
* @tc.name : verify subscribe and publish : Check different subscribes and publish different common event
* @tc.desc : Check the subscriber can receive event "publish_event1000" type of the interface
*/
it
(
'
ActsSubscriberTestUnorder_1000
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_1000==========================>
"
);
var
num
=
0
;
var
commonEventSubscribeInfo1
=
{
events
:
[
"
publish_event1000_1
"
],
priority
:
5
};
var
commonEventSubscribeInfo2
=
{
events
:
[
"
publish_event1000_2
"
],
priority
:
10
};
var
commonEventPublishData1
=
{
bundleName
:
"
publish_event1000_bundleName1
"
,
code
:
3
,
data
:
"
publish_event1000_data
"
,
isOrdered
:
false
,
isSticky
:
false
,
}
var
commonEventPublishData2
=
{
bundleName
:
"
publish_event1000_bundleName2
"
,
code
:
5
,
data
:
"
publish_event1000_data
"
,
isOrdered
:
false
,
isSticky
:
false
,
}
async
function
subscriberCallBack0101
(
err
,
data
)
{
console
.
info
(
"
==========================>subscriberCallBack0101
"
);
console
.
info
(
"
==========================>subscriberCallBack0101 event:
"
+
data
.
event
);
console
.
info
(
"
==========================>subscriberCallBack0101 bundleName:
"
+
data
.
bundleName
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event1000_1
"
);
expect
(
data
.
bundleName
).
assertEqual
(
"
publish_event1000_bundleName1
"
);
expect
(
data
.
code
).
assertEqual
(
3
);
expect
(
data
.
data
).
assertEqual
(
"
publish_event1000_data
"
);
if
(
num
==
0
)
{
num
++
;
}
else
if
(
num
==
1
)
{
done
();
}
}
function
subscriberCallBack0102
(
err
,
data
)
{
console
.
info
(
"
==========================>subscriberCallBack0102
"
);
console
.
info
(
"
==========================>subscriberCallBack0102 event:
"
+
data
.
event
);
console
.
info
(
"
==========================>subscriberCallBack0102 bundleName:
"
+
data
.
bundleName
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event1000_2
"
);
expect
(
data
.
bundleName
).
assertEqual
(
"
publish_event1000_bundleName2
"
);
expect
(
data
.
code
).
assertEqual
(
5
);
expect
(
data
.
data
).
assertEqual
(
"
publish_event1000_data
"
);
if
(
num
==
0
)
{
num
++
;
}
else
if
(
num
==
1
)
{
done
();
}
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo1
).
then
((
data
)
=>
{
console
.
info
(
"
=================ActsSubscriberTestUnorder_1000=========>createSubscriber Promise1000_1
"
);
commonEventSubscriber0101
=
data
;
data
.
getSubscribeInfo
().
then
(()
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_1000=========getSubscribeInfo promise1000_1
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0101
,
subscriberCallBack0101
);
});
});
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo2
).
then
((
data
)
=>
{
console
.
info
(
"
=================ActsSubscriberTestUnorder_1000=========>createSubscriber Promise1000_2
"
);
commonEventSubscriber0102
=
data
;
data
.
getSubscribeInfo
().
then
(()
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_1000=========getSubscribeInfo promise1000_2
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0102
,
subscriberCallBack0102
);
setTimeout
(
function
(){
console
.
info
(
"
==========ActsSubscriberTestUnorder_1000 publish start============
"
);
Subscriber
.
publish
(
"
publish_event1000_1
"
,
commonEventPublishData1
,
publishCallback10001
);
Subscriber
.
publish
(
"
publish_event1000_2
"
,
commonEventPublishData2
,
publishCallback10002
);
},
1000
);
});
});
})
/*
* @tc.number : ActsSubscriberTestUnorder_1100
* @tc.name : verify subscribe and publish : Check one subscribes and publish one common event
* @tc.desc : Check the subscriber can receive event "publish_event1100" type of the callback interface
*/
it
(
'
ActsSubscriberTestUnorder_1100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_1100==========================>
"
);
function
subscriberCallBack011
(
err
,
data
)
{
console
.
info
(
"
==========================>subscriberCallBack011
"
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event1100
"
);
expect
(
data
.
bundleName
).
assertEqual
(
""
);
expect
(
data
.
code
).
assertEqual
(
0
);
expect
(
data
.
data
).
assertEqual
(
""
);
done
();
}
var
commonEventSubscribeInfo
=
{
events
:
[
"
publish_event1100
"
],
};
function
getSubscribeInfo1100CallBack
(
err
,
data
)
{
console
.
info
(
"
==========================>getSubscribeInfo1100CallBack=======================>
"
);
expect
(
data
.
events
[
0
]).
assertEqual
(
"
publish_event1100
"
);
Subscriber
.
subscribe
(
commonEventSubscriber011
,
subscriberCallBack011
);
setTimeout
(
function
(){
console
.
debug
(
"
==========ActsSubscriberTestUnorder_1100 publish start============
"
);
Subscriber
.
publish
(
"
publish_event1100
"
,
publishCallback
);
},
1000
);
}
function
createSubscriber1100CallBack
(
err
,
data
)
{
console
.
info
(
"
==========================>createSubscriber1100CallBack=======================>
"
);
commonEventSubscriber011
=
data
;
data
.
getSubscribeInfo
(
getSubscribeInfo1100CallBack
);
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
,
createSubscriber1100CallBack
);
})
/*
* @tc.number : ActsSubscriberTestUnorder_1200
* @tc.name : verify subscribe and publish : Check one subscribes and publish one common event with parameters
* @tc.desc : Check the subscriber can receive event "publish_event1200" type of the callback interface
*/
it
(
'
ActsSubscriberTestUnorder_1200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_1200==========================>
"
);
function
subscriberCallBack012
(
err
,
data
)
{
console
.
info
(
"
==========================>subscriberCallBack012
"
);
console
.
info
(
"
==========================>subscriberCallBack012
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
).
assertEqual
(
"
publish_event1200
"
);
expect
(
data
.
bundleName
).
assertEqual
(
""
);
expect
(
data
.
code
).
assertEqual
(
0
);
expect
(
data
.
data
).
assertEqual
(
""
);
console
.
info
(
"
==========================>subscriberCallBack012:key1-value =
"
+
data
.
parameters
[
"
key1
"
]);
console
.
info
(
"
==========================>subscriberCallBack012:key2-value =
"
+
data
.
parameters
[
"
key2
"
][
0
]);
console
.
info
(
"
==========================>subscriberCallBack012:key2-value =
"
+
data
.
parameters
[
"
key2
"
][
1
]);
console
.
info
(
"
==========================>subscriberCallBack012:key3-value =
"
+
data
.
parameters
[
"
key3
"
]);
done
();
}
var
commonEventSubscribeInfo
=
{
events
:
[
"
publish_event1200
"
],
};
var
commonEventPublishData
=
{
isOrdered
:
false
,
isSticky
:
false
,
parameters
:
{
key1
:
"
ActsSubscriberTestUnorder_1200_key
"
,
key2
:
[
100
,
200
],
key3
:
44
}
}
function
getSubscribeInfo1200CallBack
(
err
,
data
)
{
console
.
info
(
"
==========================>getSubscribeInfo1200CallBack=======================>
"
);
expect
(
data
.
events
[
0
]).
assertEqual
(
"
publish_event1200
"
);
Subscriber
.
subscribe
(
commonEventSubscriber012
,
subscriberCallBack012
);
setTimeout
(
function
(){
console
.
info
(
"
==========ActsSubscriberTestUnorder_1200 publish start============
"
);
Subscriber
.
publish
(
"
publish_event1200
"
,
commonEventPublishData
,
publishCallback
);
},
1000
);
}
function
createSubscriber1200CallBack
(
err
,
data
)
{
console
.
info
(
"
==========================>createSubscriber1200CallBack=======================>
"
);
commonEventSubscriber012
=
data
;
data
.
getSubscribeInfo
(
getSubscribeInfo1200CallBack
);
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
,
createSubscriber1200CallBack
);
})
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录