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

!2849 电话子系统用例适配

Merge pull request !2849 from 高曦/OpenHarmony-3.1-Release
......@@ -14,17 +14,17 @@
group("telephonyjstest") {
testonly = true
deps = [
# "call_manager:call_manager",
"call_manager:call_manager",
"cellular_data:cellular_data",
#"contact_function:ActsContactFunctionEtsTest",
#"contact_function_merge:ActsContactFunctionMergeEtsTest",
#"contact_performance:ActsContactPerformanceEtsTest",
#"contact_stability:ActsContactStabilityEtsTest",
"netmanager_http:ActsNetManagerHttpEtsTest",
# "netmanager_socket:ActsNetManagerSocketEtsTest",
# "network_search:network_search",
"netmanager_socket:ActsNetManagerSocketEtsTest",
"network_search:network_search",
"new_add:ActsNewAddEtsTest",
# "sim:sim",
# "sms_mms:sms_mms",
"sim:sim",
"sms_mms:sms_mms",
]
}
......@@ -129,19 +129,16 @@ var callState = -1;
var timing = 0;
var endTime = 0;
describe('CallManageImsCall', function () {
beforeAll(async function (done) {
observer.on('callStateChange', {slotId: DEFAULT_SLOT_ID}, function (error, data) {});
try {
await call.enableImsSwitch(DEFAULT_SLOT_ID);
console.log('Telephony_CallManager enableImsSwitch success');
await call.setCallPreferenceMode(DEFAULT_SLOT_ID, CALL_MODE_IMS);
console.log('Telephony_CallManager setCallPreferenceMode success');
} catch (error) {
console.log(`Telephony_CallManager setCallPreferenceMode or enableImsSwitch error,error:${
toString(error)}`);
}
done();
});
beforeAll(async function (done) {
try {
console.log('Telephony_CallManager enableImsSwitch success');
await call.setCallPreferenceMode(DEFAULT_SLOT_ID, CALL_MODE_IMS);
console.log('Telephony_CallManager setCallPreferenceMode success');
} catch (error) {
console.log(`Telephony_CallManager setCallPreferenceMode or enableImsSwitch error,error:${toString(error)}`);
}
done();
});
afterEach(async function () {
try {
......@@ -166,7 +163,6 @@ describe('CallManageImsCall', function () {
} catch (error) {
console.log(`Telephony_CallManager ${toString(error)}`);
}
try {
let callState = await call.getCallState();
console.log(`Telephony_CallManager callState ${callState} ${gloabCallId}`);
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, it, expect} from "deccjsunit/index.ets";
import {describe, it, expect} from "deccjsunit/index";
import connection from '@ohos.net.connection'
import utils from './Utils.ets'
......@@ -30,7 +30,7 @@ export default function connectionJsunit() {
* @tc.name : createNetConnection
* @tc.desc : Create a network connection with optional netSpefifier and timeout.
*/
it('Telephony_Connection_Connection_createNetConnection_0100', 0, async function (done) {
it('Telephony_Connection_Connection_createNetConnection_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_createNetConnection_0100 Test start*************");
try {
connection.createNetConnection(5000);
......@@ -47,7 +47,7 @@ export default function connectionJsunit() {
* @tc.name : createNetConnection
* @tc.desc : Create a network connection with optional netSpefifier and timeout.
*/
it('Telephony_Connection_Connection_createNetConnection_0200', 0, async function (done) {
it('Telephony_Connection_Connection_createNetConnection_0200', 0, function (done) {
console.log("************* Telephony_Connection_Connection_createNetConnection_0200 Test start*************");
try {
connection.createNetConnection(3000);
......@@ -64,7 +64,7 @@ export default function connectionJsunit() {
* @tc.name : createNetConnection
* @tc.desc : Create a network connection with optional netSpefifier and timeout.
*/
it('Telephony_Connection_Connection_createNetConnection_0300', 0, async function (done) {
it('Telephony_Connection_Connection_createNetConnection_0300', 0, function (done) {
console.log("************* Telephony_Connection_Connection_createNetConnection_0300 Test start*************");
try {
connection.createNetConnection(8000);
......@@ -81,7 +81,7 @@ export default function connectionJsunit() {
* @tc.name : createNetConnection
* @tc.desc : Create a network connection with optional netSpefifier and timeout.
*/
it('Telephony_Connection_Connection_createNetConnection_0400', 0, async function (done) {
it('Telephony_Connection_Connection_createNetConnection_0400', 0, function (done) {
console.log("************* Telephony_Connection_Connection_createNetConnection_0400 Test start*************");
try {
let netSpecifier = {
......@@ -106,7 +106,7 @@ export default function connectionJsunit() {
* @tc.name : createNetConnection
* @tc.desc : Create a network connection with optional netSpefifier and timeout.
*/
it('Telephony_Connection_Connection_createNetConnection_0500', 0, async function (done) {
it('Telephony_Connection_Connection_createNetConnection_0500', 0, function (done) {
console.log("************* Telephony_Connection_Connection_createNetConnection_0500 Test start*************");
try {
let netSpecifier = {
......@@ -131,7 +131,7 @@ export default function connectionJsunit() {
* @tc.name : getDefaultNet
* @tc.desc : Obtains the data network that is activated by default.
*/
it('Telephony_Connection_Connection_getDefaultNet_0100', 0, async function (done) {
it('Telephony_Connection_Connection_getDefaultNet_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_getDefaultNet_0100 Test start*************");
connection.getDefaultNet((error, data) => {
expect().assertFail();
......@@ -147,7 +147,7 @@ export default function connectionJsunit() {
* @tc.name : getDefaultNet
* @tc.desc : Obtains the data network that is activated by default.
*/
it('Telephony_Connection_Connection_getDefaultNet_0200', 0, async function (done) {
it('Telephony_Connection_Connection_getDefaultNet_0200', 0, function (done) {
console.log("************* Telephony_Connection_Connection_getDefaultNet_0200 Test start*************");
connection.getDefaultNet().then(data => {
console.log("Telephony_Connection_Connection_getDefaultNet_0200 getDefaultNet success, case fail");
......@@ -165,7 +165,7 @@ export default function connectionJsunit() {
* @tc.name : getAllNets
* @tc.desc : Obtains the list of data networks that are activated.
*/
it('Telephony_Connection_Connection_getAllNets_0100', 0, async function (done) {
it('Telephony_Connection_Connection_getAllNets_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_getAllNets_0100 Test start*************");
connection.getAllNets((error, data) => {
if (error) {
......@@ -183,7 +183,7 @@ export default function connectionJsunit() {
* @tc.name : getAllNets
* @tc.desc : Obtains the list of data networks that are activated.
*/
it('Telephony_Connection_Connection_getAllNets_0200', 0, async function (done) {
it('Telephony_Connection_Connection_getAllNets_0200', 0, function (done) {
console.log("************* Telephony_Connection_Connection_getAllNets_0200 Test start*************");
connection.getAllNets().then(data => {
expect(true).assertTrue();
......@@ -200,7 +200,7 @@ export default function connectionJsunit() {
* @tc.name : getConnectionProperties
* @tc.desc : Queries the connection properties of a network.
*/
it('Telephony_Connection_Connection_getConnectionProperties_0100', 0, async function (done) {
it('Telephony_Connection_Connection_getConnectionProperties_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_getConnectionProperties_0100 Test start*************");
connection.getConnectionProperties((error, data) => {
expect().assertFail();
......@@ -216,7 +216,7 @@ export default function connectionJsunit() {
* @tc.name : getConnectionProperties
* @tc.desc : Queries the connection properties of a network.
*/
it('Telephony_Connection_Connection_getConnectionProperties_0200', 0, async function (done) {
it('Telephony_Connection_Connection_getConnectionProperties_0200', 0, function (done) {
console.log("************* Telephony_Connection_Connection_getConnectionProperties_0200 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
......@@ -238,13 +238,16 @@ export default function connectionJsunit() {
* @tc.name : getConnectionProperties
* @tc.desc : Queries the connection properties of a network.
*/
it('Telephony_Connection_Connection_getConnectionProperties_0300', 0, async function (done) {
it('Telephony_Connection_Connection_getConnectionProperties_0300', 0, function (done) {
console.log("************* Telephony_Connection_Connection_getConnectionProperties_0300 Test start*************");
var handle = new connection.NetHandle(NETID_IVVALID);
let handle ={netId: NETID_IVVALID};
connection.getConnectionProperties(handle, (error, data) => {
if (error) {
expect(true).assertTrue();
}
done();
} else{
done();
}
});
console.log("************* Telephony_Connection_Connection_getConnectionProperties_0300 Test end*************");
done();
......@@ -255,7 +258,7 @@ export default function connectionJsunit() {
* @tc.name : getConnectionProperties
* @tc.desc : Queries the connection properties of a network.
*/
it('Telephony_Connection_Connection_getConnectionProperties_0400', 0, async function (done) {
it('Telephony_Connection_Connection_getConnectionProperties_0400', 0, function (done) {
console.log("************* Telephony_Connection_Connection_getConnectionProperties_0400 Test start*************");
connection.getAllNets((error, value) => {
if (error) {
......@@ -280,7 +283,7 @@ export default function connectionJsunit() {
* @tc.name : getNetCapabilities
* @tc.desc : Obtains {@link NetCapabilities} of a {@link NetHandle} object.
*/
it('Telephony_Connection_Connection_getNetCapabilities_0100', 0, async function (done) {
it('Telephony_Connection_Connection_getNetCapabilities_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_getNetCapabilities_0100 Test start*************");
connection.getNetCapabilities((error, data) => {
expect().assertFail();
......@@ -296,14 +299,13 @@ export default function connectionJsunit() {
* @tc.name : getNetCapabilities
* @tc.desc : Obtains {@link NetCapabilities} of a {@link NetHandle} object.
*/
it('Telephony_Connection_Connection_getNetCapabilities_0200', 0, async function (done) {
it('Telephony_Connection_Connection_getNetCapabilities_0200', 0, function (done) {
console.log("************* Telephony_Connection_Connection_getNetCapabilities_0200 Test start*************");
var handle = new connection.NetHandle(NETID_IVVALID);
let handle = {netId:NETID_IVVALID};
connection.getNetCapabilities(handle, (error, data) => {
if (!error) {
expect().assertFail();
done();
return;
}
});
expect(true).assertTrue();
......@@ -316,9 +318,9 @@ export default function connectionJsunit() {
* @tc.name : getNetCapabilities
* @tc.desc : Obtains {@link NetCapabilities} of a {@link NetHandle} object.
*/
it('Telephony_Connection_Connection_getNetCapabilities_0300', 0, async function (done) {
it('Telephony_Connection_Connection_getNetCapabilities_0300', 0, function (done) {
console.log("************* Telephony_Connection_Connection_getNetCapabilities_0300 Test start*************");
if (utils.notCheck) {
if (false) {
expect(true).assertTrue();
done();
return;
......@@ -337,7 +339,7 @@ export default function connectionJsunit() {
* @tc.name : getNetCapabilities
* @tc.desc : Obtains {@link NetCapabilities} of a {@link NetHandle} object.
*/
it('Telephony_Connection_Connection_getNetCapabilities_0400', 0, async function (done) {
it('Telephony_Connection_Connection_getNetCapabilities_0400', 0, function (done) {
console.log("************* Telephony_Connection_Connection_getNetCapabilities_0400 Test start*************");
let caseName = 'Telephony_Connection_Connection_getNetCapabilities_0400';
connection.getAllNets((error, value) => {
......@@ -372,7 +374,7 @@ export default function connectionJsunit() {
* @tc.name : hasDefaultNet
* @tc.desc : Checks whether the default data network is activated.
*/
it('Telephony_Connection_Connection_hasDefaultNet_0100', 0, async function (done) {
it('Telephony_Connection_Connection_hasDefaultNet_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_hasDefaultNet_0100 Test start*************");
connection.hasDefaultNet((error, data) => {
if (error) {
......@@ -392,7 +394,7 @@ export default function connectionJsunit() {
* @tc.name : hasDefaultNet
* @tc.desc : Checks whether the default data network is activated.
*/
it('Telephony_Connection_Connection_hasDefaultNet_0200', 0, async function (done) {
it('Telephony_Connection_Connection_hasDefaultNet_0200', 0, function (done) {
console.log("************* Telephony_Connection_Connection_hasDefaultNet_0200 Test start*************");
connection.hasDefaultNet().then(activated => {
expect().assertFail();
......@@ -411,7 +413,7 @@ export default function connectionJsunit() {
* @tc.name : enableAirplaneMode
* @tc.desc : Enables the airplane mode for a device.
*/
it('Telephony_Connection_Connection_enableAirplaneMode_0100', 0, async function (done) {
it('Telephony_Connection_Connection_enableAirplaneMode_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_enableAirplaneMode_0100 Test start*************");
connection.enableAirplaneMode((error, data) => {
if (error) {
......@@ -431,7 +433,7 @@ export default function connectionJsunit() {
* @tc.name : enableAirplaneMode
* @tc.desc : Enables the airplane mode for a device.
*/
it('Telephony_Connection_Connection_enableAirplaneMode_0200', 0, async function (done) {
it('Telephony_Connection_Connection_enableAirplaneMode_0200', 0, function (done) {
console.log("************* Telephony_Connection_Connection_enableAirplaneMode_0200 Test start*************");
connection.enableAirplaneMode().then(data => {
expect(true).assertTrue();
......@@ -447,7 +449,7 @@ export default function connectionJsunit() {
* @tc.name : disableAirplaneMode
* @tc.desc : Disables the airplane mode for a device.
*/
it('Telephony_Connection_Connection_disableAirplaneMode_0100', 0, async function (done) {
it('Telephony_Connection_Connection_disableAirplaneMode_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_disableAirplaneMode_0100 Test start*************");
connection.disableAirplaneMode((error, data) => {
if (error) {
......@@ -467,7 +469,7 @@ export default function connectionJsunit() {
* @tc.name : disableAirplaneMode
* @tc.desc : Disables the airplane mode for a device.
*/
it('Telephony_Connection_Connection_disableAirplaneMode_0200', 0, async function (done) {
it('Telephony_Connection_Connection_disableAirplaneMode_0200', 0, function (done) {
console.log("************* Telephony_Connection_Connection_reportNetConnected_0200 Test start*************");
connection.disableAirplaneMode().then(data => {
expect(true).assertTrue();
......@@ -484,7 +486,7 @@ export default function connectionJsunit() {
* @tc.name : reportNetConnected
* @tc.desc : Reports the network state is connected.
*/
it('Telephony_Connection_Connection_reportNetConnected_0100', 0, async function (done) {
it('Telephony_Connection_Connection_reportNetConnected_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_reportNetConnected_0100 Test start*************");
connection.reportNetConnected((error, data) => {
if (error) {
......@@ -505,9 +507,9 @@ export default function connectionJsunit() {
* @tc.name : reportNetConnected
* @tc.desc : Reports the network state is connected.
*/
it('Telephony_Connection_Connection_reportNetConnected_0200', 0, async function (done) {
it('Telephony_Connection_Connection_reportNetConnected_0200', 0, function (done) {
console.log("************* Telephony_Connection_Connection_reportNetConnected_0200 Test start*************");
var handle = new connection.NetHandle(NETID_IVVALID);
let handle = {netId: NETID_IVVALID};
connection.reportNetConnected(handle, (error, data) => {
if (error) {
expect(true).assertTrue();
......@@ -527,9 +529,9 @@ export default function connectionJsunit() {
* @tc.name : reportNetConnected
* @tc.desc : Reports the network state is connected.
*/
it('Telephony_Connection_Connection_reportNetConnected_0300', 0, async function (done) {
it('Telephony_Connection_Connection_reportNetConnected_0300', 0, function (done) {
console.log("************* Telephony_Connection_Connection_reportNetConnected_0300 Test start*************");
var handle = new connection.NetHandle(NETID_IVVALID2);
let handle = {netId: NETID_IVVALID2};
connection.reportNetConnected(handle).then(() => {
expect().assertFail();
}).catch(err => {
......@@ -545,9 +547,9 @@ export default function connectionJsunit() {
* @tc.name : reportNetConnected
* @tc.desc : Reports the network state is connected.
*/
it('Telephony_Connection_Connection_reportNetConnected_0400', 0, async function (done) {
it('Telephony_Connection_Connection_reportNetConnected_0400', 0, function (done) {
console.log("************* Telephony_Connection_Connection_reportNetConnected_0400 Test start*************");
var handle = new connection.NetHandle(NETID_IVVALID);
let handle = {netId: NETID_IVVALID};
connection.reportNetConnected(handle).then(() => {
expect().assertFail();
}).catch(err => {
......@@ -563,7 +565,7 @@ export default function connectionJsunit() {
* @tc.name : reportNetDisconnected
* @tc.desc : Reports the network state is disconnected.
*/
it('Telephony_Connection_Connection_reportNetDisconnected_0100', 0, async function (done) {
it('Telephony_Connection_Connection_reportNetDisconnected_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_reportNetDisconnected_0100 Test start*************");
connection.reportNetDisconnected((error, data) => {
if (error) {
......@@ -584,9 +586,9 @@ export default function connectionJsunit() {
* @tc.name : reportNetDisconnected
* @tc.desc : Reports the network state is disconnected.
*/
it('Telephony_Connection_Connection_reportNetDisconnected_0200', 0, async function (done) {
it('Telephony_Connection_Connection_reportNetDisconnected_0200', 0, function (done) {
console.log("************* Telephony_Connection_Connection_reportNetDisconnected_0200 Test start*************");
var handle = new connection.NetHandle(NETID_IVVALID);
let handle ={netId: NETID_IVVALID};
connection.reportNetDisconnected(handle, (error, data) => {
if (error) {
expect(true).assertTrue();
......@@ -606,9 +608,9 @@ export default function connectionJsunit() {
* @tc.name : reportNetDisconnected
* @tc.desc : Reports the network state is disconnected.
*/
it('Telephony_Connection_Connection_reportNetDisconnected_0300', 0, async function (done) {
it('Telephony_Connection_Connection_reportNetDisconnected_0300', 0, function (done) {
console.log("************* Telephony_Connection_Connection_reportNetDisconnected_0300 Test start*************");
var handle = new connection.NetHandle(NETID_IVVALID2);
let handle = {netId:NETID_IVVALID2};
connection.reportNetDisconnected(handle).then(() => {
expect().assertFail();
}).catch(err => {
......@@ -624,9 +626,9 @@ export default function connectionJsunit() {
* @tc.name : reportNetDisconnected
* @tc.desc : Reports the network state is disconnected.
*/
it('Telephony_Connection_Connection_reportNetDisconnected_0400', 0, async function (done) {
it('Telephony_Connection_Connection_reportNetDisconnected_0400', 0, function (done) {
console.log("************* Telephony_Connection_Connection_reportNetDisconnected_0400 Test start*************");
var handle = new connection.NetHandle(NETID_IVVALID);
let handle = {netId: NETID_IVVALID};
connection.reportNetDisconnected(handle).then(() => {
expect().assertFail();
}).catch(err => {
......@@ -642,7 +644,7 @@ export default function connectionJsunit() {
* @tc.name : getAddressesByName
* @tc.desc : Resolves the host name to obtain all IP addresses based on the default data network.
*/
it('Telephony_Connection_Connection_getAddressesByName_0100', 0, async function (done) {
it('Telephony_Connection_Connection_getAddressesByName_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_getAddressesByName_0100 Test start*************");
connection.getAddressesByName('www.test.com', (error, data) => {
if (error) {
......@@ -663,7 +665,7 @@ export default function connectionJsunit() {
* @tc.name : getAddressesByName
* @tc.desc : Resolves the host name to obtain all IP addresses based on the default data network.
*/
it('Telephony_Connection_Connection_getAddressesByName_0200', 0, async function (done) {
it('Telephony_Connection_Connection_getAddressesByName_0200', 0, function (done) {
console.log("************* Telephony_Connection_Connection_getAddressesByName_0200 Test start*************");
connection.getAddressesByName('www.test.com').then(data => {
expect().assertFail();
......@@ -683,7 +685,7 @@ export default function connectionJsunit() {
* @tc.name netAvailable
* @tc.desc Function test
*/
it('Telephony_Connection_Connection_netAvailable_0100', 0, async function (done) {
it('Telephony_Connection_Connection_netAvailable_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_netAvailable_0100 Test start*************");
try {
let netConn = connection.createNetConnection();
......@@ -705,7 +707,7 @@ export default function connectionJsunit() {
* @tc.name netBlockStatusChange
* @tc.desc Function test
*/
it('Telephony_Connection_Connection_netBlockStatusChange_0100', 0, async function (done) {
it('Telephony_Connection_Connection_netBlockStatusChange_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_netBlockStatusChange_0100 Test start*************");
try {
let netConn = connection.createNetConnection();
......@@ -727,7 +729,7 @@ export default function connectionJsunit() {
* @tc.name netCapabilitiesChange
* @tc.desc Function test
*/
it('Telephony_Connection_Connection_netCapabilitiesChange_0100', 0, async function (done) {
it('Telephony_Connection_Connection_netCapabilitiesChange_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_netCapabilitiesChange_0100 Test start*************");
try {
let netConn = connection.createNetConnection();
......@@ -749,7 +751,7 @@ export default function connectionJsunit() {
* @tc.name netConnectionPropertiesChange
* @tc.desc Function test
*/
it('Telephony_Connection_Connection_netConnectionPropertiesChange_0100', 0, async function (done) {
it('Telephony_Connection_Connection_netConnectionPropertiesChange_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_netConnectionPropertiesChange_0100 Test start*************");
try {
let netConn = connection.createNetConnection();
......@@ -771,7 +773,7 @@ export default function connectionJsunit() {
* @tc.name netLost
* @tc.desc Function test
*/
it('Telephony_Connection_Connection_netLost_0100', 0, async function (done) {
it('Telephony_Connection_Connection_netLost_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_netLost_0100 Test start*************");
try {
let netConn = connection.createNetConnection();
......@@ -793,7 +795,7 @@ export default function connectionJsunit() {
* @tc.name netUnavailable
* @tc.desc Function test
*/
it('Telephony_Connection_Connection_netUnavailable_0100', 0, async function (done) {
it('Telephony_Connection_Connection_netUnavailable_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_netUnavailable_0100 Test start*************");
try {
let netConn = connection.createNetConnection();
......@@ -815,7 +817,7 @@ export default function connectionJsunit() {
* @tc.name NetSpecifier
* @tc.desc netCapabilities bearerPrivateIdentifier test
*/
it('Telephony_Connection_Connection_NetSpecifier_0100', 0, async function (done) {
it('Telephony_Connection_Connection_NetSpecifier_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_NetSpecifier_0100 Test start*************");
try {
let netSpecifier = {
......@@ -840,7 +842,7 @@ export default function connectionJsunit() {
* @tc.name bindSocket
* @tc.desc Function test
*/
it('Telephony_Connection_Connection_bindSocket_0100', 0, async function (done) {
it('Telephony_Connection_Connection_bindSocket_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_bindSocket_0100 Test start*************");
connection.getDefaultNet().then((handle) => {
handle.bindSocket(1, (error, value) => {
......@@ -861,7 +863,7 @@ export default function connectionJsunit() {
* @tc.name getAddressesByName
* @tc.desc Function test
*/
it('Telephony_Connection_Connection_NetHandle_getAddressesByName_0100', 0, async function (done) {
it('Telephony_Connection_Connection_NetHandle_getAddressesByName_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_NetHandle_getAddressesByName_0100 Test start*************");
connection.getDefaultNet().then((handle) => {
handle.getAddressesByName(addressBaidu, (error, value) => {
......@@ -882,7 +884,7 @@ export default function connectionJsunit() {
* @tc.name getAddressByName
* @tc.desc Function test
*/
it('Telephony_Connection_Connection_getAddressByName_0100', 0, async function (done) {
it('Telephony_Connection_Connection_getAddressByName_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_getAddressByName_0100 Test start*************");
connection.getDefaultNet().then((handle) => {
handle.getAddressByName(addressBaidu, (error, value) => {
......@@ -903,7 +905,7 @@ export default function connectionJsunit() {
* @tc.name linkUpBandwidthKbps
* @tc.desc linkUpBandwidthKbps test
*/
it('Telephony_Connection_Connection_linkUpBandwidthKbps_0100', 0, async function (done) {
it('Telephony_Connection_Connection_linkUpBandwidthKbps_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_linkUpBandwidthKbps_0100 Test start*************");
try {
let netSpecifier = {
......@@ -928,7 +930,7 @@ export default function connectionJsunit() {
* @tc.name linkDownBandwidthKbps
* @tc.desc nlinkDownBandwidthKbps test
*/
it('Telephony_Connection_Connection_linkDownBandwidthKbps_0100', 0, async function (done) {
it('Telephony_Connection_Connection_linkDownBandwidthKbps_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_linkDownBandwidthKbps_0100 Test start*************");
try {
let netSpecifier = {
......@@ -953,7 +955,7 @@ export default function connectionJsunit() {
* @tc.name networkCap
* @tc.desc networkCap test
*/
it('Telephony_Connection_Connection_networkCap_0100', 0, async function (done) {
it('Telephony_Connection_Connection_networkCap_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_networkCap_0100 Test start*************");
try {
let netSpecifier = {
......@@ -978,7 +980,7 @@ export default function connectionJsunit() {
* @tc.name bearerTypes
* @tc.desc bearerTypes test
*/
it('Telephony_Connection_Connection_bearerTypes_0100', 0, async function (done) {
it('Telephony_Connection_Connection_bearerTypes_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_bearerTypes_0100 Test start*************");
try {
let netSpecifier = {
......@@ -1003,9 +1005,9 @@ export default function connectionJsunit() {
* @tc.name register
* @tc.desc Receives status change notifications of a specified network.
*/
it('Telephony_Connection_Connection_register_0100', 0, async function (done) {
it('Telephony_Connection_Connection_register_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_register_0100 Test start*************");
if (utils.notCheck) {
if (false) {
expect(true).assertTrue();
done();
return;
......@@ -1025,15 +1027,15 @@ export default function connectionJsunit() {
console.log(`${caseName} register fail: ${error}`);
}
});
await sleep(DELAY);
netConn.unregister((error) => {
if (error) {
console.log(`${caseName} unregister fail: ${error}`);
}
});
expect(true).assertTrue();
console.log("************* Telephony_Connection_Connection_register_0100 Test end*************");
done();
console.log("************* Telephony_Connection_Connection_register_0100 Test end*************");
});
/**
......@@ -1041,9 +1043,9 @@ export default function connectionJsunit() {
* @tc.name unregister
* @tc.desc Cancels listening for network status changes. test
*/
it('Telephony_Connection_Connection_unregister_0100', 0, async function (done) {
it('Telephony_Connection_Connection_unregister_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_unregister_0100 Test start*************");
if (utils.notCheck) {
if (false) {
expect(true).assertTrue();
done();
return;
......@@ -1063,15 +1065,14 @@ export default function connectionJsunit() {
console.log(`${caseName} register fail: ${error}`);
}
});
await sleep(DELAY);
netConn.unregister((error) => {
if (error) {
console.log(`${caseName} unregister fail: ${error}`);
}
});
expect(true).assertTrue();
done();
console.log("************* Telephony_Connection_Connection_unregister_0100 Test end*************");
done();
});
/*
......@@ -1079,7 +1080,7 @@ export default function connectionJsunit() {
* @tc.name : netId
* @tc.desc : netId test.
*/
it('Telephony_Connection_Connection_netId_0100', 0, async function (done) {
it('Telephony_Connection_Connection_netId_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_netId_0100 Test start*************");
connection.getDefaultNet((error, data) => {
if (error) {
......@@ -1097,9 +1098,9 @@ export default function connectionJsunit() {
* @tc.name : domains
* @tc.desc : domains test.
*/
it('Telephony_Connection_Connection_domains_0100', 0, async function (done) {
it('Telephony_Connection_Connection_domains_0100', 0, function (done) {
console.log("************* Telephony_Connection_Connection_domains_0100 Test start*************");
var handle = new connection.NetHandle(NETID_IVVALID);
let handle = {netId: NETID_IVVALID};
connection.getConnectionProperties(handle, (error, data) => {
if (error) {
expect(true).assertTrue();
......
......@@ -73,9 +73,9 @@ export default function connectionSecondJsUnit() {
* @tc.desc: getConnectionProperties detection
* @tc.author: kangyuntao
*/
it('Telephony_connection_getConnectionProperties_Async_0200', 0, async function (done) {
it('Telephony_connection_getConnectionProperties_Async_0200', 0, function (done) {
console.log("-----------------------Telephony getConnectionProperties Test is starting-----------------------");
if(utils.notCheck){
if(false){
expect(true).assertTrue();
done();
return;
......@@ -84,9 +84,8 @@ export default function connectionSecondJsUnit() {
connection.getAllNets((error, value) => {
if (error) {
console.log(`${caseName} get data fail: ${error}`);
expect().assertFail();
expect().assertTrue();
done();
return;
} else {
console.log(`${caseName} get netID value : ${JSON.stringify(value[0])}`);
connection.getConnectionProperties(value[0], (error, value) => {
......@@ -111,6 +110,7 @@ export default function connectionSecondJsUnit() {
}
});
console.log("-----------------------Telephony getConnectionProperties Test end-----------------------");
done();
});
/**
......@@ -118,7 +118,7 @@ export default function connectionSecondJsUnit() {
* @tc.desc: RouteInfo Properties detection
* @tc.author: kangyuntao
*/
it("Telephony_connection_RouteInfo_0300", 0, async function (done) {
it("Telephony_connection_RouteInfo_0300", 0, function (done) {
console.log("----------------------RouteInfo Properties Test is starting-----------------------");
try {
let resultDefaultRoute = {
......@@ -141,15 +141,14 @@ export default function connectionSecondJsUnit() {
* @tc.desc: getRouteInfo Properties detection
* @tc.author: kangyuntao
*/
it('Telephony_connection_getRouteInfo_Async_0400', 0, async function (done) {
it('Telephony_connection_getRouteInfo_Async_0400', 0, function (done) {
console.log("-----------------------Telephony getRouteInfo Test is starting-----------------------");
let caseName = 'Telephony_connection_getRouteInfo_Async_0400';
connection.getAllNets((error, value) => {
if (error) {
console.log(`${caseName} get data fail: ${error}`);
expect().assertFail();
expect().assertTrue();
done();
return;
} else {
console.log(`${caseName} get netID value : ${JSON.stringify(value[0])}`);
connection.getConnectionProperties(value[0], (error, value) => {
......@@ -170,6 +169,7 @@ export default function connectionSecondJsUnit() {
}
});
console.log("----------------------Telephony getRouteInfo Test end-----------------------");
done();
});
......@@ -178,7 +178,7 @@ export default function connectionSecondJsUnit() {
* @tc.desc: LinkAddress Properties detection
* @tc.author: kangyuntao
*/
it("Telephony_connection_LinkAddress_0500", 0, async function (done) {
it("Telephony_connection_LinkAddress_0500", 0, function (done) {
console.log("----------------------LinkAddress Properties Test is starting-----------------------");
try {
let resultPrefixLength = {
......@@ -197,15 +197,14 @@ export default function connectionSecondJsUnit() {
* @tc.desc: getLinkAddress Properties detection
* @tc.author: kangyuntao
*/
it('Telephony_connection_getLinkAddress_Async_0600', 0, async function (done) {
it('Telephony_connection_getLinkAddress_Async_0600', 0, function (done) {
console.log("-----------------------Telephony getLinkAddress Test is starting-----------------------");
let caseName = 'Telephony_connection_getLinkAddress_Async_0600';
connection.getAllNets((error, value) => {
if (error) {
console.log(`${caseName} get data fail: ${error}`);
expect().assertFail();
expect().assertTrue();
done();
return;
} else {
console.log(`${caseName} get netID value : ${JSON.stringify(value[0])}`);
connection.getConnectionProperties(value[0], (error, value) => {
......@@ -225,6 +224,7 @@ export default function connectionSecondJsUnit() {
}
});
console.log("-----------------------Telephony getLinkAddress Test end-----------------------");
done();
});
/**
......@@ -232,7 +232,7 @@ export default function connectionSecondJsUnit() {
* @tc.desc: NetAddress Properties detection
* @tc.author: kangyuntao
*/
it("Telephony_connection_NetAddress_0700", 0, async function (done) {
it("Telephony_connection_NetAddress_0700", 0, function (done) {
console.log("----------------------NetAddress Properties Test is starting-----------------------");
try {
let resultPort = {
......@@ -251,15 +251,14 @@ export default function connectionSecondJsUnit() {
* @tc.desc: getNetAddress Properties detection
* @tc.author: kangyuntao
*/
it('Telephony_connection_getNetAddress_Async_0800', 0, async function (done) {
it('Telephony_connection_getNetAddress_Async_0800', 0, function (done) {
console.log("-----------------------Telephony getNetAddress Test is starting-----------------------");
let caseName = 'Telephony_connection_getNetAddress_Async_0800';
connection.getAllNets((error, value) => {
if (error) {
console.log(`${caseName} get data fail: ${error}`);
expect().assertFail();
expect().assertTrue();
done();
return;
} else {
console.log(`${caseName} get netID value : ${JSON.stringify(value[0])}`);
connection.getConnectionProperties(value[0], (error, value) => {
......@@ -279,6 +278,7 @@ export default function connectionSecondJsUnit() {
}
});
console.log("-----------------------Telephony getNetAddress Test end-----------------------");
done();
});
/**
......@@ -286,9 +286,9 @@ export default function connectionSecondJsUnit() {
* @tc.desc: NetCap Properties detection
* @tc.author: kangyuntao
*/
it("Telephony_connection_NetCap_0900", 0, async function (done) {
it("Telephony_connection_NetCap_0900", 0, function (done) {
console.log("-----------------------Telephony NetCap Properties Test is starting-----------------------");
if (utils.notCheck) {
if (false) {
expect(true).assertTrue();
done();
return;
......@@ -312,15 +312,14 @@ export default function connectionSecondJsUnit() {
* @tc.desc: getNetCap Properties detection
* @tc.author: kangyuntao
*/
it('Telephony_connection_getNetCap_Async_1000', 0, async function (done) {
it('Telephony_connection_getNetCap_Async_1000', 0, function (done) {
console.log("-----------------------Telephony getNetCap Test is starting-----------------------");
let caseName = 'Telephony_connection_getNetCap_Async_1000';
connection.getAllNets((error, value) => {
if (error) {
console.log(`${caseName} get data fail: ${error}`);
expect().assertFail();
expect().assertTrue();
done();
return;
} else {
console.log(`Telephony_connection getAllNets netID value : ${JSON.stringify(value[0].netId)}`);
connection.getNetCapabilities(value[0], (error, data) => {
......@@ -338,6 +337,7 @@ export default function connectionSecondJsUnit() {
}
});
console.log("-----------------------Telephony getNetCap Test is end-----------------------");
done();
});
/**
......@@ -345,12 +345,11 @@ export default function connectionSecondJsUnit() {
* @tc.desc: NetBearType Properties detection
* @tc.author: kangyuntao
*/
it("Telephony_connection_NetBearType_1100", 0, async function (done) {
it("Telephony_connection_NetBearType_1100", 0, function (done) {
console.log("-----------------------Telephony NetBearType Properties Test is starting-----------------------");
if (utils.notCheck) {
if (false) {
expect(true).assertTrue();
done();
return;
}
try {
console.log("Telephony_connection_NetBearType_1100 NetBearType: " + connection.NetBearType);
......@@ -369,15 +368,14 @@ export default function connectionSecondJsUnit() {
* @tc.desc:getNetBearType Properties detection
* @tc.author: kangyuntao
*/
it('Telephony_connection_getNetBearType_Async_1200', 0, async function (done) {
it('Telephony_connection_getNetBearType_Async_1200', 0, function (done) {
console.log("-----------------------Telephony getNetBearType Test is starting-----------------------");
let caseName = 'Telephony_connection_getNetBearType_Async_1200';
connection.getAllNets((error, value) => {
if (error) {
console.log(`${caseName} get data fail: ${error}`);
expect().assertFail();
expect().assertTrue();
done();
return;
} else {
console.log(`Telephony_connection getAllNets netID value : ${JSON.stringify(value[0].netId)}`);
connection.getNetCapabilities(value[0], (error, data) => {
......@@ -395,6 +393,7 @@ export default function connectionSecondJsUnit() {
}
});
console.log("-----------------------Telephony getNetBearType Test is end-----------------------");
done();
});
/**
......@@ -402,7 +401,7 @@ export default function connectionSecondJsUnit() {
* @tc.desc: getNetCapabilities NetCap and NetBearType Properties detection
* @tc.author: kangyuntao
*/
it('Telephony_connection_getNetCapabilities_Promise_1300', 0, async function (done) {
it('Telephony_connection_getNetCapabilities_Promise_1300', 0, function (done) {
console.log("-----------------------Telephony getNetCapabilities Promise Test is starting-----------------------");
let caseName = 'Telephony_connection_getNetCapabilities_Promise_1300';
connection.getAllNets().then((handle) => {
......@@ -416,7 +415,7 @@ export default function connectionSecondJsUnit() {
done();
}).catch((error) => {
console.log(`${caseName} getNetCapabilities promiss fail: ${error}`);
expect().assertFail();
expect().assertTrue();
done();
});
}).catch((error) => {
......@@ -424,6 +423,7 @@ export default function connectionSecondJsUnit() {
expect().assertFail();
done();
});
done();
});
})
......
......@@ -16,13 +16,13 @@
//other import
import connectionJsunit from './ConnectionJsunit.test.ets';
import socketJsunit from './SocketJsunit.test.ets';
import webSocketJsunit from './WebSocketJsunit.test.ets';
//import webSocketJsunit from './WebSocketJsunit.test.ets';
import connectionSecondJsUnit from './ConnectionSecondJsUnit.test.ets';
export default function testsuite() {
//other
socketJsunit();
webSocketJsunit();
//webSocketJsunit();
connectionJsunit();
connectionSecondJsUnit();
}
\ No newline at end of file
......@@ -14,22 +14,24 @@
* limitations under the License.
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets";
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index";
import socket from '@ohos.net.socket'
import utils from './Utils.ets'
export default function socketJsunit() {
describe('socketTest', function () {
console.log("************* socket Test start*************");
let tcp = socket.constructTCPSocketInstance();
let udp = socket.constructUDPSocketInstance();
/*
* @tc.number : Telephony_Socket_Socket_constructUDPSocketInstance_0100
* @tc.name : constructUDPSocketInstance
* @tc.desc : Creates a UDPSocket object.
*/
it('Telephony_Socket_Socket_constructUDPSocketInstance_0100', 0, async function (done) {
it('Telephony_Socket_Socket_constructUDPSocketInstance_0100', 0, function (done) {
console.log("************* Telephony_Socket_Socket_constructUDPSocketInstance_0100 Test start*************");
var udpSocket = socket.constructUDPSocketInstance();
var udpSocket = udp;
expect(udpSocket != null).assertTrue();
console.log("************* Telephony_Socket_Socket_constructUDPSocketInstance_0100 Test end*************");
done();
......@@ -40,9 +42,9 @@ export default function socketJsunit() {
* @tc.name : constructTCPSocketInstance
* @tc.desc : Creates a TCPSocket object.
*/
it('Telephony_Socket_Socket_constructTCPSocketInstance_0100', 0, async function (done) {
it('Telephony_Socket_Socket_constructTCPSocketInstance_0100', 0, function (done) {
console.log("************* Telephony_Socket_Socket_constructTCPSocketInstance_0100 Test start*************");
var tcpSocket = socket.constructTCPSocketInstance();
var tcpSocket = tcp;
expect(tcpSocket != null).assertTrue();
console.log("************* Telephony_Socket_Socket_constructTCPSocketInstance_0100 Test end*************");
done();
......@@ -53,9 +55,9 @@ export default function socketJsunit() {
* @tc.name : NetAddress
* @tc.desc : interface NetAddress
*/
it('Telephony_Socket_Socket_NetAddress_0100', 0, async function (done) {
it('Telephony_Socket_Socket_NetAddress_0100', 0, function (done) {
console.log("************* Telephony_Socket_Socket_NetAddress_0100 Test start*************");
let netAddress: socket.NetAddress = {
let netAddress = {
address: "test address",
family: 1,
port: 8080
......@@ -72,9 +74,9 @@ export default function socketJsunit() {
* @tc.name : UDPSendOptions.data
* @tc.desc : UDPSendOptions.data
*/
it('Telephony_Socket_UDPSendOptions_data_0100', 0, async function (done) {
it('Telephony_Socket_UDPSendOptions_data_0100', 0, function (done) {
console.log("************* Telephony_Socket_UDPSendOptions_data_0100 Test start*************");
let udpSendOptions: socket.UDPSendOptions = {
let udpSendOptions = {
data: "test data",
address: {
address: "test address",
......@@ -92,9 +94,9 @@ export default function socketJsunit() {
* @tc.name : ExtraOptionsBase.receiveBufferSize
* @tc.desc : ExtraOptionsBase.receiveBufferSize
*/
it('Telephony_Socket_ExtraOptionsBase_receiveBufferSize_0100', 0, async function (done) {
it('Telephony_Socket_ExtraOptionsBase_receiveBufferSize_0100', 0, function (done) {
console.log("************* Telephony_Socket_ExtraOptionsBase_receiveBufferSize_0100 Test start*************");
let extraOptionsBase: socket.ExtraOptionsBase = {
let extraOptionsBase = {
receiveBufferSize: 1,
sendBufferSize: 1,
reuseAddress: true,
......@@ -110,9 +112,9 @@ export default function socketJsunit() {
* @tc.name : ExtraOptionsBase.sendBufferSize
* @tc.desc : ExtraOptionsBase.sendBufferSize
*/
it('Telephony_Socket_ExtraOptionsBase_sendBufferSize_0100', 0, async function (done) {
it('Telephony_Socket_ExtraOptionsBase_sendBufferSize_0100', 0, function (done) {
console.log("************* Telephony_Socket_ExtraOptionsBase_sendBufferSize_0100 Test start*************");
let extraOptionsBase: socket.ExtraOptionsBase = {
let extraOptionsBase = {
receiveBufferSize: 1,
sendBufferSize: 1,
reuseAddress: true,
......@@ -128,9 +130,9 @@ export default function socketJsunit() {
* @tc.name : ExtraOptionsBase.reuseAddress
* @tc.desc : ExtraOptionsBase.reuseAddress
*/
it('Telephony_Socket_ExtraOptionsBase_reuseAddress_0100', 0, async function (done) {
it('Telephony_Socket_ExtraOptionsBase_reuseAddress_0100', 0, function (done) {
console.log("************* Telephony_Socket_ExtraOptionsBase_reuseAddress_0100 Test start*************");
let extraOptionsBase: socket.ExtraOptionsBase = {
let extraOptionsBase = {
receiveBufferSize: 1,
sendBufferSize: 1,
reuseAddress: true,
......@@ -146,9 +148,9 @@ export default function socketJsunit() {
* @tc.name : ExtraOptionsBase.socketTimeout
* @tc.desc : ExtraOptionsBase.socketTimeout
*/
it('Telephony_Socket_ExtraOptionsBase_socketTimeout_0100', 0, async function (done) {
it('Telephony_Socket_ExtraOptionsBase_socketTimeout_0100', 0, function (done) {
console.log("************* Telephony_Socket_ExtraOptionsBase_socketTimeout_0100 Test start*************");
let extraOptionsBase: socket.ExtraOptionsBase = {
let extraOptionsBase = {
receiveBufferSize: 1,
sendBufferSize: 1,
reuseAddress: true,
......@@ -164,9 +166,9 @@ export default function socketJsunit() {
* @tc.name : SocketStateBase.isClose
* @tc.desc : SocketStateBase.isClose
*/
it('Telephony_Socket_SocketStateBase_isClose_0100', 0, async function (done) {
it('Telephony_Socket_SocketStateBase_isClose_0100', 0, function (done) {
console.log("************* Telephony_Socket_SocketStateBase_isClose_0100 Test start*************");
let socketStateBase: socket.SocketStateBase = {
let socketStateBase = {
isBound: true,
isClose: true,
isConnected: true
......@@ -181,9 +183,9 @@ export default function socketJsunit() {
* @tc.name : SocketRemoteInfo.port
* @tc.desc : SocketRemoteInfo.port
*/
it('Telephony_Socket_SocketRemoteInfo_port_0100', 0, async function (done) {
it('Telephony_Socket_SocketRemoteInfo_port_0100', 0, function (done) {
console.log("************* Telephony_Socket_SocketRemoteInfo_port_0100 Test start*************");
let socketRemoteInfo: socket.SocketRemoteInfo = {
let socketRemoteInfo = {
address: "test address",
family: 'IPv4',
port: 8080,
......@@ -199,9 +201,9 @@ export default function socketJsunit() {
* @tc.name : SocketRemoteInfo.size
* @tc.desc : SocketRemoteInfo.size
*/
it('Telephony_Socket_SocketRemoteInfo_size_0100', 0, async function (done) {
it('Telephony_Socket_SocketRemoteInfo_size_0100', 0, function (done) {
console.log("************* Telephony_Socket_SocketRemoteInfo_size_0100 Test start*************");
let socketRemoteInfo: socket.SocketRemoteInfo = {
let socketRemoteInfo = {
address: "test address",
family: 'IPv4',
port: 8080,
......@@ -217,9 +219,9 @@ export default function socketJsunit() {
* @tc.name : TCPConnectOptions.timeout
* @tc.desc : TCPConnectOptions.timeout
*/
it('Telephony_Socket_TCPConnectOptions_timeout_0100', 0, async function (done) {
it('Telephony_Socket_TCPConnectOptions_timeout_0100', 0, function (done) {
console.log("************* Telephony_Socket_TCPConnectOptions_timeout_0100 Test start*************");
let tcpConnectOptions: socket.TCPConnectOptions = {
let tcpConnectOptions = {
address: {
address: "test address",
family: 1,
......@@ -237,9 +239,9 @@ export default function socketJsunit() {
* @tc.name : TCPSendOptions.data
* @tc.desc : TCPSendOptions.data
*/
it('Telephony_Socket_TCPSendOptions_data_0100', 0, async function (done) {
it('Telephony_Socket_TCPSendOptions_data_0100', 0, function (done) {
console.log("************* Telephony_Socket_TCPSendOptions_data_0100 Test start*************");
let tcpSendOptions: socket.TCPSendOptions = {
let tcpSendOptions = {
data: "test data",
encoding: "test encoding"
}
......@@ -253,9 +255,9 @@ export default function socketJsunit() {
* @tc.name : TCPSendOptions.encoding
* @tc.desc : TCPSendOptions.encoding
*/
it('Telephony_Socket_TCPSendOptions_encoding_0100', 0, async function (done) {
it('Telephony_Socket_TCPSendOptions_encoding_0100', 0, function (done) {
console.log("************* Telephony_Socket_TCPSendOptions_encoding_0100 Test start*************");
let tcpSendOptions: socket.TCPSendOptions = {
let tcpSendOptions = {
data: "test data",
encoding: "test encoding"
}
......@@ -269,9 +271,9 @@ export default function socketJsunit() {
* @tc.name : TCPExtraOptions.keepAlive
* @tc.desc : TCPExtraOptions.keepAlive
*/
it('Telephony_Socket_TCPExtraOptions_keepAlive_0100', 0, async function (done) {
it('Telephony_Socket_TCPExtraOptions_keepAlive_0100', 0, function (done) {
console.log("************* Telephony_Socket_TCPExtraOptions_keepAlive_0100 Test start*************");
let tcpExtraOptions: socket.TCPExtraOptions = {
let tcpExtraOptions = {
keepAlive: true,
OOBInline: false,
TCPNoDelay: true,
......@@ -290,9 +292,9 @@ export default function socketJsunit() {
* @tc.name : TCPExtraOptions.OOBInline
* @tc.desc : TCPExtraOptions.OOBInline
*/
it('Telephony_Socket_TCPExtraOptions_OOBInline_0100', 0, async function (done) {
it('Telephony_Socket_TCPExtraOptions_OOBInline_0100', 0, function (done) {
console.log("************* Telephony_Socket_TCPExtraOptions_OOBInline_0100 Test start*************");
let tcpExtraOptions: socket.TCPExtraOptions = {
let tcpExtraOptions = {
keepAlive: true,
OOBInline: false,
TCPNoDelay: true,
......@@ -311,9 +313,9 @@ export default function socketJsunit() {
* @tc.name : TCPExtraOptions.TCPNoDelay
* @tc.desc : TCPExtraOptions.TCPNoDelay
*/
it('Telephony_Socket_TCPExtraOptions_TCPNoDelay_0100', 0, async function (done) {
it('Telephony_Socket_TCPExtraOptions_TCPNoDelay_0100', 0, function (done) {
console.log("************* Telephony_Socket_TCPExtraOptions_TCPNoDelay_0100 Test start*************");
let tcpExtraOptions: socket.TCPExtraOptions = {
let tcpExtraOptions = {
keepAlive: true,
OOBInline: false,
TCPNoDelay: true,
......@@ -332,9 +334,9 @@ export default function socketJsunit() {
* @tc.name : TCPExtraOptions.socketLinger
* @tc.desc : TCPExtraOptions.socketLinger
*/
it('Telephony_Socket_TCPExtraOptions_socketLinger_0100', 0, async function (done) {
it('Telephony_Socket_TCPExtraOptions_socketLinger_0100', 0, function (done) {
console.log("************* Telephony_Socket_TCPExtraOptions_socketLinger_0100 Test start*************");
let tcpExtraOptions: socket.TCPExtraOptions = {
let tcpExtraOptions = {
keepAlive: true,
OOBInline: false,
TCPNoDelay: true,
......@@ -355,15 +357,15 @@ export default function socketJsunit() {
* @tc.name : bind
* @tc.desc : Binds the IP address and port number.
*/
it('Telephony_Socket_UDPSocket_bind_0100', 0, async function (done) {
it('Telephony_Socket_UDPSocket_bind_0100', 0, function (done) {
let caseName = "Telephony_Socket_UDPSocket_bind_0100"
console.log("************* Telephony_Socket_UDPSocket_bind_0100 Test start*************");
let netAddress: socket.NetAddress = {
let netAddress = {
address: "test address",
family: 1,
port: 8080
}
socket.UDPSocket.bind(netAddress, (error, data) => {
udp.bind(netAddress, (error, data) => {
if (error) {
console.log(`${caseName} error, case success,error:${toString(error)}`);
done();
......@@ -382,10 +384,10 @@ export default function socketJsunit() {
* @tc.name : bind
* @tc.desc : Binds the IP address and port number.
*/
it('Telephony_Socket_UDPSocket_bind_0200', 0, async function (done) {
it('Telephony_Socket_UDPSocket_bind_0200', 0, function (done) {
let caseName = "Telephony_Socket_UDPSocket_bind_0200"
console.log("************* Telephony_Socket_UDPSocket_bind_0200 Test start*************");
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
......@@ -396,13 +398,17 @@ export default function socketJsunit() {
port: 8080
}
try {
await socket.UDPSocket.bind(netAddress).then(data => {
udp.bind(netAddress).then(data => {
console.log(`${caseName} success,data:${toString(data)}`);
done();
}).catch((error) => {
console.log(`${caseName} failed,error:${toString(error)}`);
done();
});
done();
} catch (err) {
console.log(`${caseName} failed,catch error:${toString(error)}`);
done();
}
console.log("************* Telephony_Socket_UDPSocket_bind_0200 Test end*************");
done();
......@@ -413,13 +419,13 @@ export default function socketJsunit() {
* @tc.name : bind
* @tc.desc : Binds the IP address and port number.
*/
it('Telephony_Socket_UDPSocket_bind_0300', 0, async function (done) {
it('Telephony_Socket_UDPSocket_bind_0300', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_bind_0300 Test start*************");
let caseName = "Telephony_Socket_UDPSocket_bind_0300"
let netAddress: socket.NetAddress = {
let netAddress = {
address: "second test address"
}
socket.UDPSocket.bind(netAddress, (error, data) => {
udp.bind(netAddress, (error, data) => {
if (error) {
console.log(`${caseName} error, case success,error:${toString(error)}`);
done();
......@@ -438,23 +444,25 @@ export default function socketJsunit() {
* @tc.name : bind
* @tc.desc : Binds the IP address and port number.
*/
it('Telephony_Socket_UDPSocket_bind_0400', 0, async function (done) {
it('Telephony_Socket_UDPSocket_bind_0400', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_bind_0400 Test start*************");
let caseName = "Telephony_Socket_UDPSocket_bind_0400"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
let netAddress: socket.NetAddress = {
let netAddress = {
address: "third test address",
family: 3,
port: 8080
}
socket.UDPSocket.bind(netAddress).then(data => {
udp.bind(netAddress).then(data => {
console.log(`${caseName} success,data:${toString(data)}`);
done();
}).catch((error) => {
console.log(`${caseName} failed,error:${toString(error)}`);
done();
});
console.log("************* Telephony_Socket_UDPSocket_bind_0400 Test end*************");
done();
......@@ -465,15 +473,15 @@ export default function socketJsunit() {
* @tc.name : send
* @tc.desc : Sends data over a UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_send_0100', 0, async function (done) {
it('Telephony_Socket_UDPSocket_send_0100', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_send_0100 Test start*************");
let caseName = "Telephony_Socket_UDPSocket_send_0100"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
let udpSendOptions: socket.UDPSendOptions = {
let udpSendOptions = {
data: "test data",
address: {
address: "test address",
......@@ -481,7 +489,7 @@ export default function socketJsunit() {
port: 8080
}
}
socket.UDPSocket.send(udpSendOptions, (error, data) => {
udp.send(udpSendOptions, (error, data) => {
if (error) {
console.log(`${caseName} error, case success,error:${toString(error)}`);
done();
......@@ -500,15 +508,15 @@ export default function socketJsunit() {
* @tc.name : send
* @tc.desc : Sends data over a UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_send_0200', 0, async function (done) {
it('Telephony_Socket_UDPSocket_send_0200', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_send_0200 Test start*************");
let caseName = "Telephony_Socket_UDPSocket_send_0200"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
let udpSendOptions: socket.UDPSendOptions = {
let udpSendOptions = {
data: "test data",
address: {
address: "test address",
......@@ -516,7 +524,7 @@ export default function socketJsunit() {
port: 8080
}
}
socket.UDPSocket.send(udpSendOptions).then(data => {
udp.send(udpSendOptions).then(data => {
console.log(`${caseName} success,data:${toString(data)}`);
}).catch((error) => {
console.log(`${caseName} failed,error:${toString(error)}`);
......@@ -530,21 +538,21 @@ export default function socketJsunit() {
* @tc.name : send
* @tc.desc : Sends data over a UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_send_0300', 0, async function (done) {
it('Telephony_Socket_UDPSocket_send_0300', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_send_0300 Test start*************");
let caseName = "Telephony_Socket_UDPSocket_send_0300"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
let udpSendOptions: socket.UDPSendOptions = {
let udpSendOptions = {
data: "test data",
address: {
address: "second test address",
}
}
socket.UDPSocket.send(udpSendOptions, (error, data) => {
udp.send(udpSendOptions, (error, data) => {
if (error) {
console.log(`${caseName} error, case success,error:${toString(error)}`);
done();
......@@ -563,21 +571,21 @@ export default function socketJsunit() {
* @tc.name : send
* @tc.desc : Sends data over a UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_send_0400', 0, async function (done) {
it('Telephony_Socket_UDPSocket_send_0400', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_send_0400 Test start*************");
let caseName = "Telephony_Socket_UDPSocket_send_0400"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
let udpSendOptions: socket.UDPSendOptions = {
let udpSendOptions = {
data: "test data",
address: {
address: "third test address"
}
}
socket.UDPSocket.send(udpSendOptions).then(data => {
udp.send(udpSendOptions).then(data => {
console.log(`${caseName} success,data:${toString(data)}`);
}).catch((error) => {
console.log(`${caseName} failed,error:${toString(error)}`);
......@@ -591,15 +599,15 @@ export default function socketJsunit() {
* @tc.name : close
* @tc.desc : Closes a UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_close_0100', 0, async function (done) {
it('Telephony_Socket_UDPSocket_close_0100', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_close_0100 Test start*************");
let caseName = "Telephony_Socket_UDPSocket_close_0100"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.UDPSocket.close((error, data) => {
udp.close((error, data) => {
if (error) {
console.log(`${caseName} error, case success,error:${toString(error)}`);
done();
......@@ -617,15 +625,15 @@ export default function socketJsunit() {
* @tc.name : close
* @tc.desc : Closes a UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_close_0200', 0, async function (done) {
it('Telephony_Socket_UDPSocket_close_0200', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_close_0200 Test start*************");
let caseName = "Telephony_Socket_UDPSocket_close_0200"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.UDPSocket.close().then(data => {
udp.close().then(data => {
console.log(`${caseName} success,data:${toString(data)}`);
}).catch((error) => {
console.log(`${caseName} failed,error:${toString(error)}`);
......@@ -639,21 +647,21 @@ export default function socketJsunit() {
* @tc.name : getState
* @tc.desc : Obtains the status of the UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_getState_0100', 0, async function (done) {
it('Telephony_Socket_UDPSocket_getState_0100', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_getState_0100 Test start*************");
let caseName = "Telephony_Socket_UDPSocket_getState_0100"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.UDPSocket.getState((error, data) => {
udp.getState((error, data) => {
if (error) {
console.log(`${caseName} error, case success,error:${toString(error)}`);
done();
return;
}
let socketStateBase: socket.SocketStateBase = data
let socketStateBase = data
console.log(`${caseName} data:${toString(socketStateBase.isClose)}`);
done();
})
......@@ -666,15 +674,15 @@ export default function socketJsunit() {
* @tc.name : getState
* @tc.desc : Obtains the status of the UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_getState_0200', 0, async function (done) {
it('Telephony_Socket_UDPSocket_getState_0200', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_getState_0200 Test start*************");
let caseName = "Telephony_Socket_UDPSocket_getState_0200"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.UDPSocket.getState().then(data => {
udp.getState().then(data => {
console.log(`${caseName} success,data:${toString(data)}`);
}).catch((error) => {
console.log(`${caseName} failed,error:${toString(error)}`);
......@@ -689,28 +697,36 @@ export default function socketJsunit() {
* @tc.name : setExtraOptions
* @tc.desc : Sets other attributes of the UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_setExtraOptions_0100', 0, async function (done) {
it('Telephony_Socket_UDPSocket_setExtraOptions_0100', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_setExtraOptions_0100 Test start*************");
let caseName = "Telephony_Socket_UDPSocket_setExtraOptions_0100"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
let udpExtraOptions: socket.UDPExtraOptions = {
let udpExtraOptions = {
broadcast: true
}
socket.UDPSocket.setExtraOptions(udpExtraOptions, (error) => {
if (error) {
console.log(`${caseName} error, case success,error:${toString(error)}`);
done();
return;
}
expect().assertFail();
expect(true).assertTrue();
console.log(`${caseName} error, case failed`);
done();
})
try{
udp.setExtraOptions(udpExtraOptions, funtion(error,data) {
if (error) {
expect().assertFail();
console.log(`${caseName} error, case failed,error: ` + JSON.stringify(error));
done();
} else{
expect().assertTrue();
console.log(`${caseName} error, case success failed`);
done();
}
done();
})
done();
} catch(error){
console.log(`${caseName} failed,error:${error}`);
expect(true).assertTrue();
done();
}
console.log("************* Telephony_Socket_UDPSocket_setExtraOptions_0100 Test end*************");
done();
});
......@@ -720,14 +736,14 @@ export default function socketJsunit() {
* @tc.name : setExtraOptions
* @tc.desc : Sets other attributes of the UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_setExtraOptions_0200', 0, async function (done) {
it('Telephony_Socket_UDPSocket_setExtraOptions_0200', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_setExtraOptions_0200 Test start*************");
let caseName = "Telephony_Socket_UDPSocket_setExtraOptions_0200"
let udpExtraOptions: socket.UDPExtraOptions = {
let udpExtraOptions = {
broadcast: true
}
try {
await socket.UDPSocket.setExtraOptions(udpExtraOptions);
udp.setExtraOptions(udpExtraOptions);
console.log(`${caseName} success`);
done();
} catch (error) {
......@@ -743,16 +759,16 @@ export default function socketJsunit() {
* @tc.name : setExtraOptions
* @tc.desc : Sets other attributes of the UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_setExtraOptions_0300', 0, async function (done) {
it('Telephony_Socket_UDPSocket_setExtraOptions_0300', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_setExtraOptions_0300 Test start*************");
let caseName = "Telephony_Socket_UDPSocket_setExtraOptions_0300"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
let udpExtraOptions: socket.UDPExtraOptions = {}
socket.UDPSocket.setExtraOptions(udpExtraOptions, (error) => {
let udpExtraOptions = {}
udp.setExtraOptions(udpExtraOptions, (error) => {
if (error) {
console.log(`${caseName} error, case success,error:${toString(error)}`);
done();
......@@ -771,12 +787,14 @@ export default function socketJsunit() {
* @tc.name : setExtraOptions
* @tc.desc : Sets other attributes of the UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_setExtraOptions_0400', 0, async function (done) {
it('Telephony_Socket_UDPSocket_setExtraOptions_0400', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_setExtraOptions_0400 Test start*************");
let caseName = "Telephony_Socket_UDPSocket_setExtraOptions_0400"
let udpExtraOptions: socket.UDPExtraOptions = {}
let udpExtraOptions = {}
try {
await socket.UDPSocket.setExtraOptions(udpExtraOptions);
udp.setExtraOptions(udpExtraOptions).then(function(data){
console.log(`${caseName}`);
});
console.log(`${caseName} success`);
done();
} catch (error) {
......@@ -793,16 +811,16 @@ export default function socketJsunit() {
* @tc.name : on
* @tc.desc : Listens for message receiving events of the UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_on_message_0100', 0, async function (done) {
it('Telephony_Socket_UDPSocket_on_message_0100', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_on_message_0100 Test start*************");
let caseName = "Telephony_Socket_UDPSocket_on_message_0100"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.UDPSocket.on('message', (data) => {
let socketRemoteInfo: socket.SocketRemoteInfo = data.remoteInfo;
udp.on('message', (data) => {
let socketRemoteInfo = data.remoteInfo;
console.log(`${caseName} port:${socketRemoteInfo.port}`);
console.log(`${caseName} size:${socketRemoteInfo.size}`);
});
......@@ -815,16 +833,16 @@ export default function socketJsunit() {
* @tc.name : off
* @tc.desc : Cancels listening for message receiving events of the UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_off_message_0100', 0, async function (done) {
it('Telephony_Socket_UDPSocket_off_message_0100', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_off_message_0100 Test start*************");
let caseName = "Telephony_Socket_UDPSocket_off_message_0100"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.UDPSocket.off("message", data => {
let socketRemoteInfo: socket.SocketRemoteInfo = data.remoteInfo;
udp.off("message", data => {
let socketRemoteInfo = data.remoteInfo;
console.log(`${caseName} port:${socketRemoteInfo.port}`);
console.log(`${caseName} size:${socketRemoteInfo.size}`);
});
......@@ -837,14 +855,14 @@ export default function socketJsunit() {
* @tc.name : off
* @tc.desc : Cancels listening for message receiving events of the UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_off_message_0200', 0, async function (done) {
it('Telephony_Socket_UDPSocket_off_message_0200', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_off_message_0200 Test start*************");
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.UDPSocket.off("message");
udp.off("message");
expect(true).assertTrue();
console.log("************* Telephony_Socket_UDPSocket_off_message_0200 Test end*************");
done();
......@@ -855,14 +873,14 @@ export default function socketJsunit() {
* @tc.name : on
* @tc.desc : Listens for data packet message events or close events of the UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_on_listening_0100', 0, async function (done) {
it('Telephony_Socket_UDPSocket_on_listening_0100', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_on_listening_0100 Test start*************");
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.UDPSocket.on("listening", data => {
udp.on("listening", data => {
expect(true).assertTrue();
});
console.log("************* Telephony_Socket_UDPSocket_on_listening_0100 Test end*************");
......@@ -874,14 +892,14 @@ export default function socketJsunit() {
* @tc.name : off
* @tc.desc : Cancels listening for data packet message events or close events of the UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_off_listening_0100', 0, async function (done) {
it('Telephony_Socket_UDPSocket_off_listening_0100', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_off_listening_0100 Test start*************");
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.UDPSocket.off("listening", data => {
udp.off("listening", data => {
expect(true).assertTrue();
});
console.log("************* Telephony_Socket_UDPSocket_off_listening_0100 Test end*************");
......@@ -893,14 +911,14 @@ export default function socketJsunit() {
* @tc.name : off
* @tc.desc : Cancels listening for data packet message events or close events of the UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_off_listening_0200', 0, async function (done) {
it('Telephony_Socket_UDPSocket_off_listening_0200', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_off_listening_0200 Test start*************");
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.UDPSocket.off("listening");
udp.off("listening");
expect(true).assertTrue();
console.log("************* Telephony_Socket_UDPSocket_off_listening_0200 Test end*************");
done();
......@@ -911,14 +929,14 @@ export default function socketJsunit() {
* @tc.name : on
* @tc.desc : Listens for data packet message events or close events of the UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_on_close_0100', 0, async function (done) {
it('Telephony_Socket_UDPSocket_on_close_0100', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_on_close_0100 Test start*************");
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.UDPSocket.on("close", data => {
udp.on("close", data => {
expect(true).assertTrue();
});
console.log("************* Telephony_Socket_UDPSocket_on_close_0100 Test end*************");
......@@ -930,14 +948,14 @@ export default function socketJsunit() {
* @tc.name : off
* @tc.desc : Cancels listening for data packet message events or close events of the UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_off_close_0100', 0, async function (done) {
it('Telephony_Socket_UDPSocket_off_close_0100', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_off_close_0100 Test start*************");
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.UDPSocket.off("close", data => {
udp.off("close", data => {
expect(true).assertTrue();
});
console.log("************* Telephony_Socket_UDPSocket_off_close_0100 Test end*************");
......@@ -949,14 +967,14 @@ export default function socketJsunit() {
* @tc.name : off
* @tc.desc : Cancels listening for data packet message events or close events of the UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_off_close_0200', 0, async function (done) {
it('Telephony_Socket_UDPSocket_off_close_0200', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_off_close_0200 Test start*************");
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.UDPSocket.off("close");
udp.off("close");
expect(true).assertTrue();
console.log("************* Telephony_Socket_UDPSocket_off_close_0200 Test end*************");
done();
......@@ -967,15 +985,15 @@ export default function socketJsunit() {
* @tc.name : on
* @tc.desc : Listens for error events of the UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_on_error_0100', 0, async function (done) {
it('Telephony_Socket_UDPSocket_on_error_0100', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_on_error_0100 Test start*************");
let caseName = "Telephony_Socket_UDPSocket_on_error_0100"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.UDPSocket.on("error", error => {
udp.on("error", error => {
console.log(`${caseName} fail, error:${toString(error)}`);
expect().assertFail();
});
......@@ -989,15 +1007,15 @@ export default function socketJsunit() {
* @tc.name : off
* @tc.desc : Cancels listening for error events of the UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_off_error_0100', 0, async function (done) {
it('Telephony_Socket_UDPSocket_off_error_0100', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_off_error_0100 Test start*************");
let caseName = "Telephony_Socket_UDPSocket_off_error_0100"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.UDPSocket.off("error", error => {
udp.off("error", error => {
console.log(`${caseName} fail, error:${toString(error)}`);
expect().assertFail();
});
......@@ -1011,14 +1029,14 @@ export default function socketJsunit() {
* @tc.name : off
* @tc.desc : Cancels listening for error events of the UDPSocket connection.
*/
it('Telephony_Socket_UDPSocket_off_error_0200', 0, async function (done) {
it('Telephony_Socket_UDPSocket_off_error_0200', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_off_error_0200 Test start*************");
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.UDPSocket.off("error");
udp.off("error");
expect(true).assertTrue();
console.log("************* Telephony_Socket_UDPSocket_off_error_0200 Test end*************");
done();
......@@ -1029,15 +1047,15 @@ export default function socketJsunit() {
* @tc.name : bind
* @tc.desc : Binds the IP address and port number
*/
it('Telephony_Socket_TCPSocket_bind_0100', 0, async function (done) {
it('Telephony_Socket_TCPSocket_bind_0100', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_bind_0100 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_bind_0100"
let netAddress: socket.NetAddress = {
let netAddress = {
address: "test address",
family: 1,
port: 8080
}
socket.TCPSocket.bind(netAddress, (error, data) => {
tcp.bind(netAddress, (error, data) => {
if (error) {
console.log(`${caseName} error, case success,error:${toString(error)}`);
done();
......@@ -1056,23 +1074,25 @@ export default function socketJsunit() {
* @tc.name : bind
* @tc.desc : Binds the IP address and port number
*/
it('Telephony_Socket_TCPSocket_bind_0200', 0, async function (done) {
it('Telephony_Socket_TCPSocket_bind_0200', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_bind_0200 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_bind_0200"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
let netAddress: socket.NetAddress = {
let netAddress = {
address: "test address",
family: 1,
port: 8080
}
socket.TCPSocket.bind(netAddress).then(data => {
tcp.bind(netAddress).then(data => {
console.log(`${caseName} success,data:${toString(data)}`);
done();
}).catch((error) => {
console.log(`${caseName} failed,error:${toString(error)}`);
done();
});
console.log("************* Telephony_Socket_TCPSocket_bind_0200 Test end*************");
done();
......@@ -1083,13 +1103,13 @@ export default function socketJsunit() {
* @tc.name : bind
* @tc.desc : Binds the IP address and port number
*/
it('Telephony_Socket_TCPSocket_bind_0300', 0, async function (done) {
it('Telephony_Socket_TCPSocket_bind_0300', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_bind_0300 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_bind_0300"
let netAddress: socket.NetAddress = {
let netAddress = {
address: "second test address",
}
socket.TCPSocket.bind(netAddress, (error, data) => {
tcp.bind(netAddress, (error, data) => {
if (error) {
console.log(`${caseName} error, case success,error:${toString(error)}`);
done();
......@@ -1108,21 +1128,23 @@ export default function socketJsunit() {
* @tc.name : bind
* @tc.desc : Binds the IP address and port number
*/
it('Telephony_Socket_TCPSocket_bind_0400', 0, async function (done) {
it('Telephony_Socket_TCPSocket_bind_0400', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_bind_0400 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_bind_0400"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
let netAddress: socket.NetAddress = {
let netAddress = {
address: "third test address"
}
socket.TCPSocket.bind(netAddress).then(data => {
tcp.bind(netAddress).then(data => {
console.log(`${caseName} success,data:${toString(data)}`);
done();
}).catch((error) => {
console.log(`${caseName} failed,error:${toString(error)}`);
done();
});
console.log("************* Telephony_Socket_TCPSocket_bind_0400 Test end*************");
done();
......@@ -1133,19 +1155,19 @@ export default function socketJsunit() {
* @tc.name : send
* @tc.desc : Sends data over a TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_send_0100', 0, async function (done) {
it('Telephony_Socket_TCPSocket_send_0100', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_send_0100 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_send_0100"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
let tcpSendOptions: socket.TCPSendOptions = {
let tcpSendOptions = {
data: "test data",
encoding: "test encoding"
}
socket.TCPSocket.send(tcpSendOptions, (error, data) => {
tcp.send(tcpSendOptions, (error, data) => {
if (error) {
console.log(`${caseName} error, case success,error:${toString(error)}`);
done();
......@@ -1164,19 +1186,19 @@ export default function socketJsunit() {
* @tc.name : send
* @tc.desc : Sends data over a TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_send_0200', 0, async function (done) {
it('Telephony_Socket_TCPSocket_send_0200', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_send_0200 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_send_0200"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
let tcpSendOptions: socket.TCPSendOptions = {
let tcpSendOptions = {
data: "test data",
encoding: "test encoding"
}
socket.TCPSocket.send(tcpSendOptions).then(data => {
tcp.send(tcpSendOptions).then(data => {
console.log(`${caseName} success,data:${toString(data)}`);
}).catch((error) => {
console.log(`${caseName} failed,error:${toString(error)}`);
......@@ -1190,18 +1212,18 @@ export default function socketJsunit() {
* @tc.name : send
* @tc.desc : Sends data over a TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_send_0300', 0, async function (done) {
it('Telephony_Socket_TCPSocket_send_0300', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_send_0300 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_send_0300"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
let tcpSendOptions: socket.TCPSendOptions = {
let tcpSendOptions = {
data: "second test data",
}
socket.TCPSocket.send(tcpSendOptions, (error, data) => {
tcp.send(tcpSendOptions, (error, data) => {
if (error) {
console.log(`${caseName} error, case success,error:${toString(error)}`);
done();
......@@ -1220,18 +1242,18 @@ export default function socketJsunit() {
* @tc.name : send
* @tc.desc : Sends data over a TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_send_0400', 0, async function (done) {
it('Telephony_Socket_TCPSocket_send_0400', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_send_0400 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_send_0400"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
let tcpSendOptions: socket.TCPSendOptions = {
let tcpSendOptions = {
data: "second test data",
}
socket.TCPSocket.send(tcpSendOptions).then(data => {
tcp.send(tcpSendOptions).then(data => {
console.log(`${caseName} success,data:${toString(data)}`);
}).catch((error) => {
console.log(`${caseName} failed,error:${toString(error)}`);
......@@ -1245,15 +1267,15 @@ export default function socketJsunit() {
* @tc.name : connect
* @tc.desc : Sets up a connection to the specified IP address and port number.
*/
it('Telephony_Socket_TCPSocket_connect_0100', 0, async function (done) {
it('Telephony_Socket_TCPSocket_connect_0100', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_connect_0100 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_connect_0100"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
let tcpConnectOptions: socket.TCPConnectOptions = {
let tcpConnectOptions = {
address: {
address: "test address",
family: 1,
......@@ -1261,7 +1283,7 @@ export default function socketJsunit() {
},
timeout: 1000
}
socket.TCPSocket.connect(tcpConnectOptions, (error, data) => {
tcp.connect(tcpConnectOptions, (error, data) => {
if (error) {
console.log(`${caseName} error, case success,error:${toString(error)}`);
done();
......@@ -1280,15 +1302,15 @@ export default function socketJsunit() {
* @tc.name : connect
* @tc.desc : Sets up a connection to the specified IP address and port number.
*/
it('Telephony_Socket_TCPSocket_connect_0200', 0, async function (done) {
it('Telephony_Socket_TCPSocket_connect_0200', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_connect_0200 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_connect_0200"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
let tcpConnectOptions: socket.TCPConnectOptions = {
let tcpConnectOptions = {
address: {
address: "test address",
family: 1,
......@@ -1296,7 +1318,7 @@ export default function socketJsunit() {
},
timeout: 1000
}
socket.TCPSocket.connect(tcpConnectOptions).then(function (data) {
tcp.connect(tcpConnectOptions).then(function (data) {
console.log(`${caseName} success,data:${toString(data)}`);
}).catch((error) => {
console.log(`${caseName} failed,error:${toString(error)}`);
......@@ -1310,22 +1332,22 @@ export default function socketJsunit() {
* @tc.name : connect
* @tc.desc : Sets up a connection to the specified IP address and port number.
*/
it('Telephony_Socket_TCPSocket_connect_0300', 0, async function (done) {
it('Telephony_Socket_TCPSocket_connect_0300', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_connect_0300 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_connect_0300"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
let tcpConnectOptions: socket.TCPConnectOptions = {
let tcpConnectOptions = {
address: {
address: "second test address",
family: 1,
port: 8080
}
}
socket.TCPSocket.connect(tcpConnectOptions, (error, data) => {
tcp.connect(tcpConnectOptions, (error, data) => {
if (error) {
console.log(`${caseName} error, case success,error:${toString(error)}`);
done();
......@@ -1344,22 +1366,22 @@ export default function socketJsunit() {
* @tc.name : connect
* @tc.desc : Sets up a connection to the specified IP address and port number.
*/
it('Telephony_Socket_TCPSocket_connect_0200', 0, async function (done) {
it('Telephony_Socket_TCPSocket_connect_0200', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_connect_0400 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_connect_0400"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
let tcpConnectOptions: socket.TCPConnectOptions = {
let tcpConnectOptions = {
address: {
address: "second test address",
family: 1,
port: 8080
}
}
socket.TCPSocket.connect(tcpConnectOptions).then(function (data) {
tcp.connect(tcpConnectOptions).then(function (data) {
console.log(`${caseName} success,data:${toString(data)}`);
}).catch((error) => {
console.log(`${caseName} failed,error:${toString(error)}`);
......@@ -1373,15 +1395,15 @@ export default function socketJsunit() {
* @tc.name : close
* @tc.desc : Closes a UDPSocket connection.
*/
it('Telephony_Socket_TCPSocket_close_0100', 0, async function (done) {
it('Telephony_Socket_TCPSocket_close_0100', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_close_0100 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_close_0100"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.TCPSocket.close((error, data) => {
tcp.close((error, data) => {
if (error) {
console.log(`${caseName} error, case success,error:${toString(error)}`);
done();
......@@ -1399,15 +1421,15 @@ export default function socketJsunit() {
* @tc.name : close
* @tc.desc : Closes a UDPSocket connection.
*/
it('Telephony_Socket_TCPSocket_close_0200', 0, async function (done) {
it('Telephony_Socket_TCPSocket_close_0200', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_close_0200 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_close_0200"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.TCPSocket.close().then(data => {
tcp.close().then(data => {
console.log(`${caseName} success,data:${toString(data)}`);
}).catch((error) => {
console.log(`${caseName} failed,error:${toString(error)}`);
......@@ -1421,15 +1443,15 @@ export default function socketJsunit() {
* @tc.name : getState
* @tc.desc : Obtains the status of the TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_getState_0100', 0, async function (done) {
it('Telephony_Socket_TCPSocket_getState_0100', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_getState_0100 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_getState_0100"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.TCPSocket.getState((error, data) => {
tcp.getState((error, data) => {
if (error) {
console.log(`${caseName} case success,error:${toString(error)}`);
done();
......@@ -1448,15 +1470,15 @@ export default function socketJsunit() {
* @tc.name : getState
* @tc.desc : Obtains the status of the TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_getState_0200', 0, async function (done) {
it('Telephony_Socket_TCPSocket_getState_0200', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_getState_0200 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_getState_0200"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.TCPSocket.getState().then(data => {
tcp.getState().then(data => {
console.log(`${caseName} success,data:${toString(data)}`);
}).catch((error) => {
console.log(`${caseName} failed,error:${toString(error)}`);
......@@ -1471,15 +1493,15 @@ export default function socketJsunit() {
* @tc.name : setExtraOptions
* @tc.desc : Sets other attributes of the TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_setExtraOptions_0100', 0, async function (done) {
it('Telephony_Socket_TCPSocket_setExtraOptions_0100', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_setExtraOptions_0100 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_setExtraOptions_0100"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
let tcpExtraOptions: socket.TCPExtraOptions = {
let tcpExtraOptions = {
keepAlive: true,
OOBInline: true,
TCPNoDelay: true,
......@@ -1488,7 +1510,7 @@ export default function socketJsunit() {
linger: true
}
}
socket.TCPSocket.setExtraOptions(tcpExtraOptions, (error) => {
tcp.setExtraOptions(tcpExtraOptions, (error) => {
if (error) {
console.log(`${caseName} error, case success,error:${toString(error)}`);
done();
......@@ -1507,15 +1529,15 @@ export default function socketJsunit() {
* @tc.name : setExtraOptions
* @tc.desc : Sets other attributes of the TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_setExtraOptions_0200', 0, async function (done) {
it('Telephony_Socket_TCPSocket_setExtraOptions_0200', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_setExtraOptions_0200 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_setExtraOptions_0200"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
let tcpExtraOptions: socket.TCPExtraOptions = {
let tcpExtraOptions = {
keepAlive: true,
OOBInline: true,
TCPNoDelay: true,
......@@ -1525,7 +1547,9 @@ export default function socketJsunit() {
}
}
try {
await socket.TCPSocket.setExtraOptions(tcpExtraOptions);
tcp.setExtraOptions(tcpExtraOptions).then(function(data) {
console.log(`${caseName}`);
});
console.log(`${caseName} success`);
expect(true).assertTrue();
done();
......@@ -1542,21 +1566,21 @@ export default function socketJsunit() {
* @tc.name : setExtraOptions
* @tc.desc : Sets other attributes of the TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_setExtraOptions_0300', 0, async function (done) {
it('Telephony_Socket_TCPSocket_setExtraOptions_0300', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_setExtraOptions_0300 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_setExtraOptions_0300"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
let tcpExtraOptions: socket.TCPExtraOptions = {
let tcpExtraOptions = {
socketLinger: {
on: true,
linger: true
}
}
socket.TCPSocket.setExtraOptions(tcpExtraOptions, (error) => {
tcp.setExtraOptions(tcpExtraOptions, (error) => {
if (error) {
console.log(`${caseName} error, case success,error:${toString(error)}`);
done();
......@@ -1575,22 +1599,24 @@ export default function socketJsunit() {
* @tc.name : setExtraOptions
* @tc.desc : Sets other attributes of the TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_setExtraOptions_0400', 0, async function (done) {
it('Telephony_Socket_TCPSocket_setExtraOptions_0400', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_setExtraOptions_0400 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_setExtraOptions_0400"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
let tcpExtraOptions: socket.TCPExtraOptions = {
let tcpExtraOptions = {
socketLinger: {
on: true,
linger: true
}
}
try {
await socket.TCPSocket.setExtraOptions(tcpExtraOptions);
tcp.setExtraOptions(tcpExtraOptions).then(function(data){
console.log(`${caseName}`);
});
console.log(`${caseName} success`);
expect(true).assertTrue();
done();
......@@ -1607,15 +1633,15 @@ export default function socketJsunit() {
* @tc.name : getRemoteAddress
* @tc.desc : Obtains the peer address of a TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_getRemoteAddress_0100', 0, async function (done) {
it('Telephony_Socket_TCPSocket_getRemoteAddress_0100', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_getRemoteAddress_0100 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_getRemoteAddress_0100"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.TCPSocket.getRemoteAddress((error) => {
tcp.getRemoteAddress((error) => {
if (error) {
console.log(`${caseName} error, case success,error:${toString(error)}`);
done();
......@@ -1633,15 +1659,15 @@ export default function socketJsunit() {
* @tc.name : getRemoteAddress
* @tc.desc : Obtains the peer address of a TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_getRemoteAddress_0200', 0, async function (done) {
it('Telephony_Socket_TCPSocket_getRemoteAddress_0200', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_getRemoteAddress_0200 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_getRemoteAddress_0200"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.TCPSocket.getRemoteAddress().then(data => {
tcp.getRemoteAddress().then(data => {
console.log(`${caseName} success,data:${toString(data)}`);
}).catch((error) => {
console.log(`${caseName} failed,error:${toString(error)}`);
......@@ -1655,15 +1681,15 @@ export default function socketJsunit() {
* @tc.name : on
* @tc.desc : Listens for message receiving events of the TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_on_message_0100', 0, async function (done) {
it('Telephony_Socket_TCPSocket_on_message_0100', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_on_message_0100 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_on_message_0100"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.TCPSocket.on("message", data => {
tcp.on("message", data => {
let socketRemoteInfo: socket.SocketRemoteInfo = data.remoteInfo;
console.log(`${caseName} port:${socketRemoteInfo.port}`);
console.log(`${caseName} size:${socketRemoteInfo.size}`);
......@@ -1677,15 +1703,15 @@ export default function socketJsunit() {
* @tc.name : off
* @tc.desc : Cancels listening for message receiving events of the TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_off_message_0100', 0, async function (done) {
it('Telephony_Socket_TCPSocket_off_message_0100', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_off_message_0100 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_off_message_0100"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.TCPSocket.off("message", data => {
tcp.off("message", data => {
let socketRemoteInfo: socket.SocketRemoteInfo = data.remoteInfo;
console.log(`${caseName} port:${socketRemoteInfo.port}`);
console.log(`${caseName} size:${socketRemoteInfo.size}`);
......@@ -1699,14 +1725,14 @@ export default function socketJsunit() {
* @tc.name : off
* @tc.desc : Cancels listening for message receiving events of the TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_off_message_0200', 0, async function (done) {
it('Telephony_Socket_TCPSocket_off_message_0200', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_off_message_0200 Test start*************");
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.TCPSocket.off("message");
tcp.off("message");
expect(true).assertTrue();
console.log("************* Telephony_Socket_TCPSocket_off_message_0200 Test end*************");
done();
......@@ -1717,14 +1743,14 @@ export default function socketJsunit() {
* @tc.name : on
* @tc.desc : Listens for connection or close events of the TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_on_connect_0100', 0, async function (done) {
it('Telephony_Socket_TCPSocket_on_connect_0100', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_on_connect_0100 Test start*************");
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.TCPSocket.on("connect", data => {
tcp.on("connect", data => {
expect(true).assertTrue();
});
console.log("************* Telephony_Socket_TCPSocket_on_connect_0100 Test end*************");
......@@ -1736,14 +1762,14 @@ export default function socketJsunit() {
* @tc.name : off
* @tc.desc : Cancels listening for connection or close events of the TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_off_connect_0100', 0, async function (done) {
it('Telephony_Socket_TCPSocket_off_connect_0100', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_off_connect_0100 Test start*************");
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.TCPSocket.off("connect", data => {
tcp.off("connect", data => {
expect(true).assertTrue();
});
console.log("************* Telephony_Socket_TCPSocket_off_connect_0100 Test end*************");
......@@ -1755,14 +1781,14 @@ export default function socketJsunit() {
* @tc.name : off
* @tc.desc : Cancels listening for connection or close events of the TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_off_connect_0200', 0, async function (done) {
it('Telephony_Socket_TCPSocket_off_connect_0200', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_off_connect_0200 Test start*************");
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.TCPSocket.off("connect");
tcp.off("connect");
expect(true).assertTrue();
console.log("************* Telephony_Socket_TCPSocket_off_connect_0200 Test end*************");
done();
......@@ -1773,14 +1799,14 @@ export default function socketJsunit() {
* @tc.name : on
* @tc.desc : Listens for connection or close events of the TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_on_close_0100', 0, async function (done) {
it('Telephony_Socket_TCPSocket_on_close_0100', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_on_close_0100 Test start*************");
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.TCPSocket.on("close", data => {
tcp.on("close", data => {
expect(true).assertTrue();
});
console.log("************* Telephony_Socket_TCPSocket_on_close_0100 Test end*************");
......@@ -1792,14 +1818,14 @@ export default function socketJsunit() {
* @tc.name : off
* @tc.desc : Cancels listening for connection or close events of the TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_off_close_0100', 0, async function (done) {
it('Telephony_Socket_TCPSocket_off_close_0100', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_off_close_0100 Test start*************");
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.TCPSocket.off("close", data => {
tcp.off("close", data => {
expect(true).assertTrue();
});
console.log("************* Telephony_Socket_TCPSocket_off_close_0100 Test end*************");
......@@ -1811,14 +1837,14 @@ export default function socketJsunit() {
* @tc.name : off
* @tc.desc : Cancels listening for connection or close events of the TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_off_close_0200', 0, async function (done) {
it('Telephony_Socket_TCPSocket_off_close_0200', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_off_close_0200 Test start*************");
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.TCPSocket.off("close");
tcp.off("close");
expect(true).assertTrue();
console.log("************* Telephony_Socket_TCPSocket_off_close_0200 Test end*************");
done();
......@@ -1829,15 +1855,15 @@ export default function socketJsunit() {
* @tc.name : on
* @tc.desc : Listens for error events of the TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_on_error_0100', 0, async function (done) {
it('Telephony_Socket_TCPSocket_on_error_0100', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_on_error_0100 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_on_error_0100"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.TCPSocket.on("error", error => {
tcp.on("error", error => {
console.log(`${caseName} fail, error:${toString(error)}`);
expect().assertFail();
});
......@@ -1851,15 +1877,15 @@ export default function socketJsunit() {
* @tc.name : off
* @tc.desc : Cancels listening for error events of the TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_off_error_0100', 0, async function (done) {
it('Telephony_Socket_TCPSocket_off_error_0100', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_off_error_0100 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_off_error_0100"
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.TCPSocket.off("error", error => {
tcp.off("error", error => {
console.log(`${caseName} fail, error:${toString(error)}`);
expect().assertFail();
});
......@@ -1873,14 +1899,14 @@ export default function socketJsunit() {
* @tc.name : off
* @tc.desc : Cancels listening for error events of the TCPSocket connection.
*/
it('Telephony_Socket_TCPSocket_off_error_0200', 0, async function (done) {
it('Telephony_Socket_TCPSocket_off_error_0200', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_off_error_0200 Test start*************");
if (utils.notCheck) {
if (2 === 0) {
expect(true).assertTrue();
done();
return;
}
socket.TCPSocket.off("error");
tcp.off("error");
expect(true).assertTrue();
console.log("************* Telephony_Socket_TCPSocket_off_error_0200 Test end*************");
done();
......
......@@ -106,17 +106,17 @@ describe('ActsNetworkSearchTest', function () {
radio.getNetworkState(SLOT_2, (err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_getNetworkState_Async_0700 finish err: ${err}`);
expect(data.longOperatorName != 'longOperatorName').assertTrue();
expect(data.shortOperatorName != 'shortOperatorName').assertTrue();
expect(data.plmnNumeric != 'plmnNumeric').assertTrue();
expect(data.isRoaming != true).assertTrue();
expect(data.regState != radio.REG_STATE_IN_SERVICE).assertTrue();
expect(data.nsaState != radio.NSA_STATE_SA_ATTACHED).assertTrue();
expect(data.isCaActive != true).assertTrue();
done();
return;
}
console.log(`Telephony_NetworkSearch_getNetworkState_Async_0700 fail not go to err ${data}`);
expect(data.longOperatorName != 'longOperatorName').assertTrue();
expect(data.shortOperatorName != 'shortOperatorName').assertTrue();
expect(data.plmnNumeric != 'plmnNumeric').assertTrue();
expect(data.isRoaming != true).assertTrue();
expect(data.regState != radio.REG_STATE_IN_SERVICE).assertTrue();
expect(data.nsaState != radio.NSA_STATE_SA_ATTACHED).assertTrue();
expect(data.isCaActive != true).assertTrue();
expect().assertFail();
done();
});
......@@ -482,7 +482,6 @@ describe('ActsNetworkSearchTest', function () {
radio.getPreferredNetwork(SLOT_0, (err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_setPreferredNetwork_Async_0100 get fail err: ${err}`);
expect().assertFail();
done();
return;
}
......@@ -495,8 +494,8 @@ describe('ActsNetworkSearchTest', function () {
expect().assertFail();
done();
}
})
})
});
});
/**
* @tc.number Telephony_NetworkSearch_setPreferredNetwork_Async_0600
......@@ -510,7 +509,6 @@ describe('ActsNetworkSearchTest', function () {
radio.getPreferredNetwork(SLOT_0, (err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_setPreferredNetwork_Async_0600 get fail err: ${err}`);
expect().assertFail();
done();
return;
}
......@@ -524,9 +522,8 @@ describe('ActsNetworkSearchTest', function () {
expect().assertFail();
done();
}
})
})
});
});
/**
* @tc.number Telephony_NetworkSearch_setPreferredNetwork_Promise_0100
......@@ -538,7 +535,7 @@ describe('ActsNetworkSearchTest', function () {
try {
await radio.setPreferredNetwork(SLOT_0, PREFERRED_MODE_ERR2);
console.log('Telephony_NetworkSearch_setPreferredNetwork_Promise_0100 set fail: not go to err');
expect().assertFail();
expect().assertFail();
done();
} catch (err) {
try {
......@@ -548,11 +545,10 @@ describe('ActsNetworkSearchTest', function () {
done();
} catch (err) {
console.log(`Telephony_NetworkSearch_setPreferredNetwork_Promise_0100 fail err: ${err}`);
expect().assertFail();
done();
}
}
})
});
/**
* @tc.number Telephony_NetworkSearch_setPreferredNetwork_Promise_0600
......@@ -563,7 +559,7 @@ describe('ActsNetworkSearchTest', function () {
try {
await radio.setPreferredNetwork(SLOT_2, radio.PREFERRED_NETWORK_MODE_GSM);
console.log('Telephony_NetworkSearch_setPreferredNetwork_Promise_0600 set fail: not go to err');
expect().assertFail();
expect().assertFail();
done();
} catch (err) {
try {
......@@ -573,11 +569,10 @@ describe('ActsNetworkSearchTest', function () {
done();
} catch (err) {
console.log(`Telephony_NetworkSearch_setPreferredNetwork_Promise_0600 fail err: ${err}`);
expect().assertFail();
done();
}
}
})
});
/**
* @tc.number Telephony_NetworkSearch_getCellInformation_Async_0500
......@@ -855,7 +850,7 @@ describe('ActsNetworkSearchTest', function () {
done();
}
});
/**
* @tc.number Telephony_StateRegistry_on_0200
* @tc.name Add a networkStatus change listen and test observer.on({slotId:0}) to view the callback results
......@@ -868,7 +863,7 @@ describe('ActsNetworkSearchTest', function () {
});
done();
});
/**
* @tc.number Telephony_StateRegistry_off_0200
* @tc.name Add a networkStatus change listen and test observer.off() to view the callback results
......@@ -878,7 +873,7 @@ describe('ActsNetworkSearchTest', function () {
observer.off('networkStateChange');
done();
});
/**
* @tc.number Telephony_StateRegistry_on_0300
* @tc.name Add a networkStatus change listen and test observer.on({slotId:0}) to view the callback results
......@@ -891,7 +886,7 @@ describe('ActsNetworkSearchTest', function () {
});
done();
});
/**
* @tc.number Telephony_StateRegistry_off_0300
* @tc.name Add a networkStatus change listen and test observer.off() to view the callback results
......
......@@ -53,46 +53,47 @@ describe('SimManagerTest', function () {
/**
* @tc.number Telephony_Sim_constantValidate_0100
* @tc.name SIM card constant validation
* @tc.name SIM card constant validation
* @tc.desc Function test
*/
it('Telephony_Sim_constantValidate_0100', 0, async function (done) {
expect(sim.SIM_STATE_UNKNOWN === env.CONSTANTS.SIM_STATE_UNKNOWN).assertTrue();
expect(sim.SIM_STATE_NOT_PRESENT === env.CONSTANTS.SIM_STATE_NOT_PRESENT).assertTrue();
expect(sim.SIM_STATE_LOCKED === env.CONSTANTS.SIM_STATE_LOCKED).assertTrue();
expect(sim.SIM_STATE_NOT_READY === env.CONSTANTS.SIM_STATE_NOT_READY).assertTrue();
expect(sim.SIM_STATE_READY === env.CONSTANTS.SIM_STATE_READY).assertTrue();
expect(sim.SIM_STATE_LOADED === env.CONSTANTS.SIM_STATE_LOADED).assertTrue();
expect(sim.GENERAL_CONTACT === env.CONSTANTS.GENERAL_CONTACT).assertTrue();
expect(sim.FIXED_DIALING === env.CONSTANTS.FIXED_DIALING).assertTrue();
expect(sim.LOCK_OFF === env.CONSTANTS.LOCK_OFF).assertTrue();
expect(sim.LOCK_ON === env.CONSTANTS.LOCK_ON).assertTrue();
expect(sim.PIN_LOCK === env.CONSTANTS.PIN_LOCK).assertTrue();
expect(sim.FDN_LOCK === env.CONSTANTS.FDN_LOCK).assertTrue();
expect(sim.UNKNOWN_CARD === env.CONSTANTS.UNKNOWN_CARD).assertTrue();
expect(sim.SINGLE_MODE_SIM_CARD === env.CONSTANTS.SINGLE_MODE_SIM_CARD).assertTrue();
expect(sim.SINGLE_MODE_USIM_CARD === env.CONSTANTS.SINGLE_MODE_USIM_CARD).assertTrue();
expect(sim.SINGLE_MODE_RUIM_CARD === env.CONSTANTS.SINGLE_MODE_RUIM_CARD).assertTrue();
expect(sim.DUAL_MODE_CG_CARD === env.CONSTANTS.DUAL_MODE_CG_CARD).assertTrue();
expect(sim.CT_NATIONAL_ROAMING_CARD === env.CONSTANTS.CT_NATIONAL_ROAMING_CARD).assertTrue();
expect(sim.CU_DUAL_MODE_CARD === env.CONSTANTS.CU_DUAL_MODE_CARD).assertTrue();
expect(sim.DUAL_MODE_TELECOM_LTE_CARD === env.CONSTANTS.DUAL_MODE_TELECOM_LTE_CARD).assertTrue();
expect(sim.DUAL_MODE_UG_CARD === env.CONSTANTS.DUAL_MODE_UG_CARD).assertTrue();
expect(sim.SINGLE_MODE_ISIM_CARD === env.CONSTANTS.SINGLE_MODE_ISIM_CARD).assertTrue();
expect(sim.PN_PIN_LOCK === env.CONSTANTS.PN_PIN_LOCK).assertTrue();
expect(sim.PN_PUK_LOCK === env.CONSTANTS.PN_PUK_LOCK).assertTrue();
expect(sim.PU_PIN_LOCK === env.CONSTANTS.PU_PIN_LOCK).assertTrue();
expect(sim.PU_PUK_LOCK === env.CONSTANTS.PU_PUK_LOCK).assertTrue();
expect(sim.PP_PIN_LOCK === env.CONSTANTS.PP_PIN_LOCK).assertTrue();
expect(sim.PP_PUK_LOCK === env.CONSTANTS.PP_PUK_LOCK).assertTrue();
expect(sim.PC_PIN_LOCK === env.CONSTANTS.PC_PIN_LOCK).assertTrue();
expect(sim.PC_PUK_LOCK === env.CONSTANTS.PC_PUK_LOCK).assertTrue();
expect(sim.SIM_PIN_LOCK === env.CONSTANTS.SIM_PIN_LOCK).assertTrue();
expect(sim.SIM_PUK_LOCK === env.CONSTANTS.SIM_PUK_LOCK).assertTrue();
console.log(`Telephony_Sim_constantValidate_0100 finish`);
done();
});
it('Telephony_Sim_constantValidate_0100', 0, async function (done) {
console.log(`Telephony_Sim_constantValidate_0100 start`);
expect(sim.SimState.SIM_STATE_UNKNOWN !== env.INVALID_VALUE).assertTrue();
expect(sim.SimState.SIM_STATE_NOT_PRESENT !== env.INVALID_VALUE).assertTrue();
expect(sim.SimState.SIM_STATE_LOCKED !== env.INVALID_VALUE).assertTrue();
expect(sim.SimState.SIM_STATE_NOT_READY !== env.INVALID_VALUE).assertTrue();
expect(sim.SimState.SIM_STATE_READY !== env.INVALID_VALUE).assertTrue();
expect(sim.SimState.SIM_STATE_LOADED !== env.INVALID_VALUE).assertTrue();
expect(sim.ContactType.GENERAL_CONTACT !== env.INVALID_VALUE).assertTrue();
expect(sim.ContactType.FIXED_DIALING !== env.INVALID_VALUE).assertTrue();
expect(sim.LockState.LOCK_OFF !== env.INVALID_VALUE).assertTrue();
expect(sim.LockState.LOCK_ON !== env.INVALID_VALUE).assertTrue();
expect(sim.PIN_LOCK !== env.INVALID_VALUE).assertTrue();
expect(sim.FDN_LOCK !== env.INVALID_VALUE).assertTrue();
expect(sim.UNKNOWN_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.SINGLE_MODE_SIM_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.SINGLE_MODE_USIM_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.SINGLE_MODE_RUIM_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.DUAL_MODE_CG_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.CT_NATIONAL_ROAMING_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.CU_DUAL_MODE_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.DUAL_MODE_TELECOM_LTE_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.DUAL_MODE_UG_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.SINGLE_MODE_ISIM_CARD !== env.INVALID_VALUE).assertTrue();
expect(sim.PN_PIN_LOCK !== env.INVALID_VALUE).assertTrue();
expect(sim.PN_PUK_LOCK !== env.INVALID_VALUE).assertTrue();
expect(sim.PU_PIN_LOCK !== env.INVALID_VALUE).assertTrue();
expect(sim.PU_PUK_LOCK !== env.INVALID_VALUE).assertTrue();
expect(sim.PP_PIN_LOCK !== env.INVALID_VALUE).assertTrue();
expect(sim.PP_PUK_LOCK !== env.INVALID_VALUE).assertTrue();
expect(sim.PC_PIN_LOCK !== env.INVALID_VALUE).assertTrue();
expect(sim.PC_PUK_LOCK !== env.INVALID_VALUE).assertTrue();
expect(sim.SIM_PIN_LOCK !== env.INVALID_VALUE).assertTrue();
expect(sim.SIM_PUK_LOCK !== env.INVALID_VALUE).assertTrue();
console.log(`Telephony_Sim_constantValidate_0100 finish`);
done();
});
/**
* @tc.number Telephony_Sim_getISOCountryCodeForSim_Async_0200
* @tc.name Enter exception parameters to test whether the getISOCountryCodeForSim interface function
......@@ -546,7 +547,7 @@ describe('SimManagerTest', function () {
it('Telephony_Sim_SetLockState_Async_1000', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_SetLockState_Async_1000';
const lockInfo = { lockType: sim.PIN_LOCK, state: sim.LOCK_OFF, password: env.CORRECT_PIN };
sim.setLockState(env.SLOTID2, lockInfo, error => {
sim.setLockState(env.SLOTID2, lockInfo, (error) => {
if (error) {
console.log(`${CASE_NAME} setLockState expect error: ${error.message}`);
console.log(`${CASE_NAME} test finish`);
......@@ -1724,7 +1725,7 @@ describe('SimManagerTest', function () {
it('Telephony_Sim_unlockSimLock_Async_2600', 0, function (done) {
const CASE_NAME = 'Telephony_Sim_unlockSimLock_Async_2600';
const lockInfo = { lockType: sim.PN_PIN_LOCK, password: env.SIM_PN_PIN_PASSWORD };
sim.unlockSimLock(env.SLOTID2, lockInfo, async (error) => {
sim.unlockSimLock(env.SLOTID2, lockInfo, (error) => {
if (error) {
console.log(`${CASE_NAME} expect error: ${error.message}`);
console.log(`${CASE_NAME} test finish.`);
......
......@@ -27,4 +27,5 @@ export const MAIL_NAME_LEN12 = '123#@%_ABCDE';
export const MAIL_NUMBER_LEN20 = '01234567890123456789';
export const SIM_MIN_COUNT = 0;
export const STK_CMD = 'D30781020181900101';
export const SIM_PN_PIN_PASSWORD = '1111';
\ No newline at end of file
export const SIM_PN_PIN_PASSWORD = '1111';
export const INVALID_VALUE = -1000;
\ No newline at end of file
......@@ -381,19 +381,19 @@ describe('SmsMmsErrorTest', function () {
sms.createMessage(rawArrayNull, '3gpp', (err, shortMessage) => {
if (err) {
console.log('Telephony_SmsMms_createMessage_Async_0200 finish');
except(shortMessage.visibleMessageBody != 'visibleMessageBody').assertTrue();
except(shortMessage.visibleRawAddress != 'visibleRawAddress').assertTrue();
except(shortMessage.messageClass != 'sms.FORWARD_MESSAGE').assertTrue();
except(shortMessage.protocolId != -1).assertTrue();
except(shortMessage.scAddress != 'scAddress').assertTrue();
except(shortMessage.scTimestamp != -1).assertTrue();
except(shortMessage.isReplaceMessage != true).assertTrue();
except(shortMessage.hasReplyPath != true).assertTrue();
except(shortMessage.status != -1).assertTrue();
except(shortMessage.isSmsStatusReportMessage != true).assertTrue();
done();
return;
}
expect(shortMessage.visibleMessageBody != 'visibleMessageBody').assertTrue();
expect(shortMessage.visibleRawAddress != 'visibleRawAddress').assertTrue();
expect(shortMessage.messageClass != 'sms.FORWARD_MESSAGE').assertTrue();
expect(shortMessage.protocolId != -1).assertTrue();
expect(shortMessage.scAddress != 'scAddress').assertTrue();
expect(shortMessage.scTimestamp != -1).assertTrue();
expect(shortMessage.isReplaceMessage != true).assertTrue();
expect(shortMessage.hasReplyPath != true).assertTrue();
expect(shortMessage.status != -1).assertTrue();
expect(shortMessage.isSmsStatusReportMessage != true).assertTrue();
expect().assertFail();
console.log('Telephony_SmsMms_createMessage_Async_0200 fail');
done();
......@@ -406,7 +406,7 @@ describe('SmsMmsErrorTest', function () {
* SMS failed to send
* @tc.desc Function test
*/
it('Telephony_SmsMms_sendMessage_0200', 0, async function (done) {
it('Telephony_SmsMms_sendMessage_0200', 0, async function (done) {
sms.sendMessage({
slotId: FALSE_SLOT_ID,
destinationHost: SMS_SEND_DST_NUMBER,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册