未验证 提交 d1a68eb3 编写于 作者: O openharmony_ci 提交者: Gitee

!5729 settingsdata接口新增ohos.permission.MANAGE_SECURE_SETTINGS权限管控机制,用例需适配、蓝区用例路径整改

Merge pull request !5729 from 安宁/OpenHarmony-3.2-Beta3
# 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.
group("applications") {
testonly = true
deps = [ "settingsdata:settingsdata" ]
}
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
......
{ {
"description": "Configuration for settings Tests", "description": "Configuration for settings Tests",
"driver": { "driver": {
"type": "OHJSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "600000", "test-timeout": "600000",
"bundle-name": "com.open.harmony.settings", "bundle-name": "com.open.harmony.settings",
"package-name": "com.open.harmony.settings", "package-name": "com.open.harmony.settings",
"shell-timeout": "600000" "shell-timeout": "600000"
}, },
"kits": [ "kits": [
{ {
"test-file-name": [ "test-file-name": [
"ActsSettingsEtsTest.hap" "ActsSettingsEtsTest.hap"
], ],
"type": "AppInstallKit", "type": "AppInstallKit",
"cleanup-apps": true "cleanup-apps": true
} }
] ]
} }
{ {
"app": { "app": {
"bundleName": "com.open.harmony.settings", "bundleName": "com.open.harmony.settings",
"vendor": "open", "vendor": "open",
"version": { "version": {
"code": 1000000, "code": 1000000,
"name": "1.0.0" "name": "1.0.0"
}, },
"apiVersion": { "apiVersion": {
"compatible": 7, "compatible": 7,
"releaseType": "Release", "releaseType": "Release",
"target": 7 "target": 7
} }
}, },
"deviceConfig": {}, "deviceConfig": {},
"module": { "module": {
"package": "com.open.harmony.settings", "package": "com.open.harmony.settings",
"name": ".MyApplication", "name": ".MyApplication",
"mainAbility": "com.open.harmony.settings.MainAbility", "mainAbility": "com.open.harmony.settings.MainAbility",
"srcPath": "", "srcPath": "",
"deviceType": [ "deviceType": [
"phone" "phone"
], ],
"distro": { "distro": {
"deliveryWithInstall": true, "deliveryWithInstall": true,
"moduleName": "entry", "moduleName": "entry",
"moduleType": "entry", "moduleType": "entry",
"installationFree": false "installationFree": false
}, },
"abilities": [ "abilities": [
{ {
"skills": [ "skills": [
{ {
"entities": [ "entities": [
"entity.system.home" "entity.system.home"
], ],
"actions": [ "actions": [
"action.system.home" "action.system.home"
] ]
} }
], ],
"orientation": "unspecified", "orientation": "unspecified",
"visible": true, "visible": true,
"srcPath": "MainAbility", "srcPath": "MainAbility",
"name": ".MainAbility", "name": ".MainAbility",
"srcLanguage": "ets", "srcLanguage": "ets",
"icon": "$media:icon", "icon": "$media:icon",
"description": "$string:description_mainability", "description": "$string:description_mainability",
"formsEnabled": false, "formsEnabled": false,
"label": "$string:entry_MainAbility", "label": "$string:entry_MainAbility",
"type": "page", "type": "page",
"launchType": "standard" "launchType": "standard"
}, },
{ {
"orientation": "unspecified", "orientation": "unspecified",
"visible": true, "visible": true,
"srcPath": "TestAbility", "srcPath": "TestAbility",
"name": ".TestAbility", "name": ".TestAbility",
"srcLanguage": "ets", "srcLanguage": "ets",
"icon": "$media:icon", "icon": "$media:icon",
"description": "$string:TestAbility_desc", "description": "$string:TestAbility_desc",
"formsEnabled": false, "formsEnabled": false,
"label": "$string:TestAbility_label", "label": "$string:TestAbility_label",
"type": "page", "type": "page",
"launchType": "standard" "launchType": "standard"
} }
], ],
"js": [ "reqPermissions": [
{ {
"mode": { "name":"ohos.permission.MANAGE_SECURE_SETTINGS",
"syntax": "ets", "reason":"need use ohos.permission.,MANAGE_SECURE_SETTINGS"
"type": "pageAbility" }
}, ],
"pages": [ "js": [
"pages/index" {
], "mode": {
"name": ".MainAbility", "syntax": "ets",
"window": { "type": "pageAbility"
"designWidth": 720, },
"autoDesignWidth": false "pages": [
} "pages/index"
}, ],
{ "name": ".MainAbility",
"mode": { "window": {
"syntax": "ets", "designWidth": 720,
"type": "pageAbility" "autoDesignWidth": false
}, }
"pages": [ },
"pages/index" {
], "mode": {
"name": ".TestAbility", "syntax": "ets",
"window": { "type": "pageAbility"
"designWidth": 720, },
"autoDesignWidth": false "pages": [
} "pages/index"
} ],
] "name": ".TestAbility",
} "window": {
} "designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
/** /**
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
export default { export default {
onCreate() { onCreate() {
console.info('Application onCreate') console.info('Application onCreate')
}, },
onDestroy() { onDestroy() {
console.info('Application onDestroy') console.info('Application onDestroy')
}, },
} }
\ No newline at end of file
// @ts-nocheck // @ts-nocheck
/** /**
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
@Entry @Entry
@Component @Component
struct MyComponent { struct MyComponent {
aboutToAppear() { aboutToAppear() {
} }
build() { build() {
Flex({ Flex({
direction: FlexDirection.Column, direction: FlexDirection.Column,
alignItems: ItemAlign.Center, alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center justifyContent: FlexAlign.Center
}) { }) {
Text('Settings ETS TEST') Text('Settings ETS TEST')
.fontSize(50) .fontSize(50)
.fontWeight(FontWeight.Bold) .fontWeight(FontWeight.Bold)
} }
.width('100%') .width('100%')
.height('100%') .height('100%')
} }
} }
/* /*
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index' import { Hypium } from 'hypium/index'
import testsuite from '../test/List.test' import testsuite from '../test/List.test'
export default { export default {
onCreate() { onCreate() {
console.info('Application onCreate') console.info('Application onCreate')
var abilityDelegator: any var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!') console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}, },
onDestroy() { onDestroy() {
console.info('Application onDestroy') console.info('Application onDestroy')
}, },
} }
\ No newline at end of file
/* /*
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import router from '@system.router'; import router from '@system.router';
@Entry @Entry
@Component @Component
struct Index { struct Index {
aboutToAppear() { aboutToAppear() {
console.info('TestAbility index aboutToAppear') console.info('TestAbility index aboutToAppear')
} }
@State message: string = 'Hello World' @State message: string = 'Hello World'
build() { build() {
Row() { Row() {
Column() { Column() {
Text(this.message) Text(this.message)
.fontSize(50) .fontSize(50)
.fontWeight(FontWeight.Bold) .fontWeight(FontWeight.Bold)
Button() { Button() {
Text('next page') Text('next page')
.fontSize(20) .fontSize(20)
.fontWeight(FontWeight.Bold) .fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule) }.type(ButtonType.Capsule)
.margin({ .margin({
top: 20 top: 20
}) })
.backgroundColor('#0D9FFB') .backgroundColor('#0D9FFB')
.width('35%') .width('35%')
.height('5%') .height('5%')
.onClick(()=>{ .onClick(()=>{
}) })
} }
.width('100%') .width('100%')
} }
.height('100%') .height('100%')
} }
} }
\ No newline at end of file
/* /*
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import TestRunner from '@ohos.application.testRunner' import TestRunner from '@ohos.application.testRunner'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
var abilityDelegator = undefined var abilityDelegator = undefined
var abilityDelegatorArguments = undefined var abilityDelegatorArguments = undefined
function translateParamsToString(parameters) { function translateParamsToString(parameters) {
const keySet = new Set([ const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s itName', '-s class', '-s notClass', '-s suite', '-s itName',
'-s level', '-s testType', '-s size', '-s timeout', '-s level', '-s testType', '-s size', '-s timeout',
'-s package' '-s package'
]) ])
let targetParams = ''; let targetParams = '';
for (const key in parameters) { for (const key in parameters) {
if (keySet.has(key)) { if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key] targetParams += ' ' + key + ' ' + parameters[key]
} }
} }
return targetParams.trim() return targetParams.trim()
} }
async function onAbilityCreateCallback() { async function onAbilityCreateCallback() {
console.log('onAbilityCreateCallback'); console.log('onAbilityCreateCallback');
} }
async function addAbilityMonitorCallback(err: any) { async function addAbilityMonitorCallback(err: any) {
console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) console.info('addAbilityMonitorCallback : ' + JSON.stringify(err))
} }
export default class OpenHarmonyTestRunner implements TestRunner { export default class OpenHarmonyTestRunner implements TestRunner {
constructor() { constructor() {
} }
onPrepare() { onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare') console.info('OpenHarmonyTestRunner OnPrepare')
} }
onRun() { onRun() {
console.log('OpenHarmonyTestRunner onRun run') console.log('OpenHarmonyTestRunner onRun run')
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
let lMonitor = { let lMonitor = {
abilityName: testAbilityName, abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback, onAbilityCreate: onAbilityCreateCallback,
}; };
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
console.info('cmd : '+cmd) console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd, abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => { (err: any, d: any) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err)); console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + d.stdResult); console.info('executeShellCommand : data : ' + d.stdResult);
console.info('executeShellCommand : data : ' + d.exitCode); console.info('executeShellCommand : data : ' + d.exitCode);
}) })
console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext') console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext')
var context = abilityDelegator.getAppContext() var context = abilityDelegator.getAppContext()
console.info('getAppContext : ' + JSON.stringify(context)) console.info('getAppContext : ' + JSON.stringify(context))
console.info('OpenHarmonyTestRunner onRun end') console.info('OpenHarmonyTestRunner onRun end')
} }
}; };
\ No newline at end of file
/** /**
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import settingUiJsunit from './SettingUiJsunit.test.ets'; import settingUiJsunit from './SettingUiJsunit.test.ets';
export default function testsuite() { export default function testsuite() {
settingUiJsunit(); settingUiJsunit();
} }
\ No newline at end of file
{ {
"string": [ "string": [
{ {
"name": "entry_MainAbility", "name": "entry_MainAbility",
"value": "entry_MainAbility" "value": "entry_MainAbility"
}, },
{ {
"name": "description_mainability", "name": "description_mainability",
"value": "ETS_Empty Ability" "value": "ETS_Empty Ability"
}, },
{ {
"name": "TestAbility_desc", "name": "TestAbility_desc",
"value": "description" "value": "description"
}, },
{ {
"name": "TestAbility_label", "name": "TestAbility_label",
"value": "label" "value": "label"
} }
] ]
} }
\ No newline at end of file
...@@ -47,6 +47,7 @@ _all_test_packages = [ ...@@ -47,6 +47,7 @@ _all_test_packages = [
"${ACTS_ROOT}/barrierfree:barrierfree", "${ACTS_ROOT}/barrierfree:barrierfree",
"${ACTS_ROOT}/customization:customization", "${ACTS_ROOT}/customization:customization",
"${ACTS_ROOT}/distributedschedule:systemabilitymgr", "${ACTS_ROOT}/distributedschedule:systemabilitymgr",
"${ACTS_ROOT}/applications:applications",
] ]
_all_test_packages_ivi = [ _all_test_packages_ivi = [
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册