Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
66376440
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,发现更多精彩内容 >>
提交
66376440
编写于
5月 12, 2022
作者:
Z
zhouyan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
将系统api从acts中移除
Signed-off-by:
N
zhouyan
<
zhouyan128@huawei.com
>
上级
7802e2c1
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
2 addition
and
650 deletion
+2
-650
security/BUILD.gn
security/BUILD.gn
+0
-1
security/access_token/AccessTokenTest_NoPermission_js/BUILD.gn
...ity/access_token/AccessTokenTest_NoPermission_js/BUILD.gn
+0
-31
security/access_token/AccessTokenTest_NoPermission_js/Test.json
...ty/access_token/AccessTokenTest_NoPermission_js/Test.json
+0
-18
security/access_token/AccessTokenTest_NoPermission_js/signature/openharmony_sx.p7b
...essTokenTest_NoPermission_js/signature/openharmony_sx.p7b
+0
-0
security/access_token/AccessTokenTest_NoPermission_js/src/main/config.json
...oken/AccessTokenTest_NoPermission_js/src/main/config.json
+0
-89
security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/app.js
...ccessTokenTest_NoPermission_js/src/main/js/default/app.js
+0
-23
security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/i18n/en-US.json
...nTest_NoPermission_js/src/main/js/default/i18n/en-US.json
+0
-6
security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/i18n/zh-CN.json
...nTest_NoPermission_js/src/main/js/default/i18n/zh-CN.json
+0
-6
security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/pages/index/index.css
...NoPermission_js/src/main/js/default/pages/index/index.css
+0
-9
security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/pages/index/index.hml
...NoPermission_js/src/main/js/default/pages/index/index.hml
+0
-5
security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/pages/index/index.js
..._NoPermission_js/src/main/js/default/pages/index/index.js
+0
-46
security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/test/AccessToken.test.js
...ermission_js/src/main/js/default/test/AccessToken.test.js
+0
-104
security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/test/List.test.js
...est_NoPermission_js/src/main/js/default/test/List.test.js
+0
-16
security/access_token/AccessTokenTest_NoPermission_js/src/main/resources/base/element/string.json
...Permission_js/src/main/resources/base/element/string.json
+0
-12
security/access_token/AccessTokenTest_NoPermission_js/src/main/resources/base/media/icon.png
...st_NoPermission_js/src/main/resources/base/media/icon.png
+0
-0
security/access_token/AccessTokenTest_Normal_js/src/main/js/default/i18n/en-US.json
...ssTokenTest_Normal_js/src/main/js/default/i18n/en-US.json
+1
-1
security/access_token/AccessTokenTest_Normal_js/src/main/js/default/test/AccessToken.test.js
...st_Normal_js/src/main/js/default/test/AccessToken.test.js
+0
-282
security/access_token/AccessTokenTest_Normal_js/src/main/resources/base/element/string.json
...est_Normal_js/src/main/resources/base/element/string.json
+1
-1
未找到文件。
security/BUILD.gn
浏览文件 @
66376440
...
...
@@ -17,7 +17,6 @@ group("security") {
testonly = true
if (is_standard_system) {
deps = [
"access_token/AccessTokenTest_NoPermission_js:ActsAccessTokenJSApiTestNoPermission",
"access_token/AccessTokenTest_Normal_js:ActsAccessTokenJSApiTestNormal",
"huks_standard",
"security_huks_basic",
...
...
security/access_token/AccessTokenTest_NoPermission_js/BUILD.gn
已删除
100755 → 0
浏览文件 @
7802e2c1
# 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")
ohos_js_hap_suite("ActsAccessTokenJSApiTestNoPermission") {
hap_profile = "./src/main/config.json"
deps = [
":accesstoken_js_assets",
":accesstoken_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAccessTokenJSApiTestNoPermission"
}
ohos_js_assets("accesstoken_js_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("accesstoken_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
security/access_token/AccessTokenTest_NoPermission_js/Test.json
已删除
100755 → 0
浏览文件 @
7802e2c1
{
"description"
:
"Configuration for osaccount js api Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"60000"
,
"package"
:
"ohos.acts.security.access_token.nopermission"
,
"shell-timeout"
:
"60000"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsAccessTokenJSApiTestNoPermission.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
\ No newline at end of file
security/access_token/AccessTokenTest_NoPermission_js/signature/openharmony_sx.p7b
已删除
100755 → 0
浏览文件 @
7802e2c1
文件已删除
security/access_token/AccessTokenTest_NoPermission_js/src/main/config.json
已删除
100755 → 0
浏览文件 @
7802e2c1
{
"app"
:
{
"bundleName"
:
"ohos.acts.security.access_token.nopermission"
,
"vendor"
:
"acts"
,
"version"
:
{
"code"
:
1000000
,
"name"
:
"1.0.0"
},
"apiVersion"
:
{
"compatible"
:
4
,
"target"
:
5
,
"releaseType"
:
"Release"
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"ohos.acts.security.access_token.nopermission"
,
"name"
:
".MyApplication"
,
"deviceType"
:
[
"phone"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
},
"definePermissions"
:
[
{
"name"
:
"ohos.permission.ALPHA"
,
"grantMode"
:
"user_grant"
,
"availableLevel"
:
"system_basic"
,
"provisionEnable"
:
true
,
"distributedSceneEnable"
:
true
,
"label"
:
"ALPHA label"
,
"description"
:
"ALPHA description"
},
{
"name"
:
"ohos.permission.BETA"
,
"grantMode"
:
"system_grant"
,
"availableLevel"
:
"system_basic"
,
"provisionEnable"
:
true
,
"distributedSceneEnable"
:
true
,
"label"
:
"BETA label"
,
"description"
:
"BETA description"
}
],
"abilities"
:
[
{
"visible"
:
true
,
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"name"
:
"ohos.acts.security.access_token.nopermission.MainAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:mainability_description"
,
"label"
:
"$string:app_name"
,
"type"
:
"page"
,
"launchType"
:
"standard"
}
],
"js"
:
[
{
"pages"
:
[
"pages/index/index"
],
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
],
"reqPermissions"
:
[
{
"name"
:
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name"
:
"ohos.permission.GET_BUNDLE_INFO"
}
]
}
}
security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/app.js
已删除
100755 → 0
浏览文件 @
7802e2c1
/*
* 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.
*/
export
default
{
onCreate
()
{
console
.
info
(
'
ohos.acts.distributeddatamgr.distributedfile onCreate
'
);
},
onDestroy
()
{
console
.
info
(
'
ohos.acts.distributeddatamgr.distributedfile onCreate
'
);
}
};
security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/i18n/en-US.json
已删除
100755 → 0
浏览文件 @
7802e2c1
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"Test"
}
}
\ No newline at end of file
security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/i18n/zh-CN.json
已删除
100755 → 0
浏览文件 @
7802e2c1
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"测试"
}
}
\ No newline at end of file
security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/pages/index/index.css
已删除
100755 → 0
浏览文件 @
7802e2c1
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
font-size
:
100px
;
}
security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/pages/index/index.hml
已删除
100755 → 0
浏览文件 @
7802e2c1
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/pages/index/index.js
已删除
100755 → 0
浏览文件 @
7802e2c1
/*
* 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
app
from
'
@system.app
'
import
{
Core
,
ExpectExtend
}
from
'
deccjsunit/index
'
export
default
{
data
:
{
title
:
''
},
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
onShow
()
{
console
.
info
(
'
onShow finish
'
)
const
core
=
Core
.
getInstance
()
const
expectExtend
=
new
ExpectExtend
({
'
id
'
:
'
extend
'
})
core
.
addService
(
'
expect
'
,
expectExtend
)
core
.
init
()
const
configService
=
core
.
getDefaultService
(
'
config
'
)
this
.
timeout
=
10000
configService
.
setConfig
(
this
)
require
(
'
../../test/List.test
'
)
core
.
execute
()
},
onReady
()
{
},
}
security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/test/AccessToken.test.js
已删除
100755 → 0
浏览文件 @
7802e2c1
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except 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 permission and
* limitations under the License.
*/
// @ts-nocheck
import
{
describe
,
beforeEach
,
afterEach
,
it
,
expect
}
from
'
deccjsunit/index
'
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
import
bundle
from
'
@ohos.bundle
'
var
PermissionFlag
=
{
PERMISSION_USER_SET
:
1
,
PERMISSION_USER_FIXED
:
2
,
PERMISSION_SYSTEM_FIXED
:
3
};
const
RESULT_FAIL
=
-
1
const
TIMEOUT
=
1000
;
const
DEFAULT_PERMISSION_FALG
=
0
var
permissionNameUser
=
"
ohos.permission.ALPHA
"
;
var
tokenID
=
undefined
describe
(
'
AccessTokenTest
'
,
function
(){
console
.
log
(
'
##########start AccessTokenTests
'
);
beforeAll
(
async
function
(
done
){
var
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.acts.security.access_token.nopermission
'
,
0
,
100
);
tokenID
=
appInfo
.
accessTokenId
;
console
.
log
(
"
AccessTokenTest accessTokenId:
"
+
appInfo
.
accessTokenId
+
"
, name:
"
+
appInfo
.
name
+
"
, bundleName:
"
+
appInfo
.
bundleName
)
console
.
info
(
"
sleep begin
"
);
sleep
(
TIMEOUT
);
console
.
info
(
"
sleep end
"
);
done
();
})
afterEach
(
function
(){
})
function
sleep
(
delay
){
var
start
=
(
new
Date
()).
getTime
();
var
next
=
(
new
Date
()).
getTime
();
while
(
next
-
start
<
delay
){
next
=
(
new
Date
()).
getTime
();
}
}
/**
* @tc.number Test_grantUserGrantedPermission_007
* @tc.name Test atManager.grantUserGrantedPermission.
* @tc.desc Grant permission that has ohos.permission.GRANT_SENSITIVE_PERMISSIONS.
*/
it
(
'
Test_grantUserGrantedPermission_007
'
,
0
,
async
function
(
done
){
console
.
info
(
"
sleep begin
"
);
sleep
(
1000
);
console
.
info
(
"
sleep end
"
);
console
.
log
(
"
Test_grantUserGrantedPermission_007 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionNameUser
,
PermissionFlag
.
PERMISSION_USER_SET
);
console
.
log
(
"
Test_grantUserGrantedPermission_007 tokenID
"
+
tokenID
+
"
-
"
+
result
)
expect
(
result
).
assertEqual
(
RESULT_FAIL
);
done
();
})
/**
* @tc.number Test_revokeUserGrantedPermission_007
* @tc.name Test atManager.grantUserGrantedPermission.
* @tc.desc Revoke permission that has ohos.permission.GRANT_SENSITIVE_PERMISSIONS.
*/
it
(
'
Test_revokeUserGrantedPermission_007
'
,
0
,
async
function
(
done
){
console
.
log
(
"
Test_revokeUserGrantedPermission_007 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
await
atManager
.
revokeUserGrantedPermission
(
tokenID
,
permissionNameUser
,
PermissionFlag
.
PERMISSION_USER_SET
);
console
.
log
(
"
Test_revokeUserGrantedPermission_007 tokenID
"
+
tokenID
+
"
-
"
+
result
)
expect
(
result
).
assertEqual
(
RESULT_FAIL
);
done
();
})
/**
* @tc.number Test_getPermissionFlags_005
* @tc.name Test atManager.getPermissionFlags.
* @tc.desc Get permission flag that has ohos.permission.GRANT_SENSITIVE_PERMISSIONS.
*/
it
(
'
Test_getPermissionFlags_005
'
,
0
,
async
function
(
done
){
console
.
log
(
"
Test_getPermissionFlags_005 start
"
);
console
.
log
(
"
Test_getPermissionFlags_005 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
await
atManager
.
getPermissionFlags
(
tokenID
,
permissionNameUser
);
console
.
log
(
"
Test_getPermissionFlags_005 tokenID
"
+
tokenID
+
"
-
"
+
result
)
expect
(
result
).
assertEqual
(
DEFAULT_PERMISSION_FALG
);
done
();
})
})
security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/test/List.test.js
已删除
100755 → 0
浏览文件 @
7802e2c1
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except 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 permission and
* limitations under the License.
*/
require
(
'
./AccessToken.test.js
'
)
\ No newline at end of file
security/access_token/AccessTokenTest_NoPermission_js/src/main/resources/base/element/string.json
已删除
100755 → 0
浏览文件 @
7802e2c1
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"AccessTokenTest"
},
{
"name"
:
"mainability_description"
,
"value"
:
"JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
security/access_token/AccessTokenTest_NoPermission_js/src/main/resources/base/media/icon.png
已删除
100755 → 0
浏览文件 @
7802e2c1
6.6 KB
security/access_token/AccessTokenTest_Normal_js/src/main/js/default/i18n/en-US.json
浏览文件 @
66376440
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"
Test
"
"world"
:
"
World
"
}
}
\ No newline at end of file
security/access_token/AccessTokenTest_Normal_js/src/main/js/default/test/AccessToken.test.js
浏览文件 @
66376440
...
...
@@ -139,286 +139,4 @@ describe('AccessTokenTest', function () {
done
();
})
/**
* @tc.number Test_grantUserGrantedPermission_001
* @tc.name Test atManager.grantUserGrantedPermission.
* @tc.desc Test grant user_grant permission(Promise).
*/
it
(
'
Test_grantUserGrantedPermission_001
'
,
0
,
async
function
(
done
){
console
.
log
(
"
Test_grantUserGrantedPermission_001 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionNameUser
,
PermissionFlag
.
PERMISSION_USER_SET
);
console
.
log
(
"
Test_grantUserGrantedPermission_001 tokenID
"
+
tokenID
+
"
-
"
+
result
);
expect
(
result
).
assertEqual
(
RESULT_SUCCESS
);
var
result1
=
await
atManager
.
verifyAccessToken
(
tokenID
,
permissionNameUser
);
console
.
log
(
"
Test_grantUserGrantedPermission_001 tokenID
"
+
tokenID
+
"
-result1
"
+
result1
)
expect
(
result1
).
assertEqual
(
GrantStatus
.
PERMISSION_GRANTED
);
done
();
})
/**
* @tc.number Test_grantUserGrantedPermission_002
* @tc.name Test atManager.grantUserGrantedPermission.
* @tc.desc Test grant user_grant permission(Promise).
*/
it
(
'
Test_grantUserGrantedPermission_002
'
,
0
,
async
function
(
done
){
console
.
log
(
"
Test_grantUserGrantedPermission_002 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionNameSystem
,
PermissionFlag
.
PERMISSION_USER_SET
);
console
.
log
(
"
Test_grantUserGrantedPermission_002 tokenID
"
+
tokenID
+
"
-
"
+
result
);
expect
(
result
).
assertEqual
(
RESULT_FAIL
);
done
();
})
/**
* @tc.number Test_grantUserGrantedPermission_003
* @tc.name Test atManager.grantUserGrantedPermission.
* @tc.desc Test grant user_grant permission(Promise).
*/
it
(
'
Test_grantUserGrantedPermission_003
'
,
0
,
async
function
(
done
){
console
.
log
(
"
Test_grantUserGrantedPermission_003 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionNameUser
,
PermissionFlag
.
PERMISSION_USER_SET
,
function
(
result
)
{
console
.
log
(
"
Test_grantUserGrantedPermission_003 tokenID
"
+
tokenID
+
"
-
"
+
result
)
expect
(
result
).
assertEqual
(
RESULT_SUCCESS
);
atManager
.
verifyAccessToken
(
tokenID
,
permissionNameUser
).
then
(
function
(
result1
)
{
console
.
log
(
"
Test_grantUserGrantedPermission_003 tokenID
"
+
tokenID
+
"
-result1
"
+
result1
)
expect
(
result1
).
assertEqual
(
GrantStatus
.
PERMISSION_GRANTED
);
});
done
();
});
})
/**
* @tc.number Test_grantUserGrantedPermission_004
* @tc.name Test atManager.grantUserGrantedPermission.
* @tc.desc Test invalid TokenID(0)(Promise).
*/
it
(
'
Test_grantUserGrantedPermission_004
'
,
0
,
async
function
(
done
){
console
.
log
(
"
Test_grantUserGrantedPermission_004 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
await
atManager
.
grantUserGrantedPermission
(
0
,
permissionNameUser
,
PermissionFlag
.
PERMISSION_USER_SET
);
console
.
log
(
"
Test_grantUserGrantedPermission_004 tokenID
"
+
tokenID
+
"
-
"
+
result
);
expect
(
result
).
assertEqual
(
RESULT_FAIL
);
done
();
})
/**
* @tc.number Test_grantUserGrantedPermission_005
* @tc.name Test atManager.grantUserGrantedPermission.
* @tc.desc Test invalid permission(empty)(Promise).
*/
it
(
'
Test_grantUserGrantedPermission_005
'
,
0
,
async
function
(
done
){
console
.
log
(
"
Test_grantUserGrantedPermission_005 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
""
,
PermissionFlag
.
PERMISSION_USER_SET
);
console
.
log
(
"
Test_grantUserGrantedPermission_005 tokenID
"
+
tokenID
+
"
-
"
+
result
);
expect
(
result
).
assertEqual
(
RESULT_FAIL
);
done
();
})
/**
* @tc.number Test_grantUserGrantedPermission_006
* @tc.name Test atManager.grantUserGrantedPermission.
* @tc.desc Test invalid permission(length exceeds 256)(Promise).
*/
it
(
'
Test_grantUserGrantedPermission_006
'
,
0
,
async
function
(
done
){
console
.
log
(
"
Test_grantUserGrantedPermission_006 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
permissionName
=
"
ohos.permission.testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
+
"
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
+
"
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
;
var
result
=
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName
,
PermissionFlag
.
PERMISSION_USER_SET
);
console
.
log
(
"
Test_grantUserGrantedPermission_006 tokenID
"
+
tokenID
+
"
-
"
+
result
);
expect
(
result
).
assertEqual
(
RESULT_FAIL
);
done
();
})
/**
* @tc.number Test_revokeUserGrantedPermission_001
* @tc.name Test atManager.revokeUserGrantedPermission.
* @tc.desc Test revoke user_grant permission(Promise).
*/
it
(
'
Test_revokeUserGrantedPermission_001
'
,
0
,
async
function
(
done
){
console
.
log
(
"
Test_revokeUserGrantedPermission_001 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
await
atManager
.
revokeUserGrantedPermission
(
tokenID
,
permissionNameUser
,
PermissionFlag
.
PERMISSION_USER_SET
);
console
.
log
(
"
Test_revokeUserGrantedPermission_001 tokenID
"
+
tokenID
+
"
-
"
+
result
);
expect
(
result
).
assertEqual
(
RESULT_SUCCESS
);
var
result1
=
await
atManager
.
verifyAccessToken
(
tokenID
,
permissionNameUser
);
console
.
log
(
"
Test_revokeUserGrantedPermission_001 tokenID
"
+
tokenID
+
"
-result1
"
+
result1
)
expect
(
result1
).
assertEqual
(
GrantStatus
.
PERMISSION_DENIED
);
done
();
})
/**
* @tc.number Test_revokeUserGrantedPermission_002
* @tc.name Test atManager.revokeUserGrantedPermission.
* @tc.desc Test revoke system_grant permission(Promise).
*/
it
(
'
Test_revokeUserGrantedPermission_002
'
,
0
,
async
function
(
done
){
console
.
log
(
"
Test_revokeUserGrantedPermission_002 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
await
atManager
.
revokeUserGrantedPermission
(
tokenID
,
permissionNameSystem
,
PermissionFlag
.
PERMISSION_USER_SET
);
console
.
log
(
"
Test_revokeUserGrantedPermission_002 tokenID
"
+
tokenID
+
"
-
"
+
result
);
expect
(
result
).
assertEqual
(
RESULT_FAIL
);
done
();
})
/**
* @tc.number Test_revokeUserGrantedPermission_003
* @tc.name Test atManager.revokeUserGrantedPermission.
* @tc.desc Test revoke user_grant permission(AsyncCallback).
*/
it
(
'
Test_revokeUserGrantedPermission_003
'
,
0
,
async
function
(
done
){
console
.
log
(
"
Test_revokeUserGrantedPermission_003 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
atManager
.
revokeUserGrantedPermission
(
tokenID
,
permissionNameUser
,
PermissionFlag
.
PERMISSION_USER_SET
,
function
(
result
)
{
console
.
log
(
"
Test_revokeUserGrantedPermission_003 tokenID
"
+
tokenID
+
"
-
"
+
result
)
expect
(
result
).
assertEqual
(
RESULT_SUCCESS
);
atManager
.
verifyAccessToken
(
tokenID
,
permissionNameUser
).
then
(
function
(
result1
)
{
console
.
log
(
"
Test_revokeUserGrantedPermission_003 tokenID
"
+
tokenID
+
"
-result1
"
+
result1
)
expect
(
result1
).
assertEqual
(
GrantStatus
.
PERMISSION_DENIED
);
});
done
();
});
})
/**
* @tc.number Test_revokeUserGrantedPermission_004
* @tc.name Test atManager.revokeUserGrantedPermission.
* @tc.desc Test invalid TokenID(0)(Promise).
*/
it
(
'
Test_revokeUserGrantedPermission_004
'
,
0
,
async
function
(
done
){
console
.
log
(
"
Test_revokeUserGrantedPermission_004 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
await
atManager
.
revokeUserGrantedPermission
(
0
,
permissionNameUser
,
PermissionFlag
.
PERMISSION_USER_SET
);
console
.
log
(
"
Test_revokeUserGrantedPermission_004 tokenID
"
+
tokenID
+
"
-
"
+
result
);
expect
(
result
).
assertEqual
(
RESULT_FAIL
);
done
();
})
/**
* @tc.number Test_revokeUserGrantedPermission_005
* @tc.name Test atManager.revokeUserGrantedPermission.
* @tc.desc Test invalid permission(empty)(Promise).
*/
it
(
'
Test_revokeUserGrantedPermission_005
'
,
0
,
async
function
(
done
){
console
.
log
(
"
Test_revokeUserGrantedPermission_005 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
await
atManager
.
revokeUserGrantedPermission
(
tokenID
,
""
,
PermissionFlag
.
PERMISSION_USER_SET
);
console
.
log
(
"
Test_revokeUserGrantedPermission_005 tokenID
"
+
tokenID
+
"
-
"
+
result
);
expect
(
result
).
assertEqual
(
RESULT_FAIL
);
done
();
})
/**
* @tc.number Test_revokeUserGrantedPermission_006
* @tc.name Test atManager.revokeUserGrantedPermission.
* @tc.desc Test invalid permission(length exceeds 256)(Promise).
*/
it
(
'
Test_revokeUserGrantedPermission_006
'
,
0
,
async
function
(
done
){
console
.
log
(
"
Test_revokeUserGrantedPermission_006 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
permissionName
=
"
ohos.permission.testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
+
"
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
+
"
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
;
var
result
=
await
atManager
.
revokeUserGrantedPermission
(
tokenID
,
permissionName
,
PermissionFlag
.
PERMISSION_USER_SET
);
console
.
log
(
"
Test_revokeUserGrantedPermission_006 tokenID
"
+
tokenID
+
"
-
"
+
result
);
expect
(
result
).
assertEqual
(
RESULT_FAIL
);
done
();
})
/**
* @tc.number Test_getPermissionFlag_001
* @tc.name Test atManager.getPermissionFlags.
* @tc.desc Test get permission flag(Promise).
*/
it
(
'
Test_getPermissionFlag_001
'
,
0
,
async
function
(
done
){
console
.
log
(
"
Test_getPermissionFlag_001 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionNameUser
,
PermissionFlag
.
PERMISSION_USER_SET
);
console
.
log
(
"
Test_getPermissionFlag_001 tokenID
"
+
tokenID
+
"
-
"
+
result
);
expect
(
result
).
assertEqual
(
RESULT_SUCCESS
);
var
result1
=
await
atManager
.
getPermissionFlags
(
tokenID
,
permissionNameUser
);
console
.
log
(
"
Test_getPermissionFlag_001 tokenID
"
+
tokenID
+
"
-result1
"
+
result1
)
expect
(
result1
).
assertEqual
(
PermissionFlag
.
PERMISSION_USER_SET
);
done
();
})
/**
* @tc.number Test_getPermissionFlag_002
* @tc.name Test atManager.getPermissionFlags.
* @tc.desc Test invalid TokenID(0)(Promise).
*/
it
(
'
Test_getPermissionFlag_002
'
,
0
,
async
function
(
done
){
console
.
log
(
"
Test_getPermissionFlag_002 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
await
atManager
.
getPermissionFlags
(
0
,
permissionNameUser
);
console
.
log
(
"
Test_getPermissionFlag_002 tokenID
"
+
tokenID
+
"
-
"
+
result
);
expect
(
result
).
assertEqual
(
DEFAULT_PERMISSION_FALG
);
done
();
})
/**
* @tc.number Test_getPermissionFlag_003
* @tc.name Test atManager.getPermissionFlags.
* @tc.desc Test invalid permission(empty)(Promise).
*/
it
(
'
Test_getPermissionFlag_003
'
,
0
,
async
function
(
done
){
console
.
log
(
"
Test_getPermissionFlag_003 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
await
atManager
.
getPermissionFlags
(
tokenID
,
""
);
console
.
log
(
"
Test_getPermissionFlag_003 tokenID
"
+
tokenID
+
"
-
"
+
result
);
expect
(
result
).
assertEqual
(
DEFAULT_PERMISSION_FALG
);
done
();
})
/**
* @tc.number Test_getPermissionFlag_004
* @tc.name Test atManager.getPermissionFlags.
* @tc.desc Test invalid permission(length exceeds 256)(Promise).
*/
it
(
'
Test_getPermissionFlag_004
'
,
0
,
async
function
(
done
){
console
.
log
(
"
Test_getPermissionFlag_004 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
permissionName
=
"
ohos.permission.testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
+
"
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
+
"
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
;
var
result
=
await
atManager
.
getPermissionFlags
(
tokenID
,
permissionName
);
console
.
log
(
"
Test_getPermissionFlag_004 tokenID
"
+
tokenID
+
"
-
"
+
result
);
expect
(
result
).
assertEqual
(
DEFAULT_PERMISSION_FALG
);
done
();
})
})
security/access_token/AccessTokenTest_Normal_js/src/main/resources/base/element/string.json
浏览文件 @
66376440
...
...
@@ -2,7 +2,7 @@
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"
Storagestatfsjstest
"
"value"
:
"
AccessTokenJsTestNormal
"
},
{
"name"
:
"mainability_description"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录