diff --git a/security/BUILD.gn b/security/BUILD.gn
index 83972393abf3bebb51eaa25a590d14ae192742fc..31b3a9344ef1b06b4cdcd05ac6002b44210778a6 100644
--- a/security/BUILD.gn
+++ b/security/BUILD.gn
@@ -16,6 +16,10 @@ import("//test/xts/tools/build/suite.gni")
group("security") {
testonly = true
if (is_standard_system) {
- deps = [ "huks_standard" ]
+ deps = [
+ "access_token/AccessTokenTest_NoPermission_js:ActsAccessTokenJSApiTestNoPermission",
+ "access_token/AccessTokenTest_Normal_js:ActsAccessTokenJSApiTestNormal",
+ "huks_standard",
+ ]
}
}
diff --git a/security/access_token/AccessTokenTest_NoPermission_js/BUILD.gn b/security/access_token/AccessTokenTest_NoPermission_js/BUILD.gn
new file mode 100755
index 0000000000000000000000000000000000000000..49a2fd0d28d867518654679c9ee1dd78f2628082
--- /dev/null
+++ b/security/access_token/AccessTokenTest_NoPermission_js/BUILD.gn
@@ -0,0 +1,31 @@
+# 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"
+}
diff --git a/security/access_token/AccessTokenTest_NoPermission_js/Test.json b/security/access_token/AccessTokenTest_NoPermission_js/Test.json
new file mode 100755
index 0000000000000000000000000000000000000000..d3ee33a5bea66052d6d01ef981027779558c5196
--- /dev/null
+++ b/security/access_token/AccessTokenTest_NoPermission_js/Test.json
@@ -0,0 +1,18 @@
+{
+ "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
diff --git a/security/access_token/AccessTokenTest_NoPermission_js/signature/openharmony_sx.p7b b/security/access_token/AccessTokenTest_NoPermission_js/signature/openharmony_sx.p7b
new file mode 100755
index 0000000000000000000000000000000000000000..25234c17b5817f2e82c495efdb57eb5e14d83015
Binary files /dev/null and b/security/access_token/AccessTokenTest_NoPermission_js/signature/openharmony_sx.p7b differ
diff --git a/security/access_token/AccessTokenTest_NoPermission_js/src/main/config.json b/security/access_token/AccessTokenTest_NoPermission_js/src/main/config.json
new file mode 100755
index 0000000000000000000000000000000000000000..225f526b509b725e46cc30738760c5d7244072a3
--- /dev/null
+++ b/security/access_token/AccessTokenTest_NoPermission_js/src/main/config.json
@@ -0,0 +1,89 @@
+{
+ "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"
+ }
+ ]
+ }
+}
diff --git a/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/app.js b/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/app.js
new file mode 100755
index 0000000000000000000000000000000000000000..60ee141c8dbd251c763b7b74552b5a133a774d6a
--- /dev/null
+++ b/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/app.js
@@ -0,0 +1,23 @@
+/*
+ * 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');
+ }
+};
diff --git a/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/i18n/en-US.json b/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/i18n/en-US.json
new file mode 100755
index 0000000000000000000000000000000000000000..ead52ed2e09ec82aaf7aa9f4e714ed39ea88308e
--- /dev/null
+++ b/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "Test"
+ }
+}
\ No newline at end of file
diff --git a/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/i18n/zh-CN.json b/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/i18n/zh-CN.json
new file mode 100755
index 0000000000000000000000000000000000000000..3f48f2585b24a8fe4a745e8ee2972a9e991a7803
--- /dev/null
+++ b/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "测试"
+ }
+}
\ No newline at end of file
diff --git a/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/pages/index/index.css b/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/pages/index/index.css
new file mode 100755
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/pages/index/index.css
@@ -0,0 +1,9 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/pages/index/index.hml b/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/pages/index/index.hml
new file mode 100755
index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184
--- /dev/null
+++ b/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/pages/index/index.js b/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/pages/index/index.js
new file mode 100755
index 0000000000000000000000000000000000000000..ea1734ec7a8698812e21f72ee5b4c4b71a9ccc33
--- /dev/null
+++ b/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/pages/index/index.js
@@ -0,0 +1,46 @@
+/*
+ * 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() {
+ },
+}
diff --git a/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/test/AccessToken.test.js b/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/test/AccessToken.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..ec3cf8880dcf200e337d0ffe8e3f370497942eca
--- /dev/null
+++ b/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/test/AccessToken.test.js
@@ -0,0 +1,105 @@
+/*
+ * 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();
+ continue;
+ }
+ }
+
+ /**
+ * @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();
+ })
+})
diff --git a/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/test/List.test.js b/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/test/List.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..7d5875a05bb68b1678e028906c7773245ca9aee5
--- /dev/null
+++ b/security/access_token/AccessTokenTest_NoPermission_js/src/main/js/default/test/List.test.js
@@ -0,0 +1,16 @@
+/*
+ * 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
diff --git a/security/access_token/AccessTokenTest_NoPermission_js/src/main/resources/base/element/string.json b/security/access_token/AccessTokenTest_NoPermission_js/src/main/resources/base/element/string.json
new file mode 100755
index 0000000000000000000000000000000000000000..7acf233da8b5debb2418bed91874c7f552fd91d3
--- /dev/null
+++ b/security/access_token/AccessTokenTest_NoPermission_js/src/main/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "AccessTokenTest"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/security/access_token/AccessTokenTest_NoPermission_js/src/main/resources/base/media/icon.png b/security/access_token/AccessTokenTest_NoPermission_js/src/main/resources/base/media/icon.png
new file mode 100755
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/security/access_token/AccessTokenTest_NoPermission_js/src/main/resources/base/media/icon.png differ
diff --git a/security/access_token/AccessTokenTest_Normal_js/BUILD.gn b/security/access_token/AccessTokenTest_Normal_js/BUILD.gn
new file mode 100755
index 0000000000000000000000000000000000000000..c9f047f390b1f0b87a677ae4e11b1d5d1e1dbe40
--- /dev/null
+++ b/security/access_token/AccessTokenTest_Normal_js/BUILD.gn
@@ -0,0 +1,31 @@
+# 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("ActsAccessTokenJSApiTestNormal") {
+ hap_profile = "./src/main/config.json"
+ deps = [
+ ":accesstoken_js_assets",
+ ":accesstoken_resources",
+ ]
+ certificate_profile = "./signature/openharmony_sx.p7b"
+ hap_name = "ActsAccessTokenJSApiTestNormal"
+}
+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"
+}
diff --git a/security/access_token/AccessTokenTest_Normal_js/Test.json b/security/access_token/AccessTokenTest_Normal_js/Test.json
new file mode 100755
index 0000000000000000000000000000000000000000..9fa5a90303703555bda4d9598e4f8f0e973996f2
--- /dev/null
+++ b/security/access_token/AccessTokenTest_Normal_js/Test.json
@@ -0,0 +1,18 @@
+{
+ "description": "Configuration for osaccount js api Tests",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "600000",
+ "package": "ohos.acts.security.access_token.normal",
+ "shell-timeout": "60000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "ActsAccessTokenJSApiTestNormal.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/security/access_token/AccessTokenTest_Normal_js/signature/openharmony_sx.p7b b/security/access_token/AccessTokenTest_Normal_js/signature/openharmony_sx.p7b
new file mode 100755
index 0000000000000000000000000000000000000000..25234c17b5817f2e82c495efdb57eb5e14d83015
Binary files /dev/null and b/security/access_token/AccessTokenTest_Normal_js/signature/openharmony_sx.p7b differ
diff --git a/security/access_token/AccessTokenTest_Normal_js/src/main/config.json b/security/access_token/AccessTokenTest_Normal_js/src/main/config.json
new file mode 100755
index 0000000000000000000000000000000000000000..10a5245cb992ad96b33f7200cbeddb4afdd38f58
--- /dev/null
+++ b/security/access_token/AccessTokenTest_Normal_js/src/main/config.json
@@ -0,0 +1,105 @@
+{
+ "app": {
+ "bundleName": "ohos.acts.security.access_token.normal",
+ "vendor": "acts",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Release"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "ohos.acts.security.access_token.normal",
+ "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"
+ }
+ ],
+ "reqPermissions": [
+ {
+ "name": "ohos.permission.ALPHA",
+ "reason": "use ohos.permission.ALPHA"
+ },
+ {
+ "name": "ohos.permission.BETA",
+ "reason": "use ohos.permission.BETA"
+ },
+ {
+ "name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
+ "reason": "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
+ },
+ {
+ "name": "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS",
+ "reason": "use ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"
+ },
+ {
+ "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
+ },
+ {
+ "name": "ohos.permission.GET_BUNDLE_INFO"
+ }
+ ],
+ "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
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/app.js b/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/app.js
new file mode 100755
index 0000000000000000000000000000000000000000..37aa79e4519ba957fcb84d27a32c566c86ae7844
--- /dev/null
+++ b/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/app.js
@@ -0,0 +1,23 @@
+/*
+ * 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.storage.statfs onCreate');
+ },
+ onDestroy() {
+ console.info('ohos.acts.storage.statfs onDestroy');
+ }
+};
diff --git a/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/i18n/en-US.json b/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/i18n/en-US.json
new file mode 100755
index 0000000000000000000000000000000000000000..ead52ed2e09ec82aaf7aa9f4e714ed39ea88308e
--- /dev/null
+++ b/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "Test"
+ }
+}
\ No newline at end of file
diff --git a/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/i18n/zh-CN.json b/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/i18n/zh-CN.json
new file mode 100755
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ }
+}
\ No newline at end of file
diff --git a/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/pages/index/index.css b/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/pages/index/index.css
new file mode 100755
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/pages/index/index.css
@@ -0,0 +1,9 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/pages/index/index.hml b/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/pages/index/index.hml
new file mode 100755
index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184
--- /dev/null
+++ b/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/pages/index/index.js b/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/pages/index/index.js
new file mode 100755
index 0000000000000000000000000000000000000000..82b0a652daad909a8cf7366575041e67f3fc0023
--- /dev/null
+++ b/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/pages/index/index.js
@@ -0,0 +1,48 @@
+/*
+ * 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'
+
+const injectRef = Object.getPrototypeOf(global) || global
+injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+
+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() {
+ },
+}
diff --git a/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/test/AccessToken.test.js b/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/test/AccessToken.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..3e2bf66b027b47c878a4a6ddc54545ccde749b66
--- /dev/null
+++ b/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/test/AccessToken.test.js
@@ -0,0 +1,425 @@
+/*
+ * 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
+};
+
+var GrantStatus = {
+ PERMISSION_DENIED: -1,
+ PERMISSION_GRANTED: 0,
+};
+const RESULT_SUCCESS = 0
+const RESULT_FAIL = -1
+const TIMEOUT = 5000;
+
+const DEFAULT_PERMISSION_FALG = 0
+var permissionNameUser = "ohos.permission.ALPHA";
+var permissionNameSystem = "ohos.permission.BETA";
+var tokenID = undefined
+describe('AccessTokenTest', function () {
+ console.log('##########start AccessTokenTest');
+ beforeAll(async function (done){
+ var appInfo = await bundle.getApplicationInfo('ohos.acts.security.access_token.normal', 0, 100);
+ tokenID = appInfo.accessTokenId;
+ console.log("AccessTokenTest accessTokenId:" + appInfo.accessTokenId + ", name:" + appInfo.name
+ + ", bundleName:" + appInfo.bundleName)
+ // setTimeout(done(),TIMEOUT);
+
+ 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();
+ continue;
+ }
+ }
+
+ /**
+ * @tc.number Test_verifyAccessToken_001
+ * @tc.name Test atManager.verifyAccessToken.
+ * @tc.desc After the installation, user_grant permission is not granted by default(Promise).
+ */
+ it('Test_verifyAccessToken_001', 0, async function(done){
+ console.log("Test_verifyAccessToken_001 start");
+ var atManager = abilityAccessCtrl.createAtManager();
+ var result = await atManager.verifyAccessToken(tokenID, permissionNameUser);
+ console.log("Test_verifyAccessToken_001 tokenID" + tokenID + "-" + result)
+ expect(result).assertEqual(GrantStatus.PERMISSION_DENIED);
+
+ done();
+ })
+
+ /**
+ * @tc.number Test_verifyAccessToken_002
+ * @tc.name Test atManager.verifyAccessToken.
+ * @tc.desc After the installation, system_grant permission is not granted by default(Promise).
+ */
+ it('Test_verifyAccessToken_002', 0, async function(done){
+ console.log("Test_verifyAccessToken_002 start");
+ var atManager = abilityAccessCtrl.createAtManager();
+ var result = await atManager.verifyAccessToken(tokenID, permissionNameSystem);
+ console.log("Test_verifyAccessToken_002 tokenID" + tokenID + "-" + result)
+ expect(result).assertEqual(GrantStatus.PERMISSION_GRANTED);
+
+ done();
+ })
+
+ /**
+ * @tc.number Test_verifyAccessToken_003
+ * @tc.name Test atManager.verifyAccessToken.
+ * @tc.desc Test invalid TokenID(0)(Promise).
+ */
+ it('Test_verifyAccessToken_003', 0, async function(done){
+ console.log("Test_verifyAccessToken_003 start");
+ var atManager = abilityAccessCtrl.createAtManager();
+ var result = await atManager.verifyAccessToken(0, permissionNameUser);
+ console.log("Test_verifyAccessToken_003 tokenID" + tokenID + "-" + result)
+ expect(result).assertEqual(GrantStatus.PERMISSION_DENIED);
+
+ done();
+ })
+
+ /**
+ * @tc.number Test_verifyAccessToken_004
+ * @tc.name Test atManager.verifyAccessToken.
+ * @tc.desc Test invalid permission(empty)(Promise).
+ */
+ it('Test_verifyAccessToken_004', 0, async function(done){
+ console.log("Test_verifyAccessToken_004 start");
+ var atManager = abilityAccessCtrl.createAtManager();
+ var result = await atManager.verifyAccessToken(tokenID, "");
+ console.log("Test_verifyAccessToken_004 tokenID" + tokenID + "-" + result)
+ expect(result).assertEqual(GrantStatus.PERMISSION_DENIED);
+
+ done();
+ })
+
+ /**
+ * @tc.number Test_verifyAccessToken_005
+ * @tc.name Test atManager.verifyAccessToken.
+ * @tc.desc Test invalid permission(length exceeds 256)(Promise).
+ */
+ it('Test_verifyAccessToken_005', 0, async function(done){
+ console.log("Test_verifyAccessToken_005 start");
+ var atManager = abilityAccessCtrl.createAtManager();
+ var permissionName = "ohos.permission.testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest"
+ + "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest"
+ + "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest";
+
+ var result = await atManager.verifyAccessToken(tokenID, permissionName);
+ console.log("Test_verifyAccessToken_005 tokenID" + tokenID + "-" + result)
+ expect(result).assertEqual(GrantStatus.PERMISSION_DENIED);
+
+ 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();
+ })
+})
diff --git a/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/test/List.test.js b/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/test/List.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..7d5875a05bb68b1678e028906c7773245ca9aee5
--- /dev/null
+++ b/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/test/List.test.js
@@ -0,0 +1,16 @@
+/*
+ * 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
diff --git a/security/access_token/AccessTokenTest_Normal_js/src/main/resources/base/element/string.json b/security/access_token/AccessTokenTest_Normal_js/src/main/resources/base/element/string.json
new file mode 100755
index 0000000000000000000000000000000000000000..a3b97c0acfe6cf4a1ff00dcfcf5eea4656fb3a8e
--- /dev/null
+++ b/security/access_token/AccessTokenTest_Normal_js/src/main/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "Storagestatfsjstest"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/security/access_token/AccessTokenTest_Normal_js/src/main/resources/base/media/icon.png b/security/access_token/AccessTokenTest_Normal_js/src/main/resources/base/media/icon.png
new file mode 100755
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/security/access_token/AccessTokenTest_Normal_js/src/main/resources/base/media/icon.png differ