提交 5b12b339 编写于 作者: Q q00313334

quanli1@huawei.com

Signed-off-by: Nq00313334 <quanli1@huawei.com>
上级 99cea292
...@@ -17,10 +17,10 @@ group("communication") { ...@@ -17,10 +17,10 @@ group("communication") {
if (is_standard_system) { if (is_standard_system) {
deps = [ deps = [
"bluetooth_ble:ActsBluetoothBleJsTest", "bluetooth_ble:ActsBluetoothBleJsTest",
"bluetooth_hid:ActsBluetoothHidJsTest",
"bluetooth_on:ActsBluetoothOnJsTest", "bluetooth_on:ActsBluetoothOnJsTest",
"bluetooth_standard:ActsBluetoothJsTest", "bluetooth_standard:ActsBluetoothJsTest",
"dsoftbus/rpc:ActsRpcJsTest", "dsoftbus/rpc:ActsRpcJsTest",
"wifi_hotspot:ActsHotSpotJSTest",
"wifi_p2p:ActsP2PJSTest", "wifi_p2p:ActsP2PJSTest",
"wifi_standard:ActsWifiJSTest", "wifi_standard:ActsWifiJSTest",
] ]
......
# Copyright (C) 2022 Huawei Device Co., Ltd. # Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
...@@ -12,20 +12,20 @@ ...@@ -12,20 +12,20 @@
# limitations under the License. # limitations under the License.
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsBluetoothHidJsTest") {
ohos_js_hap_suite("ActsHotSpotJSTest") {
hap_profile = "./src/main/config.json" hap_profile = "./src/main/config.json"
deps = [ deps = [
":wifi_js_assets", ":bluetooth_js_assets",
":wifi_resources", ":bluetooth_resources",
] ]
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsHotSpotJSApiTest" hap_name = "ActsBluetoothHidHapTest"
} }
ohos_js_assets("wifi_js_assets") { ohos_js_assets("bluetooth_js_assets") {
source_dir = "./src/main/js/default" source_dir = "./src/main/js/default"
} }
ohos_resources("wifi_resources") { ohos_resources("bluetooth_resources") {
sources = [ "./src/main/resources" ] sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json" hap_profile = "./src/main/config.json"
} }
{ {
"description": "Configuration for wifi js api Tests", "description": "Configuration for bluetooth js api Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "JSUnitTest",
"test-timeout": "600000", "test-timeout": "600000",
"package": "ohos.acts.communication.wifi.wifidevice", "package": "ohos.acts.communication.bluetooth.bluetoothhost",
"shell-timeout": "600000" "shell-timeout": "60000"
}, },
"kits": [ "kits": [
{ {
"test-file-name": [ "test-file-name": [
"ActsHotSpotJSApiTest.hap" "ActsBluetoothHidHapTest.hap"
], ],
"type": "AppInstallKit", "type": "AppInstallKit",
"cleanup-apps": true "cleanup-apps": true
......
{ {
"app": { "app": {
"bundleName": "ohos.acts.communication.wifi.wifidevice", "bundleName": "ohos.acts.communication.bluetooth.bluetoothhost",
"vendor": "acts", "vendor": "acts",
"version": { "version": {
"code": 1000000, "code": 1000000,
...@@ -13,15 +13,14 @@ ...@@ -13,15 +13,14 @@
}, },
"deviceConfig": {}, "deviceConfig": {},
"module": { "module": {
"package": "ohos.acts.communication.wifi.wifidevice", "package": "ohos.acts.communication.bluetooth.bluetoothhost",
"name": ".MyApplication", "name": ".MyApplication",
"mainAbility": "ohos.acts.communication.wifi.wifidevice.MainAbility",
"deviceType": [ "deviceType": [
"phone" "phone"
], ],
"distro": { "distro": {
"deliveryWithInstall": true, "deliveryWithInstall": true,
"moduleName": "wifi_standard", "moduleName": "entry",
"moduleType": "entry" "moduleType": "entry"
}, },
"abilities": [ "abilities": [
...@@ -37,7 +36,7 @@ ...@@ -37,7 +36,7 @@
] ]
} }
], ],
"name": "ohos.acts.communication.wifi.wifidevice.MainAbility", "name": "ohos.acts.communication.bluetooth.bluetoothhost.MainAbility",
"icon": "$media:icon", "icon": "$media:icon",
"description": "$string:mainability_description", "description": "$string:mainability_description",
"label": "$string:app_name", "label": "$string:app_name",
...@@ -59,41 +58,47 @@ ...@@ -59,41 +58,47 @@
], ],
"reqPermissions": [ "reqPermissions": [
{ {
"name" : "ohos.permission.GET_WIFI_INFO", "name": "ohos.permission.USE_BLUETOOTH",
"reason" : "use ohos.permission.GET_WIFI_INFO" "reason": "",
}, "usedScene": {
{ "ability": [
"name" : "ohos.permission.SET_WIFI_INFO", "ohos.acts.communication.bluetooth.bluetoothhost.MainAbility"
"reason" : "use ohos.permission.SET_WIFI_INFO" ],
}, "when": "inuse"
{ }
"name" : "ohos.permission.MANAGE_WIFI_CONNECTION",
"reason" : "use ohos.permission.MANAGE_WIFI_CONNECTION"
},
{
"name" : "ohos.permission.SET_WIFI_CONFIG",
"reason" : "use ohos.permission.SET_WIFI_CONFIG"
},
{
"name" : "ohos.permission.GET_WIFI_CONFIG",
"reason" : "use ohos.permission.GET_WIFI_CONFIG"
},
{
"name" : "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason" : "use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
}, },
{ {
"name" : "ohos.permission.GET_WIFI_LOCAL_MAC", "name": "ohos.permission.MANAGE_BLUETOOTH",
"reason" : "use ohos.permission.GET_WIFI_LOCAL_MAC" "reason": "",
"usedScene": {
"ability": [
"ohos.acts.communication.bluetooth.bluetoothhost.MainAbility"
],
"when": "inuse"
}
}, },
{ {
"name" : "ohos.permission.MANAGE_WIFI_HOTSPOT", "name": "ohos.permission.DISCOVER_BLUETOOTH",
"reason" : "use ohos.permission.MANAGE_WIFI_HOTSPOT" "reason": "",
"usedScene": {
"ability": [
"ohos.acts.communication.bluetooth.bluetoothhost.MainAbility"
],
"when": "inuse"
}
}, },
{ {
"name" : "ohos.permission.GET_WIFI_INFO_INTERNAL", "name": "ohos.permission.LOCATION",
"reason" : "use ohos.permission.GET_WIFI_INFO_INTERNAL" "reason": "",
"usedScene": {
"ability": [
"ohos.acts.communication.bluetooth.bluetoothhost.MainAbility"
],
"when": "inuse"
}
} }
] ]
} }
} }
/* /*
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
* limitations under the License. * limitations under the License.
*/ */
.container { .container {
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
* limitations under the License. * limitations under the License.
*/ */
<div class="container"> <div class="container">
<text class="title"> <text class="title">
{{ $t('strings.hello') }} {{ title }} {{ $t('strings.hello') }} {{ title }}
......
...@@ -14,13 +14,11 @@ ...@@ -14,13 +14,11 @@
*/ */
import {Core, ExpectExtend} from 'deccjsunit/index' import {Core, ExpectExtend} from 'deccjsunit/index'
export default { export default {
data: { data: {
title: '', title: ""
myTimeout: 25000
}, },
onInit() { onInit() {
this.title = this.$t('strings.world'); this.title = this.$t('strings.world');
...@@ -38,7 +36,6 @@ export default { ...@@ -38,7 +36,6 @@ export default {
core.init() core.init()
const configService = core.getDefaultService('config') const configService = core.getDefaultService('config')
this.timeout = this.myTimeout
configService.setConfig(this) configService.setConfig(this)
require('../../test/List.test') require('../../test/List.test')
......
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import bluetooth from '@ohos.bluetooth';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
let hidHostProfile = bluetooth.getProfile(6);
function on(ON_VALUE_TEST_ELEMENT) {
return new Promise((resolve, reject) => {
hidHostProfile.on(ON_VALUE_TEST_ELEMENT, function (err, data) {
if (err != undefined) {
reject(err);
} else {
resolve(data);
}
})
});
}
function off(OFF_VALUE_TEST_ELEMENT) {
return new Promise((resolve, reject) => {
hidHostProfile.off(OFF_VALUE_TEST_ELEMENT, function (err, data) {
if (err != undefined) {
reject(err);
} else {
resolve(data);
}
})
});
}
let ProfId = {
PROFILE_A2DP_SINK : 0,
PROFILE_A2DP_SOURCE : 1,
PROFILE_AVRCP_CT : 2,
PROFILE_AVRCP_TG : 3,
PROFILE_HANDS_FREE_AUDIO_GATEWAY : 4,
PROFILE_HANDS_FREE_UNIT : 5
}
describe('bluetoothhostTest', function () {
beforeAll(function () {
console.info('beforeAll called')
})
beforeEach(function () {
console.info('beforeEach called')
})
afterEach(function () {
console.info('afterEach called')
})
afterAll(function () {
console.info('afterAll called')
})
function sleep(delay) {
return new Promise(resovle => setTimeout(resovle, delay))
}
async function tryToEnableBt() {
let sta = bluetooth.getState();
switch(sta){
case 0:
console.info('[bluetooth_js] bt turn off:'+ JSON.stringify(sta));
bluetooth.enableBluetooth();
await sleep(3000);
break;
case 1:
console.info('[bluetooth_js] bt turning on:'+ JSON.stringify(sta));
await sleep(3000);
break;
case 2:
console.info('[bluetooth_js] bt turn on:'+ JSON.stringify(sta));
break;
case 3:
console.info('[bluetooth_js] bt turning off:'+ JSON.stringify(sta));
bluetooth.enableBluetooth();
await sleep(3000);
break;
default:
console.info('[bluetooth_js] enable success');
}
}
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GET_PROFILE_LOOP_0001
* @tc.name looptestgetprofile(set parameterless)
* @tc.desc Test getProfile api 1000 times.
* @tc.author defu.zheng
* @tc.size SMALL
* @tc.type Function
* @tc.level Level 0
*/
it('SUB_COMMUNACATION_bluetooth_DEVICE_JS_GET_PROFILE_LOOP_0001', 0, async function (done) {
console.info('[bluetooth_js] loop get profile start');
await tryToEnableBt();
let proFile = bluetooth.getProfile(6);
console.info('[bluetooth_js] loop get profile result:' + JSON.stringify(proFile));
expect(proFile != null).assertEqual(true);
done();
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GET_CONN_DEV_LOOP_0001
* @tc.name looptestgetConnectionDevices(bluetooth mode is off)
* @tc.desc Test getConnectionDevices api 1000 times.
* @tc.author defu.zheng
* @tc.size SMALL
* @tc.type Function
* @tc.level Level 0
*/
it('SUB_COMMUNACATION_bluetooth_DEVICE_JS_GET_CONN_DEV_LOOP_0001', 0, async function (done) {
console.info('[bluetooth_js] loop get connection devices start');
await tryToEnableBt();
let arrDev = hidHostProfile.getConnectionDevices();
console.info('[bluetooth_js] loop getconndev:' + JSON.stringify(arrDev)+ 'length'+ arrDev.length);
expect(arrDev.length).assertEqual(0);
done();
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GET_DEV_STATE_LOOP_0001
* @tc.name looptestgetDeviceState(set a null value)
* @tc.desc Test getDeviceState api 1000 times.
* @tc.author defu.zheng
* @tc.size SMALL
* @tc.type Function
* @tc.level Level 0
*/
it('SUB_COMMUNACATION_bluetooth_DEVICE_JS_GET_DEV_STATE_LOOP_0001', 0, async function (done) {
console.info('[bluetooth_js] loop get device state start');
await tryToEnableBt();
let devState = hidHostProfile.getDeviceState('');
console.info('[bluetooth_js] loop get device state result:' + JSON.stringify(devState));
expect(devState).assertEqual(3);
done();
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_HID_HOST_PROFILE_CONN_LOOP_0001
* @tc.name looptesthidhostprofileconnect(set a null value)
* @tc.desc Test hidHostProfile connect api 1000 times.
* @tc.author defu.zheng
* @tc.size SMALL
* @tc.type Function
* @tc.level Level 0
*/
it('SUB_COMMUNACATION_bluetooth_DEVICE_JS_HID_HOST_PROFILE_CONN_LOOP_0001', 0, async function (done) {
console.info('[bluetooth_js] loop HidHostProfile the connect start');
await tryToEnableBt();
let conn = hidHostProfile.connect('');
console.info('[bluetooth_js] loop HidHostProfile the connect result:' + JSON.stringify(conn));
expect(conn).assertFalse();
done();
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_HID_HOST_PROFILE_DISCONN_LOOP_0001
* @tc.name looptesthidhostprofiledisconnect(set a null value)
* @tc.desc Test hidHostProfile disconnect api 1000 times.
* @tc.author defu.zheng
* @tc.size SMALL
* @tc.type Function
* @tc.level Level 0
*/
it('SUB_COMMUNACATION_bluetooth_DEVICE_JS_HID_HOST_PROFILE_DISCONN_LOOP_0001', 0, async function (done) {
console.info('[bluetooth_js] loop HidHostProfile the disconnect start');
await tryToEnableBt();
let disConn = hidHostProfile.disconnect('');
console.info('[bluetooth_js] loop HidHostProfile the disconnect result:' + JSON.stringify(disConn));
expect(disConn).assertFalse();
done();
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_HID_HOST_PROFILE_ON_LOOP_0001
* @tc.name looptesthidhostprofileon
* @tc.desc Test hidHostProfile on api 1000 times.
* @tc.author defu.zheng
* @tc.size SMALL
* @tc.type Function
* @tc.level Level 0
*/
it('SUB_COMMUNACATION_bluetooth_DEVICE_JS_HID_HOST_PROFILE_ON_LOOP_0001', 0, async function (done) {
try {
await tryToEnableBt();
console.info('[bluetooth_js] loop HidHostProfile the on start');
on("connectionStateChange", function (data) {
console.info("[bluetooth_js] HidHostProfile_on data " + JSON.stringify(data));
expect(true).assertEqual(data !=null);
});
}catch(e) {
expect(null).assertFail();
}
try {
console.info('[bluetooth_js] HidHostProfile the off test start');
off("connectionStateChange", function (data) {
console.info("[bluetooth_js] HidHostProfile_off data-> " + JSON.stringify(data));
expect(true).assertEqual(data ==null);
});
}catch(e) {
expect(null).assertFail();
}
done();
})
})
/* /*
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -12,7 +12,5 @@ ...@@ -12,7 +12,5 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
require('./WifiSoftAP.test.js')
require('./BluetoothHid.test.js')
...@@ -17,7 +17,8 @@ import {Core, ExpectExtend} from 'deccjsunit/index' ...@@ -17,7 +17,8 @@ import {Core, ExpectExtend} from 'deccjsunit/index'
export default { export default {
data: { data: {
title: "" title: "",
myTimeout:10000
}, },
onInit() { onInit() {
this.title = this.$t('strings.world'); this.title = this.$t('strings.world');
...@@ -35,6 +36,7 @@ export default { ...@@ -35,6 +36,7 @@ export default {
core.init() core.init()
const configService = core.getDefaultService('config') const configService = core.getDefaultService('config')
this.timeout = this.myTimeout
configService.setConfig(this) configService.setConfig(this)
require('../../test/List.test') require('../../test/List.test')
......
...@@ -18,7 +18,8 @@ import {Core, ExpectExtend} from 'deccjsunit/index' ...@@ -18,7 +18,8 @@ import {Core, ExpectExtend} from 'deccjsunit/index'
export default { export default {
data: { data: {
title: "" title: "",
myTimeout:75000
}, },
onInit() { onInit() {
this.title = this.$t('strings.world'); this.title = this.$t('strings.world');
...@@ -36,7 +37,8 @@ export default { ...@@ -36,7 +37,8 @@ export default {
core.init() core.init()
const configService = core.getDefaultService('config') const configService = core.getDefaultService('config')
configService.setConfig(this) this.timeout = this.myTimeout
configService.setConfig(this)
require('../../test/List.test') require('../../test/List.test')
core.execute() core.execute()
......
...@@ -419,24 +419,6 @@ describe('bluetoothhostTest', function() { ...@@ -419,24 +419,6 @@ describe('bluetoothhostTest', function() {
}) })
/**
* @tc.number SUB_COMMUNACATION_bluetooth_CANCEL_PAIRED_DEV_0001
* @tc.name testCancelPairedDevice
* @tc.desc Test CancelPairedDevice api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNACATION_bluetooth_CANCEL_PAIRED_DEV_0001', 0, async function (done) {
console.info('[bluetooth_js] cancelPairedDevice start');
await tryToEnableBt();
let ret = bluetooth.cancelPairedDevice("00:00:00:00:00:00");
console.info('[bluetooth_js] cancelPairedDevice ret2 : ' + JSON.stringify(ret));
expect(ret).assertFalse();
done();
})
/** /**
* @tc.number SUB_COMMUNACATION_bluetooth_SET_LOCAL_NAME_0001 * @tc.number SUB_COMMUNACATION_bluetooth_SET_LOCAL_NAME_0001
* @tc.name testsetLocalName * @tc.name testsetLocalName
...@@ -713,3 +695,4 @@ describe('bluetoothhostTest', function() { ...@@ -713,3 +695,4 @@ describe('bluetoothhostTest', function() {
}) })
}) })
...@@ -21,12 +21,9 @@ function sleep(delay) { ...@@ -21,12 +21,9 @@ function sleep(delay) {
return new Promise(resovle => setTimeout(resovle, delay)) return new Promise(resovle => setTimeout(resovle, delay))
} }
async function tryToEnableWifi(){ function checkWifiPowerOn(){
if(!wifi.isWifiActive()){
console.info("wifi_test/enable wifi:" + wifi.enableWifi());
await sleep(3000);
}
console.info("wifi_test/wifi status:" + wifi.isWifiActive()); console.info("wifi_test/wifi status:" + wifi.isWifiActive());
expect(wifi.isWifiActive()).assertTrue();
} }
let GroupOwnerBand = { let GroupOwnerBand = {
...@@ -42,27 +39,13 @@ describe('ACTS_WifiTest', function () { ...@@ -42,27 +39,13 @@ describe('ACTS_WifiTest', function () {
afterEach(function () { afterEach(function () {
}) })
/**
* @tc.number Setting_0001
* @tc.name SUB_Communication_WiFi_P2P_Setting_0001
* @tc.desc Test setDeviceName infos
*/
it('SUB_Communication_WiFi_P2P_Setting_0001', 0, async function(done) {
await tryToEnableWifi();
console.info("[wifi_test] test setDeviceName start.");
let devName = wifi.setDeviceName("P2PTest");
console.info("[wifi_test] test start setDeviceName->" + devName);
expect(devName).assertTrue();
done();
})
/** /**
* @tc.number config_0001 * @tc.number config_0001
* @tc.name SUB_Communication_WiFi_P2P_Config_0001 * @tc.name SUB_Communication_WiFi_P2P_Config_0001
* @tc.desc Test createGroup and getCurrentGroup promise infos * @tc.desc Test createGroup and getCurrentGroup promise infos
*/ */
it('SUB_Communication_WiFi_P2P_Config_0001', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Config_0001', 0, async function(done) {
await tryToEnableWifi(); checkWifiPowerOn();
let WifiP2PConfig = { let WifiP2PConfig = {
deviceAddress : "00:00:00:00:00:00", deviceAddress : "00:00:00:00:00:00",
netId : -1, netId : -1,
...@@ -95,7 +78,7 @@ describe('ACTS_WifiTest', function () { ...@@ -95,7 +78,7 @@ describe('ACTS_WifiTest', function () {
* @tc.desc Test getCurrentGroup callback infos * @tc.desc Test getCurrentGroup callback infos
*/ */
it('SUB_Communication_WiFi_P2P_Config_0002', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Config_0002', 0, async function(done) {
await tryToEnableWifi(); checkWifiPowerOn();
let WifiP2PConfig = { let WifiP2PConfig = {
deviceAddress : "00:00:00:00:00:00", deviceAddress : "00:00:00:00:00:00",
netId : -1, netId : -1,
...@@ -139,7 +122,7 @@ describe('ACTS_WifiTest', function () { ...@@ -139,7 +122,7 @@ describe('ACTS_WifiTest', function () {
* @tc.desc Test createGroup 2.4G band and getCurrentGroup infos * @tc.desc Test createGroup 2.4G band and getCurrentGroup infos
*/ */
it('SUB_Communication_WiFi_P2P_Config_0003', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Config_0003', 0, async function(done) {
await tryToEnableWifi(); checkWifiPowerOn();
let WifiP2PConfig2 = { let WifiP2PConfig2 = {
deviceAddress : "00:00:00:00:00:00", deviceAddress : "00:00:00:00:00:00",
netId : -1, netId : -1,
...@@ -170,10 +153,10 @@ describe('ACTS_WifiTest', function () { ...@@ -170,10 +153,10 @@ describe('ACTS_WifiTest', function () {
/** /**
* @tc.number config_0004 * @tc.number config_0004
* @tc.name SUB_Communication_WiFi_P2P_Config_0004 * @tc.name SUB_Communication_WiFi_P2P_Config_0004
* @tc.desc Test createGroup and deletePersistentGroup infos * @tc.desc Test create PersistentGroup infos
*/ */
it('SUB_Communication_WiFi_P2P_Config_0004', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Config_0004', 0, async function(done) {
await tryToEnableWifi(); checkWifiPowerOn();
let WifiP2PConfig = { let WifiP2PConfig = {
deviceAddress : "00:00:00:00:00:00", deviceAddress : "00:00:00:00:00:00",
netId : -2, netId : -2,
...@@ -193,9 +176,6 @@ describe('ACTS_WifiTest', function () { ...@@ -193,9 +176,6 @@ describe('ACTS_WifiTest', function () {
console.info("[wifi_test] getCurrentGroup [promise] result -> " + JSON.stringify(data)); console.info("[wifi_test] getCurrentGroup [promise] result -> " + JSON.stringify(data));
expect(true).assertEqual(resultLength!=0); expect(true).assertEqual(resultLength!=0);
let removePConfig = wifi.deletePersistentGroup(data.networkId);
expect(removePConfig).assertTrue();
let removeConfig = wifi.removeGroup(); let removeConfig = wifi.removeGroup();
expect(removeConfig).assertTrue(); expect(removeConfig).assertTrue();
}); });
...@@ -208,7 +188,7 @@ describe('ACTS_WifiTest', function () { ...@@ -208,7 +188,7 @@ describe('ACTS_WifiTest', function () {
* @tc.desc Test p2pConnect infos * @tc.desc Test p2pConnect infos
*/ */
it('SUB_Communication_WiFi_P2P_Config_0005', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Config_0005', 0, async function(done) {
await tryToEnableWifi(); checkWifiPowerOn();
let WifiP2PConfig3 = { let WifiP2PConfig3 = {
deviceAddress : "00:00:00:00:00:00", deviceAddress : "00:00:00:00:00:00",
netId : -2, netId : -2,
...@@ -237,7 +217,7 @@ describe('ACTS_WifiTest', function () { ...@@ -237,7 +217,7 @@ describe('ACTS_WifiTest', function () {
* @tc.desc Test getP2pLinkedInfo promise infos * @tc.desc Test getP2pLinkedInfo promise infos
*/ */
it('SUB_Communication_WiFi_P2P_Config_0006', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Config_0006', 0, async function(done) {
await tryToEnableWifi(); checkWifiPowerOn();
let P2pConnectState = { let P2pConnectState = {
DISCONNECTED :0, DISCONNECTED :0,
CONNECTED : 1, CONNECTED : 1,
...@@ -261,7 +241,7 @@ describe('ACTS_WifiTest', function () { ...@@ -261,7 +241,7 @@ describe('ACTS_WifiTest', function () {
* @tc.desc Test getP2pLinkedInfo callback infos * @tc.desc Test getP2pLinkedInfo callback infos
*/ */
it('SUB_Communication_WiFi_P2P_Config_0007', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Config_0007', 0, async function(done) {
await tryToEnableWifi(); checkWifiPowerOn();
let P2pConnectState = { let P2pConnectState = {
DISCONNECTED :0, DISCONNECTED :0,
CONNECTED : 1, CONNECTED : 1,
...@@ -287,7 +267,7 @@ describe('ACTS_WifiTest', function () { ...@@ -287,7 +267,7 @@ describe('ACTS_WifiTest', function () {
* @tc.desc Test p2pCancelConnect infos * @tc.desc Test p2pCancelConnect infos
*/ */
it('SUB_Communication_WiFi_P2P_Config_0008', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Config_0008', 0, async function(done) {
await tryToEnableWifi(); checkWifiPowerOn();
let disConn = wifi.p2pCancelConnect(); let disConn = wifi.p2pCancelConnect();
await sleep(2000); await sleep(2000);
console.info("[wifi_test] test p2pCancelConnect result." + disConn); console.info("[wifi_test] test p2pCancelConnect result." + disConn);
...@@ -304,7 +284,7 @@ describe('ACTS_WifiTest', function () { ...@@ -304,7 +284,7 @@ describe('ACTS_WifiTest', function () {
* @tc.desc Test getP2pPeerDevices infos * @tc.desc Test getP2pPeerDevices infos
*/ */
it('SUB_Communication_WiFi_P2P_Config_0009', 0, async function(done){ it('SUB_Communication_WiFi_P2P_Config_0009', 0, async function(done){
await tryToEnableWifi(); checkWifiPowerOn();
let P2pDeviceStatus = { let P2pDeviceStatus = {
CONNECTED : 0, CONNECTED : 0,
INVITED : 1, INVITED : 1,
...@@ -337,7 +317,7 @@ describe('ACTS_WifiTest', function () { ...@@ -337,7 +317,7 @@ describe('ACTS_WifiTest', function () {
* @tc.desc Test getP2pPeerDevices infos * @tc.desc Test getP2pPeerDevices infos
*/ */
it('SUB_Communication_WiFi_P2P_Config_0010', 0, async function(done){ it('SUB_Communication_WiFi_P2P_Config_0010', 0, async function(done){
await tryToEnableWifi(); checkWifiPowerOn();
let P2pDeviceStatus = { let P2pDeviceStatus = {
CONNECTED : 0, CONNECTED : 0,
INVITED : 1, INVITED : 1,
...@@ -393,7 +373,7 @@ describe('ACTS_WifiTest', function () { ...@@ -393,7 +373,7 @@ describe('ACTS_WifiTest', function () {
* @tc.desc Test p2pStateChange callback * @tc.desc Test p2pStateChange callback
*/ */
it('SUB_Communication_WiFi_P2P_P2pStateChange_0001', 0, async function (done) { it('SUB_Communication_WiFi_P2P_P2pStateChange_0001', 0, async function (done) {
await tryToEnableWifi(); checkWifiPowerOn();
await wifi.on('p2pStateChange', result => { await wifi.on('p2pStateChange', result => {
console.info("onP2pStateChange callback, result:" + JSON.stringify(result)); console.info("onP2pStateChange callback, result:" + JSON.stringify(result));
expect(true).assertEqual(result !=null); expect(true).assertEqual(result !=null);
...@@ -415,7 +395,7 @@ describe('ACTS_WifiTest', function () { ...@@ -415,7 +395,7 @@ describe('ACTS_WifiTest', function () {
* @tc.desc Test p2pConnectionChange callback * @tc.desc Test p2pConnectionChange callback
*/ */
it('SUB_Communication_WiFi_P2P_p2pConnectionChange_0002', 0, async function (done) { it('SUB_Communication_WiFi_P2P_p2pConnectionChange_0002', 0, async function (done) {
await tryToEnableWifi(); checkWifiPowerOn();
await wifi.on('p2pConnectionChange', recvP2pConnectionChangeFunc => { await wifi.on('p2pConnectionChange', recvP2pConnectionChangeFunc => {
console.info("[wifi_test] p2pConnectionChange result -> " + recvP2pConnectionChangeFunc); console.info("[wifi_test] p2pConnectionChange result -> " + recvP2pConnectionChangeFunc);
expect(true).assertEqual(recvP2pConnectionChangeFunc !=null); expect(true).assertEqual(recvP2pConnectionChangeFunc !=null);
...@@ -459,7 +439,7 @@ describe('ACTS_WifiTest', function () { ...@@ -459,7 +439,7 @@ describe('ACTS_WifiTest', function () {
* @tc.desc Test p2pPeerDeviceChange callback * @tc.desc Test p2pPeerDeviceChange callback
*/ */
it('SUB_Communication_WiFi_P2P_p2pPeerDeviceChange_0004', 0, async function (done) { it('SUB_Communication_WiFi_P2P_p2pPeerDeviceChange_0004', 0, async function (done) {
await tryToEnableWifi(); checkWifiPowerOn();
let recvP2pPeerDeviceChangeFunc = result => { let recvP2pPeerDeviceChangeFunc = result => {
console.info("wifi_test / p2p peer device change receive event: " + JSON.stringify(result)); console.info("wifi_test / p2p peer device change receive event: " + JSON.stringify(result));
wifi.getP2pDevices((err, data) => { wifi.getP2pDevices((err, data) => {
...@@ -505,7 +485,7 @@ describe('ACTS_WifiTest', function () { ...@@ -505,7 +485,7 @@ describe('ACTS_WifiTest', function () {
* @tc.desc Test p2pPersistentGroupChange callback * @tc.desc Test p2pPersistentGroupChange callback
*/ */
it('SUB_Communication_WiFi_P2P_p2pPersistentGroupChange_0005', 0, async function (done) { it('SUB_Communication_WiFi_P2P_p2pPersistentGroupChange_0005', 0, async function (done) {
await tryToEnableWifi(); checkWifiPowerOn();
let recvP2pPersistentGroupChangeFunc = result => { let recvP2pPersistentGroupChangeFunc = result => {
console.info("wifi_test / p2p persistent group change receive event" + JSON.stringify(result)); console.info("wifi_test / p2p persistent group change receive event" + JSON.stringify(result));
let config = { let config = {
...@@ -545,7 +525,7 @@ describe('ACTS_WifiTest', function () { ...@@ -545,7 +525,7 @@ describe('ACTS_WifiTest', function () {
* @tc.desc Test p2pDiscoveryChange callback * @tc.desc Test p2pDiscoveryChange callback
*/ */
it('SUB_Communication_WiFi_P2P_p2pDiscoveryChange_0006', 0, async function (done) { it('SUB_Communication_WiFi_P2P_p2pDiscoveryChange_0006', 0, async function (done) {
await tryToEnableWifi(); checkWifiPowerOn();
await wifi.on('p2pDiscoveryChange', result => { await wifi.on('p2pDiscoveryChange', result => {
console.info("onp2pDiscoveryChange callback, result:" + JSON.stringify(result)); console.info("onp2pDiscoveryChange callback, result:" + JSON.stringify(result));
expect(true).assertEqual(result !=null); expect(true).assertEqual(result !=null);
...@@ -564,3 +544,4 @@ describe('ACTS_WifiTest', function () { ...@@ -564,3 +544,4 @@ describe('ACTS_WifiTest', function () {
}) })
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册