CTS: skip wifi related net test if no such feature
When a device does not have wifi feature, we should skip wifi related net tests. BUG: 31806034 Change-Id: I9867342c47499efc855a50a67a04177fa94e83e5
This commit is contained in:
@@ -387,6 +387,10 @@ public class ConnectivityManagerTest extends AndroidTestCase {
|
|||||||
* Tests reporting of connectivity changed.
|
* Tests reporting of connectivity changed.
|
||||||
*/
|
*/
|
||||||
public void testConnectivityChanged_manifestRequestOnly_shouldNotReceiveIntent() {
|
public void testConnectivityChanged_manifestRequestOnly_shouldNotReceiveIntent() {
|
||||||
|
if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_WIFI)) {
|
||||||
|
Log.i(TAG, "testConnectivityChanged_manifestRequestOnly_shouldNotReceiveIntent cannot execute unless device supports WiFi");
|
||||||
|
return;
|
||||||
|
}
|
||||||
ConnectivityReceiver.prepare();
|
ConnectivityReceiver.prepare();
|
||||||
|
|
||||||
toggleWifi();
|
toggleWifi();
|
||||||
@@ -400,6 +404,10 @@ public class ConnectivityManagerTest extends AndroidTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testConnectivityChanged_whenRegistered_shouldReceiveIntent() {
|
public void testConnectivityChanged_whenRegistered_shouldReceiveIntent() {
|
||||||
|
if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_WIFI)) {
|
||||||
|
Log.i(TAG, "testConnectivityChanged_whenRegistered_shouldReceiveIntent cannot execute unless device supports WiFi");
|
||||||
|
return;
|
||||||
|
}
|
||||||
ConnectivityReceiver.prepare();
|
ConnectivityReceiver.prepare();
|
||||||
ConnectivityReceiver receiver = new ConnectivityReceiver();
|
ConnectivityReceiver receiver = new ConnectivityReceiver();
|
||||||
IntentFilter filter = new IntentFilter();
|
IntentFilter filter = new IntentFilter();
|
||||||
@@ -416,6 +424,10 @@ public class ConnectivityManagerTest extends AndroidTestCase {
|
|||||||
|
|
||||||
public void testConnectivityChanged_manifestRequestOnlyPreN_shouldReceiveIntent()
|
public void testConnectivityChanged_manifestRequestOnlyPreN_shouldReceiveIntent()
|
||||||
throws InterruptedException {
|
throws InterruptedException {
|
||||||
|
if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_WIFI)) {
|
||||||
|
Log.i(TAG, "testConnectivityChanged_manifestRequestOnlyPreN_shouldReceiveIntent cannot execute unless device supports WiFi");
|
||||||
|
return;
|
||||||
|
}
|
||||||
Intent startIntent = new Intent();
|
Intent startIntent = new Intent();
|
||||||
startIntent.setComponent(new ComponentName("android.net.cts.appForApi23",
|
startIntent.setComponent(new ComponentName("android.net.cts.appForApi23",
|
||||||
"android.net.cts.appForApi23.ConnectivityListeningActivity"));
|
"android.net.cts.appForApi23.ConnectivityListeningActivity"));
|
||||||
|
|||||||
Reference in New Issue
Block a user