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

!3376 add netnamager_base test suite

Merge pull request !3376 from 高曦/OpenHarmony-3.1-Release
......@@ -16,7 +16,13 @@ group("telephonyjstest") {
deps = [
"call_manager:call_manager",
"cellular_data:cellular_data",
"netmanager_base:netmanager_base",
"netmanager_http:ActsNetManagerHttpEtsTest",
#"contact_function:ActsContactFunctionEtsTest",
#"contact_function_merge:ActsContactFunctionMergeEtsTest",
#"contact_performance:ActsContactPerformanceEtsTest",
#"contact_stability:ActsContactStabilityEtsTest",
"netmanager_socket:ActsNetManagerSocketEtsTest",
"network_search:network_search",
"observer:ActsObserverEtsTest",
......
# 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("netmanager_base") {
testonly = true
if (is_standard_system) {
deps = [
"dns:ActsDNSTest",
"jshttp:ActsJSHTTPTest",
"register:ActsRegisterTest",
"socket:ActsSocketTest",
]
}
}
# 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("ActsDNSTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsDNSTest"
}
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": "1800000",
"package": "com.ohos.dns",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"$module.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.ohos.dns",
"vendor": "ohos",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Release"
}
},
"deviceConfig": {},
"module": {
"package": "com.ohos.dns",
"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.dns.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"reqPermissions": [
{
"name": "ohos.permission.LOCATION",
"reason": "need use ohos.permission.LOCATION"
},
{
"name":"ohos.permission.SET_TELEPHONY_STATE",
"reason":"need use ohos.permission.SET_TELEPHONY_STATE"
},
{
"name":"ohos.permission.GET_TELEPHONY_STATE",
"reason":"need use ohos.permission.GET_TELEPHONY_STATE"
},
{
"name":"ohos.permission.PLACE_CALL",
"reason":"need use ohos.permission.PLACE_CALL"
},
{
"name":"ohos.permission.READ_CONTACTS",
"reason":"need use ohos.permission.READ_CONTACTS"
},
{
"name":"ohos.permission.WRITE_CONTACTS",
"reason":"need use ohos.permission.WRITE_CONTACTS"
},
{
"name":"ohos.permission.SEND_MESSAGES",
"reason":"need use ohos.permission.SEND_MESSAGES"
},
{
"name":"ohos.permission.RECEIVE_SMS",
"reason":"need use ohos.permission.RECEIVE_SMS"
},
{
"name":"ohos.permission.READ_CALL_LOG",
"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
}
}
]
}
}
\ 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">
SIM TEST
</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');
this.timeout = 30000
configService.setConfig(this);
require('../../../test/List.test');
core.execute();
},
onReady () {
},
};
\ 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
/**
* 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('./NetworkManagerDNS.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.
*/
import netConnection from '@ohos.net.connection';
import {describe, afterAll, it, expect, beforeAll, afterEach} from 'deccjsunit/index';
describe('Telephony_NETMANAGER_TestDNSTest',function(){
it('Telephony_NETMANAGER_TestDNS_Test0100', 0, function(done){
netConnection.getDefaultNet().then(function(netHandle){
netHandle.getAddressesByName("www.zhihu.com").then(function(addresses){
if(addresses === undefined || addresses.length == 0 ){
console.log('Telephony_NETMANAGER_TestDNS_Test0100 addresses id undefined '+addresses);
expect(false).assertFail();
}else{
console.log('Telephony_NETMANAGER_TestDNS_Test0100 is success');
expect(true).assertTrue();
}
done();
})
})
});
it('Telephony_NETMANAGER_TestDNS_Test0200', 0, function(done){
netConnection.getDefaultNet().then(function(netHandle){
netHandle.getAddressesByName("www.zhihu.com", function(err, addresses){
if(addresses === undefined || addresses.length == 0 ){
console.log('Telephony_NETMANAGER_TestDNS_Test0200 addresses id undefined '+addresses);
expect(false).assertFail();
}else{
console.log('Telephony_NETMANAGER_TestDNS_Test0200 is success');
expect(true).assertTrue();
}
done();
})
})
});
it('Telephony_NETMANAGER_TestDNS_Test0300', 0, function(done){
netConnection.getDefaultNet().then(function(netHandle){
netHandle.getAddressByName("www.zhihu.com").then(function(address){
if(address === undefined){
console.log('Telephony_NETMANAGER_TestDNS_Test0300 addresses id undefined '+address);
expect(false).assertFail();
}else{
console.log('Telephony_NETMANAGER_TestDNS_Test0300 is success');
expect(true).assertTrue();
}
done();
})
})
});
it('Telephony_NETMANAGER_TestDNS_Test0400', 0, function(done){
netConnection.getDefaultNet().then(function(netHandle){
netHandle.getAddressByName("www.baidu.com", function(err, address){
if(address === undefined ){
console.log('Telephony_NETMANAGER_TestDNS_Test0400 addresses id undefined '+address);
expect(false).assertFail();
}else{
console.log('Telephony_NETMANAGER_TestDNS_Test0400 is success');
expect(true).assertTrue();
}
done();
})
})
});
it('Telephony_NETMANAGER_TestDNS_Test0500', 0, function(done){
netConnection.getDefaultNet().then(function(netHandle){
netHandle.getAddressesByName("www.askjdbaksjnhd.com").catch(function(error){
if(error === undefined){
expect(false).assertTrue();
}else{
expect(true).assertTrue()
}
done();
})
})
});
it('Telephony_NETMANAGER_TestDNS_Test0600', 0, function(done){
netConnection.getDefaultNet().then(function(netHandle){
netHandle.getAddressesByName("www.askjdbaksjnhd.com", function(err, addresses){
if(addresses instanceof Array && addresses.length !== 0 ){
console.log('Telephony_NETMANAGER_TestDNS_Test0600 addresses id undefined '+addresses);
expect(false).assertFail();
}else{
console.log('Telephony_NETMANAGER_TestDNS_Test0600 is success');
expect(true).assertTrue();
}
done();
})
})
});
it('Telephony_NETMANAGER_TestDNS_Test0700', 0, function(done){
netConnection.getDefaultNet().then(function(netHandle){
netHandle.getAddressesByName("www.askjdbaksjnhd.com").catch(function(error){
if(error === undefined){
expect(false).assertTrue();
}else{
expect(true).assertTrue()
}
done();
})
})
});
it('Telephony_NETMANAGER_TestDNS_Test0800', 0, function(done){
netConnection.getDefaultNet().then(function(netHandle){
netHandle.getAddressesByName("www.askjdbaksjnhd.com", function(err, address){
if(address !== undefined ){
console.log('Telephony_NETMANAGER_TestDNS_Test0800 addresses id undefined '+address);
expect(false).assertFail();
}else{
console.log('Telephony_NETMANAGER_TestDNS_Test0800 is success');
expect(true).assertTrue();
}
done();
})
})
});
});
\ 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
# 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("ActsJSHTTPTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsJSHTTPTest"
}
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": "1800000",
"package": "com.ohos.jshttp",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"$module.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.ohos.jshttp",
"vendor": "ohos",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Release"
}
},
"deviceConfig": {},
"module": {
"package": "com.ohos.jshttp",
"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.jshttp.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"reqPermissions": [
{
"name": "ohos.permission.LOCATION",
"reason": "need use ohos.permission.LOCATION"
},
{
"name":"ohos.permission.SET_TELEPHONY_STATE",
"reason":"need use ohos.permission.SET_TELEPHONY_STATE"
},
{
"name":"ohos.permission.GET_TELEPHONY_STATE",
"reason":"need use ohos.permission.GET_TELEPHONY_STATE"
},
{
"name":"ohos.permission.PLACE_CALL",
"reason":"need use ohos.permission.PLACE_CALL"
},
{
"name":"ohos.permission.READ_CONTACTS",
"reason":"need use ohos.permission.READ_CONTACTS"
},
{
"name":"ohos.permission.WRITE_CONTACTS",
"reason":"need use ohos.permission.WRITE_CONTACTS"
},
{
"name":"ohos.permission.SEND_MESSAGES",
"reason":"need use ohos.permission.SEND_MESSAGES"
},
{
"name":"ohos.permission.RECEIVE_SMS",
"reason":"need use ohos.permission.RECEIVE_SMS"
},
{
"name":"ohos.permission.READ_CALL_LOG",
"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
}
}
]
}
}
\ 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">
SIM TEST
</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');
this.timeout = 30000
configService.setConfig(this);
require('../../../test/List.test');
core.execute();
},
onReady () {
},
};
\ 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
/**
* 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('./NetworkManagerHttp.test');
/**
* 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 netHttp from '@ohos.net.http';
import {describe, afterAll, it, expect, beforeAll, afterEach} from 'deccjsunit/index';
describe('Telephony_NETSTACK_HTTPTest',function(){
/**
* @tc.number Telephony_NETSTACK_HttpTestBasicGet_0100
* @tc.name 基本场景,测试能否GET一个网址
* @tc.desc Function test`
*/
it('Telephony_NETSTACK_HttpTestBasicGet_0100', 0, function(done){
let http = netHttp.createHttp()
http.request("https://httpbin.org/anything").then(function(data){
expect(data.responseCode === netHttp.ResponseCode.OK).assertTrue();
done();
})
});
/**
* @tc.number Telephony_NETSTACK_HttpTestUserAgent_0100
* @tc.name 返回用户代理
* @tc.desc Function test`
*/
it('Telephony_NETSTACK_HttpTestUserAgent_0100', 0, function(done){
let http = netHttp.createHttp()
http.request("https://httpbin.org/user-agent").then(function(data){
expect(data.responseCode === netHttp.ResponseCode.OK).assertTrue();
expect(JSON.parse(data.result)["user-agent"] === "libcurl-agent/1.0").assertTrue();
done();
})
});
/**
* @tc.number Telephony_NETSTACK_HttpTestHeader_0100
* @tc.name 返回Header
* @tc.desc Function test`
*/
it('Telephony_NETSTACK_HttpTestHeader_0100', 0, function(done){
let http = netHttp.createHttp();
http.request("https://httpbin.org/headers").then(function(data){
expect(data.responseCode === netHttp.ResponseCode.OK).assertTrue()
console.info("NETSTACK ####" + JSON.stringify(JSON.parse(data.result)))
expect(JSON.parse(data.result)["headers"]["Content-Type"] === "application/json").assertTrue()
done()
})
});
/**
* @tc.number Telephony_NETSTACK_HttpTestPost
* @tc.name 返回post内容
* @tc.desc Function test`
*/
it('Telephony_NETSTACK_HttpTestPost_0100', 0, function(done){
let http = netHttp.createHttp()
http.request("https://httpbin.org/post" ,{
method : netHttp.RequestMethod.POST,
extraData : "MineMine"
}).then(function(data){
expect(data.responseCode === netHttp.ResponseCode.OK).assertTrue()
expect(JSON.parse(data.result)["data"] === "MineMine").assertTrue()
done();
})
});
/**
* @tc.number Telephony_NETSTACK_HttpTestPUT
* @tc.name 返回put内容
* @tc.desc Function test`
*/
it('Telephony_NETSTACK_HttpTestPut_0100', 0, function(done){
let http = netHttp.createHttp()
http.request("https://httpbin.org/put" ,{
method : netHttp.RequestMethod.PUT,
extraData : "MineMine"
}).then(function(data){
expect(data.responseCode === netHttp.ResponseCode.OK).assertTrue()
expect(JSON.parse(data.result)["data"] === "MineMine").assertTrue()
done();
})
});
/**
* @tc.number Telephony_NETSTACK_HttpTestCookies
* @tc.name 返回Cookies内容
* @tc.desc Function test`
*/
it('Telephony_NETSTACK_HttpTestCookies_0100', 0, function(done){
let http = netHttp.createHttp()
http.request("https://httpbin.org/cookies/set/name/value").then(function(data){
expect(data.responseCode === netHttp.ResponseCode.OK).assertTrue()
expect(data.cookies !== "").assertTrue()
done();
})
});
/**
* @tc.number Telephony_NETSTACK_HttpTestEncode
* @tc.name 返回Cookies内容
* @tc.desc Function test`
*/
it('Telephony_NETSTACK_HttpTestEncode_0100', 0, function(done){
let http = netHttp.createHttp()
http.request("https://httpbin.org/response-headers?key1=val1&key2=val2",{
extraData : {
"name1" : "mine1",
"name2" : "mine2",
}
}).then(function(data){
expect(data.responseCode === netHttp.ResponseCode.OK).assertTrue()
expect(JSON.parse(data.result)["key1"] === "val1").assertTrue()
expect(JSON.parse(data.result)["key2"] === "val2").assertTrue()
expect(JSON.parse(data.result)["name1"] === "mine1").assertTrue()
expect(JSON.parse(data.result)["name2"] === "mine2").assertTrue()
done();
})
});
});
{
"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) 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("ActsRegisterTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsRegisterTest"
}
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": "1800000",
"package": "com.ohos.register",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"$module.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.ohos.register",
"vendor": "ohos",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Release"
}
},
"deviceConfig": {},
"module": {
"package": "com.ohos.register",
"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.register.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"reqPermissions": [
{
"name": "ohos.permission.LOCATION",
"reason": "need use ohos.permission.LOCATION"
},
{
"name":"ohos.permission.SET_TELEPHONY_STATE",
"reason":"need use ohos.permission.SET_TELEPHONY_STATE"
},
{
"name":"ohos.permission.GET_TELEPHONY_STATE",
"reason":"need use ohos.permission.GET_TELEPHONY_STATE"
},
{
"name":"ohos.permission.PLACE_CALL",
"reason":"need use ohos.permission.PLACE_CALL"
},
{
"name":"ohos.permission.READ_CONTACTS",
"reason":"need use ohos.permission.READ_CONTACTS"
},
{
"name":"ohos.permission.WRITE_CONTACTS",
"reason":"need use ohos.permission.WRITE_CONTACTS"
},
{
"name":"ohos.permission.SEND_MESSAGES",
"reason":"need use ohos.permission.SEND_MESSAGES"
},
{
"name":"ohos.permission.RECEIVE_SMS",
"reason":"need use ohos.permission.RECEIVE_SMS"
},
{
"name":"ohos.permission.READ_CALL_LOG",
"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
}
}
]
}
}
\ 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');
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.
*/
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
/**
* 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
# 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("ActsSocketTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsSocketTest"
}
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": "1800000",
"package": "com.ohos.socket",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"$module.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.ohos.socket",
"vendor": "ohos",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Release"
}
},
"deviceConfig": {},
"module": {
"package": "com.ohos.socket",
"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.socket.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"reqPermissions": [
{
"name": "ohos.permission.LOCATION",
"reason": "need use ohos.permission.LOCATION"
},
{
"name":"ohos.permission.SET_TELEPHONY_STATE",
"reason":"need use ohos.permission.SET_TELEPHONY_STATE"
},
{
"name":"ohos.permission.GET_TELEPHONY_STATE",
"reason":"need use ohos.permission.GET_TELEPHONY_STATE"
},
{
"name":"ohos.permission.PLACE_CALL",
"reason":"need use ohos.permission.PLACE_CALL"
},
{
"name":"ohos.permission.READ_CONTACTS",
"reason":"need use ohos.permission.READ_CONTACTS"
},
{
"name":"ohos.permission.WRITE_CONTACTS",
"reason":"need use ohos.permission.WRITE_CONTACTS"
},
{
"name":"ohos.permission.SEND_MESSAGES",
"reason":"need use ohos.permission.SEND_MESSAGES"
},
{
"name":"ohos.permission.RECEIVE_SMS",
"reason":"need use ohos.permission.RECEIVE_SMS"
},
{
"name":"ohos.permission.READ_CALL_LOG",
"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
}
}
]
}
}
\ 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">
SIM TEST
</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');
this.timeout = 30000
configService.setConfig(this);
require('../../../test/List.test');
core.execute();
},
onReady () {
},
};
\ 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
/**
* 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('./NetStackSocket.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.
*/
import netSocket from '@ohos.net.socket';
import {describe, afterAll, it, expect, beforeAll, afterEach} from 'deccjsunit/index';
describe('Telephony_NETSTACK_SocketTest',function(){
/**
* @tc.number Telephony_NetStack_UDPTest0100
* @tc.name UDP bind,callback方式,预计无异常,错误码为undefined
* @tc.desc Function test`
*/
it('Telephony_NetStack_UDPTest0100', 0, function(done){
let udp = netSocket.constructUDPSocketInstance()
udp.bind({
address : "127.0.0.1",
family : 1,
port : 0
},function(err,data){
expect(err === undefined).assertTure()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_UDPTest0200
* @tc.name UDP bind,promise方式,预计无异常,错误码为undefined
* @tc.desc Function test`
*/
it('Telephony_NetStack_UDPTest0200', 0, function(done){
let udp = netSocket.constructUDPSocketInstance()
udp.bind({
address : "127.0.0.1",
family : 1,
port : 0
}).then(function(data){
expect(data === undefined).assertTure()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_UDPTest0300
* @tc.name UDP send,callback方式,预计无异常,错误码为undefined
* @tc.desc Function test`
*/
it('Telephony_NetStack_UDPTest0300', 0, function(done){
let udp = netSocket.constructUDPSocketInstance()
udp.send({
address: {
address : "127.0.0.1",
family : 1,
port : 0
},
data : "Hello"
},function(err,data){
expect(err !== undefined).assertTure()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_UDPTest0400
* @tc.name UDP send,promise方式,预计无异常,错误码为undefined
* @tc.desc Function test`
*/
it('Telephony_NetStack_UDPTest0400', 0, function(done){
let udp = netSocket.constructUDPSocketInstance()
udp.send({
address:{
address : "127.0.0.1",
family : 1,
port : 0
},
data : "Hello"
}).then(function(data){
expect(data !== undefined).assertTure()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_UDPTest0500
* @tc.name UDP close,callback方式,预计无异常,错误码为undefined
* @tc.desc Function test`
*/
it('Telephony_NetStack_UDPTest0500', 0, function(done){
let udp = netSocket.constructUDPSocketInstance()
udp.close(function(err,data){
expect(err !== undefined).assertTrue()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_UDPTest0600
* @tc.name UDP close,promise方式,预计无异常,错误码为undefined
* @tc.desc Function test`
*/
it('Telephony_NetStack_UDPTest0600', 0, function(done){
let udp = netSocket.constructUDPSocketInstance()
udp.close().then(function(data){
expect(data !== undefined).assertTrue()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_UDPTest0700
* @tc.name UDP getState,callback方式,预计无异常,错误码为undefined
* @tc.desc Function test`
*/
it('Telephony_NetStack_UDPTest0700', 0, function(done){
let udp = netSocket.constructUDPSocketInstance()
udp.getState(function(err,data){
expect(err !== undefined).assertTrue()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_UDPTest0800
* @tc.name UDP getState,promise方式,预计无异常,错误码为undefined
* @tc.desc Function test`
*/
it('Telephony_NetStack_UDPTest0800', 0, function(done){
let udp = netSocket.constructUDPSocketInstance()
udp.getState().then(function(data){
expect(data !== undefined).assertTure()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_UDPTest0900
* @tc.name UDP setExtraOptions,callback方式,预计无异常,错误码为undefined
* @tc.desc Function test`
*/
it('Telephony_NetStack_UDPTest0900', 0, function(done){
let udp = netSocket.constructUDPSocketInstance()
udp.setExtraOptions({},function(err,data){
expect(err !==undefined).assertTure()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_UDPTest1000
* @tc.name UDP setExtraOptions,promise方式,预计无异常,错误码为undefined
* @tc.desc Function test`
*/
it('Telephony_NetStack_UDPTest1000', 0, function(done){
let udp = netSocket.constructUDPSocketInstance()
udp.setExtraOptions({},).then(function(date){
expect(date !== undefined).assertTrue()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_UDPTest1100
* @tc.name UDP on,预计callback不被调用
* @tc.desc Function test`
*/
it('Telephony_NetStack_UDPTest1100', 0, function(done){
let udp =netSocket.constructUDPSocketInstance()
udp.on('message',function(){
expect().assertFail()
done()
})
udp.on('listening',function(){
expect().assertFail()
done()
})
udp.on('close',function(){
expect().assertFail()
done()
})
udp.on('error',function(){
expect().assertFail()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_UDPTest1100
* @tc.name UDP on,预计callback不被调用
* @tc.desc Function test`
*/
it('Telephony_NetStack_UDPTest1100', 0, function(done){
let udp =netSocket.constructUDPSocketInstance()
udp.on('message',function(){
expect().assertFail()
done()
})
udp.on('listening',function(){
expect().assertFail()
done()
})
udp.on('close',function(){
expect().assertFail()
done()
})
udp.on('error',function(){
expect().assertFail()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_UDPTest1200
* @tc.name UDP off,预计callback不被调用
* @tc.desc Function test`
*/
it('Telephony_NetStack_UDPTest1200', 0, function(done){
let udp =netSocket.constructUDPSocketInstance()
udp.off('message',function(){
expect().assertFail()
done()
})
udp.off('listening',function(){
expect().assertFail()
done()
})
udp.off('close',function(){
expect().assertFail()
done()
})
udp.off('error',function(){
expect().assertFail()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_TCPTest0100
* @tc.name TCP bind,callback方式,预计无异常,错误码为undefined
* @tc.desc Function test`
*/
it('Telephony_NetStack_TCPTest0100', 0, function(done){
let tcp = netSocket.constructTCPSocketInstance()
tcp.bind({
address : "127.0.0.1",
family : 1,
port : 0
},function(err,data){
expect(err === undefined).assertTure()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_TCPTest0200
* @tc.name TCP bind,promise方式,预计无异常,错误码为undefined
* @tc.desc Function test`
*/
it('Telephony_NetStack_TCPTest0200', 0, function(done){
let tcp = netSocket.constructTCPSocketInstance()
tcp.bind({
address : "127.0.0.1",
family : 1,
port : 0
}).then(function(data){
expect(data === undefined).assertTure()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_TCPTest0300
* @tc.name TCP send,callback方式,预计无异常,错误码为undefined
* @tc.desc Function test`
*/
it('Telephony_NetStack_TCPTest0300', 0, function(done){
let tcp = netSocket.constructTCPSocketInstance()
tcp.send({
data : "Hello"
},function(err,data){
expect(err !== undefined).assertTure()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_TCPTest0400
* @tc.name TCP send,promise方式,预计无异常,错误码为undefined
* @tc.desc Function test`
*/
it('Telephony_NetStack_TCPTest0400', 0, function(done){
let tcp =netSocket.constructTCPSocketInstance()
tcp.send({
data : "Hello"
}).then(function(data){
expect(data !== undefined).assertTure()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_TCPTest0500
* @tc.name TCP close,callback方式,预计无异常,错误码为undefined
* @tc.desc Function test`
*/
it('Telephony_NetStack_TCPTest0500', 0, function(done){
let tcp = netSocket.constructTCPSocketInstance()
tcp.close(function(err,data){
expect(err !== undefined).assertTrue()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_TCPTest0600
* @tc.name TCP close,promise方式,预计无异常,错误码为undefined
* @tc.desc Function test`
*/
it('Telephony_NetStack_TCPTest0600', 0, function(done){
let tcp = netSocket.constructTCPSocketInstance()
tcp.close().then(function(data){
expect(data !== undefined).assertTrue()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_TCPTest0700
* @tc.name TCP getState,callback方式,预计无异常,错误码为undefined
* @tc.desc Function test`
*/
it('Telephony_NetStack_TCPTest0700', 0, function(done){
let tcp = netSocket.constructTCPSocketInstance()
tcp.getState(function(err,data){
expect(err !== undefined).assertTrue()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_TCPTest0800
* @tc.name TCP getState,promise方式,预计无异常,错误码为undefined
* @tc.desc Function test`
*/
it('Telephony_NetStack_TCPTest0800', 0, function(done){
let tcp =netSocket.constructTCPSocketInstance()
tcp.getState().then(function(data){
expect(data !== undefined).assertTure()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_TCPTest0900
* @tc.name TCP setExtraOptions,callback方式,预计无异常,错误码为undefined
* @tc.desc Function test`
*/
it('Telephony_NetStack_TCPTest0900', 0, function(done){
let tcp = netSocket.constructTCPSocketInstance()
tcp.setExtraOptions({},function(err,data){
expect(err !==undefined).assertTure()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_TCPTest1000
* @tc.name TCP setExtraOptions,promise方式,预计无异常,错误码为undefined
* @tc.desc Function test`
*/
it('Telephony_NetStack_TCPTest1000', 0, function(done){
let tcp = netSocket.constructTCPSocketInstance()
tcp.setExtraOptions({},).then(function(date){
expect(date !== undefined).assertTrue()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_TCPTest1100
* @tc.name TCP on,预计callback不被调用
* @tc.desc Function test`
*/
it('Telephony_NetStack_TCPTest1100', 0, function(done){
let tcp = netSocket.constructTCPSocketInstance()
tcp.on('message',function(){
expect().assertFail()
done()
})
tcp.on('listening',function(){
expect().assertFail()
done()
})
tcp.on('close',function(){
expect().assertFail()
done()
})
tcp.on('error',function(){
expect().assertFail()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_TCPTest1100
* @tc.name TCP on,预计callback不被调用
* @tc.desc Function test`
*/
it('Telephony_NetStack_TCPTest1100', 0, function(done){
let tcp = netSocket.constructTCPSocketInstance()
tcp.on('message',function(){
expect().assertFail()
done()
})
tcp.on('listening',function(){
expect().assertFail()
done()
})
tcp.on('close',function(){
expect().assertFail()
done()
})
tcp.on('error',function(){
expect().assertFail()
done()
})
done()
});
/**
* @tc.number Telephony_NetStack_TCPTest1200
* @tc.name TCP off,预计callback不被调用
* @tc.desc Function test`
*/
it('Telephony_NetStack_TCPTest1200', 0, function(done){
let tcp = netSocket.constructTCPSocketInstance()
tcp.off('message',function(){
expect().assertFail()
done()
})
tcp.off('listening',function(){
expect().assertFail()
done()
})
tcp.off('close',function(){
expect().assertFail()
done()
})
tcp.off('error',function(){
expect().assertFail()
done()
})
done()
});
});
\ 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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册