summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorjunyulai <junyulai@google.com>2021-03-23 17:21:34 +0800
committerjunyulai <junyulai@google.com>2021-03-23 17:40:55 +0800
commitc9afd3fa08008934343277762d7617e8d1a5c95b (patch)
tree1d8a75c44b87aadd09b191748ce120e9060b9524 /tests
parente1b9b92816da866ac27d1eee566a3df89522f59c (diff)
Fix cannot find removeUnwantedCapability on R device
Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkCapabilitiesTest Fix: 183473863 Merged-In: Icf2cda325795acee22a6c634e8d978f64c5ac3cb Change-Id: Icf2cda325795acee22a6c634e8d978f64c5ac3cb (cherry-picked from ag/13966708)
Diffstat (limited to 'tests')
-rw-r--r--tests/net/common/java/android/net/NetworkCapabilitiesTest.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/net/common/java/android/net/NetworkCapabilitiesTest.java b/tests/net/common/java/android/net/NetworkCapabilitiesTest.java
index f161e52c2fd5..03e4d6657de6 100644
--- a/tests/net/common/java/android/net/NetworkCapabilitiesTest.java
+++ b/tests/net/common/java/android/net/NetworkCapabilitiesTest.java
@@ -611,17 +611,18 @@ public class NetworkCapabilitiesTest {
// From S, it is not allowed to have the same capability in both wanted and
// unwanted list.
assertThrows(IllegalArgumentException.class, () -> nc2.combineCapabilities(nc1));
+ // Remove unwanted capability to continue other tests.
+ nc1.removeUnwantedCapability(NET_CAPABILITY_NOT_ROAMING);
} else {
nc2.combineCapabilities(nc1);
// We will get this capability in both requested and unwanted lists thus this request
// will never be satisfied.
assertTrue(nc2.hasCapability(NET_CAPABILITY_NOT_ROAMING));
assertTrue(nc2.hasUnwantedCapability(NET_CAPABILITY_NOT_ROAMING));
+ // For R or below, remove unwanted capability via removeCapability.
+ nc1.removeCapability(NET_CAPABILITY_NOT_ROAMING);
}
- // Remove unwanted capability to continue other tests.
- nc1.removeUnwantedCapability(NET_CAPABILITY_NOT_ROAMING);
-
nc1.setSSID(TEST_SSID);
nc2.combineCapabilities(nc1);
if (isAtLeastR()) {