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

!1698 电话子系统js用例上库

Merge pull request !1698 from 高曦/master
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
group("telephony") {
testonly = true
deps = [ "telephonyjstest:telephonyjstest" ]
}
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
group("telephonyjstest") {
testonly = true
deps = [
"call_manager:call_manager",
"cellular_data:cellular_data",
"network_search:network_search",
"sim:sim",
"sms_mms:sms_mms",
]
}
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
group("call_manager") {
testonly = true
if (is_standard_system) {
deps = [ "call_manager_ims2_call:ActsCallManagerIms2CallTest" ]
}
}
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsCallManagerIms2CallTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsCallManagerIms2CallTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for ActsCallManagerIms2CallTest Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "1200000",
"package": "com.ohos.actscallmanagerims2calltest",
"shell-timeout": "1200000",
"native-test-timeout":"1200000"
},
"kits": [
{
"test-file-name": [
"$module.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.ohos.actscallmanagerims2calltest",
"vendor": "ohos",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Release"
}
},
"deviceConfig": {},
"module": {
"package": "com.ohos.actscallmanagerims2calltest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.ohos.actscallmanagerims2calltest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('TestApplication onCreate');
},
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 {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import app from '@system.app'
import device from '@system.device'
import router from '@system.router'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.timeout = 8000;
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
{
"string": [
{
"name": "app_name",
"value": "MyApplication"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ 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.
*/
require('./CallManageAll.test.js');
/**
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export function toString (data) {
if (typeof data === 'object') {
return JSON.stringify(data);
} else {
return data;
}
}
export function promisify (fn) {
return function () {
let args = Array.prototype.slice.call(arguments);
return new Promise(function (resolve, reject) {
console.log(`Telephony_CallManager promisify args:${toString(arguments)},fn:${fn}`);
args.push(function (error, data) {
console.log(`Telephony_CallManager promisify error:${toString(error)},data:${toString(data)}`);
if (error) {
reject(error);
} else {
resolve(data);
}
});
fn.apply(null, args);
});
};
}
\ No newline at end of file
/**
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {TEST_PERF_COUNT, PERF_GOAL_TIME} from './Const.js';
import {toString} from './ApiToPromise.js';
// packaging the function to the perfomace test function
export async function apiToPromisePerfomace (options, args) {
// recursion plan
let {func, caseName, target, perfTime, compareFunc} = options;
let flag = true;
let count = TEST_PERF_COUNT;
perfTime = perfTime ? perfTime : PERF_GOAL_TIME;
console.log(`${caseName} apiToPromisePerfomace func ${func}, caseName ${caseName},args:${toString(args)}`);
function excuteCallbackPromise () {
return new Promise((resolve, reject) => {
function excuteCallback () {
target[func](...args);
}
args[args.length - 1] = function (error, data) {
if (count === 0) {
if (flag) {
resolve(flag);
} else {
reject(new Error(`flag:${flag}`));
}
} else {
flag = flag && !!compareFunc(error, data);
count--;
excuteCallback();
}
};
excuteCallback();
});
}
let startTime = new Date().getTime();
if (typeof args[args.length - 1] === 'function') {
try {
flag = await excuteCallbackPromise();
} catch (error) {
flag = false;
}
} else {
for (;count > 0;count--) {
let error = null;
let data = null;
try {
data = await target[func](...args);
flag = flag && !!compareFunc(error, data);
} catch (err) {
error = err;
flag = flag && !!compareFunc(error, data);
}
}
}
let endTime = new Date().getTime();
const cost = endTime - startTime;
console.log(`${caseName} ${func} result flag:${toString(flag)} count:${TEST_PERF_COUNT}` +
` cost:${cost}ms avarage:${parseInt(cost * 1000 / TEST_PERF_COUNT)}`);
if (flag && cost < perfTime) {
return flag;
} else {
throw new Error(`flag:${flag}`);
}
}
export async function apiToPerfomace (options, args) {
// recursion plan
let {func, caseName, target, perfTime, compareFunc, runedFunc} = options;
let flag = true;
let count = TEST_PERF_COUNT;
perfTime = perfTime ? perfTime : PERF_GOAL_TIME;
console.log(`${caseName} apiToPerfomace func ${func}, caseName ${caseName},args:${toString(args)}`);
function excuteCallbackPromise () {
return new Promise((resolve, reject) => {
function excuteCallback () {
target[func](...args);
}
args[args.length - 1] = function (error, data) {
if (count === 0) {
if (flag) {
resolve(flag);
} else {
reject(new Error(`flag:${flag}`));
}
} else {
flag = flag && !!compareFunc(error, data);
count--;
excuteCallback();
}
};
excuteCallback();
});
}
let startTime = new Date().getTime();
if (typeof args[args.length - 1] === 'function') {
try {
flag = await excuteCallbackPromise();
} catch (error) {
flag = false;
}
} else {
for (;count > 0;count--) {
let error = null;
let data = null;
try {
data = await target[func](...args);
flag = flag && !!compareFunc(error, data);
} catch (err) {
error = err;
flag = flag && !!compareFunc(error, data);
}
}
}
let endTime = new Date().getTime();
const cost = endTime - startTime;
console.log(`${caseName} ${func} result flag:${toString(flag)} count:${TEST_PERF_COUNT}` +
` cost:${cost}ms avarage:${parseInt(cost * 1000 / TEST_PERF_COUNT)}`);
runedFunc(flag && cost < perfTime);
}
export function validate (error, data, func) {
return func(error, data);
}
\ 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 {toString} from './ApiToPromise.js';
import {TEST_RELY_NUMBER} from './Const.js';
// packaging the function to the reliability test function
export async function apiToPromiseReliability (options, args) {
// recursion plan
let {func, caseName, target, compareFunc} = options;
let flag = true;
let count = TEST_RELY_NUMBER;
console.log(`${caseName} apiToPromiseReliability func ${func}, caseName ${caseName},args:${toString(args)}`);
function excuteCallbackPromise () {
return new Promise((resolve, reject) => {
function excuteCallback () {
target[func](...args);
}
args[args.length - 1] = function (error, data) {
if (count === 0) {
if (flag) {
resolve(flag);
} else {
reject(new Error(`flag:${flag}`));
}
} else {
flag = flag && !!compareFunc(error, data);
count--;
excuteCallback();
}
};
excuteCallback();
});
}
if (typeof args[args.length - 1] === 'function') {
try {
flag = await excuteCallbackPromise();
} catch (error) {
flag = false;
}
} else {
for (;count > 0;count--) {
let error = null;
let data = null;
try {
data = await target[func](...args);
flag = flag && !!compareFunc(error, data);
} catch (err) {
error = err;
flag = flag && !!compareFunc(error, data);
}
}
}
console.log(`${caseName} result ${func} flag:${toString(flag)} count:${TEST_RELY_NUMBER}`);
if (flag) {
return flag;
} else {
throw new Error(`flag:${flag}`);
}
}
export async function apiToReliability (options, args) {
// recursion plan
let {func, caseName, target, compareFunc, runedFunc} = options;
let flag = true;
let count = TEST_RELY_NUMBER;
console.log(`${caseName} apiToPromiseReliability func ${func}, caseName ${caseName},args:${toString(args)}`);
function excuteCallbackPromise () {
return new Promise((resolve, reject) => {
function excuteCallback () {
target[func](...args);
}
args[args.length - 1] = function (error, data) {
console.log(`${caseName} error ${toString(error)} data ${toString(data)}`);
if (count === 0) {
if (flag) {
resolve(flag);
} else {
reject(new Error(`flag:${flag}`));
}
} else {
flag = flag && !!compareFunc(error, data);
count--;
console.log(`${caseName} error:${toString(error)},data:${toString(data)},` +
`flag:${flag},count:${count}`);
excuteCallback();
}
};
excuteCallback();
});
}
if (typeof args[args.length - 1] === 'function') {
try {
flag = await excuteCallbackPromise();
} catch (error) {
flag = false;
}
} else {
for (;count > 0;count--) {
let error = null;
let data = null;
try {
data = await target[func](...args);
flag = flag && !!compareFunc(error, data);
} catch (err) {
error = err;
flag = flag && !!compareFunc(error, data);
}
console.log(`${caseName} error:${toString(error)},data:${toString(data)},flag:${flag},count:${count}`);
}
}
console.log(`${caseName} result ${func} flag:${toString(flag)} count:${TEST_RELY_NUMBER}`);
runedFunc(flag);
}
/**
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// export const AUTO_ACCEPT_NUMBER = '17615117737';
export const AUTO_ACCEPT_NUMBER = '10010';
export const AUTO_ACCEPT_NUMBER2 = '10010';
export const NOT_ACCEPT_NUMBER = '17160409240';
export const PHONE_NUMBER_AREA_LAND = '089800000000';
export const PHONE_NUMBER_LENGTH_8 = '86459751';
export const PHONE_NUMBER_LENGTH_11 = '10000000001';
export const PHONE_NUMBER_VOICE_MAIL = '12599';
export const PHONE_NUMBER_LONG = '1234567890123456789012345678901234567890123' +
'4567890123456789012345678901234567890123456789012345678901';
export const EMERGENCY_NUMBER = '112';
export const RIGHT_PASSWORD = '000001';
export const ERROR_PASSWORD = '1234567890123456789012345678901234567890123' +
'4567890123456789012345678901234567890123456789012345678901';
export const CALL_EMERGENCY = 2;
export const PHONE_LIST = ['10000000001'];
export const PHONE_LIST2 = ['10000000001', '10000000002'];
export const NULL_PHONE_NUMBER = '';
export const SPECIA_CHAR_NUMBER = '"=#$%^&*()+';
export const PHONE_NUMBER_CHAR = 'abcdefghijk';
export const BOUNDARY_NUMBER_INT = 2147483649;
export const MINUS_BOUNDARY_NUMBER_INT = -2147483649;
export const MINUS_VALUE = -100;
export const TEST_RELY_NUMBER = 20; // test count for Reliability
export const TEST_PERF_COUNT = 20; // test count for Perfomace
export const PERF_GOAL_TIME = TEST_PERF_COUNT * 0.5;
export const CALL_STATUS_ACTIVE = 0;
export const CALL_STATUS_HOLDING = 1;
export const CALL_STATUS_DIALING = 2;
export const CALL_STATUS_ALERTING = 3;
export const CALL_STATUS_INCOMING = 4;
export const CALL_STATUS_WAITING = 5;
export const CALL_STATUS_DISCONNECTED = 6;
export const CALL_STATUS_DISCONNECTING = 7;
export const CALL_STATUS_IDLE = 8;
export const TEL_CONFERENCE_IDLE = 0;
export const TEL_CONFERENCE_ACTIVE = 1;
export const TEL_CONFERENCE_DISCONNECTING = 2;
export const TEL_CONFERENCE_DISCONNECTED = 3;
export const DEVICE_EARPIECE = 0;
export const DEVICE_SPEAKER = 1;
export const DEVICE_WIRED_HEADSET = 2;
export const DEVICE_BLUETOOTH_SCO = 3;
export const DEVICE_INVALID = -1;
export const DEVICE_INVALID4 = 4;
export const RESTRICTION_MODE_DEACTIVATION = 0;
export const RESTRICTION_MODE_ACTIVATION = 1;
export const RESTRICTION_MODE_INVALID = -1;
export const RESTRICTION_MODE_INVALID2 = 2;
export const RESTRICTION_DISABLE = 0;
export const RESTRICTION_ENABLE = 1;
export const RESTRICTION_TYPE_ALL_INCOMING = 0;
export const RESTRICTION_TYPE_ALL_OUTGOING = 1;
export const RESTRICTION_TYPE_INTERNATIONAL = 2;
export const RESTRICTION_TYPE_INTERNATIONAL_EXCLUDING_HOME = 3;
export const RESTRICTION_TYPE_ROAMING_INCOMING = 4;
export const RESTRICTION_TYPE_INCOMING_SERVICES = 7;
export const RESTRICTION_TYPE_OUTGOING_SERVICES = 6;
export const RESTRICTION_TYPE_ALL_CALLS = 5;
export const RESTRICTION_TYPE_INVALID = -1;
export const RESTRICTION_TYPE_INVALID2 = 8;
export const DEFAULT_SLOT_ID = 0;
export const SLOT_ID1 = 1;
export const SLOT_ID_INVALID = -1;
export const SLOT_ID_INVALID_2 = 2;
export const CALL_ID_NOT_EXIST = 999;
export const VIDEO_STATE_AUDIO = 0;
export const CALL_TYPE_CS = 0;
export const CALL_TYPE_IMS = 1;
export const EVENT_START_DTMF_SUCCESS = 3;
export const EVENT_STOP_DTMF_SUCCESS = 5;
export const CALL_STATE_UNKNOWN = -1;
export const CALL_STATE_IDLE = 0;
export const CALL_STATE_RINGING = 1;
export const CALL_STATE_OFFHOOK = 2;
export const TIMEOUT_LENTH = 1000;
// call error code
export const CALL_MANAGER_NUMBER_NULL_NOTICE = '83951616';
export const TRANSFER_DISABLE = 0; // tran is close
export const TRANSFER_ENABLE = 1; // tran is open
export const CALL_TRANSFER_ENABLE = 0;
export const CALL_TRANSFER_DISABLE = 1;
export const CALL_TRANSFER_REGISTRATION = 3; // open tran function
export const CALL_TRANSFER_ERASURE = 4; // close tran function
export const CALL_TRANSFER_INVALID = -1;
export const CALL_TRANSFER_INVALID2 = 5;
export const CALL_TRANSFER_INVALID3 = 2;
export const TRANSFER_TYPE_BUSY = 1; // tran busy
export const TRANSFER_TYPE_NO_REPLY = 2;// no response tran
export const TRANSFER_TYPE_NOT_REACHABLE = 3; // untouchable(no signal/shut down) tran
export const TRANSFER_TYPE_UNCONDITIONAL = 0; // unconditional tran
export const TRANSFER_TYPE_INVALID = -1;
export const TRANSFER_TYPE_INVALID4 = 4;
export const REACH_TIMES = 10;
export const AFTER_HANUP_TIMES = 5;
export const CARMER_ID_NOT_EXIT = 'xtsautotest123456';
export const CARMER_ID_SPACE = '';
export const IMAGE_PNG_PATH = '/system/data/callManager.png';
export const IMAGE_JPG_PATH = '/system/data/callManager.jpg';
export const IMAGE_BMP_PATH = '/system/data/callManager.bmp';
export const IMAGE_WEBP_PATH = '/system/data/callManager.webp';
export const IMAGE_LOCAL_ERROR_PATH = '/system/data/callManager/notexistpath.png';
export const IMAGE_SPACE_PATH = '';
export const SENT_STRING_0 = '0';
export const SENT_STRING_1 = '1';
export const SENT_STRING_2 = '2';
export const SENT_STRING_3 = '3';
export const SENT_STRING_4 = '4';
export const SENT_STRING_5 = '5';
export const SENT_STRING_6 = '6';
export const SENT_STRING_7 = '7';
export const SENT_STRING_8 = '8';
export const SENT_STRING_9 = '9';
export const SENT_STRING_ERROR_10 = '10';
export const SENT_STRING_A = 'A';
export const SENT_STRING_Z = 'Z';
export const SENT_STRING_C = 'C';
export const SENT_STRING_D = 'D';
export const SENT_STRING_E = 'E';
export const SENT_STRING_LOW_A = 'a';
export const SENT_STRING_LOW_C = 'c';
export const SENT_STRING_LOW_B = 'b';
export const SENT_STRING_LOW_D = 'd';
export const SENT_STRING_STAR = '*';
export const SENT_STRING_ADD = '+';
export const SENT_STRING_MINUS = '-';
export const SENT_STRING_JIN = '#';
export const CALL_MODE_CS = 0;
export const CALL_MODE_IMS = 3;
export const MEDIA_TYPE_VOICE = 0;
export const MEDIA_TYPE_VIDEO = 1;
export const MEDIA_TYPE_ERROR = -1;
export const MEDIA_TYPE_ERROR2 = 2;
export const DIAL_SCENCE_CALL_NORMAL = 0;
export const DIAL_SCENCE_CALL_PRIVILEGED = 1;
export const DIAL_SCENCE_CALL_CALL_EMERGENCY = 2;
export const DIAL_SCENCE_ERROR = -1;
export const DIAL_SCENCE_ERROR2 = 3;
export const DIAL_CARRIER_TYPE = 0;
export const DIAL_VOICE_MAIL_TYPE = 1;
export const DIAL_OTT_TYPE = 2;
export const DIAL_TYPE_ERROR = -1;
export const DIAL_TYPE_ERROR3 = 3;
export const POS_700 = 700;
export const POS_10 = 10;
export const POS_Z_0 = 0;
export const POS_Z_1 = 1;
export const POS_Z_ERROR = -1;
export const POS_Z_ERROR2 = 2;
export const POS_LENGTH_300 = 300;
export const POS_LENGTH_600 = 600;
export const ZOOM_RATIO_5_0 = 5.0;
export const ZOOM_RATIO_15_0 = 15.0;
export const ZOOM_RATIO_0_0 = 0.0;
export const ZOOM_RATIO_10_1 = 10.1;
export const ZOOM_RATIO_MINUS_1_0 = -1.0;
export const ROTATION_0 = 0;
export const ROTATION_90 = 90;
export const ROTATION_60 = 60;
export const ROTATION_180 = 180;
export const ROTATION_270 = 270;
export const ROTATION_360 = 360;
export const ROTATION_MINUS_1 = -1;
export const COMMAND_CALL_WAITTING_OPEN = '*43#';
export const COMMAND_CALL_WAITTING_CLOSE = '#43#';
export const COMMAND_CALL_WAITTING_QUERY = '*#43#';
export const COMMAND_CALL_TRANS_OPEN = '*21*10000000001#';
export const COMMAND_CALL_TRANS_OPEN2 = '**21*10000000001*10#';
export const COMMAND_CALL_TRANS_RESET = '##21#';
export const COMMAND_CALL_ERROR = '**21*10000000001******10#';
export const COMMAND_CALL_ERROR2 = '*ABCDEF123456789#';
export const COMMAND_CALL_ERROR3 = '#ABCDEF123456789#';
export const COMMAND_CALL_ERROR4 = '*#ABCDE123456789#';
export const COMMAND_CALL_ERROR5 = '**ABCDE123456789#';
export const COMMAND_CALL_ERROR6 = '##ABCDEF123456789#';
export const CALL_WAITING_DISABLE = 0;
export const CALL_WAITING_ENABLE = 1;
export const EVENT_SEND_USSD_SUCCESS = 17;
export const EVENT_SEND_USSD_FAILED = 18;
export const EVENT_SEND_MEDIA_MODE_UPDATE = 19;
export const RTT_MSG = 'Ab666&#';
export const CALL_MODE_AUDIO_ONLY = 0;
export const CALL_MODE_SEND_RECEIVE = 3;
export const CALL_MODE_SEND_ONLY = 1;
export const CALL_MODE_RECEIVE_ONLY = 2;
export const CALL_MODE_VIDEO_PAUSED = 4;
export const CALL_MODE_INVALID_MINUS_1 = -1;
export const CALL_MODE_INVALID_5 = 5;
/**
* 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 {RIGHT_PASSWORD, DEFAULT_SLOT_ID, RESTRICTION_MODE_DEACTIVATION} from './Const.js';
import {toString} from './ApiToPromise.js';
import call from '@ohos.telephony.call';
// limit call scence
export function scenceLimitCalling (caseName, type, mode, slotId) {
return new Promise((resolve, reject) => {
console.log(`${caseName} scenceLimitCalling type:${type},mode:${mode}`);
call.setCallRestriction(slotId ? slotId : DEFAULT_SLOT_ID, {
type,
mode,
password:RIGHT_PASSWORD,
})
.then(data => {
console.log(`${caseName} setCallRestriction success, data:${toString(data)}`);
resolve(data);
})
.catch((error) => {
console.log(`${caseName} setCallRestriction error,error:${toString(error)}`);
reject(error);
});
});
}
export function scenceLimitCancel (caseName, type, slotId) {
return new Promise((resolve, reject) => {
console.log(`${caseName} scenceLimitCancel type:${type}`);
call.setCallRestriction(slotId ? slotId : DEFAULT_SLOT_ID, {
type,
mode:RESTRICTION_MODE_DEACTIVATION,
password:RIGHT_PASSWORD,
})
.then(data => {
console.log(`${caseName} scenceLimitCancel success, data:${toString(data)}`);
resolve(data);
})
.catch((error) => {
console.log(`${caseName} scenceLimitCancel error,error:${toString(error)}`);
reject(error);
});
});
}
/**
* 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 call from '@ohos.telephony.call';
import {toString} from './ApiToPromise.js';
export function scenceTransferCalling (caseName, settingType, type, phoneNumber) {
return new Promise((resolve, reject) => {
call.setCallTransfer(0, {
settingType,
type,
phoneNumber,
})
.then(data => {
console.log(`${caseName} scenceTransferCalling success,data:${toString(data)}`);
resolve(data);
})
.catch((error) => {
console.log(`${caseName} scenceTransferCalling error,error:${toString(error)}`);
reject(error);
});
});
}
export function scenceTransferCancel (caseName) {
return new Promise((resolve, reject) => {
call.dial('##002#')
.then(data => {
console.log(`${caseName} scenceTransferCancel success,data:${toString(data)}`);
resolve(data);
})
.catch((error) => {
console.log(`${caseName} scenceTransferCancel error,error${toString(error)}`);
reject(error);
});
});
}
{
"string": [
{
"name": "app_name",
"value": "CallManager"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
group("cellular_data") {
testonly = true
if (is_standard_system) {
deps = [ "cellular_data_abnormal:ActsCellularDataAbnormalTest" ]
}
}
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsCellularDataAbnormalTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsCellularDataAbnormalTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for callmanager Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "18000",
"package": "com.ohos.cellulardata",
"shell-timeout": "18000",
"native-test-timeout":"18000"
},
"kits": [
{
"test-file-name": [
"$module.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.ohos.cellulardata",
"vendor": "ohos",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Release"
}
},
"deviceConfig": {},
"module": {
"package": "com.ohos.cellulardata",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.ohos.cellulardata.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('TestApplication onCreate');
},
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 {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import app from '@system.app'
import device from '@system.device'
import router from '@system.router'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish!')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.timeout = 8000
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "CallManager"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ 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 cellular from "@ohos.telephony.data";
import { describe, it, expect } from "deccjsunit/index";
describe("ActsCellularDataAbnormalTest", function () {
const ERR_SLOT_ID = 3;
/*
* @tc.number Telephony_CellularData_isCellularDataEnabled_Async_0100
* @tc.name Call the enableCellularData interface and then call the isCellularDataEnabled interface.
* The result is true
* @tc.desc Function test
*/
it("Telephony_CellularData_isCellularDataEnabled_Async_0100", 0, async function (done) {
cellular.isCellularDataEnabled((err, data) => {
if (err) {
expect().assertFail();
console.log("Telephony_CellularData_isCellularDataEnabled_Async_0100 fail");
done();
return;
}
console.log("Telephony_CellularData_isCellularDataEnabled_Async_0100 finish");
done();
})
})
/*
* @tc.number Telephony_CellularData_getCellularDataState_Async_0100
* @tc.name Call the enableCellularData interface, call the getCellularDataState interface,
* and get the result 1 or 2
* @tc.desc Function test
*/
it("Telephony_CellularData_getCellularDataState_Async_0100", 0, async function (done) {
cellular.getCellularDataState((err, data) => {
if (err) {
expect().assertFail();
console.log("Telephony_CellularData_getCellularDataState_Async_0100 fail");
done();
return;
}
console.log("Telephony_CellularData_getCellularDataState_Async_0100 finish");
done();
})
})
/*
* @tc.number Telephony_CellularData_enableCellularData_Async_0100
* @tc.name Open the data switch and query the switch status and data status
* @tc.desc Function test
*/
it("Telephony_CellularData_enableCellularData_Async_0100", 0, async function (done) {
cellular.enableCellularData((err) => {
if (err) {
expect().assertFail();
console.log("Telephony_CellularData_enableCellularData_Async_0100 enableCellularData fail");
done();
return;
}
console.log("Telephony_CellularData_enableCellularData_Async_0100 enableCellularData finish");
done();
})
})
/*
* @tc.number Telephony_CellularData_disableCellularData_Async_0100
* @tc.name Turn off the data switch and query the switch status and data status
* @tc.desc Function test
*/
it("Telephony_CellularData_disableCellularData_Async_0100", 0, async function (done) {
cellular.disableCellularData((err) => {
if (err) {
expect().assertFail();
console.log("Telephony_CellularData_disableCellularData_Async_0100 disableCellularData fail");
done();
return;
}
console.log("Telephony_CellularData_disableCellularData_Async_0100 disableCellularData finish");
done();
})
})
/*
* @tc.number Telephony_CellularData_enableCellularDataRoaming_Async_0300
* @tc.name Call enableCellularDataRoaming interface, setting parameters as slotId error value (3),
* to check the correction results
* @tc.desc Function test
*/
it("Telephony_CellularData_enableCellularDataRoaming_Async_0300", 0, async function (done) {
cellular.enableCellularDataRoaming(ERR_SLOT_ID, (err) => {
if (err) {
console.log("Telephony_CellularData_enableCellularDataRoaming_Async_0300 enableCellularData finish");
done();
return;
}
expect().assertFail();
console.log("Telephony_CellularData_enableCellularDataRoaming_Async_0300 enableCellularData fail");
done();
})
})
/*
* @tc.number Telephony_CellularData_disableCellularDataRoaming_Async_0300
* @tc.name Call enableCellularDataRoaming interface, setting parameters as slotId error value (3), to check the
* correction results
* @tc.desc Function test
*/
it("Telephony_CellularData_disableCellularDataRoaming_Async_0300", 0, async function (done) {
cellular.disableCellularDataRoaming(ERR_SLOT_ID, (err) => {
if (err) {
console.log(
"Telephony_CellularData_disableCellularDataRoaming_Async_0300 disableCellularDataRoaming finish"
);
done();
return;
}
expect().assertFail();
console.log("Telephony_CellularData_disableCellularDataRoaming_Async_0300 disableCellularDataRoaming fail");
done();
})
})
/*
* @tc.number Telephony_CellularData_getCellularDataFlowType_Async_0100
* @tc.name When cellular data is turned on, call getCellularDataFlowType() to get the data stream type and
* verify that the callback value is within the enumeration value range
* @tc.desc Function test
*/
it("Telephony_CellularData_getCellularDataFlowType_Async_0100", 0, async function (done) {
cellular.getCellularDataFlowType((err, data) => {
if (err) {
expect().assertFail();
console.log("Telephony_CellularData_getCellularDataFlowType_Async_0100 fail");
done();
return;
}
console.log("Telephony_CellularData_getCellularDataFlowType_Async_0100 finish");
done();
})
})
/*
* @tc.number Telephony_CellularData_isCellularDataRoamingEnabled_Async_0200
* @tc.name Call isCellularDataRoamingEnabled, set the slotId to error values (3), to check the correction
* results
* @tc.desc Function test
*/
it("Telephony_CellularData_isCellularDataRoamingEnabled_Async_0200", 0, async function (done) {
cellular.isCellularDataRoamingEnabled(ERR_SLOT_ID, (err) => {
if (err) {
console.log("Telephony_CellularData_isCellularDataRoamingEnabled_Async_0200 finish");
done();
return;
}
expect().assertFail();
console.log("Telephony_CellularData_isCellularDataRoamingEnabled_Async_0200 fail");
done();
})
})
/*
* @tc.number Telephony_CellularData_setDefaultCellularDataSlotId_Async_0500
* @tc.name Call setDefaultCellularDataSlotId() interface, set the default card slot to the number of exceptions
* (-1), and verify whether the setting failed (Async)
* @tc.desc Function test
*/
it("Telephony_CellularData_setDefaultCellularDataSlotId_Async_0500", 0, async function (done) {
cellular.setDefaultCellularDataSlotId(ERR_SLOT_ID, (err) => {
if (err) {
console.log("Telephony_CellularData_setDefaultCellularDataSlotId_Async_0500 finish");
done();
return;
}
expect().assertFail();
console.log("Telephony_CellularData_setDefaultCellularDataSlotId_Async_0500 fail");
done();
})
})
/*
* @tc.number Telephony_CellularData_getDefaultCellularDataSlotId_Async_0500
* @tc.name Call getDefaultCellularDataSlotId() interface and verify whether the setting failed (Async)
* @tc.desc Function test
*/
it("Telephony_CellularData_getDefaultCellularDataSlotId_Async_0500", 0, async function (done) {
cellular.getDefaultCellularDataSlotId((err) => {
if (err) {
expect().assertFail();
console.log("Telephony_CellularData_setDefaultCellularDataSlotId_Async_0500 fail");
done();
return;
}
console.log("Telephony_CellularData_setDefaultCellularDataSlotId_Async_0500 finish");
done();
})
})
/*
* @tc.number Telephony_CellularData_isCellularDataEnabled_Promise_0100
* @tc.name Call the enableCellularData interface and then call the isCellularDataEnabled interface.
* The result is true
* @tc.desc Function test
*/
it("Telephony_CellularData_isCellularDataEnabled_Promise_0100", 0, async function (done) {
try {
await cellular.isCellularDataEnabled();
console.log("Telephony_CellularData_isCellularDataEnabled_Promise_0100 finish");
done();
} catch (err) {
expect().assertFail();
console.log("Telephony_CellularData_isCellularDataEnabled_Promise_0100 fail");
done();
}
})
/*
* @tc.number Telephony_CellularData_getCellularDataState_Promise_0100
* @tc.name Call the enableCellularData interface, call the getCellularDataState interface,
* and get the result 1 or 2
* @tc.desc Function test
*/
it("Telephony_CellularData_getCellularDataState_Promise_0100", 0, async function (done) {
try {
await cellular.getCellularDataState();
console.log("Telephony_CellularData_getCellularDataState_Promise_0100 finish");
done();
} catch (err) {
expect().assertFail();
console.log("Telephony_CellularData_getCellularDataState_Promise_0100 fail");
done();
}
})
/*
* @tc.number Telephony_CellularData_enableCellularData_Promise_0100
* @tc.name Open the data switch and query the switch status and data status
* @tc.desc Function test
*/
it("Telephony_CellularData_enableCellularData_Promise_0100", 0, async function (done) {
try {
await cellular.enableCellularData();
console.log("Telephony_CellularData_enableCellularData_Promise_0100 finish");
done();
} catch (err) {
expect().assertFail();
console.log("Telephony_CellularData_enableCellularData_Promise_0100 fail");
done();
}
})
/*
* @tc.number Telephony_CellularData_disableCellularData_Promise_0100
* @tc.name Turn off the data switch and query the switch status and data status
* @tc.desc Function test
*/
it("Telephony_CellularData_disableCellularData_Promise_0100", 0, async function (done) {
try {
await cellular.disableCellularData();
console.log("Telephony_CellularData_disableCellularData_Promise_0100 finish");
done();
} catch (err) {
expect().assertFail();
console.log("Telephony_CellularData_disableCellularData_Promise_0100 fail");
done();
}
})
/*
* @tc.number Telephony_CellularData_enableCellularDataRoaming_Promise_0300
* @tc.name Call enableCellularDataRoaming interface, setting parameters as slotId error value (3),
* to check the correction results
* @tc.desc Function test
*/
it("Telephony_CellularData_enableCellularDataRoaming_Promise_0300", 0, async function (done) {
try {
await cellular.enableCellularDataRoaming(ERR_SLOT_ID);
expect().assertFail();
console.log("Telephony_CellularData_enableCellularDataRoaming_Promise_0300 fail");
done();
} catch (err) {
console.log("Telephony_CellularData_enableCellularDataRoaming_Promise_0300 finish");
done();
}
})
/*
* @tc.number Telephony_CellularData_disableCellularDataRoaming_Promise_0300
* @tc.name Call enableCellularDataRoaming interface, setting parameters as slotId error value (3), to check the
* correction results
* @tc.desc Function test
*/
it("Telephony_CellularData_disableCellularDataRoaming_Promise_0300", 0, async function (done) {
try {
await cellular.disableCellularDataRoaming(ERR_SLOT_ID);
expect().assertFail();
console.log("Telephony_CellularData_disableCellularDataRoaming_Promise_0300 fail");
done();
} catch (err) {
console.log("Telephony_CellularData_disableCellularDataRoaming_Promise_0300 finish");
done();
}
})
/*
* @tc.number Telephony_CellularData_getCellularDataFlowType_Promise_0100
* @tc.name When cellular data is turned on, call getCellularDataFlowType() to get the data stream type and
* verify that the callback value is within the enumeration value range
* @tc.desc Function test
*/
it("Telephony_CellularData_getCellularDataFlowType_Promise_0100", 0, async function (done) {
try {
await cellular.getCellularDataFlowType();
console.log("Telephony_CellularData_getCellularDataFlowType_Promise_0100 finish");
done();
} catch (err) {
expect().assertFail();
console.log("Telephony_CellularData_getCellularDataFlowType_Promise_0100 fail");
done();
}
})
/*
* @tc.number Telephony_CellularData_isCellularDataRoamingEnabled_Promise_0200
* @tc.name Call isCellularDataRoamingEnabled, set the slotId to error values (3), to check the correction
* results
* @tc.desc Function test
*/
it("Telephony_CellularData_isCellularDataRoamingEnabled_Promise_0200", 0, async function (done) {
try {
await cellular.isCellularDataRoamingEnabled(ERR_SLOT_ID);
expect().assertFail();
console.log("Telephony_CellularData_isCellularDataRoamingEnabled_Promise_0200 fail");
done();
} catch (err) {
console.log("Telephony_CellularData_isCellularDataRoamingEnabled_Promise_0200 finish");
done();
}
})
/*
* @tc.number Telephony_CellularData_setDefaultCellularDataSlotId_Promise_0500
* @tc.name Call setDefaultCellularDataSlotId() interface, set the default card slot to the number of exceptions
* (-1), and verify whether the setting failed (Async)
* @tc.desc Function test
*/
it("Telephony_CellularData_setDefaultCellularDataSlotId_Promise_0500", 0, async function (done) {
try {
await cellular.setDefaultCellularDataSlotId(ERR_SLOT_ID);
expect().assertFail();
console.log("Telephony_CellularData_setDefaultCellularDataSlotId_Promise_0500 fail");
done();
} catch (err) {
console.log("Telephony_CellularData_setDefaultCellularDataSlotId_Promise_0500 finish");
done();
}
})
/*
* @tc.number Telephony_CellularData_getDefaultCellularDataSlotId_Promise_0500
* @tc.name Call getDefaultCellularDataSlotId() interface and verify whether the setting failed (Async)
* @tc.desc Function test
*/
it("Telephony_CellularData_getDefaultCellularDataSlotId_Promise_0500", 0, async function (done) {
try {
await cellular.getDefaultCellularDataSlotId();
console.log("Telephony_CellularData_getDefaultCellularDataSlotId_Promise_0500 finish");
done();
} catch (err) {
expect().assertFail();
console.log("Telephony_CellularData_getDefaultCellularDataSlotId_Promise_0500 fail");
done();
}
})
})
/*
* 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.
*/
require('./CellularDataAbnorma.test.js')
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "CallManager"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
group("network_search") {
testonly = true
if (is_standard_system) {
deps = [ "network_search_errors:ActsNetworkSearchTest" ]
}
}
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsNetworkSearchTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsNetworkSearchTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for NetworkSearch Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "1800",
"package": "com.ohos.networksearch",
"shell-timeout": "1800",
"native-test-timeout":"1800"
},
"kits": [
{
"test-file-name": [
"$module.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.ohos.networksearch",
"vendor": "ohos",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Release"
}
},
"deviceConfig": {},
"module": {
"package": "com.ohos.networksearch",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.ohos.networksearch.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import app from '@system.app'
import device from '@system.device'
import router from '@system.router'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish!')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.timeout = 8000
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "MyApplication"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ 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.
*/
require('./NetworkSearchErrors.test');
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "NetworkSearchTest"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ 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("//build/ohos_var.gni")
group("sim") {
testonly = true
if (is_standard_system) {
deps = [ "sim_manager_function_test:ActsSimManagerFunctionTest" ]
}
}
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsSimManagerFunctionTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsSimManagerFunctionTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Function test of sim manager interface",
"driver": {
"type": "JSUnitTest",
"test-timeout": "540000",
"package": "com.ohos.simmanagertest",
"shell-timeout": "540000",
"native-test-timeout":"540000"
},
"kits": [
{
"test-file-name": [
"$module.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.ohos.simmanagertest",
"vendor": "ohos",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Release"
}
},
"deviceConfig": {},
"module": {
"package": "com.ohos.simmanagertest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.ohos.simmanagertest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate () {
console.info('TestApplication onCreate');
},
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 {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file';
import app from '@system.app';
import device from '@system.device';
import router from '@system.router';
import {Core, ExpectExtend} from 'deccjsunit/index';
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ''
},
onInit () {
this.title = this.$t('strings.world');
},
onShow () {
console.info('onShow finish!');
const core = Core.getInstance();
const expectExtend = new ExpectExtend({
'id': 'extend'
});
core.addService('expect', expectExtend);
core.init();
const configService = core.getDefaultService('config');
configService.timeout = 8000
configService.setConfig(this);
require('../../../test/List.test');
core.execute();
},
onReady () {
},
};
\ No newline at end of file
此差异已折叠。
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册