提交 04b99c0d 编写于 作者: Q quanli

quanli1@huawei.com

Signed-off-by: Nquanli <quanli1@huawei.com>
上级 3e03a27d
...@@ -25,7 +25,7 @@ function sleep(delay) { ...@@ -25,7 +25,7 @@ function sleep(delay) {
} }
function checkWifiPowerOn(){ function checkWifiPowerOn(){
console.info("Wifi_test/wifi status:" + wifi.isWifiActive()); console.info("wifi_test/wifi status:" + wifi.isWifiActive());
} }
let GroupOwnerBand = { let GroupOwnerBand = {
...@@ -34,7 +34,7 @@ let GroupOwnerBand = { ...@@ -34,7 +34,7 @@ let GroupOwnerBand = {
GO_BAND_5GHZ : 2, GO_BAND_5GHZ : 2,
} }
describe('ACTS_WifiTest', function () { describe('ActsWifiTest', function () {
beforeEach(function () { beforeEach(function () {
console.info("beforeEach start"); console.info("beforeEach start");
checkWifiPowerOn(); checkWifiPowerOn();
...@@ -101,7 +101,6 @@ describe('ACTS_WifiTest', function () { ...@@ -101,7 +101,6 @@ describe('ACTS_WifiTest', function () {
if (err) { if (err) {
console.error('wifi_test / failed to get getCurrentGroup: ' + JSON.stringify(err)); console.error('wifi_test / failed to get getCurrentGroup: ' + JSON.stringify(err));
expect().assertFail(); expect().assertFail();
return;
}else{ }else{
console.info("[wifi_test] getCurrentGroup [callback] -> " + JSON.stringify(result)); console.info("[wifi_test] getCurrentGroup [callback] -> " + JSON.stringify(result));
let removeConfig = wifi.removeGroup(); let removeConfig = wifi.removeGroup();
...@@ -215,8 +214,6 @@ describe('ACTS_WifiTest', function () { ...@@ -215,8 +214,6 @@ describe('ACTS_WifiTest', function () {
expect(true).assertEqual(resultLength!=0); expect(true).assertEqual(resultLength!=0);
done() done()
}); });
done();
}) })
/** /**
...@@ -506,3 +503,4 @@ describe('ACTS_WifiTest', function () { ...@@ -506,3 +503,4 @@ describe('ACTS_WifiTest', function () {
console.log("*************[wifi_test] start wifi js unit test end*************"); console.log("*************[wifi_test] start wifi js unit test end*************");
}) })
...@@ -25,11 +25,11 @@ function sleep(delay) { ...@@ -25,11 +25,11 @@ function sleep(delay) {
} }
function checkWifiPowerOn(){ function checkWifiPowerOn(){
console.info("Wifi_test/wifi status:" + wifi.isWifiActive()); console.info("wifi_test/wifi status:" + wifi.isWifiActive());
} }
function resolve(ip) { function resolveIP(ip) {
return (ip>>24 & 0xFF) + "." + (ip>>16 & 0xFF ) + (ip>>8 & 0xFF ) + (ip & 0xFF ); return (ip>>24 & 0xFF) + "." + (ip>>16 & 0xFF ) + "." +(ip>>8 & 0xFF ) + "." + (ip & 0xFF );
} }
...@@ -65,11 +65,11 @@ let WifiChannelWidth = { ...@@ -65,11 +65,11 @@ let WifiChannelWidth = {
WIDTH_40MHZ : 1, WIDTH_40MHZ : 1,
WIDTH_80MHZ : 2, WIDTH_80MHZ : 2,
WIDTH_160MHZ : 3, WIDTH_160MHZ : 3,
WIDTH_280MHZ_PLUS : 4, WIDTH_80MHZ_PLUS : 4,
WIDTH_INVALID WIDTH_INVALID : null,
} }
describe('ACTS_WifiTest', function() { describe('ActsWifiTest', function() {
beforeEach(function() { beforeEach(function() {
checkWifiPowerOn(); checkWifiPowerOn();
...@@ -123,8 +123,10 @@ describe('ACTS_WifiTest', function() { ...@@ -123,8 +123,10 @@ describe('ACTS_WifiTest', function() {
"rssi: " + result[j].rssi + "band: " + result[j].band + "rssi: " + result[j].rssi + "band: " + result[j].band +
"frequency: " + result[j].frequency + "frequency: " + result[j].frequency +
"timestamp" + result[j].timestamp + "capabilities" + result[j].capabilities "timestamp" + result[j].timestamp + "capabilities" + result[j].capabilities
+ "channelWidth: " + result[j].channelWidth+"centerFrequency0"+result[j].centerFrequency0 + "channelWidth: " + result[j].channelWidth+"centerFrequency0"
+"centerFrequency1"+result[j].centerFrequency1+"infoElems"+result[j].infoElems +result[j].centerFrequency0
+"centerFrequency1"+result[j].centerFrequency1
+"infoElems"+result[j].infoElems
); );
} }
} }
...@@ -194,8 +196,9 @@ describe('ACTS_WifiTest', function() { ...@@ -194,8 +196,9 @@ describe('ACTS_WifiTest', function() {
expect(wifi.isWifiActive()).assertTrue(); expect(wifi.isWifiActive()).assertTrue();
let countryCode = wifi.getCountryCode(); let countryCode = wifi.getCountryCode();
console.info("[wifi_test] getCountryCode -> " + JSON.stringify(countryCode)); console.info("[wifi_test] getCountryCode -> " + JSON.stringify(countryCode));
console.info("[wifi_test] getCountryCode.length -> " + JSON.stringify(countryCode.length)); let countrylen = countryCode.length;
expect(true).assertEqual(countryCode.length == 2); console.info("[wifi_test] getCountryCode.length -> " + JSON.stringify(countrylen));
expect(true).assertEqual(countrylen == 2);
}) })
/** /**
...@@ -285,32 +288,32 @@ describe('ACTS_WifiTest', function() { ...@@ -285,32 +288,32 @@ describe('ACTS_WifiTest', function() {
"linkSpeed: " + result.linkSpeed + "frequency:" "linkSpeed: " + result.linkSpeed + "frequency:"
+ result.frequency + "snr:" +result.snr + + result.frequency + "snr:" +result.snr +
"macAddress: " + result.macAddress + "ipAddress: " + result.ipAddress + "macAddress: " + result.macAddress + "ipAddress: " + result.ipAddress +
"suppState" + result.suppState +"connState: " + result.connState+ "suppState:" + result.suppState +"connState: " + result.connState+
"macType: " + result.macType); "macType: " + result.macType);
let state = wifi.getLinkedInfo().connState; let state = wifi.getLinkedInfo().connState;
if(state == connState.SCANNING){ if(state == ConnState.SCANNING){
expect(true).assertEqual(state == 0); expect(true).assertEqual(state == 0);
} }
if(state == connState.CONNECTING){ if(state == ConnState.CONNECTING){
expect(true).assertEqual(state == 1); expect(true).assertEqual(state == 1);
} }
if(state == connState.AUTHENTICATING){ if(state == ConnState.AUTHENTICATING){
expect(true).assertEqual(state == 2); expect(true).assertEqual(state == 2);
} }
if(state == connState.OBTAINING_IPADDR){ if(state == ConnState.OBTAINING_IPADDR){
expect(true).assertEqual(state == 3); expect(true).assertEqual(state == 3);
} }
if(state == connState.CONNECTED){ if(state == ConnState.CONNECTED){
expect(true).assertEqual(state == 4); expect(true).assertEqual(state == 4);
} }
if(state == connState.DISCONNECTING){ if(state == ConnState.DISCONNECTING){
expect(true).assertEqual(state == 5); expect(true).assertEqual(state == 5);
} }
if(state == connState.DISCONNECTED){ if(state == ConnState.DISCONNECTED){
expect(true).assertEqual(state == 6); expect(true).assertEqual(state == 6);
} }
if(state == connState.UNKNOWN){ if(state == ConnState.UNKNOWN){
expect(true).assertEqual(state == 7); expect(true).assertEqual(state == 7);
} }
done(); done();
...@@ -465,11 +468,11 @@ describe('ACTS_WifiTest', function() { ...@@ -465,11 +468,11 @@ describe('ACTS_WifiTest', function() {
* @tc.level Level 3 * @tc.level Level 3
*/ */
it('SUB_Communication_WiFi_Hotspot_Off_0002', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Off_0002', 0, async function (done) {
console.info("[wifi_test] hotspotStateChange off test");
try { try {
await wifi.off('hotspotStateChange', (data) => { await wifi.off('hotspotStateChange', (data) => {
console.info("[wifi_test] hotspotStateChange Off ->" + data); console.info("[wifi_test] hotspotStateChange Off ->" + data);
expect(true).assertEqual(data != null); expect(true).assertEqual(data != null);
console.info("[wifi_test] wifiRssiChange unregister end");
}); });
}catch(e) { }catch(e) {
...@@ -480,3 +483,4 @@ describe('ACTS_WifiTest', function() { ...@@ -480,3 +483,4 @@ describe('ACTS_WifiTest', function() {
console.log("*************[wifi_test] start wifi js unit test end*************"); console.log("*************[wifi_test] start wifi js unit test end*************");
}) })
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册