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

!6776 电话服务register用例整改

Merge pull request !6776 from zhangfuzhi/master
/**
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Copyright (C) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
......@@ -13,105 +13,61 @@
* limitations under the License.
*/
import connection from '@ohos.net.connection';
import { describe, expect, it } from '@ohos/hypium';
import connection from '@ohos.net.connection';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
export default function Telephony_NetworkManagerRegisterTest() {
export default function Telephony_NetworkManagerRegisterTest() {
describe('Telephony_NetworkManagerRegisterTest', function () {
const ETH_100 = 100;
const TEST_RUN_TIME_2 = 2;
const TEST_RUN_TIME_5 = 5;
const TEST_RUN_TIME_1000 = 1000;
const DELAY = 1000;
const DELAY_TIME = 1000;
const TIMEOUT = 100;
const TIMEOUT_1 = 1000;
let VALUE = 0;
let envReady = false;
function sleep(timeout) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, timeout);
})
}
function sleepOther(timeout) {
for (var t = Date.now(); Date.now() - t <= timeout;) ;
}
const TIMEOUT = 1000;
/**
*@tc.number Telephony_NetworkManager_register_Async_0100
*@tc.name Enter bearerTypes and networkCap asempty, set class NetConnection,
* @tc.number Telephony_NetworkManager_register_Async_0100
* @tc.name Enter bearerTypes and networkCap asempty, set class NetConnection,
* call Register() to activate the default network, and see if the callback information is generated
@tc.desc Function test
*/
it('Telephony_NetworkManager_register_Async_0100', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_register_Async_0100';
let netConn = connection.createNetConnection();
let returnValue = 0;
netConn.on('netAvailable', (value) => {
if (value === undefined) {
console.info("${caseName} on netAvailable fail");
netConn.register(function (error) {
console.log("Telephony_NetworkManager_register_Async_0100 register ");
if (error) {
console.info(caseName + " register fail: " + JSON.stringify(error));
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable :" + value.netId);
returnValue = value.netId;
return;
}
netConn.on('netAvailable', function (value) {
console.log("netAvailable " + JSON.stringify(value));
});
netConn.on('netCapabilitiesChange', (value) => {
if (value === undefined) {
console.info("${caseName} netCapabilitiesChange fail");
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle =:" + value.netHandle.netId);
expect(value.netHandle.netId >= ETH_100).assertTrue();
}
netConn.on('netCapabilitiesChange', function (value) {
console.log("netCapabilitiesChange " + JSON.stringify(value));
});
netConn.on('netConnectionPropertiesChange', (value) => {
if (value === undefined) {
console.info("${caseName} netConnectionPropertiesChange fail");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
}
netConn.on('netConnectionPropertiesChange', function (value) {
console.log("netConnectionPropertiesChange" + JSON.stringify(value));
});
netConn.on('netLost', (value) => {
netConn.on('netLost', function (value) {
console.log("netLost" + JSON.stringify(value));
});
console.log("Telephony_NetworkManager_register_Async_0100 netLost end");
console.log("Telephony_NetworkManager_register_Async_0100 unregister start");
netConn.unregister(function (error) {
console.log("Telephony_NetworkManager_register_Async_0100 unregister ");
if (error) {
console.info("${caseName} netLost fail");
console.info(caseName + " register fail: " + JSON.stringify(error));
expect().assertFail();
done();
} else {
console.info("${caseName} netLost: " + value.netId);
}
});
netConn.register((error) => {
if (error) {
console.info(JSON.stringify(error) + "${caseName} register fail: ${error}");
done();
}
});
await sleep(DELAY);
console.info("${caseName} returnVaule : " + returnValue);
netConn.unregister((error) => {
if (error) {
console.info("${caseName} register fail: ${error}");
done();
}
done();
});
done();
});
/**
*@tc.number Telephony_NetworkManager_register_Async_0200
*@tc.name Enter bearerTypes and networkCap asempty, set class NetConnection,
* @tc.number Telephony_NetworkManager_register_Async_0200
* @tc.name Enter bearerTypes and networkCap asempty, set class NetConnection,
* call Register() to activate the default network, and see if the callback information is generated
@tc.desc Function test
*/
......@@ -122,87 +78,41 @@
bearerTypes: [1],
}
}
let netId = 0;
let netConn = connection.createNetConnection(netSpecifier, TIMEOUT);
netConn.on('netAvailable', (value) => {
if (value === undefined) {
console.info("${caseName} on netAvailable fail");
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable : " + value.netId);
returnValue = value.netId;
}
});
console.info("netAvailable end");
netConn.on('netCapabilitiesChange', (value) => {
if (value === undefined) {
console.info("${caseName} netCapabilitiesChange fail");
expect().assertFail();
netConn.register(function (error) {
if (error) {
console.info(caseName + " register fail: " + JSON.stringify(error));
done();
} else {
console.info("${caseName} netCapabilitiesChange handle =:" + value.netHandle.netId);
expect(value.netHandle.netId >= ETH_100).assertTrue();
return;
}
netConn.on('netAvailable', function (value) {
console.log("netAvailable " + JSON.stringify(value));
});
console.info("netCapabilitiesChange end");
netConn.on('netConnectionPropertiesChange', (value) => {
if (value === undefined) {
console.info("${caseName} netConnectionPropertiesChange fail");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle =:" + value.netHandle.netId);
}
netConn.on('netCapabilitiesChange', function (value) {
console.log("netCapabilitiesChange " + JSON.stringify(value));
});
console.info("netConnectionPropertiesChange end");
netConn.on('netLost', (value) => {
if (error) {
console.info("${caseName} netLost fail");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost : " + value.netId);
}
netConn.on('netConnectionPropertiesChange', function (value) {
console.log("netConnectionPropertiesChange" + JSON.stringify(value));
});
console.info("netLost end");
netConn.on('netUnavailable', (value) => {
if (error) {
console.info("${caseName} netUnavailable fail");
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable: " + value.netId);
}
netConn.on('netLost', function (value) {
console.log("netLost" + JSON.stringify(value));
});
console.info("netUnavailable end");
netConn.on('netBlockStatuschange', (value) => {
if (error) {
console.info("${caseName} netBlockStatusChange fail");
expect().assertFail();
done();
} else {
console.info("${caseName} netBlockStatusChange : " + value.netHandle.netId);
}
netConn.on('netUnavailable', function (value) {
console.log("netUnavailable" + JSON.stringify(value));
});
console.info("netBlockStatuschange end");
netConn.register((error) => {
if (error) {
console.info("${caseName} register fail: ${error}");
}
netConn.on('netBlockStatusChange', function (value) {
console.log("netBlockStatusChange " + JSON.stringify(value));
});
console.info("register end");
await sleep(DELAY);
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregisterresult: ${error}" + JSON.stringify(error));
console.info(caseName + " unregisterresult: " + JSON.stringify(error));
expect().assertFail();
done();
}
});
console.info("unregister end");
done();
});
});
});
/*
*@tc.number Telephony_NetworkManager_register_Async_0300
......@@ -220,77 +130,40 @@
networkCap: [11],
}, bearerPrivateIdentifier: '123'
}
let netId = 0;
let netConn = connection.createNetConnection(netSpecifier, TIMEOUT);
netConn.on('netAvailable', (error, value) => {
netConn.register(function (error) {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
console.info(caseName + " register fail: " + JSON.stringify(error));
done();
} else {
console.info("${caseName} netAvailable:" + value.netId);
return;
}
netConn.on('netAvailable', function (value) {
console.log("netAvailable " + JSON.stringify(value));
});
netConn.on('netBlockStatusChange', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
}
netConn.on('netBlockStatusChange', function (value) {
console.log("netBlockStatusChange " + JSON.stringify(value));
});
netConn.on('netBlockStatusChange', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
}
netConn.on('netCapabilitiesChange', function (value) {
console.log("netCapabilitiesChange " + JSON.stringify(value));
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
}
netConn.on('netConnectionPropertiesChange', function (value) {
console.log("netConnectionPropertiesChange" + JSON.stringify(value));
});
netConn.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost = :" + value.netId);
}
netConn.on('netLost', function (value) {
console.log("netLost" + JSON.stringify(value));
});
netConn.on('netUnavailable', function (value) {
console.info(caseName + " register fail: " + JSON.stringify(value));
});
netConn.on('netUnavailable', (error, value) => {
netConn.unregister((error) => {
if (error) {
console.info("${caseName} register fail: ${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable = :" + value);
netId = true;
}
});
netConn.register((error) => {
if (error) {
console.info("${caseName} register fail: ${error}");
}
done();
});
await sleep(DELAY);
console.info("${caseName} netId : ${netId}");
expect(true).assertTrue()
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregister result: ${error}");
}
});
done();
});
/*
......@@ -301,7 +174,6 @@
*/
it('Telephony_NetworkManager_register_Async_0400', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_register_Async_0400';
let netId = 0;
let netSpecifier = {
netCapabilities: {
linkUpBandwidthKbps: 0,
......@@ -311,74 +183,39 @@
}, bearerPrivateIdentifier: '123'
}
let netConn = connection.createNetConnection(netSpecifier, TIMEOUT);
netConn.on('netAvailable', (error, value) => {
netConn.register(function (error) {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
console.info(caseName + " register fail: " + JSON.stringify(error));
done();
} else {
console.info("${caseName} netAvailable:" + value.netId);
return;
}
netConn.on('netAvailable', function (value) {
console.log("netAvailable" + JSON.stringify(value))
});
netConn.on('netBlockStatusChange', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
}
netConn.on('netCapabilitiesChange', function (value) {
console.log("netCapabilitiesChange" + JSON.stringify(value))
});
netConn.on('netCapabilitiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
}
netConn.on('netConnectionPropertiesChange', function (value) {
console.log("netConnectionPropertiesChange" + JSON.stringify(value));
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
}
netConn.on('netLost', function (value) {
console.log("netLost" + JSON.stringify(value));
});
netConn.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost = :" + value.netId);
}
netConn.on('netUnavailable', function (value) {
console.log("netUnavailable" + JSON.stringify(value));
});
netConn.on('netBlockStatusChange', function (value) {
console.log("netBlockStatusChange " + JSON.stringify(value));
});
netConn.on('netUnavailable', (error, value) => {
netConn.unregister((error) => {
if (error) {
console.info("${caseName} register fail: ${error}");
console.info(caseName + " unregisterresult: " + JSON.stringify(error));
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable = :" + value);
netId = true;
}
});
netConn.register((error) => {
if (error) {
console.info("${caseName} register fail: ${error}");
}
done();
});
await sleep(DELAY);
expect(true).assertTrue()
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregister result: ${error.code},${error.message}");
}
});
done();
});
/*
......@@ -397,77 +234,40 @@
networkCap: [15],
}, bearerPrivateIdentifier: '123'
}
let netId = 0;
let netConn = connection.createNetConnection(netSpecifier, TIMEOUT);
netConn.on('netAvailable', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable:" + value.netId);
}
});
netConn.on('netBlockStatusChange', (error, value) => {
netConn.register(function (error) {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
console.info(caseName + " register fail: " + JSON.stringify(error));
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
return;
}
netConn.on('netAvailable', function (value) {
console.log("netAvailable " + JSON.stringify(value));
});
netConn.on('netCapabilitiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
}
netConn.on('netCapabilitiesChange', function (value) {
console.log("netCapabilitiesChange " + JSON.stringify(value));
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
}
netConn.on('netConnectionPropertiesChange', function (value) {
console.log("netConnectionPropertiesChange" + JSON.stringify(value));
});
netConn.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost = :" + value.netId);
}
netConn.on('netLost', function (value) {
console.log("netLost" + JSON.stringify(value));
});
netConn.on('netUnavailable', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable = :" + value);
netId = true;
}
netConn.on('netUnavailable', function (value) {
console.log("netUnavailable" + JSON.stringify(value));
});
netConn.register((error) => {
if (error) {
console.info("${caseName} register fail: ${error}");
}
netConn.on('netBlockStatusChange', function (value) {
console.log("netBlockStatusChange " + JSON.stringify(value));
});
await sleep(DELAY);
expect(true).assertTrue()
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregister result: ${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
}
done();
});
done();
});
});
/*
......@@ -487,76 +287,39 @@
}, bearerPrivateIdentifier: '123'
}
let netConn = connection.createNetConnection(netSpecifier, TIMEOUT);
let netId = 0;
netConn.on('netAvailable', (error, value) => {
netConn.register(function (error) {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable:" + value.netId);
}
});
netConn.on('netBlockStatusChange', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
console.info(caseName + " register fail: " + JSON.stringify(error));
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
return;
}
netConn.on('netAvailable', function (value) {
console.log("netAvailable " + JSON.stringify(value));
});
netConn.on('netCapabilitiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
}
netConn.on('netCapabilitiesChange', function (value) {
console.log("netCapabilitiesChange " + JSON.stringify(value));
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
}
netConn.on('netConnectionPropertiesChange', function (value) {
console.log("netConnectionPropertiesChange" + JSON.stringify(value));
});
netConn.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost = :" + value.netId);
}
netConn.on('netLost', function (value) {
console.log("netLost" + JSON.stringify(value));
});
netConn.on('netUnavailable', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable = :" + value);
netId = true;
}
netConn.on('netUnavailable', function (value) {
console.log("netUnavailable" + JSON.stringify(value));
});
netConn.register((error) => {
if (error) {
console.info("${caseName} register fail: ${error}");
}
netConn.on('netBlockStatusChange', function (value) {
console.log("netBlockStatusChange " + JSON.stringify(value));
});
await sleep(DELAY);
expect(true).assertTrue()
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregister result: ${error}");
console.info(caseName + " unregisterresult: " + JSON.stringify(error));
expect().assertFail();
done();
}
done();
});
done();
});
});
/*
......@@ -576,76 +339,39 @@
}, bearerPrivateIdentifier: '123'
}
let netConn = connection.createNetConnection(netSpecifier, TIMEOUT);
let netId = 0;
netConn.on('netAvailable', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable:" + value.netId);
}
});
netConn.on('netBlockStatusChange', (error, value) => {
netConn.register(function (error) {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
console.info(caseName + " register fail: " + JSON.stringify(error));
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
return;
}
netConn.on('netAvailable', function (value) {
console.log("netAvailable " + JSON.stringify(value));
});
netConn.on('netCapabilitiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
}
netConn.on('netBlockStatusChange', function (value) {
console.log("netBlockStatusChange " + JSON.stringify(value));
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
}
netConn.on('netCapabilitiesChange', function (value) {
console.log("netCapabilitiesChange " + JSON.stringify(value));
});
netConn.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost = :" + value.netId);
}
netConn.on('netConnectionPropertiesChange', function (value) {
console.log("netConnectionPropertiesChange" + JSON.stringify(value));
});
netConn.on('netUnavailable', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable = :" + value);
netId = true;
}
netConn.on('netLost', function (value) {
console.log("netLost" + JSON.stringify(value));
});
netConn.register((error) => {
if (error) {
console.info("${caseName} register fail: ${error}");
}
netConn.on('netUnavailable', function (value) {
console.log("netUnavailable" + JSON.stringify(value));
});
await sleep(DELAY);
expect(true).assertTrue()
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregister result: ${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
}
done();
});
done();
});
});
/*
......@@ -665,78 +391,40 @@
}, bearerPrivateIdentifier: '123'
}
let netConn = connection.createNetConnection(netSpecifier, TIMEOUT);
let netId = 0;
netConn.on('netAvailable', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable:" + value.netId);
}
});
netConn.on('netBlockStatusChange', (error, value) => {
netConn.register(function (error) {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
console.info(caseName + " register fail: " + JSON.stringify(error));
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
return;
}
netConn.on('netAvailable', function (value) {
console.log("netAvailable " + JSON.stringify(value));
});
netConn.on('netCapabilitiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
}
netConn.on('netBlockStatusChange', function (value) {
console.log("netBlockStatusChange " + JSON.stringify(value));
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
}
netConn.on('netCapabilitiesChange', function (value) {
console.log("netCapabilitiesChange " + JSON.stringify(value));
});
netConn.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost = :" + value.netId);
}
netConn.on('netConnectionPropertiesChange', function (value) {
console.log("netConnectionPropertiesChange" + JSON.stringify(value));
});
netConn.on('netUnavailable', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable = :" + value);
netId = true;
}
netConn.on('netLost', function (value) {
console.log("netLost" + JSON.stringify(value));
});
netConn.register((error) => {
if (error) {
console.info("${caseName} register fail: ${error}");
}
netConn.on('netUnavailable', function (value) {
console.log("netUnavailable" + JSON.stringify(value));
});
await sleep(DELAY);
expect(true).assertTrue()
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregister result: ${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
}
done();
});
done();
});
});
/*
*@tc.number Telephony_NetworkManager_register_Async_0900
*@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection,
......@@ -754,79 +442,39 @@
}, bearerPrivateIdentifier: '123'
}
let netConn = connection.createNetConnection(netSpecifier, TIMEOUT);
let netId = 0;
netConn.on('netAvailable', (error, value) => {
netConn.register(function (error) {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable:" + value.netId);
}
});
netConn.on('netBlockStatusChange', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
console.info(caseName + " register fail: " + JSON.stringify(error));
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
expect(value.netHandle.netId >= ETH_100).assertTrue();
return;
}
netConn.on('netAvailable', function (value) {
console.log("netAvailable " + JSON.stringify(value));
});
netConn.on('netCapabilitiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
expect(value.netHandle.netId >= ETH_100).assertTrue();
}
netConn.on('netBlockStatusChange', function (value) {
console.log("netBlockStatusChange " + JSON.stringify(value));
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
expect(value.netHandle.netId >= ETH_100).assertTrue();
}
netConn.on('netCapabilitiesChange', function (value) {
console.log("netCapabilitiesChange " + JSON.stringify(value));
});
netConn.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost = :" + value.netId);
}
netConn.on('netConnectionPropertiesChange', function (value) {
console.log("netCapabilitiesChange " + JSON.stringify(value));
});
netConn.on('netUnavailable', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable = :" + value);
netId = true;
}
netConn.on('netLost', function (value) {
console.log("netLost" + JSON.stringify(value));
});
netConn.register((error) => {
if (error) {
console.info("${caseName} register fail: ${error}");
}
netConn.on('netUnavailable', function (value) {
console.log("netUnavailable" + JSON.stringify(value));
});
await sleep(10000);
expect(true).assertTrue()
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregister result: ${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
}
done();
});
done();
});
});
/*
......@@ -846,79 +494,39 @@
}, bearerPrivateIdentifier: '123'
}
let netConn = connection.createNetConnection(netSpecifier, TIMEOUT);
let netId = 0;
netConn.on('netAvailable', (error, value) => {
netConn.register(function (error) {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
console.info(caseName + " register fail: " + JSON.stringify(error));
done();
} else {
console.info("${caseName} netAvailable:" + value.netId);
expect(value.netId >= ETH_100).assertTrue();
return;
}
netConn.on('netAvailable', function (value) {
console.log("netAvailable " + JSON.stringify(value));
});
netConn.on('netBlockStatusChange', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
expect(value.netHandle.netId >= ETH_100).assertTrue();
}
});
netConn.on('netCapabilitiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
}
netConn.on('netBlockStatusChange', function (value) {
console.log("netBlockStatusChange " + JSON.stringify(value));
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
expect(value.netHandle.netId >= ETH_100).assertTrue();
}
netConn.on('netCapabilitiesChange', function (value) {
console.log("netCapabilitiesChange " + JSON.stringify(value));
});
netConn.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost = :" + value.netId);
}
netConn.on('netConnectionPropertiesChange', function (value) {
console.log("netConnectionPropertiesChange" + JSON.stringify(value));
});
netConn.on('netUnavailable', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable = :" + value);
netId = true;
}
netConn.on('netLost', function (value) {
console.log("netLost" + JSON.stringify(value));
});
netConn.register((error) => {
if (error) {
console.info("${caseName} register fail: ${error}");
}
netConn.on('netUnavailable', function (value) {
console.log("netUnavailable" + JSON.stringify(value));
});
await sleep(DELAY);
expect(true).assertTrue()
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregister result: ${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
}
done();
});
done();
});
});
/**
......@@ -938,78 +546,40 @@
networkCap: [15],
}, bearerPrivateIdentifier: '123'
}
let netId = 0;
let netConn = connection.createNetConnection(netSpecifier, TIMEOUT);
netConn.on('netAvailable', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable : " + value.netId);
}
});
netConn.on('netBlockStatusChange', (error, value) => {
netConn.register(function (error) {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
console.info(caseName + " register fail: " + JSON.stringify(error));
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
return;
}
netConn.on('netAvailable', function (value) {
console.log("netAvailable " + JSON.stringify(value));
});
netConn.on('netCapabilitiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
}
netConn.on('netBlockStatusChange', function (value) {
console.log("netBlockStatusChange " + JSON.stringify(value));
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
expect(value.netHandle.netId >= ETH_100).assertTrue();
}
netConn.on('netCapabilitiesChange', function (value) {
console.log("netCapabilitiesChange " + JSON.stringify(value));
});
netConn.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost " + value.netId);
}
netConn.on('netConnectionPropertiesChange', function (value) {
console.log("netConnectionPropertiesChange" + JSON.stringify(value));
});
netConn.on('netUnavailable', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable " + value.netId);
netId = true;
}
netConn.on('netLost', function (value) {
console.log("netLost" + JSON.stringify(value));
});
netConn.register((error) => {
if (error) {
console.info("${caseName} register fail ${error}");
}
netConn.on('netUnavailable', function (value) {
console.log("netUnavailable" + JSON.stringify(value));
});
await sleep(DELAY);
expect(true).assertTrue()
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregister result : ${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
}
done();
});
done();
});
});
/**
......@@ -1029,79 +599,40 @@
networkCap: [16],
}, bearerPrivateIdentifier: '123'
}
let netId = 0;
let netConn = connection.createNetConnection(netSpecifier, TIMEOUT);
netConn.on('netAvailable', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable : " + value.netId);
}
});
netConn.on('netBlockStatusChange', (error, value) => {
netConn.register(function (error) {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
console.info(caseName + " register fail: " + JSON.stringify(error));
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
expect(value.netHandle.netId >= ETH_100).assertTrue();
return;
}
netConn.on('netAvailable', function (value) {
console.log("netAvailable " + JSON.stringify(value));
});
netConn.on('netCapabilitiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
expect(value.netHandle.netId >= ETH_100).assertTrue();
}
netConn.on('netBlockStatusChange', function (value) {
console.log("netBlockStatusChange " + JSON.stringify(value));
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
}
netConn.on('netCapabilitiesChange', function (value) {
console.log("netCapabilitiesChange " + JSON.stringify(value));
});
netConn.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost " + value.netId);
}
netConn.on('netConnectionPropertiesChange', function (value) {
console.log("netConnectionPropertiesChange" + JSON.stringify(value));
});
netConn.on('netUnavailable', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable " + value.netId);
netId = true;
}
netConn.on('netLost', function (value) {
console.log("netLost" + JSON.stringify(value));
});
netConn.register((error) => {
if (error) {
console.info("${caseName} register fail ${error}");
}
netConn.on('netUnavailable', function (value) {
console.log("netUnavailable" + JSON.stringify(value));
});
await sleep(DELAY);
expect(true).assertTrue()
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregister result : ${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
}
done();
});
done();
});
});
......@@ -1123,77 +654,39 @@
}, bearerPrivateIdentifier: '123'
}
let netConn = connection.createNetConnection(netSpecifier, TIMEOUT);
netConn.on('netAvailable', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable : " + value.netId);
expect(value.netId).assertEqual(ETH_100);
}
});
netConn.on('netBlockStatusChange', (error, value) => {
netConn.register(function (error) {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
console.info(caseName + " register fail: " + JSON.stringify(error));
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
expect(value.netHandle.netId >= ETH_100).assertTrue();
return;
}
netConn.on('netAvailable', function (value) {
console.log("netAvailable " + JSON.stringify(value));
});
netConn.on('netCapabilitiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
expect(value.netHandle.netId >= ETH_100).assertTrue();
}
netConn.on('netBlockStatusChange', function (value) {
console.log("netBlockStatusChange " + JSON.stringify(value));
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
expect(value.netHandle.netId >= ETH_100).assertTrue();
}
netConn.on('netCapabilitiesChange', function (value) {
console.log("netCapabilitiesChange " + JSON.stringify(value));
});
netConn.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost " + value.netId);
}
netConn.on('netConnectionPropertiesChange', function (value) {
console.log("netConnectionPropertiesChange " + JSON.stringify(value));
});
netConn.on('netUnavailable', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable " + value);
}
netConn.on('netLost', function (value) {
console.log("netLost" + JSON.stringify(value));
});
netConn.register((error) => {
if (error) {
console.info("${caseName} register fail ${error}");
}
netConn.on('netUnavailable', function (value) {
console.log("netUnavailable " + JSON.stringify(value));
});
await sleep(DELAY);
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregister result : ${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
}
done();
});
done();
});
});
......@@ -1214,77 +707,40 @@
networkCap: [12],
}, bearerPrivateIdentifier: '123'
}
let netId = 0;
let netConn = connection.createNetConnection(netSpecifier, TIMEOUT);
netConn.on('netAvailable', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable : " + value.netId);
}
});
netConn.on('netBlockStatusChange', (error, value) => {
netConn.register(function (error) {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
console.info(caseName + " register fail: " + JSON.stringify(error));
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
return;
}
netConn.on('netAvailable', function (value) {
console.log("netAvailable " + JSON.stringify(value));
});
netConn.on('netCapabilitiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
}
netConn.on('netBlockStatusChange', function (value) {
console.log("netBlockStatusChange " + JSON.stringify(value));
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
}
netConn.on('netCapabilitiesChange', function (value) {
console.log("netCapabilitiesChange " + JSON.stringify(value));
});
netConn.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost " + value.netId);
}
netConn.on('netConnectionPropertiesChange', function (value) {
console.log("netConnectionPropertiesChange" + JSON.stringify(value));
});
netConn.on('netUnavailable', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable " + value.netId);
netId = true;
}
netConn.on('netLost', function (value) {
console.log("netLost" + JSON.stringify(value));
});
netConn.register((error) => {
if (error) {
console.info("${caseName} register fail ${error}");
}
netConn.on('netUnavailable', function (value) {
console.log("netUnavailable" + JSON.stringify(value));
});
await sleep(DELAY);
expect(true).assertTrue()
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregister result : ${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
}
done();
});
done();
});
});
/**
......@@ -1305,75 +761,39 @@
}, bearerPrivateIdentifier: '123'
}
let netConn = connection.createNetConnection(netSpecifier, TIMEOUT);
netConn.on('netAvailable', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable : " + value.netId);
VALUE = value.netId;
expect(VALUE >= ETH_100).assertTrue();
}
});
netConn.on('netBlockStatusChange', (error, value) => {
netConn.register(function (error) {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
console.info(caseName + " register fail: " + JSON.stringify(error));
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
return;
}
netConn.on('netAvailable', function (value) {
console.log("netAvailable " + JSON.stringify(value));
});
netConn.on('netCapabilitiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
}
netConn.on('netBlockStatusChange', function (value) {
console.log("netBlockStatusChange " + JSON.stringify(value));
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
}
netConn.on('netCapabilitiesChange', function (value) {
console.log("netCapabilitiesChange " + JSON.stringify(value));
});
netConn.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost " + value.netId);
}
netConn.on('netConnectionPropertiesChange', function (value) {
console.log("netConnectionPropertiesChange" + JSON.stringify(value));
});
netConn.on('netUnavailable', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable " + value);
}
netConn.on('netLost', function (value) {
console.log("netLost" + JSON.stringify(value));
});
netConn.register((error) => {
if (error) {
console.info("${caseName} register fail ${error}");
}
netConn.on('netUnavailable', function (value) {
console.log("netUnavailable" + JSON.stringify(value));
});
await sleep(DELAY);
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregister result : ${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
}
done();
});
done();
});
});
......@@ -1394,77 +814,40 @@
networkCap: [12],
}, bearerPrivateIdentifier: '123'
}
let netId = 0;
let netConn = connection.createNetConnection(netSpecifier, TIMEOUT);
netConn.on('netAvailable', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable : " + value.netId);
}
});
netConn.on('netBlockStatusChange', (error, value) => {
netConn.register(function (error) {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
console.info(caseName + " register fail: " + JSON.stringify(error));
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
return;
}
netConn.on('netAvailable', function (value) {
console.log("netAvailable " + JSON.stringify(value));
});
netConn.on('netCapabilitiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
}
netConn.on('netBlockStatusChange', function (value) {
console.log("netBlockStatusChange " + JSON.stringify(value));
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
}
netConn.on('netCapabilitiesChange', function (value) {
console.log("netCapabilitiesChange " + JSON.stringify(value));
});
netConn.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost " + value.netId);
}
netConn.on('netConnectionPropertiesChange', function (value) {
console.log("netConnectionPropertiesChange" + JSON.stringify(value));
});
netConn.on('netUnavailable', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable " + value);
netId = true;
}
netConn.on('netLost', function (value) {
console.log("netLost" + JSON.stringify(value));
});
netConn.register((error) => {
if (error) {
console.info("${caseName} register fail ${error}");
}
netConn.on('netUnavailable', function (value) {
console.log("netUnavailable" + JSON.stringify(value));
});
await sleep(DELAY);
expect(true).assertTrue()
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregister result : ${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
}
done();
});
done();
});
});
/**
......@@ -1484,77 +867,40 @@
networkCap: [17],
}, bearerPrivateIdentifier: '123'
}
let netId = 0;
let netConn = connection.createNetConnection(netSpecifier, TIMEOUT);
netConn.on('netAvailable', (error, value) => {
netConn.register(function (error) {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable : " + value.netId);
}
});
netConn.on('netBlockStatusChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
console.info(caseName + " register fail: " + JSON.stringify(error));
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
return;
}
netConn.on('netAvailable', function (value) {
console.log("netAvailable " + JSON.stringify(value));
});
netConn.on('netCapabilitiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
}
netConn.on('netBlockStatusChange', function (value) {
console.log("netBlockStatusChange " + JSON.stringify(value));
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
}
netConn.on('netCapabilitiesChange', function (value) {
console.log("netCapabilitiesChange " + JSON.stringify(value));
});
netConn.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost " + value.netId);
}
netConn.on('netConnectionPropertiesChange', function (value) {
console.log("netConnectionPropertiesChange" + JSON.stringify(value));
});
netConn.on('netUnavailable', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable " + value);
netId = true;
}
netConn.on('netLost', function (value) {
console.log("netLost" + JSON.stringify(value));
});
netConn.register((error) => {
if (error) {
console.info("${caseName} register fail ${error}");
}
netConn.on('netUnavailable', function (value) {
console.log("netUnavailable" + JSON.stringify(value));
});
await sleep(DELAY);
expect(true).assertTrue()
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregister result : ${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
}
done();
});
done();
});
});
/**
......@@ -1574,147 +920,38 @@
networkCap: [12],
}, bearerPrivateIdentifier: '123'
}
let netId = 0;
let netConn = connection.createNetConnection(netSpecifier, TIMEOUT);
netConn.on('netAvailable', (error, value) => {
netConn.register(function (error) {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
console.info(caseName + " register fail: " + JSON.stringify(error));
done();
} else {
console.info("${caseName} netAvailable : " + value.netId);
return;
}
});
netConn.on('netBlockStatusChange', (error, value) => {
netConn.unregister((error) => {
if (error) {
console.info("${caseName} register fail :${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
return;
}
});
netConn.on('netCapabilitiesChange', (error, value) => {
let netConn1 = connection.createNetConnection(netSpecifier, TIMEOUT);
netConn1.register(function (error) {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
console.info(caseName + " register fail: " + JSON.stringify(error));
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
return;
}
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
netConn1.unregister((error) => {
if (error) {
console.info("${caseName} register fail :${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
}
});
netConn.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost " + value.netId);
}
});
netConn.on('netUnavailable', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable " + value);
netId = true;
}
});
netConn.register((error) => {
if (error) {
console.info("${caseName} register fail ${error}");
}
});
await sleep(DELAY);
expect(true).assertTrue()
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregister result : ${error}");
}
done();
});
await sleep(DELAY);
let netConn1 = connection.createNetConnection(netSpecifier, TIMEOUT);
netConn1.on('netAvailable', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable : " + value.netId);
}
});
netConn.on('netBlockStatusChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
}
});
netConn1.on('netCapabilitiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
}
});
netConn1.on('netConnectionPropertiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
}
});
netConn1.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost " + value.netId);
}
});
netConn1.on('netUnavailable', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable " + value);
netId = true;
}
});
netConn1.register((error) => {
if (error) {
console.info("${caseName} register fail ${error}");
}
});
await sleep(DELAY);
expect(true).assertTrue()
netConn1.unregister((error) => {
if (error) {
console.info("${caseName} unregister result : ${error}");
}
done();
});
done();
});
/**
......@@ -1735,68 +972,21 @@
}, bearerPrivateIdentifier: '123'
}
let netConn = connection.createNetConnection(netSpecifier, TIMEOUT);
netConn.on('netAvailable', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable : " + value.netId);
}
});
netConn.on('netBlockStatusChange', (error, value) => {
netConn.register(function (error) {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
console.info(caseName + " register finish: " + JSON.stringify(error));
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
}
});
netConn.on('netCapabilitiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
}
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
return;
}
});
netConn.on('netLost', (error, value) => {
netConn.unregister((error) => {
if (error) {
console.info("${caseName} register fail :${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
} else {
console.info("${caseName} netLost " + value.netId);
}
});
netConn.on('netUnavailable', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable " + value);
}
});
netConn.register((error) => {
if (error) {
done();
}
done();
});
done();
});
/**
......@@ -1816,44 +1006,41 @@
networkCap: [0],
}, bearerPrivateIdentifier: '123'
}
let netId = 0;
let netConn = connection.createNetConnection(netSpecifier, TIMEOUT);
netConn.on('netAvailable', (error, value) => {
expect(false).assertTrue()
netConn.register(function (error) {
if (error) {
console.info(caseName + " register fail " + error);
done();
return;
}
netConn.on('netAvailable', function (value) {
console.log("netAvailable " + JSON.stringify(value));
});
netConn.on('netBlockStatusChange', (error, value) => {
expect(false).assertTrue()
done();
netConn.on('netBlockStatusChange', function (value) {
console.log("netBlockStatusChange " + JSON.stringify(value));
});
netConn.on('netCapabilitiesChange', (error, value) => {
expect(false).assertTrue()
done();
netConn.on('netCapabilitiesChange', function (value) {
console.log("netCapabilitiesChange " + JSON.stringify(value));
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
expect(false).assertTrue()
done();
netConn.on('netConnectionPropertiesChange', function (value) {
console.log("netConnectionPropertiesChange " + JSON.stringify(value));
});
netConn.on('netLost', (error, value) => {
expect(false).assertTrue()
done();
netConn.on('netLost', function (value) {
console.log("netLost " + JSON.stringify(value));
});
netConn.on('netUnavailable', (error, value) => {
done();
netConn.on('netUnavailable', function (value) {
console.log("netUnavailable " + JSON.stringify(value));
});
netConn.register((error) => {
if (error) {
console.info("${caseName} register fail ${error}");
}
});
await sleep(DELAY);
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregister result : ${error}");
console.info(caseName + " unregister fail " + error);
expect().assertFail();
done();
}
});
done();
});
});
});
/**
* @tc.number Telephony_NetworkManager_register_Async_2100
......@@ -1871,76 +1058,20 @@
networkCap: [0],
}, bearerPrivateIdentifier: '123'
}
let netId = 0;
let netConn = connection.createNetConnection(netSpecifier, TIMEOUT);
netConn.on('netAvailable', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable : " + value.netId);
}
});
netConn.on('netBlockStatusChange', (error, value) => {
netConn.register(function (error) {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
console.info(caseName + " register fail: " + JSON.stringify(error));
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
}
});
netConn.on('netCapabilitiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
}
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
}
});
netConn.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost " + value.netId);
return;
}
});
netConn.on('netUnavailable', (error, value) => {
netConn.unregister((error) => {
if (error) {
console.info("${caseName} register fail :${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable " + value);
netId = true;
}
});
netConn.register((error) => {
if (error) {
console.info("${caseName} register fail ${error}");
}
});
await sleep(DELAY);
expect(true).assertTrue()
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregister result : ${error}");
return;
}
done();
});
let netSpecifier1 = {
netCapabilities: {
linkUpBandwidthKbps: 0,
......@@ -1950,75 +1081,24 @@
}, bearerPrivateIdentifier: '123'
}
let netConn1 = connection.createNetConnection(netSpecifier1, TIMEOUT);
netConn1.on('netAvailable', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable : " + value.netId);
}
});
netConn1.on('netBlockStatusChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
}
});
netConn1.on('netCapabilitiesChange', (error, value) => {
netConn1.register(function (error) {
if (error) {
console.info("${caseName} register fail :${error}");
console.info(caseName + " register fail: " + JSON.stringify(error));
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
return;
}
});
netConn1.on('netConnectionPropertiesChange', (error, value) => {
netConn1.unregister((error) => {
if (error) {
console.info("${caseName} register fail :${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
}
});
netConn1.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost " + value.netId);
}
});
netConn1.on('netUnavailable', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable " + value);
netId = true;
}
});
netConn1.register((error) => {
if (error) {
console.info("${caseName} register fail ${error}");
}
});
await sleep(DELAY);
expect(true).assertTrue()
netConn1.unregister((error) => {
if (error) {
console.info("${caseName} unregister result : ${error}");
}
done();
});
done();
});
/**
......@@ -2037,76 +1117,20 @@
networkCap: [0],
}, bearerPrivateIdentifier: '123'
}
let netId = 0;
let netConn = connection.createNetConnection(netSpecifier, TIMEOUT);
netConn.on('netAvailable', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable : " + value.netId);
}
});
netConn.on('netBlockStatusChange', (error, value) => {
netConn.register(function (error) {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
console.info(caseName + " register fail: " + JSON.stringify(error));
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
}
});
netConn.on('netCapabilitiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
}
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
}
});
netConn.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost " + value.netId);
return;
}
});
netConn.on('netUnavailable', (error, value) => {
netConn.unregister((error) => {
if (error) {
console.info("${caseName} register fail :${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable " + value.netId);
netId = true;
}
});
netConn.register((error) => {
if (error) {
console.info("${caseName} register fail ${error}");
}
});
await sleep(DELAY);
expect(true).assertTrue()
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregister result : ${error}");
return;
}
done();
});
let netSpecifier1 = {
netCapabilities: {
linkUpBandwidthKbps: 0,
......@@ -2116,75 +1140,24 @@
}, bearerPrivateIdentifier: '123'
}
let netConn1 = connection.createNetConnection(netSpecifier1, TIMEOUT);
netConn1.on('netAvailable', (error, value) => {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable : " + value.netId);
}
});
netConn1.on('netBlockStatusChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
}
});
netConn1.on('netCapabilitiesChange', (error, value) => {
netConn1.register(function (error) {
if (error) {
console.info("${caseName} register fail :${error}");
console.info(caseName + " register fail: " + JSON.stringify(error));
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
return;
}
});
netConn1.on('netConnectionPropertiesChange', (error, value) => {
netConn1.unregister((error) => {
if (error) {
console.info("${caseName} register fail :${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
}
});
netConn1.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost " + value.netId);
}
});
netConn1.on('netUnavailable', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable " + value.netId);
netId = true;
}
});
netConn1.register((error) => {
if (error) {
console.info("${caseName} register fail ${error}");
}
});
await sleep(DELAY);
expect(true).assertTrue()
netConn1.unregister((error) => {
if (error) {
console.info("${caseName} unregister result : ${error}");
}
done();
});
done();
});
/**
......@@ -2196,60 +1169,40 @@
it('Telephony_NetworkManager_register_Async_2300', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_register_Async_2300';
let netConn = connection.createNetConnection();
let returnValue = 0;
netConn.on('netAvailable', (value) => {
if (value === undefined) {
console.info("${caseName} on netAvailable fail");
netConn.register(function (error) {
if (error) {
console.info(caseName + " register fail: " + JSON.stringify(error));
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable" + value.netId);
returnValue = value.netId;
return;
}
netConn.on('netAvailable', function (value) {
console.log("netAvailable " + JSON.stringify(value));
});
netConn.on('netCapabilitiesChange', (value) => {
if (value === undefined) {
console.info("${caseName} on netCapabilitiesChange fail");
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle " + value.netHandle.netId);
expect(value.netHandle.netId >= ETH_100 ).assertTrue();
}
netConn.on('netBlockStatusChange', function (value) {
console.log("netBlockStatusChange " + JSON.stringify(value));
});
netConn.on('netConnectionPropertiesChange', (value) => {
if (value === undefined) {
console.info("${caseName} on netConnectionPropertiesChange fail");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange hdndle" + value.netHandle.netId);
}
netConn.on('netCapabilitiesChange', function (value) {
console.log("netCapabilitiesChange " + JSON.stringify(value));
});
netConn.on('netLost', (value) => {
if (error) {
console.info("${caseName} netLost fail");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost " + value.netId);
}
netConn.on('netConnectionPropertiesChange', function (value) {
console.log("netConnectionPropertiesChange" + JSON.stringify(value));
});
netConn.register((error) => {
if (error) {
console.info("${caseName} register fail ${error}");
}
netConn.on('netLost', function (value) {
console.log("netLost" + JSON.stringify(value));
});
netConn.on('netUnavailable', function (value) {
console.log("netUnavailable" + JSON.stringify(value));
});
await sleep(DELAY);
console.info("${caseName} returnValue " + returnValue);
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregister result : ${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
}
done();
});
done();
});
});
/**
......@@ -2259,11 +1212,6 @@
* @tc.desc Function test
*/
it('Telephony_NetworkManager_unregister_Async_0100', 0, async function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let caseName = 'Telephony_NetworkManager_unregister_Async_0100';
let netSpecifier = {
netCapabilities: {
......@@ -2273,82 +1221,40 @@
networkCap: [0],
}, bearerPrivateIdentifier: '123'
}
let netConn = connection.createNetConnection(netSpecifier, TIMEOUT_1);
netConn.on('netAvailable', (error, value) => {
let netConn = connection.createNetConnection(netSpecifier, TIMEOUT);
netConn.register(function (error) {
if (error) {
console.info("${caseName} register fail: ${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable : " + value.netId);
console.info(caseName + " register fail: " + JSON.stringify(error));
done();
return;
}
netConn.on('netAvailable', function (value) {
console.log("netAvailable " + JSON.stringify(value));
});
netConn.on('netBlockStatusChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
done();
}
netConn.on('netBlockStatusChange', function (value) {
console.log("netBlockStatusChange " + JSON.stringify(value));
});
netConn.on('netCapabilitiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
done();
}
netConn.on('netCapabilitiesChange', function (value) {
console.log("netCapabilitiesChange " + JSON.stringify(value));
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
done();
}
netConn.on('netConnectionPropertiesChange', function (value) {
console.log("netConnectionPropertiesChange" + JSON.stringify(value));
});
netConn.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost " + value.netId);
done();
}
netConn.on('netLost', function (value) {
console.log("netLost" + JSON.stringify(value));
});
netConn.on('netUnavailable', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable " + value.netId);
done();
}
});
netConn.register((error) => {
if (error) {
console.info("${caseName} register fail ${error}");
}
netConn.on('netUnavailable', function (value) {
console.log("netUnavailable" + JSON.stringify(value));
});
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregister result : ${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
}
done();
});
done();
});
});
......@@ -2359,88 +1265,42 @@
* @tc.desc Function test
*/
it('Telephony_NetworkManager_unregister_Async_0200', 0, async function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let caseName = 'Telephony_NetworkManager_unregister_Async_0200';
let netConn = connection.createNetConnection();
netConn.on('netAvailable', (error, value) => {
netConn.register(function (error) {
if (error) {
console.info("${caseName} register fail: ${error}");
console.info(caseName + " register fail: " + JSON.stringify(error));
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable : " + value.netId);
done();
return;
}
netConn.on('netAvailable', function (value) {
console.log("netAvailable " + JSON.stringify(value));
});
netConn.on('netBlockStatusChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
done();
}
netConn.on('netBlockStatusChange', function (value) {
console.log("netBlockStatusChange " + JSON.stringify(value));
});
netConn.on('netCapabilitiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
done();
}
netConn.on('netCapabilitiesChange', function (value) {
console.log("netCapabilitiesChange " + JSON.stringify(value));
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
done();
}
netConn.on('netConnectionPropertiesChange', function (value) {
console.log("netConnectionPropertiesChange" + JSON.stringify(value));
});
netConn.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost " + value.netId);
done();
}
netConn.on('netLost', function (value) {
console.log("netLost" + JSON.stringify(value));
});
netConn.on('netUnavailable', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable " + value.netId);
done();
}
});
netConn.register((error) => {
if (error) {
console.info("${caseName} register fail ${error}");
}
netConn.on('netUnavailable', function (value) {
console.log("netUnavailable" + JSON.stringify(value));
});
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregister result : ${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
}
done();
});
done();
});
});
/**
......@@ -2450,86 +1310,43 @@
* @tc.desc Function test
*/
it('Telephony_NetworkManager_unregister_Async_0300', 0, async function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let caseName = 'Telephony_NetworkManager_unregister_Async_0300';
let netConn = connection.createNetConnection();
netConn.on('netAvailable', (error, value) => {
netConn.register(function (error) {
if (error) {
console.info("${caseName} register fail: ${error}");
console.info(caseName + " register fail: " + JSON.stringify(error));
expect().assertFail();
done();
} else {
console.info("${caseName} netAvailable : " + value.netId);
done();
return;
}
netConn.on('netAvailable', function (value) {
console.log("netAvailable " + JSON.stringify(value));
});
netConn.on('netBlockStatusChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netBlockStatusChange handle = :" + value.netHandle.netId);
done();
}
netConn.on('netBlockStatusChange', function (value) {
console.log("netBlockStatusChange " + JSON.stringify(value));
});
netConn.on('netCapabilitiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netCapabilitiesChange handle = :" + value.netHandle.netId);
done();
}
netConn.on('netCapabilitiesChange', function (value) {
console.log("netCapabilitiesChange " + JSON.stringify(value));
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netConnectionPropertiesChange handle = :" + value.netHandle.netId);
done();
}
netConn.on('netConnectionPropertiesChange', function (value) {
console.log("netConnectionPropertiesChange" + JSON.stringify(value));
});
netConn.on('netLost', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netLost " + value.netId);
done();
}
netConn.on('netLost', function (value) {
console.log("netLost" + JSON.stringify(value));
});
netConn.on('netUnavailable', (error, value) => {
if (error) {
console.info("${caseName} register fail :${error}");
expect().assertFail();
done();
} else {
console.info("${caseName} netUnavailable " + value.netId);
done();
}
netConn.on('netUnavailable', function (value) {
console.log("netUnavailable" + JSON.stringify(value));
});
expect(true).assertTrue();
netConn.unregister((error) => {
if (error) {
console.info("${caseName} unregister result : ${error}");
console.info(caseName + " unregister result: " + JSON.stringify(error));
expect().assertFail();
done();
}
done();
});
done();
});
});
});
}
\ No newline at end of file
\ No newline at end of file
......@@ -19,7 +19,6 @@ import observer from '@ohos.telephony.observer';
export default function ObserverJsunit() {
describe('ObserverJsunit', function () {
console.log("************* Observer Test start *************");
let envReady = false;
/*
* @tc.number : Telephony_observer_observer_DataConnectState_0100
......@@ -446,11 +445,6 @@ export default function ObserverJsunit() {
* @tc.desc : check the SIM_NONE property of LockReason
*/
it('Telephony_observer_LockReason_SIM_NONE_0100', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("************* Telephony_observer_LockReason_SIM_NONE_0100 Test start *************")
expect(0).assertEqual(observer.LockReason.SIM_NONE);
done();
......@@ -463,11 +457,6 @@ export default function ObserverJsunit() {
* @tc.desc : check the SIM_PIN property of LockReason
*/
it('Telephony_observer_LockReason_SIM_PIN_0100', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("************* Telephony_observer_LockReason_SIM_PIN_0100 Test start *************");
expect(1).assertEqual(observer.LockReason.SIM_PIN);
done();
......@@ -480,11 +469,6 @@ export default function ObserverJsunit() {
* @tc.desc : check the SIM_PUK property of LockReason
*/
it('Telephony_observer_LockReason_SIM_PUK_0100', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("************* Telephony_observer_LockReason_SIM_PUK_0100 Test start *************");
expect(2).assertEqual(observer.LockReason.SIM_PUK);
done();
......@@ -497,11 +481,6 @@ export default function ObserverJsunit() {
* @tc.desc : check the SIM_PN_PIN property of LockReason
*/
it('Telephony_observer_LockReason_SIM_PN_PIN_0100', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("************* Telephony_observer_LockReason_SIM_PN_PIN_0100 Test start *************");
expect(3).assertEqual(observer.LockReason.SIM_PN_PIN);
done();
......@@ -513,11 +492,6 @@ export default function ObserverJsunit() {
* @tc.desc : check the SIM_PN_PUK property of LockReason
*/
it('Telephony_observer_LockReason_SIM_PN_PUK_0100', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("************* Telephony_observer_LockReason_SIM_PN_PUK_0100 Test start *************");
expect(4).assertEqual(observer.LockReason.SIM_PN_PUK);
done();
......@@ -530,11 +504,6 @@ export default function ObserverJsunit() {
* @tc.desc : check the SIM_PU_PIN property of LockReason
*/
it('Telephony_observer_LockReason_SIM_PU_PIN_0100', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("************* Telephony_observer_LockReason_SIM_PU_PIN_0100 Test start *************");
expect(5).assertEqual(observer.LockReason.SIM_PU_PIN);
done();
......@@ -547,11 +516,6 @@ export default function ObserverJsunit() {
* @tc.desc : check the SIM_PU_PUK property of LockReason
*/
it('Telephony_observer_LockReason_SIM_PU_PUK_0100', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("************* Telephony_observer_LockReason_SIM_PU_PUK_0100 Test start *************");
expect(6).assertEqual(observer.LockReason.SIM_PU_PUK);
done();
......@@ -564,11 +528,6 @@ export default function ObserverJsunit() {
* @tc.desc : check the SIM_PP_PIN property of LockReason
*/
it('Telephony_observer_LockReason_SIM_PP_PIN_0100', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("************* Telephony_observer_LockReason_SIM_PP_PIN_0100 Test start *************");
expect(7).assertEqual(observer.LockReason.SIM_PP_PIN);
done();
......@@ -581,11 +540,6 @@ export default function ObserverJsunit() {
* @tc.desc : check the SIM_PP_PUK property of LockReason
*/
it('Telephony_observer_LockReason_SIM_PP_PUK_0100', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("************* Telephony_observer_LockReason_SIM_PP_PUK_0100 Test start *************");
expect(8).assertEqual(observer.LockReason.SIM_PP_PUK);
done();
......@@ -598,11 +552,6 @@ export default function ObserverJsunit() {
* @tc.desc : check the SIM_PC_PIN property of LockReason
*/
it('Telephony_observer_LockReason_SIM_PC_PIN_0100', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("************* Telephony_observer_LockReason_SIM_PC_PIN_0100 Test start *************");
expect(9).assertEqual(observer.LockReason.SIM_PC_PIN);
done();
......@@ -615,11 +564,6 @@ export default function ObserverJsunit() {
* @tc.desc : check the SIM_PC_PUK property of LockReason
*/
it('Telephony_observer_LockReason_SIM_PC_PUK_0100', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("************* Telephony_observer_LockReason_SIM_PC_PUK_0100 Test start *************");
expect(10).assertEqual(observer.LockReason.SIM_PC_PUK);
done();
......@@ -632,11 +576,6 @@ export default function ObserverJsunit() {
* @tc.desc : check the SIM_SIM_PIN property of LockReason
*/
it('Telephony_observer_LockReason_SIM_SIM_PIN_0100', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("************* Telephony_observer_LockReason_SIM_SIM_PIN_0100 Test start *************");
expect(11).assertEqual(observer.LockReason.SIM_SIM_PIN);
done();
......@@ -649,11 +588,6 @@ export default function ObserverJsunit() {
* @tc.desc : check the SIM_SIM_PUK property of LockReason
*/
it('Telephony_observer_LockReason_SIM_SIM_PUK_0100', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("************* Telephony_observer_LockReason_SIM_SIM_PUK_0100 Test start *************");
expect(12).assertEqual(observer.LockReason.SIM_SIM_PUK);
done();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册