Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
f87d6095
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看板
提交
f87d6095
编写于
11月 25, 2021
作者:
O
openharmony_ci
提交者:
Gitee
11月 25, 2021
浏览文件
操作
浏览文件
下载
差异文件
!1176 修改一个导致不能执行用例的问题
Merge pull request !1176 from 伞木希美/myfeature
上级
aebc5fd1
ae3997c2
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
239 addition
and
195 deletion
+239
-195
security/BUILD.gn
security/BUILD.gn
+1
-3
security/permission/permissionkitcpp/BUILD.gn
security/permission/permissionkitcpp/BUILD.gn
+22
-0
security/permission/permissionkitcpp/Test.json
security/permission/permissionkitcpp/Test.json
+1
-3
security/permission/permissionkitcpp/src/PermissionKitFunctionCPPTest.cpp
...ion/permissionkitcpp/src/PermissionKitFunctionCPPTest.cpp
+111
-103
security/permission/permissionkitcpp/src/PermissionKitPerformanceCPPTest.cpp
.../permissionkitcpp/src/PermissionKitPerformanceCPPTest.cpp
+65
-56
security/permission/permissionkitcpp/src/PermissionKitReliabilityCPPTest.cpp
.../permissionkitcpp/src/PermissionKitReliabilityCPPTest.cpp
+39
-30
未找到文件。
security/BUILD.gn
浏览文件 @
f87d6095
...
...
@@ -20,9 +20,7 @@ group("security") {
# "authentication_standard/deviceauth_p2p:DeviceauthP2PFunctionCPPTest",
"dataprotect/huks_standard_adapter:huks_std_function_test",
"deviceauth/deviceauth_function:DeviceAuthFunctionTest",
"permission/permissionkitcpp:PermissionKitFunctionCPPTest",
"permission/permissionkitcpp:PermissionKitPerformanceCPPTest",
"permission/permissionkitcpp:PermissionKitReliabilityCPPTest",
"permission/permissionkitcpp:PermissionKitCPPTest",
]
} else {
deps =
...
...
security/permission/permissionkitcpp/BUILD.gn
浏览文件 @
f87d6095
...
...
@@ -75,3 +75,25 @@ ohos_moduletest_suite("PermissionKitReliabilityCPPTest") {
"//utils/native/base:utils",
]
}
##################################################################################
ohos_moduletest_suite("PermissionKitCPPTest") {
subsystem_name = "hits"
part_name = "permission_standard"
module_out_path = subsystem_name + "/" + part_name
configs = [ ":module_private_config" ]
cflags_cc = [ "-DHILOG_ENABLE" ]
sources = [
"src/PermissionKitFunctionCPPTest.cpp",
"src/PermissionKitPerformanceCPPTest.cpp",
"src/PermissionKitReliabilityCPPTest.cpp",
]
deps = [
"//base/security/permission/frameworks/permission_standard/permissioninfrastructure:permission_standard_infrastructure_cxx",
"//base/security/permission/interfaces/innerkits/permission_standard/permissionsdk:libpermissionsdk_standard",
"//utils/native/base:utils",
]
}
security/permission/permissionkitcpp/Test.json
浏览文件 @
f87d6095
...
...
@@ -2,9 +2,7 @@
"kits"
:
[
{
"push"
:
[
"PermissionKitFunctionCPPTest->/data/local/tmp/PermissionKitFunctionCPPTest"
,
"PermissionKitPerformanceCPPTest->/data/local/tmp/PermissionKitPerformanceCPPTest"
,
"PermissionKitReliabilityCPPTest->/data/local/tmp/PermissionKitReliabilityCPPTest"
"PermissionKitCPPTest->/data/local/tmp/PermissionKitCPPTest"
],
"type"
:
"PushKit"
,
"post-push"
:
[
...
...
security/permission/permissionkitcpp/src/PermissionKitFunctionCPPTest.cpp
浏览文件 @
f87d6095
此差异已折叠。
点击以展开。
security/permission/permissionkitcpp/src/PermissionKitPerformanceCPPTest.cpp
浏览文件 @
f87d6095
...
...
@@ -23,6 +23,7 @@ using namespace testing::ext;
using
namespace
OHOS
::
Security
::
Permission
;
const
int
TIME_MILLIS
=
1000
;
const
int
RUNNING_TIMES
=
10000
;
static
vector
<
PermissionDef
>
permDefNormal
;
static
vector
<
PermissionDef
>
permDefAbnormal1
;
static
vector
<
PermissionDef
>
permDefAbnormal2
;
...
...
@@ -32,6 +33,14 @@ PermissionDef permissionDefBeta;
PermissionDef
permissionDefAbnormal1
;
PermissionDef
permissionDefAbnormal2
;
class
PermissionKitPerformanceTest
:
public
testing
::
Test
{
public:
static
void
SetUpTestCase
();
static
void
TearDownTestCase
();
void
SetUp
();
void
TearDown
();
};
void
initPermissionDef
()
{
permissionDefAlpha
=
{
...
...
@@ -77,7 +86,7 @@ void initPermissionDef()
};
}
void
PermissionKitTest
::
SetUpTestCase
()
void
PermissionKit
Performance
Test
::
SetUpTestCase
()
{
vector
<
PermissionDef
>
permDefList1
;
vector
<
PermissionDef
>
permDefList2
;
...
...
@@ -122,7 +131,7 @@ void PermissionKitTest::SetUpTestCase()
}
}
void
PermissionKitTest
::
TearDownTestCase
()
void
PermissionKit
Performance
Test
::
TearDownTestCase
()
{
PermissionKit
::
RemoveDefPermissions
(
TEST_BUNDLE_NAME
);
PermissionKit
::
RemoveDefPermissions
(
ABNORMAL_BUNDLE_NAME
);
...
...
@@ -139,7 +148,7 @@ void PermissionKitTest::TearDownTestCase()
}
}
void
PermissionKitTest
::
SetUp
()
void
PermissionKit
Performance
Test
::
SetUp
()
{
PermissionKit
::
RemoveDefPermissions
(
TEST_BUNDLE_NAME
);
PermissionKit
::
RemoveDefPermissions
(
ABNORMAL_BUNDLE_NAME
);
...
...
@@ -152,7 +161,7 @@ void PermissionKitTest::SetUp()
PermissionKit
::
RevokeSystemGrantedPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_BETA
);
}
void
PermissionKitTest
::
TearDown
()
void
PermissionKit
Performance
Test
::
TearDown
()
{
PermissionKit
::
RemoveDefPermissions
(
TEST_BUNDLE_NAME
);
PermissionKit
::
RemoveDefPermissions
(
ABNORMAL_BUNDLE_NAME
);
...
...
@@ -182,10 +191,10 @@ long GetCurrentTimeMillis()
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_AddDefPer_009
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Performance
Test
,
Security_AppSecurity_PermissionManager_L2_AddDefPer_009
,
TestSize
.
Level3
)
{
long
timeAll
=
0
;
for
(
int
i
=
0
;
i
<
10000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
long
startTime
=
GetCurrentTimeMillis
();
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
...
...
@@ -194,8 +203,8 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_AddDefPer_
ret
=
PermissionKit
::
RemoveDefPermissions
(
TEST_BUNDLE_NAME
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
}
std
::
cout
<<
"Performance of AddDefPermissions interface is::"
<<
timeAll
/
10000
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
10000
,
5
);
std
::
cout
<<
"Performance of AddDefPermissions interface is::"
<<
timeAll
/
RUNNING_TIMES
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
RUNNING_TIMES
,
5
);
}
/**
...
...
@@ -208,10 +217,10 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_AddDefPer_
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_RemoveDefPer_008
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Performance
Test
,
Security_AppSecurity_PermissionManager_L2_RemoveDefPer_008
,
TestSize
.
Level3
)
{
long
timeAll
=
0
;
for
(
int
i
=
0
;
i
<
10000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
long
startTime
=
GetCurrentTimeMillis
();
...
...
@@ -220,8 +229,8 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_RemoveDefP
long
timeCost
=
GetCurrentTimeMillis
()
-
startTime
;
timeAll
=
timeAll
+
timeCost
;
}
std
::
cout
<<
"Performance of RemoveDefPermissions interface is::"
<<
timeAll
/
10000
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
10000
,
5
);
std
::
cout
<<
"Performance of RemoveDefPermissions interface is::"
<<
timeAll
/
RUNNING_TIMES
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
RUNNING_TIMES
,
5
);
}
/**
...
...
@@ -234,19 +243,19 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_RemoveDefP
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_GetDefPer_006
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Performance
Test
,
Security_AppSecurity_PermissionManager_L2_GetDefPer_006
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
PermissionDef
permissionDefResultAlpha
;
long
startTime
=
GetCurrentTimeMillis
();
for
(
int
i
=
0
;
i
<
10000
;
i
++
)
{
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
)
{
ret
=
PermissionKit
::
GetDefPermission
(
TEST_PERMISSION_NAME_ALPHA
,
permissionDefResultAlpha
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
}
long
timeAll
=
GetCurrentTimeMillis
()
-
startTime
;
std
::
cout
<<
"Performance of GetDefPermission interface is::"
<<
timeAll
/
10000
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
10000
,
5
);
std
::
cout
<<
"Performance of GetDefPermission interface is::"
<<
timeAll
/
RUNNING_TIMES
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
RUNNING_TIMES
,
5
);
}
/**
...
...
@@ -259,14 +268,14 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_GetDefPer_
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_AddUserGrantedPer_014
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Performance
Test
,
Security_AppSecurity_PermissionManager_L2_AddUserGrantedPer_014
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
vector
<
string
>
permList
;
permList
.
push_back
(
TEST_PERMISSION_NAME_ALPHA
);
long
timeAll
=
0
;
for
(
int
i
=
0
;
i
<
10000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
long
startTime
=
GetCurrentTimeMillis
();
ret
=
PermissionKit
::
AddUserGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
permList
,
TEST_USER_ID
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
...
...
@@ -275,8 +284,8 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_AddUserGra
ret
=
PermissionKit
::
RemoveUserGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
TEST_USER_ID
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
}
std
::
cout
<<
"Performance of AddUserGrantedReqPermissions interface is::"
<<
timeAll
/
10000
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
10000
,
5
);
std
::
cout
<<
"Performance of AddUserGrantedReqPermissions interface is::"
<<
timeAll
/
RUNNING_TIMES
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
RUNNING_TIMES
,
5
);
}
/**
...
...
@@ -289,14 +298,14 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_AddUserGra
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_AddSystemGrantedPer_011
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Performance
Test
,
Security_AppSecurity_PermissionManager_L2_AddSystemGrantedPer_011
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
vector
<
string
>
permList
;
permList
.
push_back
(
TEST_PERMISSION_NAME_ALPHA
);
long
timeAll
=
0
;
for
(
int
i
=
0
;
i
<
10000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
long
startTime
=
GetCurrentTimeMillis
();
ret
=
PermissionKit
::
AddSystemGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
permList
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
...
...
@@ -305,8 +314,8 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_AddSystemG
ret
=
PermissionKit
::
RemoveSystemGrantedReqPermissions
(
TEST_BUNDLE_NAME
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
}
std
::
cout
<<
"Performance of AddSystemGrantedReqPermissions interface is::"
<<
timeAll
/
10000
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
10000
,
5
);
std
::
cout
<<
"Performance of AddSystemGrantedReqPermissions interface is::"
<<
timeAll
/
RUNNING_TIMES
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
RUNNING_TIMES
,
5
);
}
/**
...
...
@@ -319,14 +328,14 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_AddSystemG
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_RemoveUserGrantedPer_012
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Performance
Test
,
Security_AppSecurity_PermissionManager_L2_RemoveUserGrantedPer_012
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
vector
<
string
>
permList
;
permList
.
push_back
(
TEST_PERMISSION_NAME_ALPHA
);
long
timeAll
=
0
;
for
(
int
i
=
0
;
i
<
10000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
ret
=
PermissionKit
::
AddUserGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
permList
,
TEST_USER_ID
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
long
startTime
=
GetCurrentTimeMillis
();
...
...
@@ -335,8 +344,8 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_RemoveUser
timeAll
=
timeAll
+
timeCost
;
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
}
std
::
cout
<<
"Performance of RemoveUserGrantedReqPermissions interface is::"
<<
timeAll
/
10000
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
10000
,
5
);
std
::
cout
<<
"Performance of RemoveUserGrantedReqPermissions interface is::"
<<
timeAll
/
RUNNING_TIMES
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
RUNNING_TIMES
,
5
);
}
/**
...
...
@@ -349,14 +358,14 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_RemoveUser
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_RemoveSystemGrantedPer_009
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Performance
Test
,
Security_AppSecurity_PermissionManager_L2_RemoveSystemGrantedPer_009
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
vector
<
string
>
permList
;
permList
.
push_back
(
TEST_PERMISSION_NAME_BETA
);
long
timeAll
=
0
;
for
(
int
i
=
0
;
i
<
10000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
ret
=
PermissionKit
::
AddSystemGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
permList
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
long
startTime
=
GetCurrentTimeMillis
();
...
...
@@ -365,8 +374,8 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_RemoveSyst
long
timeCost
=
GetCurrentTimeMillis
()
-
startTime
;
timeAll
=
timeAll
+
timeCost
;
}
std
::
cout
<<
"Performance of RemoveSystemGrantedReqPermissions interface is::"
<<
timeAll
/
10000
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
10000
,
5
);
std
::
cout
<<
"Performance of RemoveSystemGrantedReqPermissions interface is::"
<<
timeAll
/
RUNNING_TIMES
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
RUNNING_TIMES
,
5
);
}
/**
...
...
@@ -379,7 +388,7 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_RemoveSyst
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_GrantUserGrantedPer_014
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Performance
Test
,
Security_AppSecurity_PermissionManager_L2_GrantUserGrantedPer_014
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
...
...
@@ -388,7 +397,7 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_GrantUserG
ret
=
PermissionKit
::
AddUserGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
permList
,
TEST_USER_ID
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
long
timeAll
=
0
;
for
(
int
i
=
0
;
i
<
10000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
long
startTime
=
GetCurrentTimeMillis
();
ret
=
PermissionKit
::
GrantUserGrantedPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_ALPHA
,
TEST_USER_ID
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
...
...
@@ -397,8 +406,8 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_GrantUserG
ret
=
PermissionKit
::
RevokeUserGrantedPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_ALPHA
,
TEST_USER_ID
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
}
std
::
cout
<<
"Performance of GrantUserGrantedPermission interface is::"
<<
timeAll
/
10000
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
10000
,
5
);
std
::
cout
<<
"Performance of GrantUserGrantedPermission interface is::"
<<
timeAll
/
RUNNING_TIMES
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
RUNNING_TIMES
,
5
);
}
/**
...
...
@@ -411,7 +420,7 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_GrantUserG
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_GrantSystemGrantedPer_011
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Performance
Test
,
Security_AppSecurity_PermissionManager_L2_GrantSystemGrantedPer_011
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
...
...
@@ -420,7 +429,7 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_GrantSyste
ret
=
PermissionKit
::
AddSystemGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
permList
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
long
timeAll
=
0
;
for
(
int
i
=
0
;
i
<
10000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
long
startTime
=
GetCurrentTimeMillis
();
ret
=
PermissionKit
::
GrantSystemGrantedPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_BETA
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
...
...
@@ -429,8 +438,8 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_GrantSyste
ret
=
PermissionKit
::
RevokeSystemGrantedPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_BETA
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
}
std
::
cout
<<
"Performance of GrantSystemGrantedPermission interface is::"
<<
timeAll
/
10000
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
10000
,
5
);
std
::
cout
<<
"Performance of GrantSystemGrantedPermission interface is::"
<<
timeAll
/
RUNNING_TIMES
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
RUNNING_TIMES
,
5
);
}
/**
...
...
@@ -443,7 +452,7 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_GrantSyste
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_RevokeUserGrantedPer_015
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Performance
Test
,
Security_AppSecurity_PermissionManager_L2_RevokeUserGrantedPer_015
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
...
...
@@ -452,7 +461,7 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_RevokeUser
ret
=
PermissionKit
::
AddUserGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
permList
,
TEST_USER_ID
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
long
timeAll
=
0
;
for
(
int
i
=
0
;
i
<
10000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
ret
=
PermissionKit
::
GrantUserGrantedPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_ALPHA
,
TEST_USER_ID
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
long
startTime
=
GetCurrentTimeMillis
();
...
...
@@ -461,8 +470,8 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_RevokeUser
long
timeCost
=
GetCurrentTimeMillis
()
-
startTime
;
timeAll
=
timeAll
+
timeCost
;
}
std
::
cout
<<
"Performance of GrantUserGrantedPermission interface is::"
<<
timeAll
/
10000
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
10000
,
5
);
std
::
cout
<<
"Performance of GrantUserGrantedPermission interface is::"
<<
timeAll
/
RUNNING_TIMES
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
RUNNING_TIMES
,
5
);
}
/**
...
...
@@ -475,7 +484,7 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_RevokeUser
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_RevokeSystemGrantedPer_012
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Performance
Test
,
Security_AppSecurity_PermissionManager_L2_RevokeSystemGrantedPer_012
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
...
...
@@ -484,7 +493,7 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_RevokeSyst
ret
=
PermissionKit
::
AddSystemGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
permList
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
long
timeAll
=
0
;
for
(
int
i
=
0
;
i
<
10000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
ret
=
PermissionKit
::
GrantSystemGrantedPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_BETA
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
long
startTime
=
GetCurrentTimeMillis
();
...
...
@@ -493,8 +502,8 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_RevokeSyst
long
timeCost
=
GetCurrentTimeMillis
()
-
startTime
;
timeAll
=
timeAll
+
timeCost
;
}
std
::
cout
<<
"Performance of RevokeSystemGrantedPermission interface is::"
<<
timeAll
/
10000
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
10000
,
5
);
std
::
cout
<<
"Performance of RevokeSystemGrantedPermission interface is::"
<<
timeAll
/
RUNNING_TIMES
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
RUNNING_TIMES
,
5
);
}
/**
...
...
@@ -507,7 +516,7 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_RevokeSyst
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_CanRequestPer_017
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Performance
Test
,
Security_AppSecurity_PermissionManager_L2_CanRequestPer_017
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
...
...
@@ -516,13 +525,13 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_CanRequest
ret
=
PermissionKit
::
AddUserGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
permList
,
TEST_USER_ID
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
long
startTime
=
GetCurrentTimeMillis
();
for
(
int
i
=
0
;
i
<
10000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
bool
isCanRequest
=
PermissionKit
::
CanRequestPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_ALPHA
,
TEST_USER_ID
);
ASSERT_TRUE
(
isCanRequest
);
}
long
timeAll
=
GetCurrentTimeMillis
()
-
startTime
;
std
::
cout
<<
"Performance of CanRequestPermission interface is::"
<<
timeAll
/
10000
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
10000
,
5
);
std
::
cout
<<
"Performance of CanRequestPermission interface is::"
<<
timeAll
/
RUNNING_TIMES
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
RUNNING_TIMES
,
5
);
}
/**
...
...
@@ -535,7 +544,7 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_CanRequest
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_VerifyPer_015
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Performance
Test
,
Security_AppSecurity_PermissionManager_L2_VerifyPer_015
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
...
...
@@ -546,11 +555,11 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_VerifyPer_
ret
=
PermissionKit
::
GrantSystemGrantedPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_BETA
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
long
startTime
=
GetCurrentTimeMillis
();
for
(
int
i
=
0
;
i
<
10000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
ret
=
PermissionKit
::
VerifyPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_BETA
,
TEST_USER_ID
);
ASSERT_EQ
(
PERMISSION_GRANTED
,
ret
);
}
long
timeAll
=
GetCurrentTimeMillis
()
-
startTime
;
std
::
cout
<<
"Performance of VerifyPermission interface is::"
<<
timeAll
/
10000
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
10000
,
5
);
std
::
cout
<<
"Performance of VerifyPermission interface is::"
<<
timeAll
/
RUNNING_TIMES
<<
"ms"
<<
std
::
endl
;
ASSERT_LT
(
timeAll
/
RUNNING_TIMES
,
5
);
}
security/permission/permissionkitcpp/src/PermissionKitReliabilityCPPTest.cpp
浏览文件 @
f87d6095
...
...
@@ -20,11 +20,20 @@
using
namespace
testing
::
ext
;
using
namespace
OHOS
::
Security
::
Permission
;
const
int
RUNNING_TIMES
=
5000
;
static
vector
<
PermissionDef
>
permDefNormal
;
static
vector
<
PermissionDef
>
permDefAbnormal1
;
static
vector
<
PermissionDef
>
permDefAbnormal2
;
void
PermissionKitTest
::
SetUpTestCase
()
class
PermissionKitReliabilityTest
:
public
testing
::
Test
{
public:
static
void
SetUpTestCase
();
static
void
TearDownTestCase
();
void
SetUp
();
void
TearDown
();
};
void
PermissionKitReliabilityTest
::
SetUpTestCase
()
{
vector
<
PermissionDef
>
permDefList1
;
vector
<
PermissionDef
>
permDefList2
;
...
...
@@ -80,10 +89,10 @@ void PermissionKitTest::SetUpTestCase()
permDefAbnormal2
=
permDefList3
;
}
void
PermissionKitTest
::
TearDownTestCase
()
void
PermissionKit
Reliability
Test
::
TearDownTestCase
()
{}
void
PermissionKitTest
::
SetUp
()
void
PermissionKit
Reliability
Test
::
SetUp
()
{
PermissionKit
::
RemoveDefPermissions
(
TEST_BUNDLE_NAME
);
PermissionKit
::
RemoveDefPermissions
(
ABNORMAL_BUNDLE_NAME
);
...
...
@@ -96,7 +105,7 @@ void PermissionKitTest::SetUp()
PermissionKit
::
RevokeSystemGrantedPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_BETA
);
}
void
PermissionKitTest
::
TearDown
()
void
PermissionKit
Reliability
Test
::
TearDown
()
{
PermissionKit
::
RemoveDefPermissions
(
TEST_BUNDLE_NAME
);
PermissionKit
::
RemoveDefPermissions
(
ABNORMAL_BUNDLE_NAME
);
...
...
@@ -119,9 +128,9 @@ void PermissionKitTest::TearDown()
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_AddDefPer_008
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Reliability
Test
,
Security_AppSecurity_PermissionManager_L2_AddDefPer_008
,
TestSize
.
Level3
)
{
for
(
int
i
=
0
;
i
<
5000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
int
ret
=
PermissionKit
::
RemoveDefPermissions
(
TEST_BUNDLE_NAME
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
...
...
@@ -139,9 +148,9 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_AddDefPer_
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_RemoveDefPer_007
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Reliability
Test
,
Security_AppSecurity_PermissionManager_L2_RemoveDefPer_007
,
TestSize
.
Level3
)
{
for
(
int
i
=
0
;
i
<
5000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
ret
=
PermissionKit
::
RemoveDefPermissions
(
TEST_BUNDLE_NAME
);
...
...
@@ -159,12 +168,12 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_RemoveDefP
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_GetDefPer_005
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Reliability
Test
,
Security_AppSecurity_PermissionManager_L2_GetDefPer_005
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
PermissionDef
permissionDefResultAlpha
;
for
(
int
i
=
0
;
i
<
5000
;
i
++
)
{
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
)
{
ret
=
PermissionKit
::
GetDefPermission
(
TEST_PERMISSION_NAME_ALPHA
,
permissionDefResultAlpha
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
}
...
...
@@ -180,13 +189,13 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_GetDefPer_
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_AddUserGrantedPer_013
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Reliability
Test
,
Security_AppSecurity_PermissionManager_L2_AddUserGrantedPer_013
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
vector
<
string
>
permList
;
permList
.
push_back
(
TEST_PERMISSION_NAME_ALPHA
);
for
(
int
i
=
0
;
i
<
5000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
ret
=
PermissionKit
::
AddUserGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
permList
,
TEST_USER_ID
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
ret
=
PermissionKit
::
RemoveUserGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
TEST_USER_ID
);
...
...
@@ -204,13 +213,13 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_AddUserGra
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_AddSystemGrantedPer_010
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Reliability
Test
,
Security_AppSecurity_PermissionManager_L2_AddSystemGrantedPer_010
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
vector
<
string
>
permList
;
permList
.
push_back
(
TEST_PERMISSION_NAME_ALPHA
);
for
(
int
i
=
0
;
i
<
5000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
ret
=
PermissionKit
::
AddSystemGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
permList
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
ret
=
PermissionKit
::
RemoveSystemGrantedReqPermissions
(
TEST_BUNDLE_NAME
);
...
...
@@ -228,13 +237,13 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_AddSystemG
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_RemoveUserGrantedPer_011
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Reliability
Test
,
Security_AppSecurity_PermissionManager_L2_RemoveUserGrantedPer_011
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
vector
<
string
>
permList
;
permList
.
push_back
(
TEST_PERMISSION_NAME_ALPHA
);
for
(
int
i
=
0
;
i
<
10000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
ret
=
PermissionKit
::
AddUserGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
permList
,
TEST_USER_ID
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
ret
=
PermissionKit
::
RemoveUserGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
TEST_USER_ID
);
...
...
@@ -252,13 +261,13 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_RemoveUser
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_RemoveSystemGrantedPer_008
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Reliability
Test
,
Security_AppSecurity_PermissionManager_L2_RemoveSystemGrantedPer_008
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
vector
<
string
>
permList
;
permList
.
push_back
(
TEST_PERMISSION_NAME_BETA
);
for
(
int
i
=
0
;
i
<
5000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
ret
=
PermissionKit
::
AddSystemGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
permList
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
ret
=
PermissionKit
::
RemoveSystemGrantedReqPermissions
(
TEST_BUNDLE_NAME
);
...
...
@@ -276,7 +285,7 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_RemoveSyst
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_GrantUserGrantedPer_013
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Reliability
Test
,
Security_AppSecurity_PermissionManager_L2_GrantUserGrantedPer_013
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
...
...
@@ -284,7 +293,7 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_GrantUserG
permList
.
push_back
(
TEST_PERMISSION_NAME_ALPHA
);
ret
=
PermissionKit
::
AddUserGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
permList
,
TEST_USER_ID
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
for
(
int
i
=
0
;
i
<
5000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
ret
=
PermissionKit
::
GrantUserGrantedPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_ALPHA
,
TEST_USER_ID
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
ret
=
PermissionKit
::
VerifyPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_ALPHA
,
TEST_USER_ID
);
...
...
@@ -306,7 +315,7 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_GrantUserG
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_GrantSystemGrantedPer_010
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Reliability
Test
,
Security_AppSecurity_PermissionManager_L2_GrantSystemGrantedPer_010
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
...
...
@@ -314,7 +323,7 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_GrantSyste
permList
.
push_back
(
TEST_PERMISSION_NAME_BETA
);
ret
=
PermissionKit
::
AddSystemGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
permList
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
for
(
int
i
=
0
;
i
<
5000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
ret
=
PermissionKit
::
GrantSystemGrantedPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_BETA
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
ret
=
PermissionKit
::
VerifyPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_BETA
,
TEST_USER_ID
);
...
...
@@ -336,7 +345,7 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_GrantSyste
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_RevokeUserGrantedPer_014
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Reliability
Test
,
Security_AppSecurity_PermissionManager_L2_RevokeUserGrantedPer_014
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
...
...
@@ -344,7 +353,7 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_RevokeUser
permList
.
push_back
(
TEST_PERMISSION_NAME_ALPHA
);
ret
=
PermissionKit
::
AddUserGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
permList
,
TEST_USER_ID
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
for
(
int
i
=
0
;
i
<
10000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
ret
=
PermissionKit
::
GrantUserGrantedPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_ALPHA
,
TEST_USER_ID
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
ret
=
PermissionKit
::
VerifyPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_ALPHA
,
TEST_USER_ID
);
...
...
@@ -366,7 +375,7 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_RevokeUser
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_RevokeSystemGrantedPer_011
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Reliability
Test
,
Security_AppSecurity_PermissionManager_L2_RevokeSystemGrantedPer_011
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
...
...
@@ -374,7 +383,7 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_RevokeSyst
permList
.
push_back
(
TEST_PERMISSION_NAME_BETA
);
ret
=
PermissionKit
::
AddSystemGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
permList
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
for
(
int
i
=
0
;
i
<
10000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
ret
=
PermissionKit
::
GrantSystemGrantedPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_BETA
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
ret
=
PermissionKit
::
VerifyPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_BETA
,
TEST_USER_ID
);
...
...
@@ -396,7 +405,7 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_RevokeSyst
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_CanRequestPer_016
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Reliability
Test
,
Security_AppSecurity_PermissionManager_L2_CanRequestPer_016
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
...
...
@@ -404,7 +413,7 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_CanRequest
permList
.
push_back
(
TEST_PERMISSION_NAME_ALPHA
);
ret
=
PermissionKit
::
AddUserGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
permList
,
TEST_USER_ID
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
for
(
int
i
=
0
;
i
<
5000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
bool
isCanRequest
=
PermissionKit
::
CanRequestPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_ALPHA
,
TEST_USER_ID
);
ASSERT_TRUE
(
isCanRequest
);
}
...
...
@@ -420,7 +429,7 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_CanRequest
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitTest
,
Security_AppSecurity_PermissionManager_L2_VerifyPer_014
,
TestSize
.
Level3
)
HWTEST_F
(
PermissionKit
Reliability
Test
,
Security_AppSecurity_PermissionManager_L2_VerifyPer_014
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
...
...
@@ -430,7 +439,7 @@ HWTEST_F(PermissionKitTest, Security_AppSecurity_PermissionManager_L2_VerifyPer_
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
ret
=
PermissionKit
::
GrantSystemGrantedPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_BETA
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
for
(
int
i
=
0
;
i
<
10000
;
i
++
){
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
ret
=
PermissionKit
::
VerifyPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_BETA
,
TEST_USER_ID
);
ASSERT_EQ
(
PERMISSION_GRANTED
,
ret
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录