提交 559107e2 编写于 作者: 1 15829070344

【账号】bundlename修改和normal权限修改

Signed-off-by: N15829070344 <hehaitao5@huawei.com>
Change-Id: I5d4edb7b79e9fb2ac7bc822c69289cc4fa8c1b09
上级 d0242b9c
......@@ -24,7 +24,6 @@ group("appaccount_hap") {
"actsgetallaccounts:ActsGetAllAccountsTest",
"actssetcheckdatasyncenable:ActsSetCheckDataSyncEnableTest",
"actssetchecksyncenable:ActsSetCheckSyncEnableTest",
"getallaccessibleaccounts:accessibleaccounts",
"getallaccounts:getallaccounts",
"sceneProject:appaccount_scene",
]
......
......@@ -144,11 +144,13 @@ export default function ActsAccountErrPermission() {
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat finish====");
appAccountManager.createAccount("accessibleAccount_callback_nopermission", (err)=>{
console.debug("====> add account ActsAccountErrPermission_0500 err:" + JSON.stringify(err));
expect(err).assertEqual(null);
console.debug("====>add account ActsAccountErrPermission_0500 err:" + JSON.stringify(err));
expect(err).assertEqual(null);
appAccountManager.getAllAccounts((err, data)=>{
console.debug("====>getAllAccounts 0500 err:" + JSON.stringify(err));
expect(err.code).assertEqual(ERR_PERMISSION_DENIED);
expect(data.length).assertEqual(1);
expect(data[0].name).assertEqual("accessibleAccount_callback_nopermission");
expect(data[0].owner).assertEqual("com.example.actsaccountoperatetest");
appAccountManager.removeAccount("accessibleAccount_callback_nopermission", (err)=>{
console.debug("====>delete Account ActsAccountErrPermission_0500 err:" + JSON.stringify(err));
expect(err).assertEqual(null);
......@@ -173,12 +175,17 @@ export default function ActsAccountErrPermission() {
console.debug("====>getAllAccounts 0600 start====");
try{
var data = await appAccountManager.getAllAccounts();
expect(data.length).assertEqual(1);
expect(data[0].name).assertEqual("accessibleAccount_promise_nopermission");
expect(data[0].owner).assertEqual("com.example.actsaccountoperatetest");
console.debug("====>getAllAccounts 0600 err:" + JSON.stringify(data));
await appAccountManager.removeAccount("accessibleAccount_promise_nopermission");
console.debug("====>ActsAccountErrPermission_0600 end====");
done();
}
catch(err){
console.debug("====>getAllAccounts 0600 err:" + JSON.stringify(err));
expect(err.code).assertEqual(ERR_PERMISSION_DENIED);
await appAccountManager.removeAccount("accessibleAccount_promise_nopermission");
console.debug("====>ActsAccountErrPermission_0600 end====");
expect().assertFail();
done();
}
});
......
......@@ -28,17 +28,8 @@
"moduleType": "entry"
},
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS"
}
],
"reqPermissions": [
{
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS",
"reason": "ceshi"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
......
......@@ -19,8 +19,8 @@
"mainAbility": ".MainAbility",
"srcPath":"",
"deviceType": [
"tablet",
"default",
"tablet",
"default",
"phone"
],
"distro": {
......@@ -29,17 +29,8 @@
"moduleType": "entry"
},
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS"
}
],
"reqPermissions": [
{
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS",
"reason": "ceshi"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
......@@ -126,4 +117,4 @@
"srcPath": "TestRunner"
}
}
}
}
......@@ -344,90 +344,7 @@ export default function ActsGetAllAccounts() {
console.debug("====>ActsGetAllAccounts_1000 end====");
done();
}, TIMEOUT);
});
/*
* @tc.number : ActsGetAllAccounts_1100
* @tc.name : getAllAccounts callback
* @tc.desc : This application adds an account, and after other applications authorize an account to this
* application, this application obtains the information of its own application
*/
it('ActsGetAllAccounts_1100', 0, async function (done) {
console.debug("====>ActsGetAllAccounts_0900 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat finish====");
var specifiedBundle = "com.example.actsscenegetallaccounts";
console.debug("====>startAbility 1100 start====");
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.actsscenegetallaccounts",
abilityName: "com.example.actsscenegetallaccounts.MainAbility",
action: "action1",
parameters:
{},
},
},
);
function getAllCallback(err, data){
console.debug("====>getAllAccounts 1100 err:" + JSON.stringify(err));
console.debug("====>getAllAccounts 1100 data:" + JSON.stringify(data));
expect(err).assertEqual(null);
expect(data[0].name).assertEqual("account_name_scene_single");
expect(data[0].owner).assertEqual("com.example.actsscenegetallaccounts");
console.debug("====>ActsGetAllAccounts_1100 end====");
done();
}
setTimeout(async function(){
console.debug("====>getAllAccounts 1100 start====");
appAccountManager.getAllAccounts(specifiedBundle, getAllCallback);
}, TIMEOUT);
});
/*
* @tc.number : ActsGetAllAccounts_1200
* @tc.name : getAllAccounts promise
* @tc.desc : This application adds an account, and after other applications authorize an account to this
* application, this application obtains the information of its own application
*/
it('ActsGetAllAccounts_1200', 0, async function (done) {
console.debug("====>ActsGetAllAccounts_1200 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat finish====");
var specifiedBundle = "com.example.actsscenegetallaccounts";
console.debug("====>startAbility 1200 start====");
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.actsscenegetallaccounts",
abilityName: "com.example.actsscenegetallaccounts.MainAbility",
action: "action1",
parameters:
{},
},
},
);
setTimeout(async function(){
console.debug("====>getAllAccounts 1200 start====");
try{
var data = await appAccountManager.getAllAccounts(specifiedBundle);
}
catch(err){
console.error("====>getAllAccounts 1200 fail err:" + JSON.stringify(err));
expect().assertFail();
done();
}
console.debug("====>getAllAccounts 1200 data:" + JSON.stringify(data));
expect(data[0].name).assertEqual("account_name_scene_single");
expect(data[0].owner).assertEqual("com.example.actsscenegetallaccounts");
console.debug("====>ActsGetAllAccounts_1200 end====");
done();
}, TIMEOUT);
});
});
/*
* @tc.number : ActsGetAllAccounts_1300
......
# 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")
group("accessibleaccounts") {
testonly = true
if (is_standard_system) {
deps = [
"actsgetallaccessibleaccounts:ActsGetAllAccessibleAccountsTest",
"actsgetallaccessiblemultiple:ActsGetAllAccessibleMultipleTest",
]
}
}
# 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("ActsGetAllAccessibleAccountsTest") {
hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsGetAllAccessibleAccountsTest"
subsystem_name = "account"
part_name = "os_account"
}
ohos_js_assets("hjs_demo_js_assets") {
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "60000",
"bundle-name": "com.example.actsgetallaccessibleaccounts",
"package-name": "com.example.actsgetallaccessibleaccounts",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsGetAllAccessibleAccountsTest.hap",
"ActsAccountSceneAccessible.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsgetallaccessibleaccounts",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsgetallaccessibleaccounts",
"name": ".entry",
"mainAbility": ".MainAbility",
"srcPath":"",
"deviceType": [
"tablet",
"default",
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS"
}
],
"reqPermissions": [
{
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS",
"reason": "ceshi"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO",
"reason":"need use ohos.permission.GET_BUNDLE_INFO"
},
{
"name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
"reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
},
{
"name":"ohos.permission.REMOVE_CACHE_FILES",
"reason":"need use ohos.permission.REMOVE_CACHE_FILES"
},
{
"name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
"reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
}
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility",
"srcLanguage": "js",
"srcPath": "MainAbility",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
},
{
"orientation": "unspecified",
"formsEnabled": false,
"name": ".TestAbility",
"srcLanguage": "js",
"srcPath": "TestAbility",
"icon": "$media:icon",
"description": "$string:TestAbility_desc",
"label": "$string:TestAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
}
}
}
\ No newline at end of file
/*
* 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('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
/*
* 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.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<!--
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.
-->
<div class="container">
<text class="title">
{{title}}
</text>
</div>
/*
* 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.
*/
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: "getAllAccessibleAccounts"
},
onInit() {
this.title = "getAllAccessibleAccounts";
},
onShow() {
console.info('onShow finish')
},
onReady() {
},
}
\ No newline at end of file
/*
* Copyright (c) 2022 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('TestApplication onCreate')
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info("TestApplication onDestroy");
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
/*
* 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.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
\ No newline at end of file
<!--
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.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{title}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
/*
* Copyright (c) 2022 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 {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
}
}
/*
* Copyright (c) 2022 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s itName',
'-s level', '-s testType', '-s size', '-s timeout',
'-s package', '-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
export default {
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare')
},
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
console.info('debug value : '+debug)
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + data.stdResult);
console.info('executeShellCommand : data : ' + data.exitCode);
})
}
};
/*
* 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 ActsGetAllAccessibleAccounts from './Getallaccessible.test.js'
export default function testsuite() {
ActsGetAllAccessibleAccounts()
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "ActsGetAllAccessibleAccounts"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
# 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("ActsGetAllAccessibleMultipleTest") {
hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsGetAllAccessibleMultipleTest"
subsystem_name = "account"
part_name = "os_account"
}
ohos_js_assets("hjs_demo_js_assets") {
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "60000",
"bundle-name": "com.example.actsgetallaccessiblemultiple",
"package-name": "com.example.actsgetallaccessiblemultiple",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsGetAllAccessibleMultipleTest.hap",
"ActsAccountAccessibleFirst.hap",
"ActsAccountAccessibleSecond.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsgetallaccessiblemultiple",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsgetallaccessiblemultiple",
"name": ".entry",
"mainAbility": ".MainAbility",
"srcPath":"",
"deviceType": [
"tablet",
"default",
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS"
}
],
"reqPermissions": [
{
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS",
"reason": "ceshi"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO",
"reason":"need use ohos.permission.GET_BUNDLE_INFO"
},
{
"name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
"reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
},
{
"name":"ohos.permission.REMOVE_CACHE_FILES",
"reason":"need use ohos.permission.REMOVE_CACHE_FILES"
},
{
"name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
"reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
}
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility",
"srcLanguage": "js",
"srcPath": "MainAbility",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
},
{
"orientation": "unspecified",
"formsEnabled": false,
"name": ".TestAbility",
"srcLanguage": "js",
"srcPath": "TestAbility",
"icon": "$media:icon",
"description": "$string:TestAbility_desc",
"label": "$string:TestAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
}
}
}
\ No newline at end of file
/*
* 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('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
/*
* 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.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<!--
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.
-->
<div class="container">
<text class="title">
{{title}}
</text>
</div>
/*
* 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.
*/
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: "getAllAccessibleAccounts"
},
onInit() {
this.title = "getAllAccessibleAccounts";
},
onShow() {
console.info('onShow finish')
},
onReady() {
},
}
\ No newline at end of file
/*
* Copyright (c) 2022 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('TestApplication onCreate')
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info("TestApplication onDestroy");
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
/*
* 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.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
\ No newline at end of file
<!--
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.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{title}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
/*
* Copyright (c) 2022 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 {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
}
}
/*
* Copyright (c) 2022 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s itName',
'-s level', '-s testType', '-s size', '-s timeout',
'-s package', '-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
export default {
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare')
},
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
console.info('debug value : '+debug)
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + data.stdResult);
console.info('executeShellCommand : data : ' + data.exitCode);
})
}
};
/*
* 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 account from '@ohos.account.appAccount'
import featureAbility from '@ohos.ability.featureAbility'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
const TIMEOUT = 5000;
export default function ActsGetAllAccessibleMultiple() {
describe('ActsGetAllAccessibleMultiple', function () {
beforeAll(async function (done) {
console.debug("====>startAbility first start====");
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.actsaccountaccessiblefirst",
abilityName: "com.example.actsaccountaccessiblefirst.MainAbility",
action: "action1",
parameters:
{},
},
},
);
sleep(TIMEOUT);
done();
});
function sleep(delay) {
var start = (new Date()).getTime();
while((new Date()).getTime() - start < delay) {
continue;
}
}
/*
* @tc.number : ActsGetAllAccessibleMultiple_0100
* @tc.name : getAllAccessibleAccounts
* @tc.desc : This application adds multiple account, other applications authorizes multiple accounts to this
* application and this application obtains authorization
*/
it('ActsGetAllAccessibleMultiple_0100', 0, async function (done) {
console.debug("====>ActsGetAllAccessibleMultiple_0100 start====");
let dataMap = new Map();
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat finish====");
console.debug("====>add first account 0100 start====");
await appAccountManager.addAccount("accessibleAccount_this_application_first");
console.debug("====>add second account 0100 start====");
await appAccountManager.addAccount("accessibleAccount_this_application_second");
console.debug("====>add third account 0100 start====");
await appAccountManager.addAccount("accessibleAccount_this_application_third");
console.debug("====>getAllAccessibleAccounts 0100 start====");
try{
var data = await appAccountManager.getAllAccessibleAccounts();
}
catch(err){
console.error("====>getAllAccessibleAccounts 0100 fail err:" + JSON.stringify(err));
expect().assertFail();
done();
}
console.debug("====>getAllAccessibleAccounts 0100 data:" + JSON.stringify(data));
expect(data.length).assertEqual(7);
console.debug("====>data.length:" + data.length);
for (let i = 0, len = data.length; i < len; i++) {
dataMap.set(data[i].name, data[i].owner)
}
expect(dataMap.has("account_name_scene_first_first")).assertTrue();
if (dataMap.has("account_name_scene_first_first")) {
let data = dataMap.get("account_name_scene_first_first");
console.debug("====>first account owner is: " + data);
expect(data).assertEqual("com.example.actsaccountaccessiblefirst");
}
expect(dataMap.has("account_name_scene_first_second")).assertTrue();
if (dataMap.has("account_name_scene_first_second")) {
let data = dataMap.get("account_name_scene_first_second");
console.debug("====>second account owner is: " + data);
expect(data).assertEqual("com.example.actsaccountaccessiblefirst");
}
expect(dataMap.has("account_name_scene_second_first")).assertTrue();
if (dataMap.has("account_name_scene_second_first")) {
let data = dataMap.get("account_name_scene_second_first");
console.debug("====>third account owner is: " + data);
expect(data).assertEqual("com.example.actsaccountaccessiblesecond");
}
expect(dataMap.has("account_name_scene_second_second")).assertTrue();
if (dataMap.has("account_name_scene_second_second")) {
let data = dataMap.get("account_name_scene_second_second");
console.debug("====>fourth account owner is: " + data);
expect(data).assertEqual("com.example.actsaccountaccessiblesecond");
}
expect(dataMap.has("accessibleAccount_this_application_first")).assertTrue();
if (dataMap.has("accessibleAccount_this_application_first")) {
let data = dataMap.get("accessibleAccount_this_application_first");
console.debug("====>fifth account owner is: " + data);
expect(data).assertEqual("com.example.actsgetallaccessiblemultiple");
}
expect(dataMap.has("accessibleAccount_this_application_second")).assertTrue();
if (dataMap.has("accessibleAccount_this_application_second")) {
let data = dataMap.get("accessibleAccount_this_application_second");
console.debug("====>sixth account owner is: " + data);
expect(data).assertEqual("com.example.actsgetallaccessiblemultiple");
}
expect(dataMap.has("accessibleAccount_this_application_third")).assertTrue();
if (dataMap.has("accessibleAccount_this_application_third")) {
let data = dataMap.get("accessibleAccount_this_application_third");
console.debug("====>seventh account owner is: " + data);
expect(data).assertEqual("com.example.actsgetallaccessiblemultiple");
}
console.debug("====>delete account start====");
await appAccountManager.deleteAccount("accessibleAccount_this_application_first");
await appAccountManager.deleteAccount("accessibleAccount_this_application_second");
await appAccountManager.deleteAccount("accessibleAccount_this_application_third");
console.debug("====>ActsGetAllAccessibleAccounts_0100 end====");
done();
});
})
}
\ No newline at end of file
/*
* 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 ActsGetAllAccessibleMultiple from './Getmultiple.test.js'
export default function testsuite() {
ActsGetAllAccessibleMultiple()
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "ActsGetAllAccessibleMultiple"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
......@@ -28,17 +28,8 @@
"moduleType": "entry"
},
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS"
}
],
"reqPermissions": [
{
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS",
"reason": "ceshi"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
......
......@@ -28,17 +28,8 @@
"moduleType": "entry"
},
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS"
}
],
"reqPermissions": [
{
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS",
"reason": "ceshi"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册