提交 5308c598 编写于 作者: 张育帅 提交者: Gitee

解决冲突

Merge branch 'OpenHarmony-3.2-Release' of gitee.com:openharmony/xts_acts into monthly
Signed-off-by: N张育帅 <zhangyushuai1@huawei.com>
......@@ -30,6 +30,7 @@ group("ability_runtime") {
"actsdataabilityaccessdatasharetest:dataabilityaccessdatashare",
"actsfwkdataaccessortest:dataability",
"actsqueryfunctiontest:actsqueryfunctiontest",
"actsrequestdialogtest:actsrequestdialogtest",
"actsserviceabilityclienttest:serviceability",
"actsshellcommandfunctionalitytest:actsshellcommandfunctionalitytest",
"actssingleton:actssingleton",
......
# 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("//test/xts/tools/build/suite.gni")
group("actsrequestdialogtest") {
testonly = true
if (is_standard_system) {
deps = [ "actsrequestdialog:ActsRequestDialogTest" ]
}
}
{
"app":{
"bundleName":"com.acts.example.requestdialog",
"vendor":"huawei",
"versionCode":1000000,
"versionName":"1.0.0",
"debug":false,
"icon":"$media:icon",
"label":"$string:app_name",
"description":"$string:description_application",
"distributedNotificationEnabled":true,
"keepAlive":true,
"singleUser":true,
"minAPIVersion":9,
"targetAPIVersion":9,
"car":{
"apiCompatibleVersion":9,
"singleUser":false
}
}
}
{
"string":[
{
"name":"app_name",
"value":"ohosProject"
}
]
}
\ 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsRequestDialogTest") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":actsrequestdialog_js_assets",
":actsrequestrecent_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsRequestDialogTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsrequestdialog_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsrequestdialog_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsrequestrecent_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsrequestdialog_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "180000",
"bundle-name": "com.acts.example.requestdialog",
"module-name": "phone",
"shell-timeout": "600000",
"testcase-timeout": 70000
},
"kits": [
{
"test-file-name": [
"ActsRequestDialogTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"remount",
"mkdir /data/test"
]
},
{
"type": "PushKit",
"push": [
"ActsRequestDialogTest.hap->/data/test/ActsRequestDialogTest.hap"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod 644 /data/test/*.hap"
]
}
]
}
\ 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 AbilityStage from "@ohos.app.ability.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("MyAbilityStage onCreate");
globalThis.stageContext = this.context;
}
}
/*
* 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 Ability from '@ohos.app.ability.UIAbility'
export default class MainAbility extends Ability {
onCreate(want,launchParam){
// Ability is creating, initialize resources for this ability
console.log("MainAbility onCreate");
globalThis.abilityWant = want;
globalThis.abilityContext = this.context;
globalThis.applicationContext = this.context.getApplicationContext();
globalThis.requestDialogSuccess = false;
globalThis.validRequestInfo = false;
globalThis.validRequestCallback = false;
}
onDestroy() {
// Ability is destroying, release resources for this ability
console.log("MainAbility onDestroy");
globalThis.applicationContext.killAllProcesses().then((data)=>{
console.log(`MainAbility getRunningProcessInformation data ${JSON.stringify(data)}`);
}).catch((err)=>{
console.log(`MainAbility getRunningProcessInformation err ${JSON.stringify(err)}`);
})
globalThis.applicationContext.killAllProcesses((err, data)=>{
console.log(`MainAbility getRunningProcessInformation data ${JSON.stringify(data)}
err: ${JSON.stringify(err)}`);
})
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("MainAbility onWindowStageCreate");
windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null)
}
onWindowStageDestroy() {
//Main window is destroyed, release UI related resources
console.log("MainAbility onWindowStageDestroy");
}
onForeground() {
// Ability has brought to foreground
console.log("MainAbility onForeground");
}
onBackground() {
// Ability has back to background
console.log("MainAbility onBackground");
}
};
\ 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 router from '@ohos.router';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../../../test/List.test'
var testTime = 0;
@Entry
@Component
struct Index {
aboutToAppear(){
console.info("start run testcase!!!!")
if(testTime++==0){
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
}
build() {
Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('Hello World')
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(25)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
})
}
.width('100%')
.height('100%')
}
}
\ 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 router from '@system.router';
@Entry
@Component
struct Second {
private content: string = "Second Page"
build() {
Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('back to index')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
router.back()
})
}
.width('100%')
.height('100%')
}
}
\ 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 Ability from '@ohos.app.ability.UIAbility'
import commonEvent from '@ohos.commonEvent'
import dialogRequest from '@ohos.app.ability.dialogRequest'
async function publishEvent() {
var event = 'ACTS_REQUEST_DIALOG_EVENT1';
var commonEventPublishData = {
parameters: {
instanceCount: 1,
}
};
commonEvent.publish(event, commonEventPublishData, () => {
console.log('============>publish event success.==========>>')
});
}
export default class MainAbility2 extends Ability {
onCreate(want, launchParam) {
// Ability is creating, initialize resources for this ability
console.log("MainAbility2 onCreate");
globalThis.abilityWant2 = want;
globalThis.requestDialogSuccess = true;
try {
let requestInfo = dialogRequest.getRequestInfo(want);
if (requestInfo) {
globalThis.validRequestInfo = true;
console.log("MainAbility2 requestInfo is valid");
} else {
console.log("MainAbility2 requestInfo is invalid");
}
let requestCallback = dialogRequest.getRequestCallback(want);
if (requestCallback) {
console.log("MainAbility2 requestCallback is valid");
globalThis.validRequestCallback = true;
let resultCode = {
result : dialogRequest.ResultCode.RESULT_CANCEL,
};
let resultCode2 ={
result : dialogRequest.ResultCode.RESULT_OK,
};
console.log(`resultCjode2 is ${JSON.stringify(resultCode2)}`);
requestCallback.setRequestResult(resultCode);
} else {
console.log("MainAbility2 requestCallback is invalid");
}
publishEvent();
} catch {
console.log("MainAbility2 testRequest fail");
}
console.log("AbilityMultiInstanceAppA abilityWant = " + JSON.stringify( globalThis.abilityWant2));
}
onDestroy() {
// Ability is destroying, release resources for this ability
console.log("MainAbility2 onDestroy");
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("MainAbility2 onWindowStageCreate")
globalThis.abilityContext2 = this.context;
windowStage.setUIContent(this.context, "MainAbility/pages/second/second", null);
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("MainAbility onWindowStageDestroy");
}
onForeground() {
// Ability has brought to foreground
console.log("MainAbility onForeground");
}
onBackground() {
// Ability has back to background
console.log("MainAbility onBackground");
}
};
/*
* 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 Ability from '@ohos.app.ability.UIAbility'
export default class TestAbility extends Ability {
onCreate(want, launchParam) {
console.log('TestAbility onCreate');
}
onDestroy() {
console.log('TestAbility onDestroy');
}
onWindowStageCreate(windowStage) {
console.log('TestAbility onWindowStageCreate');
windowStage.loadContent("TestAbility/pages/index", (err, data) => {
if (err.code) {
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
return;
}
console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data))
});
globalThis.abilityContext = this.context;
}
onWindowStageDestroy() {
console.log('TestAbility onWindowStageDestroy');
}
onForeground() {
console.log('TestAbility onForeground');
}
onBackground() {
console.log('TestAbility onBackground');
}
};
\ 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 router from '@ohos.router';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('TestAbility index aboutToAppear')
}
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ 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 TestRunner from '@ohos.application.testRunner'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
var abilityDelegator = undefined;
var abilityDelegatorArguments = undefined;
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s it',
'-s level', '-s testType', '-s size', '-s timeout',
'-s dryRun'
]);
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams = `${targetParams} ${key} ${parameters[key]}`;
}
}
return targetParams.trim();
}
async function onAbilityCreateCallback() {
console.log("onAbilityCreateCallback");
}
async function addAbilityMonitorCallback(err: any) {
console.info("addAbilityMonitorCallback : " + JSON.stringify(err));
}
export default class OpenHarmonyTestRunner implements TestRunner {
constructor() {
}
onPrepare() {
console.info("OpenHarmonyTestRunner OnPrepare ");
}
async onRun() {
console.log('OpenHarmonyTestRunner onRun run')
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments();
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility';
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback);
var cmd = 'aa start -d 0 -a com.acts.example.requestdialog.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName;
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters);
var debug = abilityDelegatorArguments.parameters["-D"];
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd);
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + d.stdResult);
console.info('executeShellCommand : data : ' + d.exitCode);
})
console.info('OpenHarmonyTestRunner onRun end');
}
};
\ 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 { describe, it, expect } from "@ohos/hypium"
import commonEvent from '@ohos.commonEvent'
var subscriberInfo = {
events: ["ACTS_REQUEST_DIALOG_EVENT1", "ACTS_REQUEST_DIALOG_EVENT2"]
};
const CASE_TIMEOUT = 3000;
console.info("====>in Ability.test====>");
export default function abilityTest() {
describe('ActsRequestDialogTest', function () {
console.info("====>in ActsRequestDialogTest====>");
function sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time));
}
/*
* @tc.number: ACTS_requestDialog_0100
* @tc.name: Start Recent Ability with no permission.
* @tc.desc: reguest dialog service
*/
it('ACTS_requestDialog_0100', 0, async function (done) {
console.log('ACTS_requestDialog_0100====<begin');
var subscriber;
let id;
let resultCode;
async function subscribeCallBack(err, data) {
console.info("====>ACTS_requestDialog_0100 Subscribe CallBack data:====>" + JSON.stringify(data));
async function processInfoCheck(data) {
console.info('====> ACTS_requestDialog_0100 processInfoCheck=====>');
expect(globalThis.requestDialogSuccess).assertTrue();
expect(globalThis.validRequestInfo).assertTrue();
expect(globalThis.validRequestCallback).assertTrue();
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
done();
}
if (data.event == "ACTS_REQUEST_DIALOG_EVENT1") {
console.info('====> ACTS_startRecent_0100 ACTS_StartAbility_CommonEvent1 success=====>');
await sleep(500);
processInfoCheck(data);
}
}
commonEvent.createSubscriber(subscriberInfo).then(async (data) => {
console.info("====>ACTS_requestDialog_0100 Create Subscriber====>");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
try {
await globalThis.abilityContext.requestDialogService(
{
bundleName: 'com.acts.example.requestdialog',
abilityName: 'com.acts.example.requestdialog.MainAbility2',
}).then((data) => {
console.info("====>ACTS_requestDialog_0100 request end + data:" + JSON.stringify(data));
resultCode = data.result;
})
} catch (paramError) {
console.info("====>ACTS_requestDialog_0100 requestDialogSerivce paramError====>");
}
})
function unSubscribeCallback() {
console.info("====>UnSubscribe0100 CallBack====>");
}
function timeout() {
console.log('ACTS_requestDialog_0100 timeout.');
done();
}
id = setTimeout(timeout, CASE_TIMEOUT);
console.log('Start ACTS_requestDialog_0100 timer id : ' + id);
})
})
}
\ 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 abilityTest from './Ability.test.ets'
export default function testsuite() {
abilityTest()
}
\ No newline at end of file
{
"module": {
"name": "phone",
"type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:phone_entry_dsc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"uiSyntax": "ets",
"pages": "$profile:main_pages",
"abilities": [
{
"name": "com.acts.example.requestdialog.MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:phone_entry_main",
"icon": "$media:icon",
"label": "$string:entry_label",
"visible": true,
"orientation": "portrait",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
]
},
{
"name": "com.acts.example.requestdialog.MainAbility2",
"srcEntrance": "./ets/MainAbility2/MainAbility2.ts",
"description": "$string:phone_entry_main",
"icon": "$media:icon",
"label": "$string:entry_label",
"visible": true,
"launchType":"standard",
"orientation": "portrait"
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "phone_entry_dsc",
"value": "i am an entry for phone"
},
{
"name": "phone_entry_main",
"value": "the phone entry ability"
},
{
"name": "entry_label",
"value": "ActsContextTest"
},
{
"name": "form_description",
"value": "my form"
},
{
"name": "serviceability_description",
"value": "my whether"
},
{
"name": "description_application",
"value": "demo for test"
},
{
"name": "app_name",
"value": "Demo"
}
]
}
{
"src": [
"MainAbility/pages/index/index",
"MainAbility/pages/second/second"
]
}
\ No newline at end of file
......@@ -12,16 +12,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import { describe, afterEach, it, expect } from '@ohos/hypium'
import formProvider from '@ohos.application.formProvider';
import FormInfo from '@ohos.application.formInfo';
import formInfoNew from '@ohos.app.form.formInfo';
import formError from '@ohos.application.formError';
import formHost from '@ohos.application.formHost';
import errorManager from '@ohos.app.ability.errorManager';
import abilityConstant from '@ohos.app.ability.AbilityConstant'
import appManager from '@ohos.application.appManager'
import appManagerNew from '@ohos.app.ability.appManager'
import commonEvent from '@ohos.commonEvent';
import ability from '@ohos.ability.ability';
......@@ -29,12 +26,11 @@ import abilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry
import common from '@ohos.app.ability.common';
import contextConstant from "@ohos.app.ability.contextConstant"
var EXTENSION_INFO_ERR = 16000001
var INNER_ERROR = 16000050
var CROSS_USER_DENY = 201
var INVALID_PARAM = 401
var trueInfo;
var array = new Array();
let EXTENSION_INFO_ERR = 16000001;
let INNER_ERROR = 16000050;
let CROSS_USER_DENY = 201;
let array = new Array();
let TAG = '';
function sleep(time) {
return new Promise((resolve)=>setTimeout(resolve,time));
}
......@@ -517,62 +513,6 @@ export default function ApiCoverTest() {
done()
});
/*
* @tc.number SUB_AA_Test_ProcessInformation_0100
* @tc.name Test getRunningProcessInformation in appManager.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_Test_ProcessInformation_0100', 0, async function (done) {
let ProcessInformation:appManagerNew.ProcessInformation;
let process;
appManagerNew.getRunningProcessInformation().then((ProcessInformations)=>{
console.info("SUB_AA_Test_ProcessInformation_0100:" + JSON.stringify(ProcessInformations));
for(let i = 0; i < ProcessInformations.length; i++){
console.info("SUB_AA_Test_ProcessInformation_0100:" + JSON.stringify(ProcessInformations[i]));
expect(ProcessInformations[i].pid).assertLarger(0)
expect(ProcessInformations[i].uid).assertLarger(0)
if(ProcessInformations[i].processName == "com.example.apicoverhaptest"){
process = ProcessInformations[i]
}
}
expect(process.bundleNames[0]).assertEqual("com.example.apicoverhaptest")
done()
}).catch((error)=>{
console.info("SUB_AA_Test_ProcessInformation_0100:" + JSON.stringify(error));
expect().assertFail()
done()
})
});
/*
* @tc.number SUB_AA_Test_ProcessInformation_0200
* @tc.name Test getRunningProcessInformation by callback in appManager.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_Test_ProcessInformation_0200', 0, async function (done) {
let process;
appManagerNew.getRunningProcessInformation((error, ProcessInformations)=>{
if (error) {
console.info("SUB_AA_Test_ProcessInformation_0200:" + JSON.stringify(error));
expect().assertFail()
done()
}
console.info("SUB_AA_Test_ProcessInformation_0200:" + JSON.stringify(ProcessInformations));
for(let i = 0; i < ProcessInformations.length; i++){
console.info("SUB_AA_Test_ProcessInformation_0200:" + JSON.stringify(ProcessInformations[i]));
expect(ProcessInformations[i].pid).assertLarger(0)
expect(ProcessInformations[i].uid).assertLarger(0)
if(ProcessInformations[i].processName == "com.example.apicoverhaptest"){
process = ProcessInformations[i]
}
}
expect(process.bundleNames[0]).assertEqual("com.example.apicoverhaptest")
done()
})
});
/*
* @tc.number SUB_AA_FMS_AbilityStage_0100
* @tc.name Start AbilityStage and get config.
......@@ -717,5 +657,115 @@ export default function ApiCoverTest() {
done()
})
})
/*
* @tc.number SUB_AA_AbilityAppManager_0100
* @tc.name The form of a promise getRunningProcessInformation
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_AbilityAppManager_0100', 0, async function (done) {
TAG = 'SUB_AA_AbilityAppManager_0100';
await appManagerNew.getRunningProcessInformation().then((data)=>{
console.log(`${TAG} getRunningProcessInformation data ${JSON.stringify(data.length)}`);
for (let i = 0; i < data.length; i++) {
console.log(`${TAG} getRunningProcessInformation${i} : JSON.stringify(data[i])`);
expect(typeof (data[i].pid)).assertEqual("number");
expect(data[i].pid).assertLarger(0);
expect(typeof (data[i].uid)).assertEqual("number");
expect(data[i].uid).assertLarger(0);
expect(typeof (data[i].processName)).assertEqual("string");
expect(data[i].processName.length).assertLarger(0);
expect(Array.isArray(data[i].bundleNames)).assertEqual(true);
expect(data[i].bundleNames.length).assertLarger(0);
}
done();
}).catch((err)=>{
console.log(`${TAG} getRunningProcessInformation err ${JSON.stringify(err)}`);
expect().assertFail();
done();
})
})
/*
* @tc.number SUB_AA_AbilityAppManager_0200
* @tc.name The form of a callback getRunningProcessInformation
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_AbilityAppManager_0200', 0, async function (done) {
TAG = 'SUB_AA_AbilityAppManager_0100';
appManagerNew.getRunningProcessInformation((err, data) => {
console.log(`${TAG} getRunningProcessInformation data ${JSON.stringify(data.length)}
err: ${JSON.stringify(err)}`);
for (let i = 0; i < data.length; i++) {
console.log(`${TAG} getRunningProcessInformation${i} : JSON.stringify(data[i])`);
expect(typeof (data[i].pid)).assertEqual("number");
expect(data[i].pid).assertLarger(0);
expect(typeof (data[i].uid)).assertEqual("number");
expect(data[i].uid).assertLarger(0);
expect(typeof (data[i].processName)).assertEqual("string");
expect(data[i].processName.length).assertLarger(0);
expect(Array.isArray(data[i].bundleNames)).assertEqual(true);
expect(data[i].bundleNames.length).assertLarger(0);
}
done();
})
})
/*
* @tc.number SUB_AA_ApplicationContext_0100
* @tc.name The form of a promise getRunningProcessInformation
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_ApplicationContext_0100', 0, async function (done) {
TAG = 'SUB_AA_ApplicationContext_0100';
await globalThis.applicationContext.getRunningProcessInformation().then((data)=>{
console.log(`${TAG} getRunningProcessInformation data ${JSON.stringify(data.length)}`);
for (let i = 0; i < data.length; i++) {
console.log(`${TAG} getRunningProcessInformation${i} : JSON.stringify(data[i])`);
expect(typeof (data[i].pid)).assertEqual("number");
expect(data[i].pid).assertLarger(0);
expect(typeof (data[i].uid)).assertEqual("number");
expect(data[i].uid).assertLarger(0);
expect(typeof (data[i].processName)).assertEqual("string");
expect(data[i].processName.length).assertLarger(0);
expect(Array.isArray(data[i].bundleNames)).assertEqual(true);
expect(data[i].bundleNames.length).assertLarger(0);
}
done();
}).catch((err)=>{
console.log(`${TAG} getRunningProcessInformation err ${JSON.stringify(err)}`);
expect().assertFail();
done();
})
})
/*
* @tc.number SUB_AA_ApplicationContext_0200
* @tc.name The form of a callback getRunningProcessInformation
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_ApplicationContext_0200', 0, async function (done) {
TAG = 'SUB_AA_ApplicationContext_0200';
globalThis.applicationContext.getRunningProcessInformation((err, data) => {
console.log(`${TAG} getRunningProcessInformation data ${JSON.stringify(data.length)}
err: ${JSON.stringify(err)}`);
for (let i = 0; i < data.length; i++) {
console.log(`${TAG} getRunningProcessInformation${i} : JSON.stringify(data[i])`);
expect(typeof (data[i].pid)).assertEqual("number");
expect(data[i].pid).assertLarger(0);
expect(typeof (data[i].uid)).assertEqual("number");
expect(data[i].uid).assertLarger(0);
expect(typeof (data[i].processName)).assertEqual("string");
expect(data[i].processName.length).assertLarger(0);
expect(Array.isArray(data[i].bundleNames)).assertEqual(true);
expect(data[i].bundleNames.length).assertLarger(0);
}
done();
})
})
})
}
......@@ -67,8 +67,10 @@ export default function verificationTest(){
console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err));
expect().assertFail();
done();
if (err.code != 16000017) {
expect().assertFail();
done();
}
});
} catch (err) {
console.info(TAG + "catch err = " + JSON.stringify(err));
......@@ -130,8 +132,10 @@ export default function verificationTest(){
console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err));
expect().assertFail();
done();
if (err.code != 16000017) {
expect().assertFail();
done();
}
});
} catch (err) {
console.info(TAG + "catch err = " + JSON.stringify(err));
......@@ -207,8 +211,10 @@ export default function verificationTest(){
console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err));
expect().assertFail();
done();
if (err.code != 16000017) {
expect().assertFail();
done();
}
});
} catch (err) {
console.info(TAG + "catch err = " + JSON.stringify(err));
......@@ -263,8 +269,10 @@ export default function verificationTest(){
console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err));
expect().assertFail();
done();
if (err.code != 16000017) {
expect().assertFail();
done();
}
});
} catch (err) {
console.info(TAG + "catch err = " + JSON.stringify(err));
......@@ -421,8 +429,10 @@ export default function verificationTest(){
console.info(TAG + "startAbility data = " + JSON.stringify(data) + ";" + JSON.stringify(data));
}).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err));
expect().assertFail();
done();
if (err.code != 16000017) {
expect().assertFail();
done();
}
});
} catch (err) {
console.info(TAG + "catch err = " + JSON.stringify(err));
......
......@@ -14,6 +14,7 @@
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import wantAgent from '@ohos.app.ability.wantAgent';
import wantConstant from '@ohos.app.ability.wantConstant'
var TAG
export default function wantAgentCoverTest() {
......@@ -60,6 +61,8 @@ export default function wantAgentCoverTest() {
});
setTimeout(() => {
expect(wantConstant.Params.ABILITY_BACK_TO_OTHER_MISSION_STACK)
.assertEqual('ability.params.backToOtherMissionStack');
expect(status).assertTrue();
expect(code1).assertEqual(2);
done()
......
......@@ -5,7 +5,8 @@
"test-timeout": "1200000",
"shell-timeout": "1200000",
"bundle-name": "ohos.acts.distributedschedule.continuationmanager",
"package-name": "ohos.acts.distributedschedule.continuationmanager"
"package-name": "ohos.acts.distributedschedule.continuationmanager",
"testcase-timeout": 60000
},
"kits": [
{
......@@ -14,6 +15,14 @@
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"power-shell wakeup",
"power-shell setmode 602",
"uinput -T -d 300 600 -m 300 600 300 100 -u 300 100"
]
}
]
}
\ No newline at end of file
......@@ -86,6 +86,11 @@
}
}
],
"reqPermissions": [
{
"name": "ohos.permission.DISTRIBUTED_DATASYNC"
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
......
......@@ -15,8 +15,45 @@
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import { UiDriver, BY } from '@ohos.UiTest'
import testsuite from '../test/List.test'
import featureAbility from '@ohos.ability.featureAbility';
async function requestPermission() {
try {
let context = featureAbility.getContext();
await context.requestPermissionsFromUser(['ohos.permission.DISTRIBUTED_DATASYNC'], 666, (data) => {
console.info('TestApplication requestPermission data: ' + JSON.stringify(data));
});
} catch (err) {
console.error('TestApplication permission' + JSON.stringify(err));
}
}
async function clickPermission(driver) {
console.info("clickPermission begin");
await driver.delayMs(2000);
var data_sync_allow = await driver.findComponent(BY.text("允许"))
await driver.delayMs(1000)
var wait_count = 0
while (data_sync_allow == null || data_sync_allow == undefined) {
data_sync_allow = await driver.findComponent(BY.text("允许"))
wait_count += 1
await driver.delayMs(1000)
if (wait_count == 15) {
break
}
}
if (data_sync_allow == null) {
console.info('应用非首次开启')
} else {
await data_sync_allow.click()
console.log('点击多设备授权框的允许按钮')
}
}
export default {
onCreate() {
console.info('TestApplication onCreate')
......@@ -24,6 +61,9 @@ export default {
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
var driver = UiDriver.create()
requestPermission()
clickPermission(driver)
},
onDestroy() {
console.info("TestApplication onDestroy");
......
......@@ -24,6 +24,10 @@ describe('continuationManagerTest', function() {
beforeAll(async function (done) {
console.info('beforeAll');
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
await sleep(20000)
done();
})
......@@ -1508,7 +1512,7 @@ describe('continuationManagerTest', function() {
done();
} catch (e) {
console.info("testUpdateContinuationState001 " + e);
expect(null).assertFail();
expect(null).assertFail();
done();
}
})
......@@ -1548,7 +1552,7 @@ describe('continuationManagerTest', function() {
done();
} catch (e) {
console.info("testUpdateContinuationState003 " + e);
expect(null).assertFail();
expect(e.code == 401).assertTrue();
done();
}
})
......
......@@ -45,6 +45,10 @@
{
"name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
"reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
},
{
"name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND",
"reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND"
}
],
"abilities": [
......
......@@ -46,11 +46,12 @@ export default function ActsAccountAppAccess() {
parameters:
{},
},
},
)
await sleep(1500);
}, (err, data) => {
console.debug("====>accountauthenticatorfeatureAbility.startAbilityForResult err:" + JSON.stringify(err))
console.debug("====>accountauthenticatorfeatureAbility.startAbilityForResult data:" + JSON.stringify(data))
done();
})
console.debug("====>ActsAccountAuthenticator beforeAll end====");
done();
});
beforeEach(async (done)=>{
console.debug("====>afterEach start====");
......
......@@ -60,6 +60,7 @@ export default function ActsAccountOnOff() {
*/
it('ActsAccountOnOff_0300', 0, async function (done) {
testInit();
await sleep(500);
console.debug("====>ActsAccountOnOff_0300 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
......@@ -124,6 +125,7 @@ export default function ActsAccountOnOff() {
*/
it('ActsAccountOnOff_0400', 0, async function (done) {
testInit();
await sleep(500);
console.debug("====>ActsAccountOnOff_0400 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
......@@ -192,6 +194,7 @@ export default function ActsAccountOnOff() {
*/
it('ActsAccountOnOff_0500', 0, async function (done) {
testInit();
await sleep(500);
console.debug("====>ActsAccountOnOff_0500 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
......@@ -251,6 +254,7 @@ export default function ActsAccountOnOff() {
*/
it('ActsAccountOnOff_0600', 0, async function (done) {
testInit();
await sleep(500);
console.debug("====>ActsAccountOnOff_0600 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
......
......@@ -32,7 +32,7 @@ export default function testsuite() {
ActsAccountRemoveAccount()
ActsAccountErrPermission()
ActsAccountAuthToken()
ActsAccountOnOff()
ActsAccountAuthenticator()
ActsAccountErrCode()
ActsAccountOnOff()
}
\ No newline at end of file
......@@ -42,6 +42,10 @@
"name":"ohos.permission.REMOVE_CACHE_FILES",
"reason":"need use ohos.permission.REMOVE_CACHE_FILES"
},
{
"name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND",
"reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND"
},
{
"name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
"reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
......
......@@ -32,7 +32,8 @@ export default function ActsAccountAppAccess() {
console.info(`sleep #{time} over ...`)
})
}
beforeAll(async function (done) {
beforeAll(async function (done) {
console.debug("====>accountauthenticatorbeforeAll start====");
await featureAbility.startAbility(
{
want:
......@@ -44,10 +45,12 @@ export default function ActsAccountAppAccess() {
parameters:
{},
},
},
)
await sleep(1000)
done();
}, (err, data) => {
console.debug("====>accountauthenticatorfeatureAbility.startAbility err:" + JSON.stringify(err))
console.debug("====>accountauthenticatorfeatureAbility.startAbility data:" + JSON.stringify(data))
done();
})
console.debug("====>accountauthenticatorfeatureAbility.startAbility end")
});
beforeEach(async function (done) {
console.debug("====>afterEach start====");
......
......@@ -33,6 +33,6 @@ export default function testsuite() {
ActsAccountSetGetExtraInfo()
ActsAccountNoPermission()
ActsAccountOAuthToken()
ActsAccountChangeOnOff()
ActsAccountAuthenticator()
ActsAccountChangeOnOff()
}
\ No newline at end of file
......@@ -60,6 +60,7 @@ export default function ActsAccountChangeOnOff() {
*/
it('ActsAccountChangeOnOff_0100', 0, async function (done) {
testInit();
await sleep(1000);
console.debug("====>ActsAccountChangeOnOff_0100 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
......@@ -129,6 +130,7 @@ export default function ActsAccountChangeOnOff() {
*/
it('ActsAccountChangeOnOff_0200', 0, async function (done) {
testInit();
await sleep(1000);
console.debug("====>ActsAccountChangeOnOff_0200 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
......@@ -193,6 +195,7 @@ export default function ActsAccountChangeOnOff() {
*/
it('ActsAccountChangeOnOff_0300', 0, async function (done) {
testInit();
await sleep(1000);
console.debug("====>ActsAccountChangeOnOff_0300 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
......@@ -257,6 +260,7 @@ export default function ActsAccountChangeOnOff() {
*/
it('ActsAccountChangeOnOff_0400', 0, async function (done) {
testInit();
await sleep(1000);
console.debug("====>ActsAccountChangeOnOff_0400 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
......@@ -325,6 +329,7 @@ export default function ActsAccountChangeOnOff() {
*/
it('ActsAccountChangeOnOff_0500', 0, async function (done) {
testInit();
await sleep(1000);
console.debug("====>ActsAccountChangeOnOff_0500 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
......@@ -384,6 +389,7 @@ export default function ActsAccountChangeOnOff() {
*/
it('ActsAccountChangeOnOff_0600', 0, async function (done) {
testInit();
await sleep(1000);
console.debug("====>ActsAccountChangeOnOff_0600 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
......@@ -456,6 +462,7 @@ export default function ActsAccountChangeOnOff() {
*/
it('ActsAccountChangeOnOff_0700', 0, async function (done) {
testInit();
await sleep(1000);
console.debug("====>ActsAccountChangeOnOff_0700 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
......@@ -520,6 +527,7 @@ export default function ActsAccountChangeOnOff() {
it('ActsAccountChangeOnOff_0800', 0, async function (done) {
console.debug("====>ActsAccountChangeOnOff_0800 start====");
let dataMap = new Map();
await sleep(1000);
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
console.debug("====>add account ActsAccountChangeOnOff_0800 start");
......@@ -575,6 +583,7 @@ export default function ActsAccountChangeOnOff() {
it('ActsAccountChangeOnOff_0900', 0, async function (done) {
console.debug("====>ActsAccountChangeOnOff_0900 start====");
let dataMap = new Map();
await sleep(1000);
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
console.debug("====>add first account ActsAccountChangeOnOff_0900 start");
......@@ -642,6 +651,7 @@ export default function ActsAccountChangeOnOff() {
console.debug("====>ActsAccountChangeOnOff_1000 start====");
let dataMapFir = new Map();
let dataMapSec = new Map();
await sleep(1000);
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
console.debug("====>add account ActsAccountChangeOnOff_1000 start");
......@@ -718,6 +728,7 @@ export default function ActsAccountChangeOnOff() {
it('ActsAccountChangeOnOff_1100', 0, async function (done) {
console.debug("====>ActsAccountChangeOnOff_1100 start====");
let dataMap = new Map();
await sleep(1000);
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
console.debug("====>add account ActsAccountChangeOnOff_1100 start");
......@@ -778,6 +789,7 @@ export default function ActsAccountChangeOnOff() {
it('ActsAccountChangeOnOff_1200', 0, async function (done) {
console.debug("====>ActsAccountChangeOnOff_1200 start====");
let dataMap = new Map();
await sleep(1000);
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
console.debug("====>add account ActsAccountChangeOnOff_1200 start");
......@@ -838,6 +850,7 @@ export default function ActsAccountChangeOnOff() {
*/
it('ActsAccountChangeOnOff_1300', 0, async function (done) {
console.debug("====>ActsAccountChangeOnOff_1300 start====");
await sleep(1000);
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
console.debug("====>add account ActsAccountChangeOnOff_1300 start");
......@@ -884,6 +897,7 @@ export default function ActsAccountChangeOnOff() {
*/
it('ActsAccountChangeOnOff_1400', 0, async function (done) {
console.debug("====>ActsAccountChangeOnOff_1400 start====");
await sleep(1000);
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
console.debug("====>add account ActsAccountChangeOnOff_1400 start");
......
......@@ -261,7 +261,7 @@ class MyAuthenticator extends rpc.RemoteObject {
case 5 :
name = readString8(data)
callback = new MyAuthenticatorCallback(data.readRemoteObject())
this.authenticatorImpl.isAccountRemovable(name, callback)
this.authenticatorImpl.checkAccountRemovable(name, callback)
break
}
return true
......@@ -345,7 +345,7 @@ class MyAuthenticatorImpl {
callback.onResult(10016, {})
}
isAccountRemovable(name, callback) {
checkAccountRemovable(name, callback) {
console.log(TAG + "name: " + name)
var isRemovable = this.accountRemovability[name]
if (isRemovable == undefined || isRemovable == false) {
......
......@@ -160,7 +160,7 @@ class MyAuthenticator extends account_appAccount.Authenticator {
callback.onResult(10016, {})
}
isAccountRemovable(name, callback) {
checkAccountRemovable(name, callback) {
console.log(TAG + "name: " + name)
var isRemovable = false;
try {
......
......@@ -36,9 +36,10 @@ export default {
data: {
},
onShow() {
this.title = "scene on off";
// this.title = "scene on off";
},
onInit() {
this.title = "scene on off";
console.debug("====>change on off scene start====");
var appAccountManager = account.createAppAccountManager();
var commonEventSubscribeInfo = {
......@@ -51,11 +52,12 @@ export default {
console.debug("====>publish call back scene err:" + JSON.stringify(err));
console.debug("====>scene off start====");
appAccountManager.off('accountChange', function (){
appAccountManager.off('change', function (){
console.debug("====>scene off finish====");
});
console.debug("====>scene off accountChange finish====");
});
appAccountManager.off('change', function (){
console.debug("====>scene off change finish====");
});
// featureAbility.terminateSelf()
featureAbility.terminateSelf()
}
// Subscribe to the callback of account information changes, verify the received account information, and send
......
......@@ -294,7 +294,7 @@ struct Index {
case "emitOnProgressChange":{
this.isProgressFinish=true
await Utils.sleep(1000)
this.controller.loadUrl({url:"https://www.gitee.com"})
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"});
break;
}
case "emitOnRefreshAccessedHistory":{
......
......@@ -45,6 +45,7 @@ struct Second {
console.info("key==>"+this.str);
switch(this.str){
case "emitOverviewModeAccessTrue":{
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"});
this.controller.runJavaScript({script:"getViewResult()",callback:(res)=>{
console.info("getViewResult==>"+res);
this.overviewScale=res;
......
......@@ -209,6 +209,42 @@ describe('threadWorkerTest', function () {
}
})
/**
* @tc.name: threadWorker_constructor_test_010
* @tc.desc: worker constructor to Creates a worker instance.
*/
it('threadWorker_constructor_test_010', 0, async function (done) {
let ss = new worker.ThreadWorker("/entry/ets/workers/newworker.js");
let isTerminate = false
ss.onexit = function () {
isTerminate = true
}
expect(ss != null).assertTrue()
ss.terminate()
while (!isTerminate) {
await promiseCase()
}
done()
})
/**
* @tc.name: threadWorker_constructor_test_011
* @tc.desc: worker constructor to Creates a worker instance.
*/
it('threadWorker_constructor_test_011', 0, async function (done) {
let ss = new worker.ThreadWorker("@bundle:com.example.threadWorkertest/entry/ets/workers/newworker.js");
let isTerminate = false
ss.onexit = function () {
isTerminate = true
}
expect(ss != null).assertTrue()
ss.terminate()
while (!isTerminate) {
await promiseCase()
}
done()
})
// check postMessage is ok
// main post "hello world", will receive "hello world worker"
/**
......@@ -2018,5 +2054,261 @@ describe('threadWorkerTest', function () {
expect(res).assertEqual("terminate")
done()
})
function CreateArray(type,b) {
switch(type) {
case 0 :
return new Int8Array(b);
case 1 :
return new Int16Array(b);
case 2 :
return new Int32Array(b);
case 3 :
return new Uint8Array(b);
case 4 :
return new Uint16Array(b);
case 5 :
return new Uint32Array(b);
case 6 :
return new Float32Array(b);
case 7 :
return new Float64Array(b);
case 8 :
return new BigInt64Array(b);
case 9 :
return new BigUint64Array(b);
default :
return;
}
}
// Check the transmission types supported by Worker is ok.
/**
* @tc.name: threadWorker_support_types_test_001
* @tc.desc: Check the transmission types supported by Worker is ok.
*/
it('threadWorker_support_types_test_001', 0, async function (done) {
let ss = new worker.ThreadWorker("entry/ets/workers/newworker_016.js");
let array = []
for (let i = 0; i < 10; i++) {
array[i] = CreateArray(i, 62);
}
let res = 0;
let flag = 0;
let isTerminate = false;
ss.onmessage = function(d) {
res += d.data;
flag += 1;
}
ss.onexit = function() {
isTerminate = true;
}
for (let i = 0; i < 10; i++) {
ss.postMessage(array[i]);
}
while (flag != 10) {
await promiseCase();
}
ss.terminate();
while (!isTerminate) {
await promiseCase();
}
expect(res).assertEqual(620)
done();
})
// Check the transmission types supported by Worker is ok.
/**
* @tc.name: threadWorker_support_types_test_002
* @tc.desc: Check the transmission types supported by Worker is ok.
*/
it('threadWorker_support_types_test_002', 0, async function (done) {
let ss = new worker.ThreadWorker("entry/ets/workers/newworker_017.js");
let res;
let flag = false;
let isTerminate = false;
ss.onmessage = function(d) {
res = d.data.name;
flag = true;
}
ss.onexit = function() {
isTerminate = true;
}
ss.postMessage("start");
while (!flag) {
await promiseCase();
}
ss.terminate();
while (!isTerminate) {
await promiseCase();
}
expect(res).assertEqual("worker")
done();
})
// Check the transmission types supported by Worker is ok.
/**
* @tc.name: threadWorker_support_types_test_003
* @tc.desc: Check the transmission types supported by Worker is ok.
*/
it('threadWorker_support_types_test_003', 0, async function (done) {
let ss = new worker.ThreadWorker("entry/ets/workers/newworker_018.js");
let res;
let flag = false;
let isTerminate = false;
ss.onmessage = function(d) {
res = d.data;
flag = true;
}
ss.onexit = function() {
isTerminate = true;
}
const data = new Set();
ss.postMessage(data);
while (!flag) {
await promiseCase();
}
ss.terminate();
while (!isTerminate) {
await promiseCase();
}
expect(res.has(1)).assertTrue()
expect(res.has(2)).assertTrue()
expect(!res.has(1010)).assertTrue()
done();
})
// Check the transmission types supported by Worker is ok.
/**
* @tc.name: threadWorker_support_types_test_004
* @tc.desc: Check the transmission types supported by Worker is ok.
*/
it('threadWorker_support_types_test_004', 0, async function (done) {
let ss = new worker.ThreadWorker("entry/ets/workers/newworker_019.js");
let res;
let flag = false;
let isTerminate = false;
ss.onmessage = function(d) {
res = d.data;
flag = true;
}
ss.onexit = function() {
isTerminate = true;
}
const data = new Map();
ss.postMessage(data);
while (!flag) {
await promiseCase();
}
ss.terminate();
while (!isTerminate) {
await promiseCase();
}
expect(res.get("worker")).assertEqual("success");
done();
})
// Check the transmission types supported by Worker is ok.
/**
* @tc.name: threadWorker_support_types_test_005
* @tc.desc: Check the transmission types supported by Worker is ok.
*/
it('threadWorker_support_types_test_005', 0, async function (done) {
let ss = new worker.ThreadWorker("entry/ets/workers/newworker_020.js");
let res;
let flag = false;
let isTerminate = false;
ss.onmessage = function(d) {
res = d.data;
flag = true;
}
ss.onexit = function() {
isTerminate = true;
}
const buffer = new ArrayBuffer(8);
ss.postMessage(buffer);
while (!flag) {
await promiseCase();
}
ss.terminate();
while (!isTerminate) {
await promiseCase();
}
expect(res[res.length - 1]).assertEqual(3);
done();
})
// Check the transmission types supported by Worker is ok.
/**
* @tc.name: threadWorker_support_types_test_006
* @tc.desc: Check the transmission types supported by Worker is ok.
*/
it('threadWorker_support_types_test_006', 0, async function (done) {
let ss = new worker.ThreadWorker("entry/ets/workers/newworker_021.js");
let res;
let flag = false;
let isTerminate = false;
ss.onmessage = function(d) {
res = d.data;
flag = true;
}
ss.onexit = function() {
isTerminate = true;
}
var re = new RegExp("(\\w+)\\s(\\w+)");
ss.postMessage(re);
while (!flag) {
await promiseCase();
}
ss.terminate();
while (!isTerminate) {
await promiseCase();
}
expect(res).assertEqual("Worker, HI!");
done();
})
// Check the transmission types supported by Worker is ok.
/**
* @tc.name: threadWorker_support_types_test_007
* @tc.desc: Check the transmission types supported by Worker is ok.
*/
it('threadWorker_support_types_test_007', 0, async function (done) {
let ss = new worker.ThreadWorker("entry/ets/workers/newworker_021.js");
let flag = false;
let isTerminate = false;
ss.onmessageerror = function(d) {
flag = true;
}
ss.onexit = function() {
isTerminate = true;
}
try {
const data = Symbol();
ss.postMessage(data);
} catch (error) {
console.info("worker:: recv error message: " + error.message)
while (!flag) {
await promiseCase();
}
ss.terminate();
while (!isTerminate) {
await promiseCase();
}
}
expect(flag).assertTrue();
done();
})
})
}
\ 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 worker from '@ohos.worker';
const parentPort = worker.workerPort;
parentPort.onmessage = function(e) {
console.info("worker:: worker receive data " + e.data);
let data = e.data;
parentPort.postMessage(data.length);
}
\ 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 worker from '@ohos.worker';
const workerPort = worker.workerPort;
class MyModel {
name = "worker"
Init() {
this.name = "MyModel"
}
}
workerPort.onmessage = function(e) {
let obj = new MyModel();
workerPort.postMessage(obj);
}
\ 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 worker from '@ohos.worker';
const workerPort = worker.workerPort;
workerPort.onmessage = function(e) {
const data = e.data;
data.add(1);
data.add(2);
workerPort.postMessage(data);
}
\ 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 worker from '@ohos.worker';
const workerPort = worker.workerPort;
workerPort.onmessage = function(e) {
const data = e.data;
data.set("worker", "success");
workerPort.postMessage(data);
}
\ 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 worker from '@ohos.worker';
const workerPort = worker.workerPort;
workerPort.onmessage = function(e) {
const data = e.data;
const view = new Int8Array(data).fill(3);
workerPort.postMessage(view);
}
\ 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 worker from '@ohos.worker';
const workerPort = worker.workerPort;
workerPort.onmessage = function(e) {
const data = e.data;
let str = "HI Worker";
let newStr = str.replace(data, "$2, $1!");
workerPort.postMessage(newStr);
}
\ No newline at end of file
......@@ -120,6 +120,42 @@ describe('WorkerTest', function () {
done()
})
/**
* @tc.name: worker_constructor_test_005
* @tc.desc: worker constructor to Creates a worker instance.
*/
it('worker_constructor_test_005', 0, async function (done) {
let ss = new worker.Worker("/entry/ets/workers/worker.js");
let isTerminate = false
ss.onexit = function () {
isTerminate = true
}
expect(ss != null).assertTrue()
ss.terminate()
while (!isTerminate) {
await promiseCase()
}
done()
})
/**
* @tc.name: worker_constructor_test_006
* @tc.desc: worker constructor to Creates a worker instance.
*/
it('worker_constructor_test_006', 0, async function (done) {
let ss = new worker.Worker("@bundle:com.example.workertest/entry/ets/workers/worker.js");
let isTerminate = false
ss.onexit = function () {
isTerminate = true
}
expect(ss != null).assertTrue()
ss.terminate()
while (!isTerminate) {
await promiseCase()
}
done()
})
// check postMessage is ok
// main post "hello world", will receive "hello world worker"
/**
......@@ -1351,5 +1387,259 @@ describe('WorkerTest', function () {
expect(res).assertEqual("terminate")
done()
})
function CreateArray(type,b) {
switch(type) {
case 0 :
return new Int8Array(b);
case 1 :
return new Int16Array(b);
case 2 :
return new Int32Array(b);
case 3 :
return new Uint8Array(b);
case 4 :
return new Uint16Array(b);
case 5 :
return new Uint32Array(b);
case 6 :
return new Float32Array(b);
case 7 :
return new Float64Array(b);
case 8 :
return new BigInt64Array(b);
case 9 :
return new BigUint64Array(b);
default :
return;
}
}
// Check the transmission types supported by Worker is ok.
/**
* @tc.name: worker_support_types_test_001
* @tc.desc: Check the transmission types supported by Worker is ok.
*/
it('worker_support_types_test_001', 0, async function (done) {
let ss = new worker.Worker("entry/ets/workers/worker_016.js");
let array = []
for (let i = 0; i < 10; i++) {
array[i] = CreateArray(i, 62);
}
let res = 0;
let flag = 0;
let isTerminate = false;
ss.onmessage = function(d) {
res += d.data;
flag += 1;
}
ss.onexit = function() {
isTerminate = true;
}
for (let i = 0; i < 10; i++) {
ss.postMessage(array[i]);
}
while (flag != 10) {
await promiseCase();
}
ss.terminate();
while (!isTerminate) {
await promiseCase();
}
expect(res).assertEqual(620)
done();
})
// Check the transmission types supported by Worker is ok.
/**
* @tc.name: worker_support_types_test_002
* @tc.desc: Check the transmission types supported by Worker is ok.
*/
it('worker_support_types_test_002', 0, async function (done) {
let ss = new worker.Worker("entry/ets/workers/worker_017.js");
let res;
let flag = false;
let isTerminate = false;
ss.onmessage = function(d) {
res = d.data.name;
flag = true;
}
ss.onexit = function() {
isTerminate = true;
}
ss.postMessage("start");
while (!flag) {
await promiseCase();
}
ss.terminate();
while (!isTerminate) {
await promiseCase();
}
expect(res).assertEqual("worker")
done();
})
// Check the transmission types supported by Worker is ok.
/**
* @tc.name: worker_support_types_test_003
* @tc.desc: Check the transmission types supported by Worker is ok.
*/
it('worker_support_types_test_003', 0, async function (done) {
let ss = new worker.Worker("entry/ets/workers/worker_018.js");
let res;
let flag = false;
let isTerminate = false;
ss.onmessage = function(d) {
res = d.data;
flag = true;
}
ss.onexit = function() {
isTerminate = true;
}
const data = new Set();
ss.postMessage(data);
while (!flag) {
await promiseCase();
}
ss.terminate();
while (!isTerminate) {
await promiseCase();
}
expect(res.has(1)).assertTrue()
expect(res.has(2)).assertTrue()
expect(!res.has(1010)).assertTrue()
done();
})
// Check the transmission types supported by Worker is ok.
/**
* @tc.name: worker_support_types_test_004
* @tc.desc: Check the transmission types supported by Worker is ok.
*/
it('worker_support_types_test_004', 0, async function (done) {
let ss = new worker.Worker("entry/ets/workers/worker_019.js");
let res;
let flag = false;
let isTerminate = false;
ss.onmessage = function(d) {
res = d.data;
flag = true;
}
ss.onexit = function() {
isTerminate = true;
}
const data = new Map();
ss.postMessage(data);
while (!flag) {
await promiseCase();
}
ss.terminate();
while (!isTerminate) {
await promiseCase();
}
expect(res.get("worker")).assertEqual("success");
done();
})
// Check the transmission types supported by Worker is ok.
/**
* @tc.name: worker_support_types_test_005
* @tc.desc: Check the transmission types supported by Worker is ok.
*/
it('worker_support_types_test_005', 0, async function (done) {
let ss = new worker.Worker("entry/ets/workers/worker_020.js");
let res;
let flag = false;
let isTerminate = false;
ss.onmessage = function(d) {
res = d.data;
flag = true;
}
ss.onexit = function() {
isTerminate = true;
}
const buffer = new ArrayBuffer(8);
ss.postMessage(buffer);
while (!flag) {
await promiseCase();
}
ss.terminate();
while (!isTerminate) {
await promiseCase();
}
expect(res[res.length - 1]).assertEqual(3);
done();
})
// Check the transmission types supported by Worker is ok.
/**
* @tc.name: worker_support_types_test_006
* @tc.desc: Check the transmission types supported by Worker is ok.
*/
it('worker_support_types_test_006', 0, async function (done) {
let ss = new worker.Worker("entry/ets/workers/worker_021.js");
let res;
let flag = false;
let isTerminate = false;
ss.onmessage = function(d) {
res = d.data;
flag = true;
}
ss.onexit = function() {
isTerminate = true;
}
var re = new RegExp("(\\w+)\\s(\\w+)");
ss.postMessage(re);
while (!flag) {
await promiseCase();
}
ss.terminate();
while (!isTerminate) {
await promiseCase();
}
expect(res).assertEqual("Worker, HI!");
done();
})
// Check the transmission types supported by Worker is ok.
/**
* @tc.name: worker_support_types_test_007
* @tc.desc: Check the transmission types supported by Worker is ok.
*/
it('worker_support_types_test_007', 0, async function (done) {
let ss = new worker.Worker("entry/ets/workers/worker_021.js");
let flag = false;
let isTerminate = false;
ss.onmessageerror = function(d) {
console.info("worker:: unsupport the Symbol.");
flag = true;
}
ss.onexit = function() {
isTerminate = true;
}
const data = Symbol();
ss.postMessage(data);
while (!flag) {
await promiseCase();
}
ss.terminate();
while (!isTerminate) {
await promiseCase();
}
expect(flag).assertTrue();
done();
})
})
}
\ No newline at end of file
......@@ -17,7 +17,7 @@ import worker from '@ohos.worker';
const parentPort = worker.parentPort;
parentPort.onmessage = function(e) {
console.log("worker:: worker receive data " + e.data);
let data = e.data + " worker";
parentPort.postMessage(data)
console.info("worker:: worker receive data " + e.data);
let data = e.data;
parentPort.postMessage(data.length);
}
\ 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 worker from '@ohos.worker';
const parentPort = worker.parentPort;
class MyModel {
name = "worker"
Init() {
this.name = "MyModel"
}
}
parentPort.onmessage = function(e) {
let obj = new MyModel();
parentPort.postMessage(obj);
}
\ 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 worker from '@ohos.worker';
const parentPort = worker.parentPort;
parentPort.onmessage = function(e) {
const data = e.data;
data.add(1);
data.add(2);
parentPort.postMessage(data);
}
\ 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 worker from '@ohos.worker';
const parentPort = worker.parentPort;
parentPort.onmessage = function(e) {
const data = e.data;
data.set("worker", "success");
parentPort.postMessage(data);
}
\ 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 worker from '@ohos.worker';
const parentPort = worker.parentPort;
parentPort.onmessage = function(e) {
const data = e.data;
const view = new Int8Array(data).fill(3);
parentPort.postMessage(view);
}
\ 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 worker from '@ohos.worker';
const parentPort = worker.parentPort;
parentPort.onmessage = function(e) {
const data = e.data;
let str = "HI Worker";
let newStr = str.replace(data, "$2, $1!");
parentPort.postMessage(newStr);
}
\ No newline at end of file
# Copyright (C) 2022 Huawei Device Co., Ltd.
# Copyright (C) 2023 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
......@@ -22,6 +22,7 @@ group("communication") {
"bluetooth_standard:ActsBluetoothJsTest",
"dsoftbus/rpc:ActsRpcJsTest",
"nfc_Controller:ActsNFCJSTest",
"nfc_ErrorCode:ActsNFCErrorJSTest",
"wifi_p2p:ActsP2PJSTest",
"wifi_standard:ActsWifiJSTest",
]
......
# Copyright (C) 2023 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("ActsNFCErrorJSTest") {
hap_profile = "./src/main/config.json"
deps = [
":nfc_js_assets",
":nfc_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsNFCErrorJSTest"
part_name = "nfc"
subsystem_name = "communication"
}
ohos_js_assets("nfc_js_assets") {
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
}
ohos_resources("nfc_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
{
"description": "Configuration for nfc js api Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "600000",
"shell-timeout": "600000",
"testcase-timeout": "600000",
"bundle-name": "ohos.acts.communication.nfc.nfcdevice",
"package-name": "ohos.acts.communication.nfc.nfcdevice"
},
"kits": [
{
"test-file-name": [
"ActsNFCErrorJSTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "ohos.acts.communication.nfc.nfcdevice",
"vendor": "acts",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.communication.nfc.nfcdevice",
"name": ".entry",
"mainAbility": ".MainAbility",
"deviceType": [
"tablet",
"default",
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "nfc_standard",
"moduleType": "entry"
},
"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
}
}
],
"reqPermissions": [
{
"name": "ohos.permission.NFC_CARD_EMULATION",
"reason": "use ohos.permission.SET_nfc_INFO"
},
{
"name": "ohos.permission.NFC_TAG",
"reason": "use ohos.permission.NFC_TAG"
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
},
"srcPath": ""
}
}
/*
* Copyright (C) 2023 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');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ 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.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
/*
* 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.
*/
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2023 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: '',
myTimeout: 25000
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
},
onReady() {
console.info('onReady finish')
},
}
/*
* Copyright (c) 2023 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
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
@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
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (c) 2023 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) 2023 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) 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 nfcIsoDepErrorTest from './error.IsoDepTag.js'
import MifareClassicErrorTest from './error.MifareClassicTag.js'
import UltralightTagErrorTest from './error.MifareUltralightTag.js'
import nfcNDEFErrorTest from './error.NDEFTag.js'
import nfcTagABFVErrorTest from './error.TagABFV.js'
import parameter from '@ohos.systemparameter';
let info = parameter.getSync("const.SystemCapability.Communication.NFC.Core" ,"false");
export default function testsuite() {
if (info != "false")
{
nfcIsoDepErrorTest();
MifareClassicErrorTest();
UltralightTagErrorTest();
nfcNDEFErrorTest();
nfcTagABFVErrorTest();
}
}
\ No newline at end of file
/*
* Copyright (C) 2023 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 tag from '@ohos.nfc.tag';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
function sleep(delay) { // delay x ms
let start = (new Date()).getTime();
while ((new Date()).getTime() - start < delay) {
continue;
}
}
let NdefRecord = {
NFC_A : 1,
NFC_B : 2,
ISO_DEP : 3,
NFC_F : 4,
NFC_V : 5,
NDEF : 6,
MIFARE_CLASSIC : 8,
MIFARE_ULTRALIGHT : 9,
NDEF_FORMATABLE : 10,
};
let NfcForumType = {
NFC_FORUM_TYPE_1 : 1,
NFC_FORUM_TYPE_2 : 2,
NFC_FORUM_TYPE_3 : 3,
NFC_FORUM_TYPE_4 : 4,
MIFARE_CLASSIC : 101,
};
let FeatureType = {
HCE : 0,
UICC : 0,
ESE : 0,
}
let isoDepTaginfo = {
"uid": [0x01, 0x02, 0x03, 0x04],
"technology": [1, 3],
"extrasData": [
{
"Sak": 0x08, "Atqa": "B000",
},
{
"HistoricalBytes": "4D54000500308693695B", "HiLayerResponse": "",
},
],
"tagRfDiscId": 1,
};
let IsoDepTag ;
export default function nfcIsoDepErrorTest() {
describe('nfcIsoDepErrorTest', function () {
beforeAll(function () {
console.info('beforeAll called')
})
beforeEach(function() {
console.info('beforeEach called')
try{
IsoDepTag = tag.getIsoDep(isoDepTaginfo);
}catch(error){
console.info('getIsoDep is ->' + error)
}
})
afterEach(function () {
console.info('afterEach called')
})
afterAll(function () {
console.info('afterAll called')
})
/**
* @tc.number SUB_Communication_NFC_nfcIsoDep_js_0100
* @tc.name Test isExtendedApduSupported IsoDep
* @tc.desc Check whether extended APDUs are supported Promise. The error code is 401
* @tc.size since 9
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_Communication_NFC_nfcIsoDep_js_0100', 0, async function (done) {
if (IsoDepTag != null && IsoDepTag != undefined) {
(async () => {
try {
let result = await IsoDepTag.isExtendedApduSupported('test');
console.info("[NFC_test]isoDep1 isExtendedApduSupported data: " + result);
expect(result).assertInstanceOf('Array')
expect().assertFail()
} catch(error) {
console.info("[NFC_test]isoDep1 isExtendedApduSupported errorcode: " + error.code);
expect(401).assertEqual(error.code)
}
})();
sleep(3000);
done();
} else {
console.info("[NFC_test]IsoDepTag1 = null & = undefined: ");
expect(true).assertFalse();
}
})
/**
* @tc.number SUB_Communication_NFC_nfcIsoDep_js_0200
* @tc.name Test isExtendedApduSupported IsoDep
* @tc.desc Check whether extended APDUs are supported callback. The error code is 401
* @tc.size since 9
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_Communication_NFC_nfcIsoDep_js_0200', 0, async function (done) {
if (IsoDepTag != null && IsoDepTag != undefined) {
try {
IsoDepTag.isExtendedApduSupported('test')((err, data)=> {
if (err) {
expect().assertFail();
console.info("[NFC_test]isoDep2 isExtendedApduSupported errcode: " + err);
} else {
expect(false).assertEqual(data);
console.info("[NFC_test]isoDep2 isExtendedApduSupported data: " + data);
}
});
} catch (error) {
console.info("[NFC_test]isoDep2 isExtendedApduSupported errorcode: " + error.code);
expect(401).assertEqual(error.code)
}
done();
} else {
console.info("[NFC_test]IsoDepTag2 = null & = undefined: ");
expect(true).assertFalse();
}
})
/**
* @tc.number SUB_Communication_NFC_nfcIsoDep_js_0300
* @tc.name Test getIsoDep IsoDep
* @tc.desc Obtains an object based on the tag information The error code is 401
* @tc.size since 9
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_Communication_NFC_nfcIsoDep_js_0300', 0, function () {
if (IsoDepTag != null && IsoDepTag != undefined) {
try {
let getIsoDepTaginfo = tag.getIsoDep("test");
console.info("[NFC_test]isoDep3 getIsoDep: " + getIsoDepTaginfo);
} catch (error) {
console.info("[NFC_test]isoDep3 getIsoDep errorcode: " + error.code);
expect(401).assertEqual(error.code)
}
} else {
console.info("[NFC_test]IsoDepTag3 = null & = undefined: ");
expect(true).assertFalse();
}
})
console.info("*************[nfc_test] start nfc js unit test end*************");
})
}
/*
* Copyright (C) 2023 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 tag from '@ohos.nfc.tag';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
function sleep(delay) { // delay x ms
let start = (new Date()).getTime();
while ((new Date()).getTime() - start < delay) {
continue;
}
}
let mifareUltralightTaginfo = {
"uid": [0x01, 0x02, 0x03, 0x04],
"technology": [1, 9],
"extrasData": [
{
"Sak": 0x08, "Atqa": "B000",
},
{
"MifareUltralightC": "ture",
},
],
"tagRfDiscId": 1,
};
let MifareUltralightType = {
TYPE_UNKOWN : 0x04,
TYPE_ULTRALIGHT : 1,
TYPE_ULTRALIGHT_C : 2,
}
let MifareUltralightTag = null;
export default function UltralightTagErrorTest() {
describe('UltralightTagErrorTest', function () {
beforeAll(function () {
console.info('beforeAll called')
})
beforeEach(function() {
console.info('beforeEach called')
try{
MifareUltralightTag = tag.getMifareUltralight(mifareUltralightTaginfo);
console.info(' mifareUltralight is' + mifareUltralight)
}catch(error){
console.info(' mifareUltralight error' + error)
}
})
afterEach(function () {
console.info('afterEach called')
})
afterAll(function () {
console.info('afterAll called')
})
/**
* @tc.number SUB_Communication_NFC_mifareUltralight_0100
* @tc.name testreadMultiplePages
* @tc.desc Test readMultiplePages api by promise. The error code is 401
* @tc.size MEDIUM
* @ since 9
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_Communication_NFC_mifareUltralight_0100', 0, async function (done) {
if (MifareUltralightTag != null && MifareUltralightTag != undefined) {
let pageIndex = 1;
(async () => {
try {
let result = await MifareUltralightTag.readMultiplePages('test');
console.info("[NFC_test]mifareUltralight1 readMultiplePages data: " + result);
} catch(error) {
console.info("[NFC_test]mifareUltralight1 readMultiplePages errorcode: " + error.code);
expect(401).assertEqual(error.code);
}
})();
sleep(3000);
done();
} else {
console.info("[NFC_test]mifareUltralight1 = null & = undefined: ");
expect(true).assertFalse();
}
})
/**
* @tc.number SUB_Communication_NFC_mifareUltralight_0200
* @tc.name testreadMultiplePages
* @tc.desc Test readMultiplePages api by callback. The error code is 401
* @tc.size MEDIUM
* @ since 9
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_Communication_NFC_mifareUltralight_0200', 0, async function (done) {
if (MifareUltralightTag != null && MifareUltralightTag != undefined) {
let pageIndex = 1;
try {
MifareUltralightTag.readMultiplePages('test', (err, data)=> {
if (err) {
console.info("[NFC_test]mifareUltralight2 readMultiplePages errcode: " + err);
expect(true).assertEqual(true);
} else {
console.info("[NFC_test]mifareUltralight2 readMultiplePages data: " + data + "json2:" + JSON.stringify(data));
expect(true).assertTrue(data >= 0);
}
});
} catch (error) {
console.info("[NFC_test]mifareUltralight2 readMultiplePages errorcode: " + error.code);
expect(401).assertEqual(error.code);
}
sleep(3000);
done();
} else {
console.info("[NFC_test]mifareUltralight2 = null & = undefined: ");
expect(true).assertFalse();
}
})
/**
* @tc.number SUB_Communication_NFC_mifareUltralight_0300
* @tc.name testwriteSinglePage
* @tc.desc Test writeSinglePage api by promise. The error code is 401
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_Communication_NFC_mifareUltralight_0300', 0, async function (done) {
if (MifareUltralightTag != null && MifareUltralightTag != undefined) {
let pageIndex = 1;
let rawData = [0x01, 0x02];
(async () => {
try {
let result = await MifareUltralightTag.writeSinglePage('test', rawData);
console.info("[NFC_test]mifareUltralight3 writeSinglePage data: " + result);
} catch(error) {
console.info("[NFC_test]mifareUltralight3 writeSinglePage errorcode: " + error.code);
expect(401).assertEqual(error.code);
}
})();
sleep(3000);
done();
} else {
console.info("[NFC_test]mifareUltralight3 = null & = undefined: ");
expect(true).assertFalse();
}
})
/**
* @tc.number SUB_Communication_NFC_mifareUltralight_0400
* @tc.name testwriteSinglePage
* @tc.desc Test writeSinglePage api by callback. The error code is 401
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_Communication_NFC_mifareUltralight_0400', 0, async function (done) {
if (MifareUltralightTag != null && MifareUltralightTag != undefined) {
let pageIndex = 1;
let rawData = [0x01, 0x02];
try {
MifareUltralightTag.writeSinglePage('test', rawData, (err, data)=> {
if (err) {
console.log("[NFC_test]mifareUltralight4 writeSinglePage errcode: " + err);
expect(true).assertEqual(true);
} else {
console.log("[NFC_test]mifareUltralight4 writeSinglePage data: " + data + "json2:" + JSON.stringify(data));
expect(true).assertTrue(data >= 0);
}
});
} catch (error) {
console.info("[NFC_test]mifareUltralight4 writeSinglePage errorcode: " + error.code);
expect(401).assertEqual(error.code);
}
sleep(3000);
done();
} else {
console.info("[NFC_test]mifareUltralight4 = null & = undefined: ");
expect(true).assertFalse();
}
})
/**
* @tc.number SUB_Communication_NFC_mifareUltralight_0500
* @tc.name getMifareUltralight
* @tc.desc Test getMifareUltralight api. The error code is 401
* @tc.size MEDIUM
* @ since 9
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_Communication_NFC_mifareUltralight_0500', 0, function () {
if (MifareUltralightTag != null && MifareUltralightTag != undefined) {
try {
let nfcMifareUltralightTag = tag.getMifareUltralight("test");
console.info("[NFC_test]mifareUltralight5 getMifareUl: " + nfcMifareUltralightTag);
} catch (error) {
console.info("[NFC_test]mifareUltralight5 getMifareUl errorcode: " + error.code);
expect(401).assertEqual(error.code)
}
} else {
console.info("[NFC_test]mifareUltralight5 = null & = undefined: ");
expect(true).assertFalse();
}
})
console.info("*************[nfc_test] start nfc js unit test end*************");
})
}
/*
* Copyright (C) 2023 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 tag from '@ohos.nfc.tag';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
function sleep(delay) { // delay x ms
let start = (new Date()).getTime();
while ((new Date()).getTime() - start < delay) {
continue;
}
}
let NdefRecord = {
NFC_A : 1,
NFC_B : 2,
ISO_DEP : 3,
NFC_F : 4,
NFC_V : 5,
NDEF : 6,
MIFARE_CLASSIC : 8,
MIFARE_ULTRALIGHT : 9,
NDEF_FORMATABLE : 10,
};
let NfcForumType = {
NFC_FORUM_TYPE_1 : 1,
NFC_FORUM_TYPE_2 : 2,
NFC_FORUM_TYPE_3 : 3,
NFC_FORUM_TYPE_4 : 4,
MIFARE_CLASSIC : 101,
};
let aTag = {
"uid": [0x01, 0x02, 0x03, 0x04],
"technology": [1],
"extrasData": [
{
"Sak": 0x08, "Atqa": "B000",
},
],
"tagRfDiscId": 1,
"supportedProfiles": 1,
};
let bTag = {
"uid": [0x01, 0x02, 0x03, 0x04],
"technology": [2],
"extrasData": [
{
"AppData": "A0C0", "ProtocolInfo": "131F",
}
],
"tagRfDiscId": 1,
};
let fTag = {
"uid": [0x01, 0x02, 0x03, 0x04],
"technology": [4],
"extrasData": [
{
"SystemCode": "A0C0", "Pmm": "131F",
}
],
"tagRfDiscId": 1,
};
let vTag = {
"uid": [0x01, 0x02, 0x03, 0x04],
"technology": [ 5 ],
"extrasData": [
{
"ResponseFlags": 0x09, "DsfId": 0x13,
}
],
"tagRfDiscId": 1,
};
let Want = {
"uid" : '01020304',
"technology" : [1],
"tagRfDiscId" :1,
"Sak": 0x08,
"Atqa": "B000",
}
export default function nfcTagABFVErrorTest() {
describe('nfcTagABFVErrorTest', function () {
beforeAll(function () {
console.info('beforeAll called')
})
beforeEach(function() {
console.info('beforeEach called')
})
afterEach(function () {
console.info('afterEach called')
})
afterAll(function () {
console.info('afterAll called')
})
/**
* @tc.number SUB_Communication_NFC_nfctage_js_0100
* @tc.name Test getTagInfo
* @tc.desc Obtains the DsfId value of the taginfo. The error code is 401
* @tc.size since 7
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_Communication_NFC_nfctage_js_0100', 0, function () {
let TagInfo ;
try{
TagInfo = tag.getTagInfo("test");
console.info('[NFC_test]TagABFV1 TagInfo:' + TagInfo)
expect(TagInfo instanceof Object).assertTrue();
}catch(error){
console.info('[NFC_test]TagABFV1 TagInfo errorcode:' + error.code)
expect(401).assertEqual(error.code);
}
})
/**
* @tc.number SUB_Communication_NFC_nfctage_js_0200
* @tc.name Test getNfcA
* @tc.desc Obtains the DsfId value of the taginfo. The error code is 401
* @tc.size since 7
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_Communication_NFC_nfctage_js_0200', 0, function () {
let TagInfo ;
try{
TagInfo = tag.getNfcA("test");
console.info('[NFC_test]TagABFV2 getNfcAtag:' + TagInfo)
expect(TagInfo instanceof Object).assertTrue();
}catch(error){
console.info('[NFC_test]TagABFV2 getNfcAtag errorcode:' + error.code)
expect(401).assertEqual(error.code);
}
})
/**
* @tc.number SUB_Communication_NFC_nfctage_js_0300
* @tc.name Test getNfcB
* @tc.desc Obtains the DsfId value of the taginfo. The error code is 401
* @tc.size since 7
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_Communication_NFC_nfctage_js_0300', 0, function () {
let TagInfo ;
try{
TagInfo = tag.getNfcB("test");
console.info('[NFC_test]TagABFV3 getNfcBtag:' + TagInfo)
expect(TagInfo instanceof Object).assertTrue();
}catch(error){
console.info('[NFC_test]TagABFV3 getNfcBtag errorcode:' + error.code)
expect(401).assertEqual(error.code);
}
})
/**
* @tc.number SUB_Communication_NFC_nfctage_js_0400
* @tc.name Test getNfcF
* @tc.desc Obtains the DsfId value of the taginfo. The error code is 401
* @tc.size since 7
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_Communication_NFC_nfctage_js_0400', 0, function () {
let TagInfo ;
try{
TagInfo = tag.getNfcF("test");
console.info('[NFC_test]TagABFV4 getNfcFtag:' + TagInfo)
expect(TagInfo instanceof Object).assertTrue();
}catch(error){
console.info('[NFC_test]TagABFV4 getNfcFtag errorcode:' + error.code)
expect(401).assertEqual(error.code);
}
})
/**
* @tc.number SUB_Communication_NFC_nfctage_js_0500
* @tc.name Test getNfcV
* @tc.desc Obtains the DsfId value of the taginfo. The error code is 401
* @tc.size since 7
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_Communication_NFC_nfctage_js_0500', 0, function () {
let TagInfo ;
try{
TagInfo = tag.getNfcV("test");
console.info('[NFC_test]TagABFV5 getNfcVtag:' + TagInfo)
expect(TagInfo instanceof Object).assertTrue();
}catch(error){
console.info('[NFC_test]TagABFV5 getNfcVtag errorcode:' + error.code)
expect(401).assertEqual(error.code);
}
})
console.info("*************[nfc_test] start nfc js unit test end*************");
})
}
{
"string": [
{
"name": "app_name",
"value": "OsAccountTest"
},
{
"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
......@@ -18,8 +18,5 @@ group("ActsGlobalTest") {
"//test/xts/acts/global_lite/i18n_lite/number_posix:ActsNumberTest",
"//test/xts/acts/global_lite/i18n_lite/numberrecall_posix:ActsNumberRecallTest",
"//test/xts/acts/global_lite/i18n_lite/week_plural_number/src:WeekPluralNumbertest",
# depend on the resources
#"//test/xts/acts/global_lite/i18n_lite/resource_parse_load/src:ResourceParseLoadtest",
]
}
......@@ -36,8 +36,5 @@ hcpptest_suite("ResourceParseLoadtest") {
"//base/global/resmgr_lite/interfaces/innerkits/include",
]
deps = [
"//base/global/resmgr_lite/frameworks/resmgr_lite:global_resmgr",
#"//third_party/bounds_checking_function:libsec_shared",
]
deps = [ "//base/global/resmgr_lite/frameworks/resmgr_lite:global_resmgr" ]
}
......@@ -22,8 +22,5 @@ hcpptest_suite("WeekPluralNumbertest") {
"//third_party/bounds_checking_function/include",
]
deps = [
"//base/global/i18n_lite/frameworks/i18n:global_i18n",
#"//third_party/bounds_checking_function:libsec_shared",
]
deps = [ "//base/global/i18n_lite/frameworks/i18n:global_i18n" ]
}
......@@ -18,8 +18,6 @@ group("VKGLCTSTest") {
deps = [
"src/deqpgles2/build0001:ActsDeqpgles2TestSuite0001",
"src/deqpgles2/build0002:ActsDeqpgles2TestSuite0002",
#"src/deqpgles2/build0003:ActsDeqpgles2TestSuite0003",
"src/deqpgles2/build0004:ActsDeqpgles2TestSuite0004",
"src/deqpgles2/build0005:ActsDeqpgles2TestSuite0005",
"src/deqpgles2/build0006:ActsDeqpgles2TestSuite0006",
......@@ -29,13 +27,8 @@ group("VKGLCTSTest") {
"src/deqpgles2/build0010:ActsDeqpgles2TestSuite0010",
"src/deqpgles2/build0011:ActsDeqpgles2TestSuite0011",
"src/deqpgles2/build0012:ActsDeqpgles2TestSuite0012",
#"src/deqpgles2/build0013:ActsDeqpgles2TestSuite0013",
#"src/deqpgles2/build0014:ActsDeqpgles2TestSuite0014",
"src/deqpgles2/build0015:ActsDeqpgles2TestSuite0015",
"src/deqpgles2/build0016:ActsDeqpgles2TestSuite0016",
#"src/deqpgles2/build0017:ActsDeqpgles2TestSuite0017",
"src/deqpgles3/build0001:ActsDeqpgles3TestSuite0001",
"src/deqpgles3/build0002:ActsDeqpgles3TestSuite0002",
"src/deqpgles3/build0003:ActsDeqpgles3TestSuite0003",
......@@ -61,8 +54,6 @@ group("VKGLCTSTest") {
"src/deqpgles3/build0023:ActsDeqpgles3TestSuite0023",
"src/deqpgles3/build0024:ActsDeqpgles3TestSuite0024",
"src/deqpgles3/build0025:ActsDeqpgles3TestSuite0025",
#"src/deqpgles3/build0026:ActsDeqpgles3TestSuite0026",
"src/deqpgles3/build0027:ActsDeqpgles3TestSuite0027",
"src/deqpgles3/build0028:ActsDeqpgles3TestSuite0028",
"src/deqpgles3/build0029:ActsDeqpgles3TestSuite0029",
......@@ -72,19 +63,13 @@ group("VKGLCTSTest") {
"src/deqpgles3/build0033:ActsDeqpgles3TestSuite0033",
"src/deqpgles3/build0034:ActsDeqpgles3TestSuite0034",
"src/deqpgles3/build0035:ActsDeqpgles3TestSuite0035",
#"src/deqpgles3/build0036:ActsDeqpgles3TestSuite0036",
"src/deqpgles3/build0037:ActsDeqpgles3TestSuite0037",
"src/deqpgles3/build0038:ActsDeqpgles3TestSuite0038",
"src/deqpgles3/build0039:ActsDeqpgles3TestSuite0039",
#"src/deqpgles3/build0040:ActsDeqpgles3TestSuite0040",
"src/deqpgles3/build0041:ActsDeqpgles3TestSuite0041",
"src/deqpgles3/build0042:ActsDeqpgles3TestSuite0042",
"src/deqpgles3/build0043:ActsDeqpgles3TestSuite0043",
"src/deqpgles3/build0044:ActsDeqpgles3TestSuite0044",
#"src/deqpgles3/build0045:ActsDeqpgles3TestSuite0045",
"src/deqpgles31/build0001:ActsDeqpgles31TestSuite0001",
"src/deqpgles31/build0002:ActsDeqpgles31TestSuite0002",
"src/deqpgles31/build0003:ActsDeqpgles31TestSuite0003",
......@@ -97,8 +82,6 @@ group("VKGLCTSTest") {
"src/deqpgles31/build0010:ActsDeqpgles31TestSuite0010",
"src/deqpgles31/build0011:ActsDeqpgles31TestSuite0011",
"src/deqpgles31/build0012:ActsDeqpgles31TestSuite0012",
#"src/deqpgles31/build0013:ActsDeqpgles31TestSuite0013",
"src/deqpgles31/build0014:ActsDeqpgles31TestSuite0014",
"src/deqpgles31/build0015:ActsDeqpgles31TestSuite0015",
"src/deqpgles31/build0016:ActsDeqpgles31TestSuite0016",
......@@ -128,26 +111,10 @@ group("VKGLCTSTest") {
"src/khrgles3/build0001:ActsKhrgles3TestSuite0001",
"src/khrgles3/build0002:ActsKhrgles3TestSuite0002",
"src/khrgles3/build0003:ActsKhrgles3TestSuite0003",
#"src/khrgles3/build0004:ActsKhrgles3TestSuite0004",
"src/khrgles3/build0005:ActsKhrgles3TestSuite0005",
"src/khrgles31/build0001:ActsKhrgles31TestSuite0001",
"src/khrgles31/build0002:ActsKhrgles31TestSuite0002",
#"src/khrgles31/build0003:ActsKhrgles31TestSuite0003",
"src/khrgles31/build0004:ActsKhrgles31TestSuite0004",
#"src/khrgles32/build0001:ActsKhrgles32TestSuite0001",
#"src/khrgles32/build0002:ActsKhrgles32TestSuite0002",
#"src/khrgles32single/build0001:ActsKhrgles32singleTestSuite0001",
#"src/khrgles32single/build0002:ActsKhrgles32singleTestSuite0002",
#"src/khrgles32single/build0003:ActsKhrgles32singleTestSuite0003",
#"src/khrgles32single/build0004:ActsKhrgles32singleTestSuite0004",
#"src/khrgles32single/build0005:ActsKhrgles32singleTestSuite0005",
#"src/khrgles32single/build0006:ActsKhrgles32singleTestSuite0006",
#"src/khrgles32single/build0007:ActsKhrgles32singleTestSuite0007",
#"src/khrglesext/build0001:ActsKhrglesextTestSuite0001",
]
}
......
......@@ -24,13 +24,6 @@ export default function imeAbilityTest(abilityContext) {
id:'',
extra:{}
}
/**
* sleep function.
*/
function sleep(date, time){
while(Date.now() - date <= time);
}
/**
* beforeEach: Prerequisites at the test case level, which are executed before each test case is executed.
......@@ -75,12 +68,14 @@ export default function imeAbilityTest(abilityContext) {
}
inputMethod.switchInputMethod(imExtAbilityProperty).then((data)=>{
console.info('====>SUB_InputMethod_IMEAbility_0004 switchInputMethod to IME :' + data);
console.info('====>SUB_InputMethod_IMEAbility_0001 switchInputMethod to IME :' + data);
expect(data == true).assertTrue();
});
sleep(Date.now(), 3000);
console.info('====>----------SUB_InputMethod_IMEAbility_0001 end-------------');
done();
let t = setTimeout(() => {
console.info('====>----------SUB_InputMethod_IMEAbility_0001 end-------------' + t);
clearTimeout(t);
done();
}, 500);
})
/**
......@@ -105,9 +100,11 @@ export default function imeAbilityTest(abilityContext) {
console.info('====>SUB_InputMethod_IMEAbility_0002 switchInputMethod to IME :' + data);
expect(data == true).assertTrue();
});
sleep(Date.now(), 2500);
console.info('====>-----------SUB_InputMethod_IMEAbility_0002 end-------------');
done();
let t = setTimeout(() => {
console.info('====>----------SUB_InputMethod_IMEAbility_0001 end-------------' + t);
clearTimeout(t);
done();
}, 500);
})
})
}
......@@ -196,11 +196,16 @@ export default function inputMethodJSUnit() {
let inputMethodCtrl = inputMethod.getInputMethodController()
inputMethodCtrl.showSoftKeyboard((err) => {
try {
expect(err.code).assertEqual(12800003)
console.info("====>************* inputmethod_test_showSoftKeyboard_001 Test end*************");
done();
if(err == undefined){
expect().assertFail()
done();
}else{
expect(err.code).assertEqual(12800003)
console.info("====>************* inputmethod_test_showSoftKeyboard_001 Test end*************");
done();
}
} catch (err) {
expect().assertFail()
console.info("====>inputmethod_test_showSoftKeyboard_001 err tests fail" + JSON.stringify(err));
done();
}
});
......@@ -215,12 +220,17 @@ export default function inputMethodJSUnit() {
it('inputmethod_test_showSoftKeyboard_002', 0, async function (done) {
let inputMethodCtrl = inputMethod.getInputMethodController()
inputMethodCtrl.showSoftKeyboard().then(() => {
expect().assertFail()
done();
try {
expect().assertFail()
done();
} catch (err) {
console.info("====>inputmethod_test_showSoftKeyboard_002 err tests fail" + JSON.stringify(err));
done();
}
}).catch((err) => {
console.info('====>showSoftKeyboard promise failed : ' + JSON.stringify(err))
console.info('====>showSoftKeyboard typeof(err.code): ' + typeof(err.code))
console.info('====>showSoftKeyboard typeof(err.code): ' + err.code)
console.info('====>inputmethod_test_showSoftKeyboard_002 promise failed : ' + JSON.stringify(err))
console.info('====>inputmethod_test_showSoftKeyboard_002 typeof(err.code): ' + typeof(err.code))
console.info('====>inputmethod_test_showSoftKeyboard_002 typeof(err.code): ' + err.code)
expect(err.code).assertEqual(12800003)
console.info("====>************* inputmethod_test_showSoftKeyboard_002 Test end*************");
done();
......@@ -237,12 +247,17 @@ export default function inputMethodJSUnit() {
let inputMethodCtrl = inputMethod.getInputMethodController()
inputMethodCtrl.hideSoftKeyboard((err) => {
try {
console.info('====>hideSoftKeyboard callbacek failed : ' + JSON.stringify(err))
expect(err.code).assertEqual(12800003)
console.info("====>************* inputmethod_test_hideSoftKeyboard_001 Test end*************");
done();
if(err == undefined){
expect().assertFail()
done();
}else{
console.info('====>inputmethod_test_hideSoftKeyboard_001 callbacek failed : ' + JSON.stringify(err))
expect(err.code).assertEqual(12800003)
console.info("====>************* inputmethod_test_hideSoftKeyboard_001 Test end*************");
done();
}
} catch (err) {
expect().assertFail();
console.info('====>inputmethod_test_hideSoftKeyboard_001 callbacek failed : ' + JSON.stringify(err))
done();
}
})
......@@ -257,10 +272,15 @@ export default function inputMethodJSUnit() {
it('inputmethod_test_hideSoftKeyboard_002', 0, async function (done) {
let inputMethodCtrl = inputMethod.getInputMethodController()
inputMethodCtrl.hideSoftKeyboard().then(() => {
expect().assertFail();
done();
try {
expect().assertFail()
done();
} catch (err) {
console.info("====>inputmethod_test_hideSoftKeyboard_002 err tests fail" + JSON.stringify(err));
done();
}
}).catch((err) => {
console.info('====>hideSoftKeyboard promise failed : ' + JSON.stringify(err))
console.info('====>inputmethod_test_hideSoftKeyboard_002 promise failed : ' + JSON.stringify(err))
expect(err.code).assertEqual(12800003);
console.info("====>************* inputmethod_test_hideSoftKeyboard_002 Test end*************");
done();
......
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Copyright (C) 2023 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
......@@ -15,8 +15,14 @@ import("//build/ohos_var.gni")
group("location") {
testonly = true
if (is_standard_system) {
deps = [ "geolocation_standard:ActslocationJsTest" ]
deps = [
"geolocation_errorCode:ActslocationErrorCodeTest",
"geolocation_standard:ActslocationJsTest",
]
} else {
deps = [ "geolocation_standard:ActslocationJsTest" ]
deps = [
"geolocation_errorCode:ActslocationErrorCodeTest",
"geolocation_standard:ActslocationJsTest",
]
}
}
# Copyright (C) 2023 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("ActslocationErrorCodeTest") {
hap_profile = "./src/main/config.json"
deps = [
":geolocation_js_assets",
":geolocation_resources",
]
# shared_libraries = [
# "//third_party/giflib:libgif",
# "//third_party/libpng:libpng",
# ]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActslocationErrorCodeApiTest"
part_name = "location"
subsystem_name = "location"
}
ohos_js_assets("geolocation_js_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("geolocation_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
{
"description": "Configuration for geolocation js api Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "600000",
"package": "ohos.acts.location.geolocation.function",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActslocationErrorCodeApiTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"hilog -Q pidoff"
]
}
]
}
{
"app": {
"bundleName": "ohos.acts.location.geolocation.function",
"vendor": "acts",
"version": {
"code": 1000000,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.location.geolocation.function",
"name": ".MyApplication",
"mainAbility": "ohos.acts.location.geolocation.function.MainAbility",
"deviceType": [
"tablet",
"default",
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"visible": true,
"name": "ohos.acts.location.geolocation.function.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"reqPermissions": [
{
"name": "ohos.permission.LOCATION",
"reason": "need use ohos.permission.LOCATION",
"usedScene": {
"ability": [
"ohos.acts.location.geolocation.function.MainAbility"
],
"when": "inuse"
}
},
{
"name":"ohos.permission.ACCESS_LOCATION",
"reason":"need use ohos.permission.ACCESS_LOCATION",
"usedScene": {
"ability": [
"ohos.acts.location.geolocation.function.MainAbility"
],
"when": "inuse"
}
},
{
"name":"ohos.permission.APPROXIMATELY_LOCATION",
"reason":"need use ohos.permission.APPROXIMATELY_LOCATION",
"usedScene": {
"ability": [
"ohos.acts.location.geolocation.function.MainAbility"
],
"when": "inuse"
}
},
{
"name":"ohos.permission.LOCATION_IN_BACKGROUND",
"reason":"need use ohos.permission.LOCATION_IN_BACKGROUND",
"usedScene": {
"ability": [
"ohos.acts.location.geolocation.function.MainAbility"
],
"when": "inuse"
}
},
{
"name":"ohos.permission.MANAGE_SECURE_SETTINGS",
"reason":"need use ohos.permission.MANAGE_SECURE_SETTINGS",
"usedScene": {
"ability": [
"ohos.acts.location.geolocation.function.MainAbility"
],
"when": "inuse"
}
},
{
"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"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册