Skip WifiManager tests if WiFi is not supported

Some of the WifiManager tests assumed that WiFi is always supported.
This is not true for all devices, for example the Android emulator, and
is not a requirement in the CDD.

BUG: 37633976
Test: Successfully ran 'run cts -m CtsNetTestCases'
Change-Id: Ia6d62e8d2b6e0b0c2ef2fafd50529e722e4419e4
(cherry picked from commit 9703adffd5e3bf85e482cdac45a1147caff4ac3d)
This commit is contained in:
Bjoern Johansson
2017-08-17 17:04:13 -07:00
parent 8bde47ae82
commit d4c2d2aca3

View File

@@ -801,7 +801,11 @@ public class WifiManagerTest extends AndroidTestCase {
* Note: Location mode must be enabled for this test.
*/
public void testStartLocalOnlyHotspotSuccess() {
// first check that softap mode is supported by the device
if (!WifiFeature.isWifiSupported(getContext())) {
// skip the test if WiFi is not supported
return;
}
// check that softap mode is supported by the device
if (!mWifiManager.isPortableHotspotSupported()) {
return;
}
@@ -826,7 +830,11 @@ public class WifiManagerTest extends AndroidTestCase {
* Note: Location mode must be enabled for this test.
*/
public void testSetWifiEnabledByAppDoesNotStopHotspot() {
// first check that softap mode is supported by the device
if (!WifiFeature.isWifiSupported(getContext())) {
// skip the test if WiFi is not supported
return;
}
// check that softap mode is supported by the device
if (!mWifiManager.isPortableHotspotSupported()) {
return;
}
@@ -850,7 +858,11 @@ public class WifiManagerTest extends AndroidTestCase {
* Note: Location mode must be enabled for this test.
*/
public void testStartLocalOnlyHotspotSingleRequestByApps() {
// first check that softap mode is supported by the device
if (!WifiFeature.isWifiSupported(getContext())) {
// skip the test if WiFi is not supported
return;
}
// check that softap mode is supported by the device
if (!mWifiManager.isPortableHotspotSupported()) {
return;
}