提交 59604b94 编写于 作者: J jiyong_sd

modified FA-JSF

Signed-off-by: Njiyong_sd <jiyong@huawei.com>
Change-Id: I979a3d5c05102542d15b36c075495e1760b7b03e
上级 2b52be99
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsDNSTest") { ohos_js_hap_suite("ActsDNSTest") {
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
deps = [ deps = [
":hjs_demo_js_assets", ":hjs_demo_js_assets",
":hjs_demo_resources", ":hjs_demo_resources",
...@@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsDNSTest") { ...@@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsDNSTest") {
hap_name = "ActsDNSTest" hap_name = "ActsDNSTest"
} }
ohos_js_assets("hjs_demo_js_assets") { ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default" js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
} }
ohos_resources("hjs_demo_resources") { ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ] sources = [ "./src/main/resources" ]
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
} }
{ {
"description": "Function test of sim manager interface", "description": "Function test of sim manager interface",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "900000", "test-timeout": "900000",
"package": "com.ohos.dns", "bundle-name": "com.ohos.dns",
"shell-timeout": "60000" "package-name": "com.ohos.dns",
}, "shell-timeout": "900000",
"kits": [ "testcase-timeout": "30000"
{ },
"test-file-name": [ "kits": [
"$module.hap" {
], "test-file-name": [
"type": "AppInstallKit", "$module.hap"
"cleanup-apps": true ],
} "type": "AppInstallKit",
] "cleanup-apps": true
} }
]
}
{ {
"app": { "app": {
"bundleName": "com.ohos.dns", "bundleName": "com.ohos.dns",
"vendor": "ohos", "vendor": "ohos",
"version": { "version": {
"code": 1000000, "code": 1000000,
"name": "1.0.0" "name": "1.0.0"
}, },
"apiVersion": { "apiVersion": {
"compatible": 4, "compatible": 4,
"target": 5, "target": 5,
"releaseType": "Release" "releaseType": "Release"
} }
}, },
"deviceConfig": {}, "deviceConfig": {},
"module": { "module": {
"package": "com.ohos.dns", "package": "com.ohos.dns",
"name": ".MyApplication", "name": ".entry",
"deviceType": [ "mainAbility": ".MainAbility",
"phone" "srcPath":"",
], "deviceType": [
"distro": { "phone"
"deliveryWithInstall": true, ],
"moduleName": "entry", "distro": {
"moduleType": "entry" "deliveryWithInstall": true,
}, "moduleName": "entry",
"abilities": [ "moduleType": "entry"
{ },
"visible": true, "abilities": [
"skills": [ {
{ "skills": [
"entities": [ {
"entity.system.home" "entities": [
], "entity.system.home"
"actions": [ ],
"action.system.home" "actions": [
] "action.system.home"
} ]
], }
"name": "com.ohos.dns.MainAbility", ],
"icon": "$media:icon", "orientation": "unspecified",
"description": "$string:mainability_description", "formsEnabled": false,
"label": "$string:app_name", "name": ".MainAbility",
"type": "page", "srcLanguage": "js",
"launchType": "standard" "srcPath": "MainAbility",
} "icon": "$media:icon",
], "description": "$string:MainAbility_desc",
"reqPermissions": [ "label": "$string:MainAbility_label",
{ "type": "page",
"name": "ohos.permission.LOCATION", "visible": true,
"reason": "need use ohos.permission.LOCATION" "launchType": "standard"
}, },
{ {
"name":"ohos.permission.SET_TELEPHONY_STATE", "orientation": "unspecified",
"reason":"need use ohos.permission.SET_TELEPHONY_STATE" "formsEnabled": false,
}, "name": ".TestAbility",
{ "srcLanguage": "js",
"name":"ohos.permission.GET_TELEPHONY_STATE", "srcPath": "TestAbility",
"reason":"need use ohos.permission.GET_TELEPHONY_STATE" "icon": "$media:icon",
}, "description": "$string:TestAbility_desc",
{ "label": "$string:TestAbility_label",
"name":"ohos.permission.PLACE_CALL", "type": "page",
"reason":"need use ohos.permission.PLACE_CALL" "visible": true,
}, "launchType": "standard"
{ }
"name":"ohos.permission.READ_CONTACTS", ],
"reason":"need use ohos.permission.READ_CONTACTS" "reqPermissions": [
}, {
{ "name": "ohos.permission.LOCATION",
"name":"ohos.permission.WRITE_CONTACTS", "reason": "need use ohos.permission.LOCATION"
"reason":"need use ohos.permission.WRITE_CONTACTS" },
}, {
{ "name":"ohos.permission.SET_TELEPHONY_STATE",
"name":"ohos.permission.SEND_MESSAGES", "reason":"need use ohos.permission.SET_TELEPHONY_STATE"
"reason":"need use ohos.permission.SEND_MESSAGES" },
}, {
{ "name":"ohos.permission.GET_TELEPHONY_STATE",
"name":"ohos.permission.RECEIVE_SMS", "reason":"need use ohos.permission.GET_TELEPHONY_STATE"
"reason":"need use ohos.permission.RECEIVE_SMS" },
}, {
{ "name":"ohos.permission.PLACE_CALL",
"name":"ohos.permission.READ_CALL_LOG", "reason":"need use ohos.permission.PLACE_CALL"
"reason":"need use ohos.permission.READ_CALL_LOG" },
}, {
{ "name":"ohos.permission.READ_CONTACTS",
"name":"ohos.permission.GET_NETWORK_INFO", "reason":"need use ohos.permission.READ_CONTACTS"
"reason":"need use ohos.permission.GET_NETWORK_INFO" },
}, {
{ "name":"ohos.permission.WRITE_CONTACTS",
"name":"ohos.permission.INTERNET", "reason":"need use ohos.permission.WRITE_CONTACTS"
"reason":"need use ohos.permission.INTERNET" },
} {
], "name":"ohos.permission.SEND_MESSAGES",
"js": [ "reason":"need use ohos.permission.SEND_MESSAGES"
{ },
"pages": [ {
"pages/index/index" "name":"ohos.permission.RECEIVE_SMS",
], "reason":"need use ohos.permission.RECEIVE_SMS"
"name": "default", },
"window": { {
"designWidth": 720, "name":"ohos.permission.READ_CALL_LOG",
"autoDesignWidth": false "reason":"need use ohos.permission.READ_CALL_LOG"
} },
} {
] "name":"ohos.permission.GET_NETWORK_INFO",
} "reason":"need use ohos.permission.GET_NETWORK_INFO"
},
{
"name":"ohos.permission.INTERNET",
"reason":"need use ohos.permission.INTERNET"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
}
}
} }
\ No newline at end of file
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
export default {
export default { onCreate() {
onCreate () { console.info('TestApplication onCreate')
console.info('TestApplication onCreate');
}, },
onDestroy () { onDestroy() {
console.info('TestApplication onDestroy'); console.info("TestApplication onDestroy");
} }
}; };
\ No newline at end of file
{ {
"strings": { "strings": {
"hello": "Hello", "hello": "Hello",
"world": "World" "world": "World"
}, },
"Files": { "Files": {
} }
} }
\ No newline at end of file
{ {
"strings": { "strings": {
"hello": "您好", "hello": "您好",
"world": "世界" "world": "世界"
}, },
"Files": { "Files": {
} }
} }
\ No newline at end of file
.container { .container {
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.title { .title {
font-size: 100px; font-size: 100px;
} }
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import file from '@system.file'; import file from '@system.file';
import app from '@system.app'; import app from '@system.app';
import device from '@system.device'; import device from '@system.device';
import router from '@system.router'; import router from '@system.router';
import {Core, ExpectExtend} from 'deccjsunit/index'; import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
const injectRef = Object.getPrototypeOf(global) || global import testsuite from '../../../test/List.test'
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
const injectRef = Object.getPrototypeOf(global) || global
export default { injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
data: {
title: '' export default {
}, data: {
onInit () { title: ''
this.title = this.$t('strings.world'); },
}, onInit () {
onShow () { this.title = this.$t('strings.world');
console.info('onShow finish!'); },
const core = Core.getInstance(); onShow () {
const expectExtend = new ExpectExtend({ console.info('onShow finish!');
'id': 'extend' var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
}); var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
core.addService('expect', expectExtend); console.info('start run testcase!!!')
core.init(); Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
const configService = core.getDefaultService('config'); onReady () {
this.timeout = 30000 },
configService.setConfig(this);
require('../../test/List.test');
core.execute();
},
onReady () {
},
}; };
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('TestApplication onCreate');
},
onDestroy() {
console.info('TestApplication onDestroy');
}
};
{ {
"strings": { "strings": {
"hello": "Hello", "hello": "Hello",
"world": "World" "world": "World"
}, },
"Files": { "Files": {
} }
} }
\ No newline at end of file
{ {
"strings": { "strings": {
"hello": "您好", "hello": "您好",
"world": "世界" "world": "世界"
}, },
"Files": { "Files": {
} }
} }
\ No newline at end of file
.container { .container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
left: 0px; left: 0px;
top: 0px; top: 0px;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.title { .title {
font-size: 60px; font-size: 60px;
text-align: center; text-align: center;
width: 100%; width: 100%;
height: 40%; height: 40%;
margin: 10px; margin: 10px;
} }
@media screen and (device-type: phone) and (orientation: landscape) { @media screen and (device-type: phone) and (orientation: landscape) {
.title { .title {
font-size: 60px; font-size: 60px;
} }
} }
@media screen and (device-type: tablet) and (orientation: landscape) { @media screen and (device-type: tablet) and (orientation: landscape) {
.title { .title {
font-size: 100px; font-size: 100px;
} }
} }
\ No newline at end of file
<div class="container"> <div class="container">
<text class="title"> <text class="title">
{{ $t('strings.hello') }} {{ title }} {{ $t('strings.hello') }} {{ title }}
</text> </text>
</div> </div>
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
}
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s itName',
'-s level', '-s testType', '-s size', '-s timeout',
'-s package', '-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
export default {
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare')
},
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility'
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. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import Telephony_NETMANAGER_TestDNSTest from './NetworkManagerDNS.test.js'
require('./NetworkManagerRegister.test.js'); export default function testsuite() {
\ No newline at end of file Telephony_NETMANAGER_TestDNSTest()
}
/** /**
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License") * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import netConnection from '@ohos.net.connection'; import netConnection from '@ohos.net.connection';
import {describe, afterAll, it, expect, beforeAll, afterEach} from 'deccjsunit/index';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
export default function Telephony_NETMANAGER_TestDNSTest() {
describe('Telephony_NETMANAGER_TestDNSTest',function(){
describe('Telephony_NETMANAGER_TestDNSTest',function(){
it('Telephony_NETMANAGER_TestDNS_Test0100', 0, function(done){
it('Telephony_NETMANAGER_TestDNS_Test0100', 0, function(done){
netConnection.getDefaultNet().then(function(netHandle){
netHandle.getAddressesByName("www.baidu.com").then(function(addresses){ netConnection.getDefaultNet().then(function(netHandle){
if(addresses === undefined || addresses.length == 0 ){ netHandle.getAddressesByName("www.baidu.com").then(function(addresses){
console.info('Telephony_NETMANAGER_TestDNS_Test0100 addresses is '+addresses); if(addresses === undefined || addresses.length == 0 ){
expect(false).assertFail(); console.info('Telephony_NETMANAGER_TestDNS_Test0100 addresses is '+addresses);
}else{ expect(false).assertFail();
console.info('Telephony_NETMANAGER_TestDNS_Test0100 is success'); }else{
expect(true).assertTrue(); console.info('Telephony_NETMANAGER_TestDNS_Test0100 is success');
} expect(true).assertTrue();
done(); }
}) done();
}) })
}); })
});
it('Telephony_NETMANAGER_TestDNS_Test0200', 0, function(done){
it('Telephony_NETMANAGER_TestDNS_Test0200', 0, function(done){
netConnection.getDefaultNet().then(function(netHandle){
netHandle.getAddressesByName("www.baidu.com", function(err, addresses){ netConnection.getDefaultNet().then(function(netHandle){
if(addresses === undefined || addresses.length == 0 ){ netHandle.getAddressesByName("www.baidu.com", function(err, addresses){
console.info('Telephony_NETMANAGER_TestDNS_Test0200 addresses is '+addresses); if(addresses === undefined || addresses.length == 0 ){
expect(false).assertFail(); console.info('Telephony_NETMANAGER_TestDNS_Test0200 addresses is '+addresses);
}else{ expect(false).assertFail();
console.info('Telephony_NETMANAGER_TestDNS_Test0200 is success'); }else{
expect(true).assertTrue(); console.info('Telephony_NETMANAGER_TestDNS_Test0200 is success');
} expect(true).assertTrue();
done(); }
}) done();
}) })
}); })
});
it('Telephony_NETMANAGER_TestDNS_Test0300', 0, function(done){
it('Telephony_NETMANAGER_TestDNS_Test0300', 0, function(done){
netConnection.getDefaultNet().then(function(netHandle){
netHandle.getAddressByName("www.baidu.com").then(function(address){ netConnection.getDefaultNet().then(function(netHandle){
if(address === undefined){ netHandle.getAddressByName("www.baidu.com").then(function(address){
console.info('Telephony_NETMANAGER_TestDNS_Test0300 addresses is '+address); if(address === undefined){
expect(false).assertFail(); console.info('Telephony_NETMANAGER_TestDNS_Test0300 addresses is '+address);
}else{ expect(false).assertFail();
console.info('Telephony_NETMANAGER_TestDNS_Test0300 is success'); }else{
expect(true).assertTrue(); console.info('Telephony_NETMANAGER_TestDNS_Test0300 is success');
} expect(true).assertTrue();
done(); }
}) done();
}) })
}); })
});
it('Telephony_NETMANAGER_TestDNS_Test0400', 0, function(done){
it('Telephony_NETMANAGER_TestDNS_Test0400', 0, function(done){
netConnection.getDefaultNet().then(function(netHandle){
netHandle.getAddressByName("www.baidu.com", function(err, address){ netConnection.getDefaultNet().then(function(netHandle){
if(address === undefined ){ netHandle.getAddressByName("www.baidu.com", function(err, address){
console.info('Telephony_NETMANAGER_TestDNS_Test0400 addresses is '+address); if(address === undefined ){
expect(false).assertFail(); console.info('Telephony_NETMANAGER_TestDNS_Test0400 addresses is '+address);
}else{ expect(false).assertFail();
console.info('Telephony_NETMANAGER_TestDNS_Test0400 is success'); }else{
expect(true).assertTrue(); console.info('Telephony_NETMANAGER_TestDNS_Test0400 is success');
} expect(true).assertTrue();
done(); }
}) done();
}) })
}); })
});
it('Telephony_NETMANAGER_TestDNS_Test0500', 0, function(done){
it('Telephony_NETMANAGER_TestDNS_Test0500', 0, function(done){
netConnection.getDefaultNet().then(function(netHandle){
netHandle.getAddressesByName("www.askjdbaksjnhd.com").then(function (data) { netConnection.getDefaultNet().then(function(netHandle){
if(data !== undefined && data.length !== 0){ netHandle.getAddressesByName("www.askjdbaksjnhd.com").then(function (data) {
expect(false).assertTrue(); if(data !== undefined && data.length !== 0){
} expect(false).assertTrue();
done() }
}).catch(function (error) { done()
if(error === undefined){ }).catch(function (error) {
expect(false).assertTrue(); if(error === undefined){
}else{ expect(false).assertTrue();
console.info('Telephony_NETMANAGER_TestDNS_Test0500 error is '+JSON.stringify(error)); }else{
} console.info('Telephony_NETMANAGER_TestDNS_Test0500 error is '+JSON.stringify(error));
done(); }
}) done();
}) })
}); })
});
it('Telephony_NETMANAGER_TestDNS_Test0600', 0, function(done){
it('Telephony_NETMANAGER_TestDNS_Test0600', 0, function(done){
netConnection.getDefaultNet().then(function(netHandle){
netHandle.getAddressesByName("www.askjdbaksjnhd.com", function(err, addresses){ netConnection.getDefaultNet().then(function(netHandle){
if(addresses instanceof Array && addresses.length !== 0 ){ netHandle.getAddressesByName("www.askjdbaksjnhd.com", function(err, addresses){
console.info('Telephony_NETMANAGER_TestDNS_Test0600 addresses is '+addresses); if(addresses instanceof Array && addresses.length !== 0 ){
expect(false).assertFail(); console.info('Telephony_NETMANAGER_TestDNS_Test0600 addresses is '+addresses);
}else{ expect(false).assertFail();
console.info('Telephony_NETMANAGER_TestDNS_Test0600 is success'); }else{
expect(true).assertTrue(); console.info('Telephony_NETMANAGER_TestDNS_Test0600 is success');
} expect(true).assertTrue();
done(); }
}) done();
}) })
}); })
});
it('Telephony_NETMANAGER_TestDNS_Test0700', 0, function(done){
it('Telephony_NETMANAGER_TestDNS_Test0700', 0, function(done){
netConnection.getDefaultNet().then(function(netHandle){
netHandle.getAddressByName("www.askjdbaksjnhd.com").then(function(data) { netConnection.getDefaultNet().then(function(netHandle){
if(data !== undefined && data.length !== 0){ netHandle.getAddressByName("www.askjdbaksjnhd.com").then(function(data) {
expect(false).assertTrue(); if(data !== undefined && data.length !== 0){
} expect(false).assertTrue();
done() }
}).catch(function (error){ done()
if(error !== undefined){ }).catch(function (error){
console.info('Telephony_NETMANAGER_TestDNS_Test0700 error is '+ JSON.stringify(error)); if(error !== undefined){
expect(true).assertTrue(); console.info('Telephony_NETMANAGER_TestDNS_Test0700 error is '+ JSON.stringify(error));
}else{ expect(true).assertTrue();
console.info('Telephony_NETMANAGER_TestDNS_Test0700 is success'); }else{
} console.info('Telephony_NETMANAGER_TestDNS_Test0700 is success');
done(); }
}) done();
}) })
}); })
});
it('Telephony_NETMANAGER_TestDNS_Test0800', 0, function(done){
it('Telephony_NETMANAGER_TestDNS_Test0800', 0, function(done){
netConnection.getDefaultNet().then(function(netHandle){
netHandle.getAddressByName("www.askjdbaksjnhd.com", function(err, address){ netConnection.getDefaultNet().then(function(netHandle){
if(address !== undefined ){ netHandle.getAddressByName("www.askjdbaksjnhd.com", function(err, address){
console.info('Telephony_NETMANAGER_TestDNS_Test0800 address is undefined '+address); if(address !== undefined ){
expect(false).assertFail(); console.info('Telephony_NETMANAGER_TestDNS_Test0800 address is undefined '+address);
}else{ expect(false).assertFail();
console.info('Telephony_NETMANAGER_TestDNS_Test0800 is success'); }else{
expect(true).assertTrue(); console.info('Telephony_NETMANAGER_TestDNS_Test0800 is success');
} expect(true).assertTrue();
done(); }
}) done();
}) })
}); })
});
});
\ No newline at end of file });
}
\ No newline at end of file
{ {
"string": [ "string": [
{ {
"name": "app_name", "name": "app_name",
"value": "Sim Test" "value": "Sim Test"
}, },
{ {
"name": "mainability_description", "name": "mainability_description",
"value": "Sim Test - sim manager interface test" "value": "Sim Test - sim manager interface test"
} },
] {
"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
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsNetworkNopermissionTest") { ohos_js_hap_suite("ActsNetworkNopermissionTest") {
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
deps = [ deps = [
":hjs_demo_js_assets", ":hjs_demo_js_assets",
":hjs_demo_resources", ":hjs_demo_resources",
...@@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsNetworkNopermissionTest") { ...@@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsNetworkNopermissionTest") {
hap_name = "ActsNetworkNopermissionTest" hap_name = "ActsNetworkNopermissionTest"
} }
ohos_js_assets("hjs_demo_js_assets") { ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default" js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
} }
ohos_resources("hjs_demo_resources") { ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ] sources = [ "./src/main/resources" ]
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
} }
{ {
"description": "Function test of sim manager interface", "description": "Function test of sim manager interface",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "900000", "test-timeout": "900000",
"package": "com.ohos.network_nopermission", "bundle-name": "com.ohos.network_nopermission",
"shell-timeout": "60000" "package-name": "com.ohos.network_nopermission",
}, "shell-timeout": "900000",
"kits": [ "testcase-timeout": "30000"
{ },
"test-file-name": [ "kits": [
"$module.hap" {
], "test-file-name": [
"type": "AppInstallKit", "$module.hap"
"cleanup-apps": true ],
} "type": "AppInstallKit",
] "cleanup-apps": true
} }
]
}
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
{ {
"app": { "app": {
"vendor": "ohos", "vendor": "ohos",
"bundleName": "com.ohos.network_nopermission", "bundleName": "com.ohos.network_nopermission",
"version": { "version": {
"code": 1000000, "code": 1000000,
"name": "1.0.0" "name": "1.0.0"
}, },
"apiVersion": { "apiVersion": {
"compatible": 4, "compatible": 4,
"target": 5, "target": 5,
"releaseType": "Release" "releaseType": "Release"
} }
}, },
"deviceConfig": {}, "deviceConfig": {},
"module": { "module": {
"mainAbility": ".MainAbility", "mainAbility": ".MainAbility",
"deviceType": [ "deviceType": [
"phone" "phone"
], ],
"abilities": [ "abilities": [
{ {
"skills": [ "skills": [
{ {
"entities": [ "entities": [
"entity.system.home" "entity.system.home"
], ],
"actions": [ "actions": [
"action.system.home" "action.system.home"
] ]
} }
], ],
"visible": true, "orientation": "unspecified",
"name": "com.ohos.network_nopermission.MainAbility", "formsEnabled": false,
"icon": "$media:icon", "name": ".MainAbility",
"description": "$string:MainAbility_desc", "srcLanguage": "js",
"label": "$string:MainAbility_label", "srcPath": "MainAbility",
"type": "page", "icon": "$media:icon",
"launchType": "standard" "description": "$string:MainAbility_desc",
} "label": "$string:MainAbility_label",
], "type": "page",
"distro": { "visible": true,
"moduleType": "entry", "launchType": "standard"
"deliveryWithInstall": true, },
"moduleName": "entry" {
}, "orientation": "unspecified",
"package": "com.ohos.network_nopermission", "formsEnabled": false,
"srcPath": "", "name": ".TestAbility",
"name": ".MyApplication", "srcLanguage": "js",
"js": [ "srcPath": "TestAbility",
{ "icon": "$media:icon",
"pages": [ "description": "$string:TestAbility_desc",
"pages/index/index" "label": "$string:TestAbility_label",
], "type": "page",
"name": "default", "visible": true,
"window": { "launchType": "standard"
"designWidth": 720, }
"autoDesignWidth": false ],
} "distro": {
} "moduleType": "entry",
] "deliveryWithInstall": true,
} "moduleName": "entry"
},
"package": "com.ohos.network_nopermission",
"name": ".entry",
"srcPath":"",
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
}
}
} }
\ No newline at end of file
/* /*
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
export default { export default {
onCreate() { onCreate() {
console.info("Application onCreate"); console.info("Application onCreate");
}, },
onDestroy() { onDestroy() {
console.info("Application onDestroy"); console.info("Application onDestroy");
} }
}; };
{ {
"strings": { "strings": {
"hello": "Hello", "hello": "Hello",
"world": "World" "world": "World"
}, },
"Files": { "Files": {
} }
} }
\ No newline at end of file
{ {
"strings": { "strings": {
"hello": "您好", "hello": "您好",
"world": "世界" "world": "世界"
}, },
"Files": { "Files": {
} }
} }
\ No newline at end of file
.container { .container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
left: 0px; left: 0px;
top: 0px; top: 0px;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.title { .title {
font-size: 60px; font-size: 60px;
text-align: center; text-align: center;
width: 100%; width: 100%;
height: 40%; height: 40%;
margin: 10px; margin: 10px;
} }
@media screen and (device-type: phone) and (orientation: landscape) { @media screen and (device-type: phone) and (orientation: landscape) {
.title { .title {
font-size: 60px; font-size: 60px;
} }
} }
@media screen and (device-type: tablet) and (orientation: landscape) { @media screen and (device-type: tablet) and (orientation: landscape) {
.title { .title {
font-size: 100px; font-size: 100px;
} }
} }
\ No newline at end of file
<div class="container"> <div class="container">
<text class="title"> <text class="title">
{{ $t('strings.hello') }} {{ title }} {{ $t('strings.hello') }} {{ title }}
</text> </text>
</div> </div>
/* /*
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import file from '@system.file'; import file from '@system.file';
import app from '@system.app'; import app from '@system.app';
import device from '@system.device'; import device from '@system.device';
import router from '@system.router'; import router from '@system.router';
import {Core, ExpectExtend} from 'deccjsunit/index'; import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
const injectRef = Object.getPrototypeOf(global) || global import testsuite from '../../../test/List.test'
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
const injectRef = Object.getPrototypeOf(global) || global
export default { injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
data: {
title: '' export default {
}, data: {
onInit () { title: ''
this.title = this.$t('strings.world'); },
}, onInit () {
onShow () { this.title = this.$t('strings.world');
console.info('onShow finish!'); },
const core = Core.getInstance(); onShow () {
const expectExtend = new ExpectExtend({ console.info('onShow finish!');
'id': 'extend' var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
}); var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
core.addService('expect', expectExtend); console.info('start run testcase!!!')
core.init(); Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
const configService = core.getDefaultService('config'); onReady () {
this.timeout = 30000 },
configService.setConfig(this);
require('../../../test/List.test');
core.execute();
},
onReady () {
},
}; };
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('TestApplication onCreate');
},
onDestroy() {
console.info('TestApplication onDestroy');
}
};
{ {
"strings": { "strings": {
"hello": "Hello", "hello": "Hello",
"world": "World" "world": "World"
}, },
"Files": { "Files": {
} }
} }
\ No newline at end of file
{ {
"strings": { "strings": {
"hello": "您好", "hello": "您好",
"world": "世界" "world": "世界"
}, },
"Files": { "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) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
}
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s itName',
'-s level', '-s testType', '-s size', '-s timeout',
'-s package', '-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
export default {
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare')
},
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility'
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. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License") * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import network from '@system.network'; import network from '@system.network';
import {describe, afterAll, it, expect, beforeAll, afterEach} from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
export default function Telephony_NetManager_NetWorkTest() {
describe("Telephony_NetManager_NetWorkTest", function () {
describe("Telephony_NetManager_NetWorkTest", function () {
/**
* @tc.number Telephony_NetManager_NetWorkTest_GetType_NoPermission_0100 /**
* @tc.name Whether GetType method is called successfully without permission * @tc.number Telephony_NetManager_NetWorkTest_GetType_NoPermission_0100
* @tc.desc Function test * @tc.name Whether GetType method is called successfully without permission
*/ * @tc.desc Function test
it("Telephony_NetManager_NetWorkTest_GetType_NoPermission_0100", 0, function (done) { */
network.getType({ it("Telephony_NetManager_NetWorkTest_GetType_NoPermission_0100", 0, function (done) {
success : function(data){ network.getType({
expect().assertFail() success : function(data){
done(); expect().assertFail()
}, done();
fail : function(data,code){ },
console.info("NetManager code "+ code) fail : function(data,code){
expect(code === 602).assertTrue() console.info("NetManager code "+ code)
done(); expect(code === 602).assertTrue()
}, done();
complete : function(){ },
expect().assertTrue() complete : function(){
done(); expect().assertTrue()
} done();
}) }
done(); })
}); done();
});
/**
* @tc.number Telephony_NetManager_NetWorkTest_GetType_NoPermission_0200 /**
* @tc.name Whether to call GetType method again without permission * @tc.number Telephony_NetManager_NetWorkTest_GetType_NoPermission_0200
* @tc.desc Function test * @tc.name Whether to call GetType method again without permission
*/ * @tc.desc Function test
it("Telephony_NetManager_NetWorkTest_GetType_NoPermission_0200", 0, function (done) { */
network.getType({ it("Telephony_NetManager_NetWorkTest_GetType_NoPermission_0200", 0, function (done) {
success : function(data){ network.getType({
expect().assertFail() success : function(data){
done(); expect().assertFail()
}, done();
fail : function(data,code){ },
console.info("NetManager code "+ code) fail : function(data,code){
expect(code === 602).assertTrue() console.info("NetManager code "+ code)
done(); expect(code === 602).assertTrue()
}, done();
complete : function(){ },
expect().assertTrue() complete : function(){
done(); expect().assertTrue()
} done();
}) }
done(); })
}); done();
});
/**
* @tc.number Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0100 /**
* @tc.name Whether the subscribe method is called successfully without permission * @tc.number Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0100
* @tc.desc Function test * @tc.name Whether the subscribe method is called successfully without permission
*/ * @tc.desc Function test
it("Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0100", 0, function (done) { */
network.subscribe({ it("Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0100", 0, function (done) {
success : function(data){ network.subscribe({
expect().assertFail() success : function(data){
done(); expect().assertFail()
}, done();
fail : function(data,code){ },
console.info("NetManager code "+ code) fail : function(data,code){
expect(code === 602).assertTrue() console.info("NetManager code "+ code)
done(); expect(code === 602).assertTrue()
} done();
}) }
done(); })
}) done();
})
/**
* @tc.number Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0200 /**
* @tc.name Whether to call the subscribe method again without permission * @tc.number Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0200
* @tc.desc Function test * @tc.name Whether to call the subscribe method again without permission
*/ * @tc.desc Function test
it("Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0200", 0, function (done) { */
network.subscribe({ it("Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0200", 0, function (done) {
success : function(data){ network.subscribe({
expect().assertFail() success : function(data){
done(); expect().assertFail()
}, done();
fail : function(data,code){ },
console.info("NetManager code "+ code) fail : function(data,code){
expect(code === 602).assertTrue() console.info("NetManager code "+ code)
done(); expect(code === 602).assertTrue()
} done();
}) }
done(); })
}) done();
})
});
});
}
/** /**
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import Telephony_NetManager_NetWorkTest from './Http.nopermission.test.js'
require('./Http.fetch.test.js'); export default function testsuite() {
\ No newline at end of file Telephony_NetManager_NetWorkTest()
}
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"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
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsRegisterTest") { ohos_js_hap_suite("ActsRegisterTest") {
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
deps = [ deps = [
":hjs_demo_js_assets", ":hjs_demo_js_assets",
":hjs_demo_resources", ":hjs_demo_resources",
...@@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsRegisterTest") { ...@@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsRegisterTest") {
hap_name = "ActsRegisterTest" hap_name = "ActsRegisterTest"
} }
ohos_js_assets("hjs_demo_js_assets") { ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default" js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
} }
ohos_resources("hjs_demo_resources") { ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ] sources = [ "./src/main/resources" ]
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
} }
{ {
"description": "Function test of sim manager interface", "description": "Function test of sim manager interface",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "1800000", "test-timeout": "1800000",
"package": "com.ohos.register", "bundle-name": "com.ohos.register",
"shell-timeout": "60000" "package-name": "com.ohos.register",
}, "shell-timeout": "1800000",
"kits": [ "testcase-timeout": "30000"
{ },
"test-file-name": [ "kits": [
"$module.hap" {
], "test-file-name": [
"type": "AppInstallKit", "$module.hap"
"cleanup-apps": true ],
} "type": "AppInstallKit",
] "cleanup-apps": true
} }
]
}
{
"string": [
{
"name": "app_name",
"value": "Sim Test"
},
{
"name": "mainability_description",
"value": "Sim Test - sim manager interface test"
}
]
}
\ 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.
*/
require('./NetworkManagerRegister.test.js');
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "Sim Test"
},
{
"name": "mainability_description",
"value": "Sim Test - sim manager interface test"
}
]
}
\ No newline at end of file
{ {
"app": { "app": {
"bundleName": "com.ohos.register", "bundleName": "com.ohos.register",
"vendor": "ohos", "vendor": "ohos",
"version": { "version": {
"code": 1000000, "code": 1000000,
"name": "1.0.0" "name": "1.0.0"
}, },
"apiVersion": { "apiVersion": {
"compatible": 4, "compatible": 4,
"target": 5, "target": 5,
"releaseType": "Release" "releaseType": "Release"
} }
}, },
"deviceConfig": {}, "deviceConfig": {},
"module": { "module": {
"package": "com.ohos.register", "package": "com.ohos.register",
"name": ".MyApplication", "name": ".entry",
"deviceType": [ "mainAbility": ".MainAbility",
"phone" "srcPath":"",
], "deviceType": [
"distro": { "phone"
"deliveryWithInstall": true, ],
"moduleName": "entry", "distro": {
"moduleType": "entry" "deliveryWithInstall": true,
}, "moduleName": "entry",
"abilities": [ "moduleType": "entry"
{ },
"visible": true, "abilities": [
"skills": [ {
{ "visible": true,
"entities": [ "skills": [
"entity.system.home" {
], "entities": [
"actions": [ "entity.system.home"
"action.system.home" ],
] "actions": [
} "action.system.home"
], ]
"name": "com.ohos.register.MainAbility", }
"icon": "$media:icon", ],
"description": "$string:mainability_description", "orientation": "unspecified",
"label": "$string:app_name", "formsEnabled": false,
"type": "page", "name": ".MainAbility",
"launchType": "standard" "srcLanguage": "js",
} "srcPath": "MainAbility",
], "icon": "$media:icon",
"reqPermissions": [ "description": "$string:MainAbility_desc",
{ "label": "$string:MainAbility_label",
"name": "ohos.permission.LOCATION", "type": "page",
"reason": "need use ohos.permission.LOCATION" "launchType": "standard"
}, },
{ {
"name":"ohos.permission.SET_TELEPHONY_STATE", "orientation": "unspecified",
"reason":"need use ohos.permission.SET_TELEPHONY_STATE" "formsEnabled": false,
}, "name": ".TestAbility",
{ "srcLanguage": "js",
"name":"ohos.permission.GET_TELEPHONY_STATE", "srcPath": "TestAbility",
"reason":"need use ohos.permission.GET_TELEPHONY_STATE" "icon": "$media:icon",
}, "description": "$string:TestAbility_desc",
{ "label": "$string:TestAbility_label",
"name":"ohos.permission.PLACE_CALL", "type": "page",
"reason":"need use ohos.permission.PLACE_CALL" "visible": true,
}, "launchType": "standard"
{ }
"name":"ohos.permission.READ_CONTACTS", ],
"reason":"need use ohos.permission.READ_CONTACTS" "reqPermissions": [
}, {
{ "name": "ohos.permission.LOCATION",
"name":"ohos.permission.WRITE_CONTACTS", "reason": "need use ohos.permission.LOCATION"
"reason":"need use ohos.permission.WRITE_CONTACTS" },
}, {
{ "name":"ohos.permission.SET_TELEPHONY_STATE",
"name":"ohos.permission.SEND_MESSAGES", "reason":"need use ohos.permission.SET_TELEPHONY_STATE"
"reason":"need use ohos.permission.SEND_MESSAGES" },
}, {
{ "name":"ohos.permission.GET_TELEPHONY_STATE",
"name":"ohos.permission.RECEIVE_SMS", "reason":"need use ohos.permission.GET_TELEPHONY_STATE"
"reason":"need use ohos.permission.RECEIVE_SMS" },
}, {
{ "name":"ohos.permission.PLACE_CALL",
"name":"ohos.permission.READ_CALL_LOG", "reason":"need use ohos.permission.PLACE_CALL"
"reason":"need use ohos.permission.READ_CALL_LOG" },
}, {
{ "name":"ohos.permission.READ_CONTACTS",
"name":"ohos.permission.GET_NETWORK_INFO", "reason":"need use ohos.permission.READ_CONTACTS"
"reason":"need use ohos.permission.GET_NETWORK_INFO" },
}, {
{ "name":"ohos.permission.WRITE_CONTACTS",
"name":"ohos.permission.INTERNET", "reason":"need use ohos.permission.WRITE_CONTACTS"
"reason":"need use ohos.permission.INTERNET" },
} {
], "name":"ohos.permission.SEND_MESSAGES",
"js": [ "reason":"need use ohos.permission.SEND_MESSAGES"
{ },
"pages": [ {
"pages/index/index" "name":"ohos.permission.RECEIVE_SMS",
], "reason":"need use ohos.permission.RECEIVE_SMS"
"name": "default", },
"window": { {
"designWidth": 720, "name":"ohos.permission.READ_CALL_LOG",
"autoDesignWidth": false "reason":"need use ohos.permission.READ_CALL_LOG"
} },
} {
] "name":"ohos.permission.GET_NETWORK_INFO",
} "reason":"need use ohos.permission.GET_NETWORK_INFO"
},
{
"name":"ohos.permission.INTERNET",
"reason":"need use ohos.permission.INTERNET"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
}
}
} }
\ No newline at end of file
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
export default { export default {
onCreate () { onCreate () {
console.info('TestApplication onCreate'); console.info('TestApplication onCreate');
}, },
onDestroy () { onDestroy () {
console.info('TestApplication onDestroy'); console.info('TestApplication onDestroy');
} }
}; };
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册