Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
43f7bf33
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,发现更多精彩内容 >>
提交
43f7bf33
编写于
12月 29, 2021
作者:
O
openharmony_ci
提交者:
Gitee
12月 29, 2021
浏览文件
操作
浏览文件
下载
差异文件
!1440 Security_xts_permission offline
Merge pull request !1440 from 胡吉翔/Security_lite_20211228
上级
ca2d286e
70ef7250
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
1 addition
and
3372 deletion
+1
-3372
security/BUILD.gn
security/BUILD.gn
+1
-3
security/permission/permissionkitcpp/BUILD.gn
security/permission/permissionkitcpp/BUILD.gn
+0
-99
security/permission/permissionkitcpp/Test.json
security/permission/permissionkitcpp/Test.json
+0
-21
security/permission/permissionkitcpp/src/PermissionKitCPPTest.h
...ty/permission/permissionkitcpp/src/PermissionKitCPPTest.h
+0
-57
security/permission/permissionkitcpp/src/PermissionKitFunctionCPPTest.cpp
...ion/permissionkitcpp/src/PermissionKitFunctionCPPTest.cpp
+0
-2181
security/permission/permissionkitcpp/src/PermissionKitPerformanceCPPTest.cpp
.../permissionkitcpp/src/PermissionKitPerformanceCPPTest.cpp
+0
-565
security/permission/permissionkitcpp/src/PermissionKitReliabilityCPPTest.cpp
.../permissionkitcpp/src/PermissionKitReliabilityCPPTest.cpp
+0
-446
未找到文件。
security/BUILD.gn
浏览文件 @
43f7bf33
...
...
@@ -20,10 +20,8 @@ group("security") {
# "authentication_standard/deviceauth_p2p:DeviceauthP2PFunctionCPPTest",
"dataprotect/huks_standard_adapter:ActsHuksStdFunctionTest",
"deviceauth/deviceauth_function:ActsDeviceAuthFunctionTest",
"permission/permissionkitcpp:ActsPermissionKitCPPTest",
]
} else {
deps =
[ "permission/zpermissioninfoswitch:zpermissioninfoswitchFunctionTest" ]
deps = []
}
}
security/permission/permissionkitcpp/BUILD.gn
已删除
100644 → 0
浏览文件 @
ca2d286e
# 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("//test/xts/tools/build/suite.gni")
##################################################################################
config("module_private_config") {
visibility = [ ":*" ]
include_dirs = [
"//utils/native/base/include",
"//base/security/permission/interfaces/innerkits/permission_standard/permissionsdk/main/cpp/include/permission",
]
}
##################################################################################
ohos_moduletest_suite("PermissionKitFunctionCPPTest") {
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" ]
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",
]
}
##################################################################################
ohos_moduletest_suite("PermissionKitPerformanceCPPTest") {
subsystem_name = "hits"
part_name = "permission_standard"
module_out_path = subsystem_name + "/" + part_name
configs = [ ":module_private_config" ]
cflags_cc = [ "-DHILOG_ENABLE" ]
sources = [ "src/PermissionKitPerformanceCPPTest.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",
]
}
##################################################################################
ohos_moduletest_suite("PermissionKitReliabilityCPPTest") {
subsystem_name = "hits"
part_name = "permission_standard"
module_out_path = subsystem_name + "/" + part_name
configs = [ ":module_private_config" ]
cflags_cc = [ "-DHILOG_ENABLE" ]
sources = [ "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",
]
}
##################################################################################
ohos_moduletest_suite("ActsPermissionKitCPPTest") {
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
已删除
100644 → 0
浏览文件 @
ca2d286e
{
"kits"
:
[
{
"push"
:
[
"ActsPermissionKitCPPTest->/data/local/tmp/ActsPermissionKitCPPTest"
],
"type"
:
"PushKit"
,
"post-push"
:
[
"chmod -R 777 /data/local/tmp/*"
]
}
],
"driver"
:
{
"native-test-timeout"
:
"120000"
,
"type"
:
"CppTest"
,
"module-name"
:
"ActsPermissionKitCPPTest"
,
"runtime-hint"
:
"1s"
,
"native-test-device-path"
:
"/data/local/tmp"
},
"description"
:
"Configuration for ActsPermissionKitCPPTest Tests"
}
security/permission/permissionkitcpp/src/PermissionKitCPPTest.h
已删除
100644 → 0
浏览文件 @
ca2d286e
/*
* 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.
*/
#ifndef PERMISSION_KIT_TEST_H
#define PERMISSION_KIT_TEST_H
#include <gtest/gtest.h>
#include <string>
namespace
OHOS
{
namespace
Security
{
namespace
Permission
{
class
PermissionKitTest
:
public
testing
::
Test
{
public:
static
void
SetUpTestCase
();
static
void
TearDownTestCase
();
void
SetUp
();
void
TearDown
();
};
static
const
std
::
string
TEST_BUNDLE_NAME
=
"ohos"
;
static
const
std
::
string
LONG_BUNDLE_NAME
=
"111111111111111111111111111111111111111111111111111111111111111111111111"
;
static
const
std
::
string
ABNORMAL_BUNDLE_NAME
=
"!@#¥%……&*()"
;
static
const
std
::
string
BUNDLE_NAME_NOT_EXIST
=
"not.exist"
;
static
const
std
::
string
TEST_PERMISSION_NAME_ALPHA
=
"ohos.permission.ALPHA"
;
static
const
std
::
string
TEST_PERMISSION_NAME_BETA
=
"ohos.permission.BETA"
;
static
const
std
::
string
TEST_PERMISSION_NAME_GAMMA
=
"ohos.permission.GAMMA"
;
static
const
std
::
string
TEST_PERMISSION_NAME_ABNORMAL
=
"!@#¥%……&*()"
;
static
const
std
::
string
PERMISSION_NAME_NOT_EXIST
=
"ohos.permission.not.exist"
;
static
const
std
::
string
TEST_LABEL
=
"test label"
;
static
const
std
::
string
TEST_DESCRIPTION
=
"test description"
;
static
const
std
::
string
TEST_DESCRIPTION_ABNORMAL
=
"!@#¥%……&*()"
;
static
const
int
TEST_LABEL_ID
=
9527
;
static
const
int
TEST_DESCRIPTION_ID
=
9528
;
static
const
int
TEST_INVALID_USER_ID
=
-
1
;
static
const
int
USER_ID_NOT_EXIST
=
25
;
static
const
int
TEST_USER_ID
=
0
;
static
const
int
TEST_SUB_USER_ID
=
10
;
}
// namespace Permission
}
// namespace Security
}
// namespace OHOS
#endif // PERMISSION_KIT_TEST_H
security/permission/permissionkitcpp/src/PermissionKitFunctionCPPTest.cpp
已删除
100644 → 0
浏览文件 @
ca2d286e
此差异已折叠。
点击以展开。
security/permission/permissionkitcpp/src/PermissionKitPerformanceCPPTest.cpp
已删除
100644 → 0
浏览文件 @
ca2d286e
此差异已折叠。
点击以展开。
security/permission/permissionkitcpp/src/PermissionKitReliabilityCPPTest.cpp
已删除
100644 → 0
浏览文件 @
ca2d286e
/*
* 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.
*/
#include "PermissionKitCPPTest.h"
#include "permission_kit.h"
#include <sys/time.h>
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
;
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
;
vector
<
PermissionDef
>
permDefList3
;
PermissionDef
permissionDefAlpha
=
{
.
permissionName
=
TEST_PERMISSION_NAME_ALPHA
,
.
bundleName
=
TEST_BUNDLE_NAME
,
.
grantMode
=
GrantMode
::
USER_GRANT
,
.
availableScope
=
AVAILABLE_SCOPE_ALL
,
.
label
=
TEST_LABEL
,
.
labelId
=
TEST_LABEL_ID
,
.
description
=
TEST_DESCRIPTION
,
.
descriptionId
=
TEST_DESCRIPTION_ID
};
PermissionDef
permissionDefBeta
=
{
.
permissionName
=
TEST_PERMISSION_NAME_BETA
,
.
bundleName
=
TEST_BUNDLE_NAME
,
.
grantMode
=
GrantMode
::
SYSTEM_GRANT
,
.
availableScope
=
AVAILABLE_SCOPE_ALL
,
.
label
=
TEST_LABEL
,
.
labelId
=
TEST_LABEL_ID
,
.
description
=
TEST_DESCRIPTION
,
.
descriptionId
=
TEST_DESCRIPTION_ID
};
PermissionDef
permissionDefAbnormal1
=
{
.
permissionName
=
TEST_PERMISSION_NAME_GAMMA
,
.
availableScope
=
AVAILABLE_SCOPE_ALL
,
.
label
=
TEST_LABEL
,
.
labelId
=
TEST_LABEL_ID
,
.
description
=
TEST_DESCRIPTION
,
.
descriptionId
=
TEST_DESCRIPTION_ID
};
PermissionDef
permissionDefAbnormal2
=
{
.
permissionName
=
TEST_PERMISSION_NAME_BETA
,
.
bundleName
=
ABNORMAL_BUNDLE_NAME
,
.
grantMode
=
GrantMode
::
SYSTEM_GRANT
,
.
availableScope
=
AVAILABLE_SCOPE_ALL
,
.
label
=
TEST_LABEL
,
.
labelId
=
TEST_LABEL_ID
,
.
description
=
TEST_DESCRIPTION_ABNORMAL
,
.
descriptionId
=
TEST_DESCRIPTION_ID
};
permDefList1
.
emplace_back
(
permissionDefAlpha
);
permDefList1
.
emplace_back
(
permissionDefBeta
);
permDefList2
.
emplace_back
(
permissionDefAbnormal1
);
permDefList3
.
emplace_back
(
permissionDefAbnormal2
);
permDefNormal
=
permDefList1
;
permDefAbnormal1
=
permDefList2
;
permDefAbnormal2
=
permDefList3
;
}
void
PermissionKitReliabilityTest
::
TearDownTestCase
()
{}
void
PermissionKitReliabilityTest
::
SetUp
()
{
PermissionKit
::
RemoveDefPermissions
(
TEST_BUNDLE_NAME
);
PermissionKit
::
RemoveDefPermissions
(
ABNORMAL_BUNDLE_NAME
);
PermissionKit
::
RemoveUserGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
TEST_USER_ID
);
PermissionKit
::
RemoveUserGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
TEST_SUB_USER_ID
);
PermissionKit
::
RemoveSystemGrantedReqPermissions
(
TEST_BUNDLE_NAME
);
PermissionKit
::
RemoveSystemGrantedReqPermissions
(
ABNORMAL_BUNDLE_NAME
);
PermissionKit
::
RevokeUserGrantedPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_ALPHA
,
TEST_USER_ID
);
PermissionKit
::
RevokeUserGrantedPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_ALPHA
,
TEST_SUB_USER_ID
);
PermissionKit
::
RevokeSystemGrantedPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_BETA
);
}
void
PermissionKitReliabilityTest
::
TearDown
()
{
PermissionKit
::
RemoveDefPermissions
(
TEST_BUNDLE_NAME
);
PermissionKit
::
RemoveDefPermissions
(
ABNORMAL_BUNDLE_NAME
);
PermissionKit
::
RemoveUserGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
TEST_USER_ID
);
PermissionKit
::
RemoveUserGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
TEST_SUB_USER_ID
);
PermissionKit
::
RemoveSystemGrantedReqPermissions
(
TEST_BUNDLE_NAME
);
PermissionKit
::
RemoveSystemGrantedReqPermissions
(
ABNORMAL_BUNDLE_NAME
);
PermissionKit
::
RevokeUserGrantedPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_ALPHA
,
TEST_USER_ID
);
PermissionKit
::
RevokeUserGrantedPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_ALPHA
,
TEST_SUB_USER_ID
);
PermissionKit
::
RevokeSystemGrantedPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_BETA
);
}
/**
* @tc.name AddDefPermissions, 稳定性
* @tc.number Security_AppSecurity_PermissionManager_L2_AddDefPer_008
* @tc.spec Security_AppSecurity_PermissionManager_L2_AddDefPer
* @tc.function Security_AppSecurity_PermissionManager_L2
* @tc.feature Security_AppSecurity_PermissionManager
* @tc.size MEDIUM
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitReliabilityTest
,
Security_AppSecurity_PermissionManager_L2_AddDefPer_008
,
TestSize
.
Level3
)
{
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
int
ret
=
PermissionKit
::
RemoveDefPermissions
(
TEST_BUNDLE_NAME
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
}
}
/**
* @tc.name RemoveDefPermissions, 稳定性
* @tc.number Security_AppSecurity_PermissionManager_L2_RemoveDefPer_007
* @tc.spec Security_AppSecurity_PermissionManager_L2_RemoveDefPer
* @tc.function Security_AppSecurity_PermissionManager_L2
* @tc.feature Security_AppSecurity_PermissionManager
* @tc.size MEDIUM
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitReliabilityTest
,
Security_AppSecurity_PermissionManager_L2_RemoveDefPer_007
,
TestSize
.
Level3
)
{
for
(
int
i
=
0
;
i
<
RUNNING_TIMES
;
i
++
){
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
ret
=
PermissionKit
::
RemoveDefPermissions
(
TEST_BUNDLE_NAME
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
}
}
/**
* @tc.name GetDefPermission, 稳定性
* @tc.number Security_AppSecurity_PermissionManager_L2_GetDefPer_005
* @tc.spec Security_AppSecurity_PermissionManager_L2_GetDefPer
* @tc.function Security_AppSecurity_PermissionManager_L2
* @tc.feature Security_AppSecurity_PermissionManager
* @tc.size MEDIUM
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitReliabilityTest
,
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
<
RUNNING_TIMES
;
i
++
)
{
ret
=
PermissionKit
::
GetDefPermission
(
TEST_PERMISSION_NAME_ALPHA
,
permissionDefResultAlpha
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
}
}
/**
* @tc.name AddUserGrantedReqPermissions, 稳定性
* @tc.number Security_AppSecurity_PermissionManager_L2_AddUserGrantedPer_013
* @tc.spec Security_AppSecurity_PermissionManager_L2_AddUserGrantedPer
* @tc.function Security_AppSecurity_PermissionManager_L2
* @tc.feature Security_AppSecurity_PermissionManager
* @tc.size MEDIUM
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitReliabilityTest
,
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
<
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
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
}
}
/**
* @tc.name AddSystemGrantedReqPermissions, 稳定性
* @tc.number Security_AppSecurity_PermissionManager_L2_AddSystemGrantedPer_010
* @tc.spec Security_AppSecurity_PermissionManager_L2_AddSystemGrantedPer
* @tc.function Security_AppSecurity_PermissionManager_L2
* @tc.feature Security_AppSecurity_PermissionManager
* @tc.size MEDIUM
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitReliabilityTest
,
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
<
RUNNING_TIMES
;
i
++
){
ret
=
PermissionKit
::
AddSystemGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
permList
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
ret
=
PermissionKit
::
RemoveSystemGrantedReqPermissions
(
TEST_BUNDLE_NAME
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
}
}
/**
* @tc.name RemoveUserGrantedReqPermissions, 稳定性
* @tc.number Security_AppSecurity_PermissionManager_L2_RemoveUserGrantedPer_011
* @tc.spec Security_AppSecurity_PermissionManager_L2_RemoveUserGrantedPer
* @tc.function Security_AppSecurity_PermissionManager_L2
* @tc.feature Security_AppSecurity_PermissionManager
* @tc.size MEDIUM
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitReliabilityTest
,
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
<
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
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
}
}
/**
* @tc.name RemoveSystemGrantedReqPermissions, 稳定性
* @tc.number Security_AppSecurity_PermissionManager_L2_RemoveSystemGrantedPer_008
* @tc.spec Security_AppSecurity_PermissionManager_L2_RemoveSystemGrantedPer
* @tc.function Security_AppSecurity_PermissionManager_L2
* @tc.feature Security_AppSecurity_PermissionManager
* @tc.size MEDIUM
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitReliabilityTest
,
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
<
RUNNING_TIMES
;
i
++
){
ret
=
PermissionKit
::
AddSystemGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
permList
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
ret
=
PermissionKit
::
RemoveSystemGrantedReqPermissions
(
TEST_BUNDLE_NAME
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
}
}
/**
* @tc.name GrantUserGrantedPermission, 稳定性
* @tc.number Security_AppSecurity_PermissionManager_L2_GrantUserGrantedPer_013
* @tc.spec Security_AppSecurity_PermissionManager_L2_GrantUserGrantedPer
* @tc.function Security_AppSecurity_PermissionManager_L2
* @tc.feature Security_AppSecurity_PermissionManager
* @tc.size MEDIUM
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitReliabilityTest
,
Security_AppSecurity_PermissionManager_L2_GrantUserGrantedPer_013
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
vector
<
string
>
permList
;
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
<
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
);
ASSERT_EQ
(
PERMISSION_GRANTED
,
ret
);
ret
=
PermissionKit
::
RevokeUserGrantedPermission
(
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
);
ASSERT_EQ
(
PERMISSION_NOT_GRANTED
,
ret
);
}
}
/**
* @tc.name GrantSystemGrantedPermissions, 稳定性
* @tc.number Security_AppSecurity_PermissionManager_L2_GrantSystemGrantedPer_010
* @tc.spec Security_AppSecurity_PermissionManager_L2_GrantSystemGrantedPer
* @tc.function Security_AppSecurity_PermissionManager_L2
* @tc.feature Security_AppSecurity_PermissionManager
* @tc.size MEDIUM
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitReliabilityTest
,
Security_AppSecurity_PermissionManager_L2_GrantSystemGrantedPer_010
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
vector
<
string
>
permList
;
permList
.
push_back
(
TEST_PERMISSION_NAME_BETA
);
ret
=
PermissionKit
::
AddSystemGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
permList
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
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
);
ASSERT_EQ
(
PERMISSION_GRANTED
,
ret
);
ret
=
PermissionKit
::
RevokeSystemGrantedPermission
(
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
);
ASSERT_EQ
(
PERMISSION_NOT_GRANTED
,
ret
);
}
}
/**
* @tc.name RevokeUserGrantedPermission, 稳定性
* @tc.number Security_AppSecurity_PermissionManager_L2_RevokeUserGrantedPer_014
* @tc.spec Security_AppSecurity_PermissionManager_L2_RevokeUserGrantedPer
* @tc.function Security_AppSecurity_PermissionManager_L2
* @tc.feature Security_AppSecurity_PermissionManager
* @tc.size MEDIUM
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitReliabilityTest
,
Security_AppSecurity_PermissionManager_L2_RevokeUserGrantedPer_014
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
vector
<
string
>
permList
;
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
<
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
);
ASSERT_EQ
(
PERMISSION_GRANTED
,
ret
);
ret
=
PermissionKit
::
RevokeUserGrantedPermission
(
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
);
ASSERT_EQ
(
PERMISSION_NOT_GRANTED
,
ret
);
}
}
/**
* @tc.name RevokeSystemGrantedPermission, 稳定性
* @tc.number Security_AppSecurity_PermissionManager_L2_RevokeSystemGrantedPer_011
* @tc.spec Security_AppSecurity_PermissionManager_L2_RevokeSystemGrantedPer
* @tc.function Security_AppSecurity_PermissionManager_L2
* @tc.feature Security_AppSecurity_PermissionManager
* @tc.size MEDIUM
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitReliabilityTest
,
Security_AppSecurity_PermissionManager_L2_RevokeSystemGrantedPer_011
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
vector
<
string
>
permList
;
permList
.
push_back
(
TEST_PERMISSION_NAME_BETA
);
ret
=
PermissionKit
::
AddSystemGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
permList
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
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
);
ASSERT_EQ
(
PERMISSION_GRANTED
,
ret
);
ret
=
PermissionKit
::
RevokeSystemGrantedPermission
(
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
);
ASSERT_EQ
(
PERMISSION_NOT_GRANTED
,
ret
);
}
}
/**
* @tc.name CanRequestPermission, 稳定性
* @tc.number Security_AppSecurity_PermissionManager_L2_CanRequestPer_016
* @tc.spec Security_AppSecurity_PermissionManager_L2_CanRequestPer
* @tc.function Security_AppSecurity_PermissionManager_L2
* @tc.feature Security_AppSecurity_PermissionManager
* @tc.size MEDIUM
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitReliabilityTest
,
Security_AppSecurity_PermissionManager_L2_CanRequestPer_016
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
vector
<
string
>
permList
;
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
<
RUNNING_TIMES
;
i
++
){
bool
isCanRequest
=
PermissionKit
::
CanRequestPermission
(
TEST_BUNDLE_NAME
,
TEST_PERMISSION_NAME_ALPHA
,
TEST_USER_ID
);
ASSERT_TRUE
(
isCanRequest
);
}
}
/**
* @tc.name VerifyPermission, 稳定性
* @tc.number Security_AppSecurity_PermissionManager_L2_VerifyPer_014
* @tc.spec Security_AppSecurity_PermissionManager_L2_VerifyPer
* @tc.function Security_AppSecurity_PermissionManager_L2
* @tc.feature Security_AppSecurity_PermissionManager
* @tc.size MEDIUM
* @tc.type FUNC
* @tc.level Level3
*/
HWTEST_F
(
PermissionKitReliabilityTest
,
Security_AppSecurity_PermissionManager_L2_VerifyPer_014
,
TestSize
.
Level3
)
{
int
ret
=
PermissionKit
::
AddDefPermissions
(
permDefNormal
);
ASSERT_EQ
(
RET_SUCCESS
,
ret
);
vector
<
string
>
permList
;
permList
.
push_back
(
TEST_PERMISSION_NAME_BETA
);
ret
=
PermissionKit
::
AddSystemGrantedReqPermissions
(
TEST_BUNDLE_NAME
,
permList
);
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
<
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录