Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
27712bbc
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,发现更多精彩内容 >>
提交
27712bbc
编写于
3月 22, 2022
作者:
Z
zhangpa2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
exchange the Test.json
Signed-off-by:
N
zhangpa2021
<
zhangpan70@huawei.com
>
上级
12d7c8e1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
104 addition
and
43 deletion
+104
-43
communication/dsoftbus/rpc/Test.json
communication/dsoftbus/rpc/Test.json
+2
-1
communication/dsoftbus/rpc/src/main/js/default/test/RpcClientJsunit.test.js
...tbus/rpc/src/main/js/default/test/RpcClientJsunit.test.js
+102
-42
未找到文件。
communication/dsoftbus/rpc/Test.json
100644 → 100755
浏览文件 @
27712bbc
...
...
@@ -10,7 +10,8 @@
"kits"
:
[
{
"test-file-name"
:
[
"ActsRpcHapTest.hap"
"ActsRpcHapTest.hap"
,
"./resource/dsoftbus/ipcserver/entry-release-standard-signed.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
...
...
communication/dsoftbus/rpc/src/main/js/default/test/RpcClientJsunit.test.js
浏览文件 @
27712bbc
...
...
@@ -51,6 +51,8 @@ describe('ActsRpcClientJsTest', function(){
const
CODE_TRANSACTION
=
27
;
const
CODE_IPCSKELETON
=
28
;
const
CODE_FILESDIR
=
29
;
const
CODE_WRITE_REMOTEOBJECTARRAY_1
=
30
;
const
CODE_WRITE_REMOTEOBJECTARRAY_2
=
31
;
function
connectAbility
()
{
let
want
=
{
...
...
@@ -125,8 +127,65 @@ describe('ActsRpcClientJsTest', function(){
constructor
(
descriptor
)
{
super
(
descriptor
)
}
onRemoteRequest
(
code
,
data
,
reply
,
option
)
{
console
.
info
(
"
TestAbilityStub: onRemoteRequest called, code:
"
+
code
)
let
descriptor
=
data
.
readInterfaceToken
()
if
(
descriptor
!==
"
TestAbilityStub
"
)
{
console
.
error
(
"
received unknown descriptor:
"
+
descriptor
)
return
false
}
switch
(
code
)
{
case
1
:
{
let
tmp1
=
data
.
readByte
()
let
tmp2
=
data
.
readByte
()
let
tmp3
=
data
.
readShort
()
let
tmp4
=
data
.
readShort
()
let
tmp5
=
data
.
readInt
()
let
tmp6
=
data
.
readInt
()
let
tmp7
=
data
.
readLong
()
let
tmp8
=
data
.
readLong
()
let
tmp9
=
data
.
readFloat
()
let
tmp10
=
data
.
readFloat
()
let
tmp11
=
data
.
readDouble
()
let
tmp12
=
data
.
readDouble
()
let
tmp13
=
data
.
readBoolean
()
let
tmp14
=
data
.
readBoolean
()
let
tmp15
=
data
.
readChar
()
let
tmp16
=
data
.
readString
()
let
s
=
new
MySequenceable
(
null
,
null
)
data
.
readSequenceable
(
s
)
reply
.
writeNoException
()
reply
.
writeByte
(
tmp1
)
reply
.
writeByte
(
tmp2
)
reply
.
writeShort
(
tmp3
)
reply
.
writeShort
(
tmp4
)
reply
.
writeInt
(
tmp5
)
reply
.
writeInt
(
tmp6
)
reply
.
writeLong
(
tmp7
)
reply
.
writeLong
(
tmp8
)
reply
.
writeFloat
(
tmp9
)
reply
.
writeFloat
(
tmp10
)
reply
.
writeDouble
(
tmp11
)
reply
.
writeDouble
(
tmp12
)
reply
.
writeBoolean
(
tmp13
)
reply
.
writeBoolean
(
tmp14
)
reply
.
writeChar
(
tmp15
)
reply
.
writeString
(
tmp16
)
reply
.
writeSequenceable
(
s
)
return
true
}
default
:
{
console
.
error
(
"
default case, code:
"
+
code
)
return
false
}
}
}
}
class
TestListener
extends
rpc
.
RemoteObject
{
constructor
(
descriptor
,
checkResult
)
{
super
(
descriptor
);
...
...
@@ -1234,7 +1293,7 @@ describe('ActsRpcClientJsTest', function(){
console
.
log
(
"
SUB_Softbus_IPC_MessageParcel_6000:run writeChar success, result is
"
+
result
);
expect
(
result
==
true
).
assertTrue
()
var
readresult
=
data
.
readChar
();
expect
(
result
==
'
a
'
).
assertTrue
()
expect
(
re
adre
sult
==
'
a
'
).
assertTrue
()
}
catch
(
error
)
{
console
.
log
(
"
SUB_Softbus_IPC_MessageParcel_6000:error =
"
+
error
);
...
...
@@ -1707,20 +1766,6 @@ describe('ActsRpcClientJsTest', function(){
var
result
=
data
.
writeRawData
(
token
,
token
.
length
);
console
.
log
(
"
SUB_Softbus_IPC_MessageParcel_7300:run writeRawData success, result is
"
+
result
);
expect
(
result
==
false
).
assertTrue
();
if
(
gIRemoteObject
==
undefined
)
{
console
.
log
(
"
SUB_Softbus_IPC_MessageParcel_7300: gIRemoteObject is undefined
"
);
}
await
gIRemoteObject
.
sendRequest
(
CODE_WRITE_RAWDATA
,
data
,
reply
,
option
).
then
((
result
)
=>
{
console
.
log
(
"
SUB_Softbus_IPC_MessageParcel_7300: sendRequest success, result is
"
+
result
.
errCode
);
var
newReadResult
=
result
.
reply
.
readRawData
(
token
.
length
);
expect
(
newReadResult
[
0
]
==
token
[
0
]).
assertTrue
();
expect
(
newReadResult
[
1
]
==
token
[
1
]).
assertTrue
();
expect
(
newReadResult
[
2
]
==
token
[
2
]).
assertTrue
();
expect
(
newReadResult
[
3
]
==
token
[
3
]).
assertTrue
();
expect
(
newReadResult
[
4
]
==
token
[
4
]).
assertTrue
();
});
data
.
reclaim
();
reply
.
reclaim
();
done
();
...
...
@@ -2579,7 +2624,8 @@ describe('ActsRpcClientJsTest', function(){
reply
.
reclaim
()
console
.
log
(
"
test done
"
)
})
})
console
.
log
(
"
---------------------end SUB_Softbus_IPC_MessageParcel_9300---------------------------
"
);
})
/*
* @tc.number SUB_Softbus_IPC_MessageParcel_9400
...
...
@@ -2589,12 +2635,19 @@ describe('ActsRpcClientJsTest', function(){
*/
it
(
'
SUB_Softbus_IPC_MessageParcel_9400
'
,
0
,
async
function
(
done
)
{
console
.
log
(
"
---------------------start SUB_Softbus_IPC_MessageParcel_9400---------------------------
"
);
try
{
function
checkResult
(
num
,
str
)
{
expect
(
num
).
assertEqual
(
123
)
expect
(
str
).
assertEqual
(
"
rpcListenerTest
"
)
let
count
=
0
;
function
checkResult
(
num
,
str
)
{
expect
(
num
).
assertEqual
(
123
)
expect
(
str
).
assertEqual
(
"
rpcListenerTest
"
)
count
++
console
.
info
(
"
check result done, count:
"
+
count
)
if
(
count
==
3
)
{
done
()
}
}
try
{
let
option
=
new
rpc
.
MessageOption
()
let
data
=
rpc
.
MessageParcel
.
create
()
let
reply
=
rpc
.
MessageParcel
.
create
()
...
...
@@ -2607,20 +2660,20 @@ describe('ActsRpcClientJsTest', function(){
console
.
info
(
"
SUB_Softbus_IPC_MessageParcel_9400 result is:
"
+
result
)
expect
(
data
.
writeInt
(
123
)).
assertTrue
()
expect
(
data
.
writeString
(
"
rpcListenerTest
"
)).
assertTrue
()
await
gIRemoteObject
.
sendRequest
(
CODE_WRITE_REMOTEOBJECTARRAY
,
data
,
reply
,
option
)
.
then
(
function
(
result
)
{
console
.
info
(
"
SUB_Softbus_IPC_MessageParcel_9400:
sendRequest done, error code:
"
+
result
.
errCode
)
expect
(
result
.
errCode
).
assertEqual
(
0
)
})
.
catch
(
function
(
e
)
{
console
.
error
(
"
SUB_Softbus_IPC_MessageParcel_9400: send request got exception:
"
+
e
)
expect
(
0
).
assertEqual
(
1
)
})
.
finally
(()
=>
{
data
.
reclaim
()
reply
.
reclaim
()
console
.
log
(
"
test done
"
)
})
await
gIRemoteObject
.
sendRequest
(
CODE_WRITE_REMOTEOBJECTARRAY
_1
,
data
,
reply
,
option
)
.
then
(
(
result
)
=>
{
console
.
info
(
"
SUB_Softbus_IPC_MessageParcel_9500:
sendRequest done, error code:
"
+
result
.
errCode
)
expect
(
result
.
errCode
).
assertEqual
(
0
)
})
.
catch
(
function
(
e
)
{
console
.
error
(
"
SUB_Softbus_IPC_MessageParcel_9400: send request got exception:
"
+
e
)
expect
(
0
).
assertEqual
(
1
)
})
.
finally
(()
=>
{
data
.
reclaim
()
reply
.
reclaim
()
console
.
log
(
"
test done
"
)
})
done
();
data
.
reclaim
();
reply
.
reclaim
();
...
...
@@ -2639,12 +2692,18 @@ describe('ActsRpcClientJsTest', function(){
*/
it
(
'
SUB_Softbus_IPC_MessageParcel_9500
'
,
0
,
async
function
(
done
)
{
console
.
log
(
"
---------------------start SUB_Softbus_IPC_MessageParcel_9500---------------------------
"
);
try
{
function
checkResult
(
num
,
str
)
{
expect
(
num
).
assertEqual
(
123
)
expect
(
str
).
assertEqual
(
"
rpcListenerTest
"
)
let
count
=
0
;
function
checkResult
(
num
,
str
)
{
expect
(
num
).
assertEqual
(
123
)
expect
(
str
).
assertEqual
(
"
rpcListenerTest
"
)
count
++
console
.
info
(
"
check result done, count:
"
+
count
)
if
(
count
==
3
)
{
done
()
}
}
try
{
let
option
=
new
rpc
.
MessageOption
()
let
data
=
rpc
.
MessageParcel
.
create
()
let
reply
=
rpc
.
MessageParcel
.
create
()
...
...
@@ -2659,7 +2718,8 @@ describe('ActsRpcClientJsTest', function(){
console
.
info
(
"
SUB_Softbus_IPC_MessageParcel_9500 result is:
"
+
result
)
expect
(
data
.
writeInt
(
123
)).
assertTrue
()
expect
(
data
.
writeString
(
"
rpcListenerTest
"
)).
assertTrue
()
gIRemoteObject
.
sendRequest
(
CODE_WRITE_REMOTEOBJECTARRAY
,
data
,
reply
,
option
,(
err
,
result
)
=>
{
await
gIRemoteObject
.
sendRequest
(
CODE_WRITE_REMOTEOBJECTARRAY_2
,
data
,
reply
,
option
)
.
then
(
(
result
)
=>
{
console
.
info
(
"
SUB_Softbus_IPC_MessageParcel_9500:sendRequest done, error code:
"
+
result
.
errCode
)
expect
(
result
.
errCode
).
assertEqual
(
0
)
})
...
...
@@ -2756,7 +2816,7 @@ describe('ActsRpcClientJsTest', function(){
try
{
expect
(
rpc
.
MessageOption
.
TF_SYNC
).
assertEqual
(
0
);
expect
(
rpc
.
MessageOption
.
TF_AYNC
).
assertEqual
(
1
);
expect
(
rpc
.
MessageOption
.
TF_A
S
YNC
).
assertEqual
(
1
);
expect
(
rpc
.
MessageOption
.
TF_WAIT_TIME
).
assertEqual
(
4
);
...
...
@@ -3197,7 +3257,7 @@ describe('ActsRpcClientJsTest', function(){
let
size
=
bytes
.
length
+
10
;
let
result
=
ashmem
.
writeToAshmem
(
bytes
,
3
,
0
);
console
.
log
(
"
SUB_Softbus_IPC_Ashmem_1600: run writeToAshmem success, result is
"
+
result
);
expect
(
result
==
true
).
assertTrue
()
expect
(
result
==
true
).
assertTrue
()
;
ashmem
.
closeAshmem
()
...
...
@@ -3873,7 +3933,7 @@ describe('ActsRpcClientJsTest', function(){
* @tc.desc Function test
* @tc.level 0
*/
it
(
"
SUB_Softbus_IPC_RemoteProxy_0500
"
,
0
,
async
function
(
done
){
it
(
"
SUB_Softbus_IPC_RemoteProxy_0500
"
,
0
,
async
function
(){
console
.
log
(
"
SUB_Softbus_IPC_RemoteProxy_0500 is starting-------------
"
)
try
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录