CtsHostsideNetworkTests: Skip unsupported tests.

If appStandby is not enabled, then
testAppIdleAndBatterySaver_tempPowerSaveWhitelists is not supported.

Fixes: 79942156
Test: cts-tradefed run singleCommand cts-dev -m CtsHostsideNetworkTests -t \
      com.android.cts.net.HostsideRestrictBackgroundNetworkTests

Change-Id: I2f4012ff2cf42481e089d7fc33930258e501ddbf
This commit is contained in:
Sudheer Shanka
2018-05-22 12:17:52 -07:00
parent 346856ab46
commit 926a3cb026

View File

@@ -57,18 +57,22 @@ public class MixedModesTest extends AbstractRestrictBackgroundNetworkTestCase {
}
}
@Override
public boolean isSupported() throws Exception {
if (!isDozeModeEnabled()) {
Log.i(TAG, "Skipping " + getClass() + "." + getName()
+ "() because device does not support Doze Mode");
return false;
}
return true;
}
/**
* Tests all DS ON and BS ON scenarios from network-policy-restrictions.md on metered networks.
*/
public void testDataAndBatterySaverModes_meteredNetwork() throws Exception {
if (!isSupported()) return;
if (!isDozeModeEnabled()) {
Log.w(TAG, "testDataAndBatterySaverModes_meteredNetwork() skipped because "
+ "device does not support Doze Mode");
return;
}
Log.i(TAG, "testDataAndBatterySaverModes_meteredNetwork() tests");
if (!setMeteredNetwork()) {
Log.w(TAG, "testDataAndBatterySaverModes_meteredNetwork() skipped because "
@@ -139,12 +143,6 @@ public class MixedModesTest extends AbstractRestrictBackgroundNetworkTestCase {
public void testDataAndBatterySaverModes_nonMeteredNetwork() throws Exception {
if (!isSupported()) return;
if (!isDozeModeEnabled()) {
Log.w(TAG, "testDataAndBatterySaverModes_nonMeteredNetwork() skipped because "
+ "device does not support Doze Mode");
return;
}
if (!setUnmeteredNetwork()) {
Log.w(TAG, "testDataAndBatterySaverModes_nonMeteredNetwork() skipped because network"
+ " is metered");
@@ -211,11 +209,6 @@ public class MixedModesTest extends AbstractRestrictBackgroundNetworkTestCase {
if (!isSupported()) {
return;
}
if (!isDozeModeEnabled()) {
Log.i(TAG, "Skipping " + getClass() + "." + getName()
+ "() because device does not support Doze Mode");
return;
}
setBatterySaverMode(true);
setDozeMode(true);
@@ -246,11 +239,6 @@ public class MixedModesTest extends AbstractRestrictBackgroundNetworkTestCase {
if (!isSupported()) {
return;
}
if (!isDozeModeEnabled()) {
Log.i(TAG, "Skipping " + getClass() + "." + getName()
+ "() because device does not support Doze Mode");
return;
}
setDozeMode(true);
setAppIdle(true);
@@ -277,11 +265,6 @@ public class MixedModesTest extends AbstractRestrictBackgroundNetworkTestCase {
if (!isSupported()) {
return;
}
if (!isDozeModeEnabled()) {
Log.i(TAG, "Skipping " + getClass() + "." + getName()
+ "() because device does not support Doze Mode");
return;
}
setDozeMode(true);
setAppIdle(true);