Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
communication_ipc
提交
4923df2e
C
communication_ipc
项目概览
OpenHarmony
/
communication_ipc
大约 1 年 前同步成功
通知
20
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
communication_ipc
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
4923df2e
编写于
12月 16, 2022
作者:
O
openharmony_ci
提交者:
Gitee
12月 16, 2022
浏览文件
操作
浏览文件
下载
差异文件
!540 IPC分支覆盖率提升UT补充
Merge pull request !540 from 张泊远yg/master
上级
b0d5370f
63ee4130
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
86 addition
and
39 deletion
+86
-39
services/dbinder/test/unittest/dbinder_death_recipient_unittest.cpp
...binder/test/unittest/dbinder_death_recipient_unittest.cpp
+12
-0
services/dbinder/test/unittest/dbinder_remote_listener_unittest.cpp
...binder/test/unittest/dbinder_remote_listener_unittest.cpp
+9
-0
services/dbinder/test/unittest/dbinder_service_unittest.cpp
services/dbinder/test/unittest/dbinder_service_unittest.cpp
+65
-39
未找到文件。
services/dbinder/test/unittest/dbinder_death_recipient_unittest.cpp
浏览文件 @
4923df2e
...
@@ -51,3 +51,15 @@ HWTEST_F(DbinderDeathRecipientUnitTest, OnRemoteDied001, TestSize.Level1)
...
@@ -51,3 +51,15 @@ HWTEST_F(DbinderDeathRecipientUnitTest, OnRemoteDied001, TestSize.Level1)
wptr
<
IRemoteObject
>
remote
=
nullptr
;
wptr
<
IRemoteObject
>
remote
=
nullptr
;
dbinderDeathRecipient
.
OnRemoteDied
(
remote
);
dbinderDeathRecipient
.
OnRemoteDied
(
remote
);
}
}
HWTEST_F
(
DbinderDeathRecipientUnitTest
,
OnRemoteDied002
,
TestSize
.
Level1
)
{
DbinderDeathRecipient
dbinderDeathRecipient
;
int
handle
=
1
;
sptr
<
IRemoteObject
>
result
=
nullptr
;
std
::
u16string
descriptor
=
std
::
u16string
();
result
=
new
(
std
::
nothrow
)
IPCObjectProxy
(
handle
,
descriptor
);
IRemoteObject
*
object
=
result
.
GetRefPtr
();
wptr
<
IRemoteObject
>
remote
=
object
;
dbinderDeathRecipient
.
OnRemoteDied
(
remote
);
}
\ No newline at end of file
services/dbinder/test/unittest/dbinder_remote_listener_unittest.cpp
浏览文件 @
4923df2e
...
@@ -236,3 +236,12 @@ HWTEST_F(DBinderRemoteListenerUnitTest, GetPeerSession_001, TestSize.Level1)
...
@@ -236,3 +236,12 @@ HWTEST_F(DBinderRemoteListenerUnitTest, GetPeerSession_001, TestSize.Level1)
const
std
::
string
peerDeviceId
=
""
;
const
std
::
string
peerDeviceId
=
""
;
EXPECT_EQ
(
dBinderRemoteListener_
.
OpenSoftbusSession
(
peerDeviceId
),
nullptr
);
EXPECT_EQ
(
dBinderRemoteListener_
.
OpenSoftbusSession
(
peerDeviceId
),
nullptr
);
}
}
HWTEST_F
(
DBinderRemoteListenerUnitTest
,
GetPeerSession_002
,
TestSize
.
Level1
)
{
DBinderRemoteListener
dBinderRemoteListener_
(
DBinderService
::
GetInstance
());
const
std
::
string
peerDeviceId
=
"12345"
;
EXPECT_EQ
(
dBinderRemoteListener_
.
OpenSoftbusSession
(
peerDeviceId
),
nullptr
);
dBinderRemoteListener_
.
softbusManager_
=
ISessionService
::
GetInstance
();
dBinderRemoteListener_
.
OpenSoftbusSession
(
peerDeviceId
);
}
\ No newline at end of file
services/dbinder/test/unittest/dbinder_service_unittest.cpp
浏览文件 @
4923df2e
...
@@ -134,6 +134,9 @@ HWTEST_F(DBinderServiceUnitTest, ReStartRemoteListener001, TestSize.Level1)
...
@@ -134,6 +134,9 @@ HWTEST_F(DBinderServiceUnitTest, ReStartRemoteListener001, TestSize.Level1)
dBinderService
->
remoteListener_
=
nullptr
;
dBinderService
->
remoteListener_
=
nullptr
;
bool
res
=
dBinderService
->
ReStartRemoteListener
();
bool
res
=
dBinderService
->
ReStartRemoteListener
();
EXPECT_EQ
(
res
,
false
);
EXPECT_EQ
(
res
,
false
);
dBinderService
->
remoteListener_
=
std
::
make_shared
<
DBinderRemoteListener
>
(
dBinderService
);
bool
res2
=
dBinderService
->
ReStartRemoteListener
();
EXPECT_EQ
(
res2
,
false
);
}
}
/**
/**
...
@@ -431,8 +434,39 @@ HWTEST_F(DBinderServiceUnitTest, MakeRemoteBinder001, TestSize.Level1)
...
@@ -431,8 +434,39 @@ HWTEST_F(DBinderServiceUnitTest, MakeRemoteBinder001, TestSize.Level1)
binder_uintptr_t
binderObject
=
12345
;
binder_uintptr_t
binderObject
=
12345
;
uint32_t
pid
=
0
;
uint32_t
pid
=
0
;
uint32_t
uid
=
0
;
uint32_t
uid
=
0
;
bool
res
=
dBinderService
->
MakeRemoteBinder
(
serviceName
,
deviceID
,
binderObject
,
pid
,
uid
);
EXPECT_EQ
(
dBinderService
->
MakeRemoteBinder
(
serviceName
,
deviceID
,
binderObject
,
pid
,
uid
),
nullptr
);
EXPECT_EQ
(
res
,
false
);
}
/**
* @tc.name: MakeRemoteBinder002
* @tc.desc: Verify the MakeRemoteBinder function
* @tc.type: FUNC
*/
HWTEST_F
(
DBinderServiceUnitTest
,
MakeRemoteBinder002
,
TestSize
.
Level1
)
{
sptr
<
DBinderService
>
dBinderService
=
DBinderService
::
GetInstance
();
std
::
u16string
serviceName
;
std
::
string
deviceID
(
"001"
);
binder_uintptr_t
binderObject
=
12345
;
uint32_t
pid
=
0
;
uint32_t
uid
=
0
;
EXPECT_EQ
(
dBinderService
->
MakeRemoteBinder
(
serviceName
,
deviceID
,
binderObject
,
pid
,
uid
),
nullptr
);
}
/**
* @tc.name: MakeRemoteBinderTest003
* @tc.desc: Verify the MakeRemoteBinder function
* @tc.type: FUNC
*/
HWTEST_F
(
DBinderServiceUnitTest
,
MakeRemoteBinderTest003
,
TestSize
.
Level1
)
{
sptr
<
DBinderService
>
dBinderService
=
DBinderService
::
GetInstance
();
std
::
u16string
serviceName
;
std
::
string
deviceID
(
"001"
);
binder_uintptr_t
binderObject
=
12345
;
uint32_t
pid
=
10
;
uint32_t
uid
=
10
;
EXPECT_EQ
(
dBinderService
->
MakeRemoteBinder
(
serviceName
,
deviceID
,
binderObject
,
pid
,
uid
),
nullptr
);
}
}
/**
/**
...
@@ -442,8 +476,8 @@ HWTEST_F(DBinderServiceUnitTest, MakeRemoteBinder001, TestSize.Level1)
...
@@ -442,8 +476,8 @@ HWTEST_F(DBinderServiceUnitTest, MakeRemoteBinder001, TestSize.Level1)
*/
*/
HWTEST_F
(
DBinderServiceUnitTest
,
SendEntryToRemote001
,
TestSize
.
Level1
)
HWTEST_F
(
DBinderServiceUnitTest
,
SendEntryToRemote001
,
TestSize
.
Level1
)
{
{
const
std
::
string
serviceName
=
"testServiceName"
;
std
::
string
serviceName
=
"testServiceName"
;
const
std
::
string
deviceID
=
"testDeviceID"
;
std
::
string
deviceID
=
"testDeviceID"
;
binder_uintptr_t
binderObject
=
161561
;
binder_uintptr_t
binderObject
=
161561
;
sptr
<
DBinderService
>
dBinderService
=
DBinderService
::
GetInstance
();
sptr
<
DBinderService
>
dBinderService
=
DBinderService
::
GetInstance
();
sptr
<
DBinderServiceStub
>
stub
=
new
DBinderServiceStub
(
serviceName
,
deviceID
,
binderObject
);
sptr
<
DBinderServiceStub
>
stub
=
new
DBinderServiceStub
(
serviceName
,
deviceID
,
binderObject
);
...
@@ -642,6 +676,19 @@ HWTEST_F(DBinderServiceUnitTest, NoticeDeviceDieTest002, TestSize.Level1)
...
@@ -642,6 +676,19 @@ HWTEST_F(DBinderServiceUnitTest, NoticeDeviceDieTest002, TestSize.Level1)
EXPECT_EQ
(
dBinderService
->
NoticeDeviceDie
(
deviceID
),
DBINDER_SERVICE_NOTICE_DIE_ERR
);
EXPECT_EQ
(
dBinderService
->
NoticeDeviceDie
(
deviceID
),
DBINDER_SERVICE_NOTICE_DIE_ERR
);
}
}
/**
* @tc.name: NoticeDeviceDieTest003
* @tc.desc: Verify the NoticeDeviceDie function
* @tc.type: FUNC
*/
HWTEST_F
(
DBinderServiceUnitTest
,
NoticeDeviceDieTest003
,
TestSize
.
Level1
)
{
sptr
<
DBinderService
>
dBinderService
=
DBinderService
::
GetInstance
();
std
::
string
deviceID
(
"123456"
);
dBinderService
->
remoteListener_
=
std
::
make_shared
<
DBinderRemoteListener
>
(
dBinderService
);
dBinderService
->
NoticeDeviceDie
(
deviceID
);
}
/**
/**
* @tc.name: NoticeServiceDieTest001
* @tc.name: NoticeServiceDieTest001
* @tc.desc: Verify the NoticeServiceDie function
* @tc.desc: Verify the NoticeServiceDie function
...
@@ -695,7 +742,7 @@ HWTEST_F(DBinderServiceUnitTest, NoticeServiceDieInnerTest003, TestSize.Level1)
...
@@ -695,7 +742,7 @@ HWTEST_F(DBinderServiceUnitTest, NoticeServiceDieInnerTest003, TestSize.Level1)
dBinderService
->
StartRemoteListener
();
dBinderService
->
StartRemoteListener
();
std
::
u16string
serviceName
(
u"testServer"
);
std
::
u16string
serviceName
(
u"testServer"
);
std
::
string
deviceID
(
"123456"
);
std
::
string
deviceID
(
"123456"
);
EXPECT_EQ
(
dBinderService
->
NoticeServiceDieInner
(
serviceName
,
deviceID
),
DBINDER_SERVICE_NOTICE_DIE_ERR
);
EXPECT_EQ
(
dBinderService
->
NoticeServiceDieInner
(
serviceName
,
deviceID
),
ERR_NONE
);
}
}
/**
/**
...
@@ -834,6 +881,13 @@ HWTEST_F(DBinderServiceUnitTest, MakeSessionByReplyMessageTest001, TestSize.Leve
...
@@ -834,6 +881,13 @@ HWTEST_F(DBinderServiceUnitTest, MakeSessionByReplyMessageTest001, TestSize.Leve
struct
DHandleEntryTxRx
replyMessage
;
struct
DHandleEntryTxRx
replyMessage
;
dBinderService
->
MakeSessionByReplyMessage
(
&
replyMessage
);
dBinderService
->
MakeSessionByReplyMessage
(
&
replyMessage
);
EXPECT_EQ
(
dBinderService
->
HasDBinderStub
(
replyMessage
.
binderObject
),
false
);
EXPECT_EQ
(
dBinderService
->
HasDBinderStub
(
replyMessage
.
binderObject
),
false
);
std
::
string
serviceName
(
"testServer"
);
std
::
string
deviceID
;
binder_uintptr_t
binderObject
=
161561
;
sptr
<
DBinderServiceStub
>
stub
=
new
DBinderServiceStub
(
serviceName
,
deviceID
,
binderObject
);
replyMessage
.
stub
=
reinterpret_cast
<
binder_uintptr_t
>
(
stub
.
GetRefPtr
());
dBinderService
->
MakeSessionByReplyMessage
(
&
replyMessage
);
}
}
/**
/**
...
@@ -1045,38 +1099,6 @@ HWTEST_F(DBinderServiceUnitTest, IsSameStubObjectTest002, TestSize.Level1)
...
@@ -1045,38 +1099,6 @@ HWTEST_F(DBinderServiceUnitTest, IsSameStubObjectTest002, TestSize.Level1)
EXPECT_EQ
(
res
,
true
);
EXPECT_EQ
(
res
,
true
);
}
}
/**
* @tc.name: MakeRemoteBinder002
* @tc.desc: Verify the MakeRemoteBinder function
* @tc.type: FUNC
*/
HWTEST_F
(
DBinderServiceUnitTest
,
MakeRemoteBinder002
,
TestSize
.
Level1
)
{
sptr
<
DBinderService
>
dBinderService
=
DBinderService
::
GetInstance
();
std
::
u16string
serviceName
;
std
::
string
deviceID
(
"001"
);
binder_uintptr_t
binderObject
=
12345
;
uint32_t
pid
=
0
;
uint32_t
uid
=
0
;
EXPECT_EQ
(
dBinderService
->
MakeRemoteBinder
(
serviceName
,
deviceID
,
binderObject
,
pid
,
uid
),
nullptr
);
}
/**
* @tc.name: MakeRemoteBinderTest003
* @tc.desc: Verify the MakeRemoteBinder function
* @tc.type: FUNC
*/
HWTEST_F
(
DBinderServiceUnitTest
,
MakeRemoteBinderTest003
,
TestSize
.
Level1
)
{
sptr
<
DBinderService
>
dBinderService
=
DBinderService
::
GetInstance
();
std
::
u16string
serviceName
;
std
::
string
deviceID
(
"001"
);
binder_uintptr_t
binderObject
=
12345
;
uint32_t
pid
=
10
;
uint32_t
uid
=
10
;
EXPECT_EQ
(
dBinderService
->
MakeRemoteBinder
(
serviceName
,
deviceID
,
binderObject
,
pid
,
uid
),
nullptr
);
}
/**
/**
* @tc.name: SendEntryToRemoteTest002
* @tc.name: SendEntryToRemoteTest002
* @tc.desc: Verify the SendEntryToRemote function
* @tc.desc: Verify the SendEntryToRemote function
...
@@ -1119,8 +1141,8 @@ HWTEST_F(DBinderServiceUnitTest, PopLoadSaItemTest001, TestSize.Level1)
...
@@ -1119,8 +1141,8 @@ HWTEST_F(DBinderServiceUnitTest, PopLoadSaItemTest001, TestSize.Level1)
sptr
<
IRemoteObject
>
remoteObject
=
nullptr
;
sptr
<
IRemoteObject
>
remoteObject
=
nullptr
;
dBinderService
->
LoadSystemAbilityComplete
(
"test"
,
2
,
remoteObject
);
dBinderService
->
LoadSystemAbilityComplete
(
"test"
,
2
,
remoteObject
);
dBinderService
->
LoadSystemAbilityComplete
(
srcNetworkId
,
systemAbilityId
,
remoteObject
);
dBinderService
->
LoadSystemAbilityComplete
(
srcNetworkId
,
systemAbilityId
,
remoteObject
);
remoteObject
=
new
IPCObjectProxy
(
1
);
sptr
<
IRemoteObject
>
remoteObject1
=
new
IPCObjectProxy
(
1
);
dBinderService
->
LoadSystemAbilityComplete
(
srcNetworkId
,
systemAbilityId
,
remoteObject
);
dBinderService
->
LoadSystemAbilityComplete
(
srcNetworkId
,
systemAbilityId
,
remoteObject
1
);
}
}
/**
/**
...
@@ -1176,6 +1198,10 @@ HWTEST_F(DBinderServiceUnitTest, StopThreadPool001, TestSize.Level1)
...
@@ -1176,6 +1198,10 @@ HWTEST_F(DBinderServiceUnitTest, StopThreadPool001, TestSize.Level1)
dBinderService
->
threadPoolStarted_
=
false
;
dBinderService
->
threadPoolStarted_
=
false
;
bool
res
=
dBinderService
->
StartThreadPool
();
bool
res
=
dBinderService
->
StartThreadPool
();
EXPECT_EQ
(
res
,
false
);
EXPECT_EQ
(
res
,
false
);
bool
res2
=
dBinderService
->
StopThreadPool
();
EXPECT_EQ
(
res2
,
true
);
dBinderService
->
threadPoolStarted_
=
true
;
dBinderService
->
StopThreadPool
();
}
}
/**
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录