提交 ebceba2f 编写于 作者: Q quanli

quanli1@huawei.com

Signed-off-by: Nquanli <quanli1@huawei.com>
上级 e185b7df
......@@ -219,23 +219,19 @@ describe('btManagerGattManagerTest', function() {
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BTMANAGER_GETDEVICENAME_0100', 0, async function (done) {
await sleep(5000)
try {
await gattClient.getDeviceName().then((data) => {
console.info('[bluetooth_js] device name:' + JSON.stringify(data))
expect(true).assertEqual(data != null);
done();
}).catch(err => {
console.error('[bluetooth_js] bluetooth getDeviceName has error: '+ JSON.stringify(err));
expect(err).assertFalse();
done();
expect(err.code).assertEqual(2900099);
});
} catch (error) {
console.error(`[bluetooth_js]GetDeviceName_0100 failed, code is ${error.code},
message is ${error.message}`);
expect(true).assertFalse();
done()
console.error(`[bluetooth_js]GetDeviceName_0100 failed, code is ${error.code},message is ${error.message}`);
expect(error.code).assertEqual('2900099');
}
done();
})
/**
......@@ -305,7 +301,7 @@ describe('btManagerGattManagerTest', function() {
expect(true).assertEqual(data.length >= 0);
} else {
console.info('[bluetooth_js] get services code ' + JSON.stringify(code));
expect(true).assertEqual(code.code == -1);
expect(false).assertEqual(code.code == 0);
}
done();
});
......@@ -475,6 +471,14 @@ describe('btManagerGattManagerTest', function() {
console.log('bluetooth characteristic characteristicUuid:'+ BLECharacteristic.characteristicUuid);
console.log('bluetooth characteristic characteristicValue:'+ BLECharacteristic.characteristicValue);
console.log('bluetooth characteristic descriptors:'+ BLECharacteristic.descriptors);
console.log('bluetooth characteristic properties:'+ BLECharacteristic.properties);
console.log('bluetooth BLECharacteristic write:'+ BLECharacteristic.properties.write);
console.log('bluetooth BLECharacteristic writeNoResponse:'+ BLECharacteristic.properties.writeNoResponse);
console.log('bluetooth BLECharacteristic read:'+ BLECharacteristic.properties.read);
console.log('bluetooth BLECharacteristic notify:'+ BLECharacteristic.properties.notify);
console.log('bluetooth BLECharacteristic indicate:'+ BLECharacteristic.properties.indicate);
let value = new Uint8Array(BLECharacteristic.characteristicValue);
console.log('bluetooth characteristic value: '
+ value[0] +','+ value[1]+','+ value[2]+','+ value[3]);
......
......@@ -101,6 +101,7 @@ export default function actsWifiManagerEventTest() {
};
let wifiP2PConfig = {
deviceAddress : "22:9b:e6:48:1f:5c",
deviceAddressType : 1,
netId : -1,
passphrase : "12345678",
groupName : "DIRECT-AAAZZZ456",
......
......@@ -604,8 +604,13 @@ export default function actsWifiManagerFunctionTest() {
* @tc.level Level 3
*/
it('SUB_Communication_WiFi_XTS_P2P_0009', 0, async function (done) {
let DeviceAddressType = {
RANDOM_DEVICE_ADDRESS : 0 ,
REAL_DEVICE_ADDRESS : 1 ,
};
let wifiP2PConfig = {
deviceAddress : "11:22:33:44:55:66",
deviceAddressType : wifiMg.DeviceAddressType.REAL_DEVICE_ADDRESS,
netId : -1,
passphrase : "12345678",
groupName : "DIRECT-AAAZZZ456",
......@@ -694,7 +699,8 @@ export default function actsWifiManagerFunctionTest() {
}
console.info("[wifi_test]getP2pLocalDevice callback result: " + JSON.stringify(ret));
console.info("deviceName: " + ret.deviceName + "deviceAddress: " +
ret.deviceAddress + "primaryDeviceType: " + ret.primaryDeviceType +
ret.deviceAddress + "deviceAddressType: " + ret.deviceAddressType +
"primaryDeviceType: " + ret.primaryDeviceType +
"deviceStatus: " + ret.deviceStatus + "groupCapabilitys: " +
ret.groupCapabilitys );
resolve();
......
......@@ -138,9 +138,48 @@ export default function actsWifiManagerCandidateNetWorkTest() {
* @tc.level Level 2
*/
it('SUB_Communication_WiFi_XTS_CandidateNetWork_0002', 0, async function (done) {
let EapMethod = {
"EAP_NONE": 0,
"EAP_PEAP": 1,
"EAP_TLS": 2,
"EAP_TTLS": 3,
"EAP_PWD": 4,
"EAP_SIM": 5,
"EAP_AKA": 6,
"EAP_AKA_PRIME": 7,
"EAP_UNAUTH_TLS": 8,
};
let Phase2Method = {
"PHASE2_NONE": 0,
"PHASE2_PAP": 1,
"PHASE2_MSCHAP": 2,
"PHASE2_MSCHAPV2": 3,
"PHASE2_GTC": 4,
"PHASE2_SIM": 5,
"PHASE2_AKA": 6,
"PHASE2_AKA_PRIME": 7,
};
let WifiEapConfig = {
"eapMethod": wifiMg.EapMethod.EAP_NONE,
"phase2Method": wifiMg.Phase2Method.PHASE2_NONE,
"identity": "aaa",
"anonymousIdentity": "bbb",
"password": "12345678",
"caCertAliases": "ddd",
"caPath": "eee",
"clientCertAliases": "fff",
"certEntry": new Uint8Array(),
"certPassword": "12345678",
"altSubjectMatch": "ggg",
"domainSuffixMatch": "hhh",
"realm": "iii",
"plmn": "jjj",
"eapSubId": "kkk",
};
let wifiDeviceConfig = {
"ssid": "TEST_PSK",
"bssid": "22:9b:e6:48:1f:5c",
"bssidType" : 1,
"preSharedKey": "12345678",
"isHiddenSsid": false,
"securityType": wifiMg.WifiSecurityType.WIFI_SEC_TYPE_PSK,
......@@ -151,6 +190,7 @@ export default function actsWifiManagerCandidateNetWorkTest() {
"randomMacType": 0,
"randomMacAddr": "11:22:33:44:55:66",
"staticIp": {"ipAddress": 1284752956,"gateway": 1284752936},
"eapConfig": wifiMg.WifiEapConfig,
};
await wifiMg.addCandidateConfig(wifiDeviceConfig)
.then(netWorkId => {
......@@ -381,4 +421,3 @@ export default function actsWifiManagerCandidateNetWorkTest() {
})
})
}
......@@ -308,8 +308,10 @@ export default function actsWifiManagerFunctionsTest() {
it('SUB_Communication_WiFi_XTS_Sta_0034', 0, async function(done) {
let scanResult = wifiMg.scan();
await sleep(3000);
let getScanInfoListResult = wifiMg.getScanInfoList();
let getScanInfoListResult = wifiMg.getScanResultsSync();
console.info("[wifi_test]wifi getScanInfoList result : " + JSON.stringify(getScanInfoListResult));
let getScanInfoResult = wifiMg.getScanInfoList();
console.info("[wifi_test]wifi getScanInfoList result : " + JSON.stringify(getScanInfoResult));
let clen = Object.keys(getScanInfoListResult).length;
console.info("[wifi_test]wifi getScanInfoList length result : " + JSON.stringify(clen));
let result = getScanInfoListResult;
......@@ -317,6 +319,7 @@ export default function actsWifiManagerFunctionsTest() {
expect(true).assertEqual(clen >= 0);
for (let j = 0; j < clen; ++j) {
console.info("ssid: " + result[j].ssid + "bssid: " + result[j].bssid +
"bssidType: " + result[j].bssidType +
"securityType: " + result[j].securityType +
"rssi: " + result[j].rssi + "band: " + result[j].band +
"frequency: " + result[j].frequency + "channelWidth: " + result[j].channelWidth +
......@@ -358,7 +361,67 @@ export default function actsWifiManagerFunctionsTest() {
expect(typeof (isBandTypeSupported4)).assertEqual('boolean');
done();
})
/**
* @tc.number SUB_Communication_WiFi_XTS_Sta_0036
* @tc.name testgetScanResults
* @tc.desc Test getScanResults promise and callback API functionality.
* @tc.type Function
* @tc.level Level 0
*/
it('SUB_Communication_WiFi_XTS_Sta_0036', 0, async function (done) {
await wifiMg.getScanResults()
.then(result => {
let clen = Object.keys(result).length;
expect(true).assertEqual(clen >= 0);
console.info("[wifi_test]getScanResults promise result:" + JSON.stringify(result));
});
function getScan() {
return new Promise((resolve, reject) => {
wifiMg.getScanResults(
(err, result) => {
if (err) {
console.log("[wifi_test] wifi getScanResults failed:" + err);
}
let clen = Object.keys(result).length;
if (!(clen == 0)) {
expect(clen).assertLarger(0);
console.info("[wifi_test] getScanResults callback result: " + JSON.stringify(result));
for (let j = 0; j < clen; ++j) {
console.info("ssid: " + result[j].ssid + "bssid: " + result[j].bssid +
"securityType: " + result[j].securityType +
"rssi: " + result[j].rssi + "band: " + result[j].band +
"frequency: " + result[j].frequency + "channelWidth: " +
result[j].channelWidth +
"timestamp" + result[j].timestamp + "capabilities" + result[j].capabilities);
}
}
resolve();
});
});
}
await getScan();
done();
})
/**
* @tc.number Communication_WiFi_XTS_Sta_0037
* @tc.name testgetIpv6Info
* @tc.desc Test getIpv6Info API functionality.
* @tc.type Function
* @tc.level Level 0
*/
it('Communication_WiFi_XTS_Sta_0037', 0, function () {
let ipv6InfoResult = wifiMg.getIpv6Info();
console.info("[wifi_test]ipv6InfoResult." + JSON.stringify(ipv6InfoResult));
expect(JSON.stringify(ipv6InfoResult)).assertContain("gateway");
console.info("linkIpv6Address: " + ipv6InfoResult.linkIpv6Address + "globalIpv6Address: " +
ipv6InfoResult.globalIpv6Address
+ "randomGlobalIpv6Address: " + ipv6InfoResult.randomGlobalIpv6Address +
"gateway: " + ipv6InfoResult.gateway +
"netmask: " + ipv6InfoResult.netmask + "primaryDns:" + ipv6InfoResult.primaryDNS +
"secondDns: " + ipv6InfoResult.secondDNS);
})
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.
先完成此消息的编辑!
想要评论请 注册