Merge "cts: skip wifi related tests if wifi is unsupported" into oc-dev am: 73a81b18cd
am: 7e31eb7564

Change-Id: I6a6bd235a41b6d1474a7ded91a44cd1213ed4dd3
diff --git a/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java b/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java
index b951378..cd6dbb2 100644
--- a/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java
+++ b/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java
@@ -789,24 +789,40 @@
 
     /** Verify that accept_ra_rt_info_min_plen exists and is set to the expected value */
     public void testAcceptRaRtInfoMinPlen() throws Exception {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_WIFI)) {
+            Log.i(TAG, "testConnectivityChanged_manifestRequestOnlyPreN_shouldReceiveIntent cannot execute unless device supports WiFi");
+            return;
+        }
         Scanner s = makeWifiSysctlScanner("accept_ra_rt_info_min_plen");
         assertEquals(IPV6_WIFI_ACCEPT_RA_RT_INFO_MIN_PLEN, s.nextInt());
     }
 
     /** Verify that accept_ra_rt_info_max_plen exists and is set to the expected value */
     public void testAcceptRaRtInfoMaxPlen() throws Exception {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_WIFI)) {
+            Log.i(TAG, "testConnectivityChanged_manifestRequestOnlyPreN_shouldReceiveIntent cannot execute unless device supports WiFi");
+            return;
+        }
         Scanner s = makeWifiSysctlScanner("accept_ra_rt_info_max_plen");
         assertEquals(IPV6_WIFI_ACCEPT_RA_RT_INFO_MAX_PLEN, s.nextInt());
     }
 
     /** Verify that router_solicitations exists and is set to the expected value */
     public void testRouterSolicitations() throws Exception {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_WIFI)) {
+            Log.i(TAG, "testConnectivityChanged_manifestRequestOnlyPreN_shouldReceiveIntent cannot execute unless device supports WiFi");
+            return;
+        }
         Scanner s = makeWifiSysctlScanner("router_solicitations");
         assertEquals(IPV6_WIFI_ROUTER_SOLICITATIONS, s.nextInt());
     }
 
     /** Verify that router_solicitation_max_interval exists and is in an acceptable interval */
     public void testRouterSolicitationMaxInterval() throws Exception {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_WIFI)) {
+            Log.i(TAG, "testConnectivityChanged_manifestRequestOnlyPreN_shouldReceiveIntent cannot execute unless device supports WiFi");
+            return;
+        }
         Scanner s = makeWifiSysctlScanner("router_solicitation_max_interval");
         int interval = s.nextInt();
         // Verify we're in the interval [15 minutes, 60 minutes]. Lower values may adversely
diff --git a/tests/cts/net/src/android/net/wifi/cts/WifiManagerTest.java b/tests/cts/net/src/android/net/wifi/cts/WifiManagerTest.java
index f667015..ea63f78 100644
--- a/tests/cts/net/src/android/net/wifi/cts/WifiManagerTest.java
+++ b/tests/cts/net/src/android/net/wifi/cts/WifiManagerTest.java
@@ -583,6 +583,10 @@
      * @throws Exception
      */
     public void testAddPasspointConfigWithUserCredential() throws Exception {
+        if (!WifiFeature.isWifiSupported(getContext())) {
+            // skip the test if WiFi is not supported
+            return;
+        }
         testAddPasspointConfig(generatePasspointConfig(generateUserCredential()));
     }
 
@@ -593,6 +597,10 @@
      * @throws Exception
      */
     public void testAddPasspointConfigWithCertCredential() throws Exception {
+        if (!WifiFeature.isWifiSupported(getContext())) {
+            // skip the test if WiFi is not supported
+            return;
+        }
         testAddPasspointConfig(generatePasspointConfig(generateCertCredential()));
     }
 
@@ -603,6 +611,10 @@
      * @throws Exception
      */
     public void testAddPasspointConfigWithSimCredential() throws Exception {
+        if (!WifiFeature.isWifiSupported(getContext())) {
+            // skip the test if WiFi is not supported
+            return;
+        }
         testAddPasspointConfig(generatePasspointConfig(generateSimCredential()));
     }