CtsNetTestCases: Add wifi feature check in new tests

Bug: 150236894
Test: atest android.net.wifi.cts
Change-Id: Ifb0980576379a8d59637a8411c61ab4b7db60af7
This commit is contained in:
Roshan Pius
2020-03-02 15:50:58 -08:00
parent 6e2b9d32ef
commit c99a57997b
2 changed files with 48 additions and 0 deletions

View File

@@ -1160,6 +1160,10 @@ public class WifiManagerTest extends AndroidTestCase {
* network.
*/
public void testConnectWithNetworkId() throws Exception {
if (!WifiFeature.isWifiSupported(getContext())) {
// skip the test if WiFi is not supported
return;
}
testConnect(true);
}
@@ -1168,6 +1172,10 @@ public class WifiManagerTest extends AndroidTestCase {
* existing saved network.
*/
public void testConnectWithWifiConfiguration() throws Exception {
if (!WifiFeature.isWifiSupported(getContext())) {
// skip the test if WiFi is not supported
return;
}
testConnect(false);
}
@@ -1217,6 +1225,10 @@ public class WifiManagerTest extends AndroidTestCase {
* an existing saved network metered.
*/
public void testSave() throws Exception {
if (!WifiFeature.isWifiSupported(getContext())) {
// skip the test if WiFi is not supported
return;
}
TestActionListener actionListener = new TestActionListener(mLock);
UiAutomation uiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
List<WifiConfiguration> savedNetworks = null;
@@ -1270,6 +1282,10 @@ public class WifiManagerTest extends AndroidTestCase {
* network.
*/
public void testForget() throws Exception {
if (!WifiFeature.isWifiSupported(getContext())) {
// skip the test if WiFi is not supported
return;
}
TestActionListener actionListener = new TestActionListener(mLock);
UiAutomation uiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
int newNetworkId = INVALID_NETWORK_ID;
@@ -1351,6 +1367,10 @@ public class WifiManagerTest extends AndroidTestCase {
* WifiManager.TrafficStateCallback)} by sending some traffic.
*/
public void testTrafficStateCallback() throws Exception {
if (!WifiFeature.isWifiSupported(getContext())) {
// skip the test if WiFi is not supported
return;
}
TestTrafficStateCallback trafficStateCallback = new TestTrafficStateCallback(mLock);
UiAutomation uiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
try {
@@ -1387,6 +1407,10 @@ public class WifiManagerTest extends AndroidTestCase {
* {@link WifiManager#isScanAlwaysAvailable()}.
*/
public void testScanAlwaysAvailable() throws Exception {
if (!WifiFeature.isWifiSupported(getContext())) {
// skip the test if WiFi is not supported
return;
}
UiAutomation uiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
Boolean currState = null;
try {
@@ -1410,6 +1434,10 @@ public class WifiManagerTest extends AndroidTestCase {
* {@link WifiManager#isScanThrottleEnabled()}.
*/
public void testScanThrottleEnabled() throws Exception {
if (!WifiFeature.isWifiSupported(getContext())) {
// skip the test if WiFi is not supported
return;
}
UiAutomation uiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
Boolean currState = null;
try {
@@ -1433,6 +1461,10 @@ public class WifiManagerTest extends AndroidTestCase {
* {@link WifiManager#isAutoWakeupEnabled()}.
*/
public void testAutoWakeUpEnabled() throws Exception {
if (!WifiFeature.isWifiSupported(getContext())) {
// skip the test if WiFi is not supported
return;
}
UiAutomation uiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
Boolean currState = null;
try {
@@ -1456,6 +1488,10 @@ public class WifiManagerTest extends AndroidTestCase {
* {@link WifiManager#isVerboseLoggingEnabled()}.
*/
public void testVerboseLoggingEnabled() throws Exception {
if (!WifiFeature.isWifiSupported(getContext())) {
// skip the test if WiFi is not supported
return;
}
UiAutomation uiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
Boolean currState = null;
try {
@@ -1482,6 +1518,10 @@ public class WifiManagerTest extends AndroidTestCase {
* configuration, suggestions, etc which will also have been lost on factory reset.
*/
public void testFactoryReset() throws Exception {
if (!WifiFeature.isWifiSupported(getContext())) {
// skip the test if WiFi is not supported
return;
}
UiAutomation uiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
List<WifiConfiguration> savedNetworks = null;
try {

View File

@@ -52,6 +52,10 @@ public class WifiMigrationTest extends AndroidTestCase {
* Tests {@link android.net.wifi.WifiMigration.ConfigStoreMigrationData} class.
*/
public void testWifiMigrationConfigStoreDataBuilder() throws Exception {
if (!WifiFeature.isWifiSupported(getContext())) {
// skip the test if WiFi is not supported
return;
}
WifiConfiguration savedNetwork1 = new WifiConfiguration();
savedNetwork1.SSID = "\"test1\"";
WifiConfiguration savedNetwork2 = new WifiConfiguration();
@@ -83,6 +87,10 @@ public class WifiMigrationTest extends AndroidTestCase {
* Tests {@link android.net.wifi.WifiMigration.ConfigStoreMigrationData} class.
*/
public void testWifiMigrationSettingsDataBuilder() throws Exception {
if (!WifiFeature.isWifiSupported(getContext())) {
// skip the test if WiFi is not supported
return;
}
WifiMigration.SettingsMigrationData migrationData =
new WifiMigration.SettingsMigrationData.Builder()
.setScanAlwaysAvailable(true)