Minor clean-up in NetworkCapabilities
Follow up clean up for aosp/606338 Bug: 72828388 Test: frameworks/base/tests/net/ -c android.net.NetworkCapabilitiesTest Change-Id: I2d2cfeb51caaa339602f7d97ffffed6e4cfad432
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
package android.net;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.SystemApi;
|
||||
import android.net.ConnectivityManager.NetworkCallback;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
@@ -322,28 +322,26 @@ public class NetworkCapabilitiesTest {
|
||||
|
||||
@Test
|
||||
public void testEqualsNetCapabilities() {
|
||||
int CAPABILITY = NET_CAPABILITY_MMS; // An arbitrary not mutable capability.
|
||||
|
||||
NetworkCapabilities nc1 = new NetworkCapabilities();
|
||||
NetworkCapabilities nc2 = new NetworkCapabilities();
|
||||
assertTrue(nc1.equalsNetCapabilities(nc2));
|
||||
assertEquals(nc1, nc2);
|
||||
|
||||
nc1.addCapability(CAPABILITY);
|
||||
nc1.addCapability(NET_CAPABILITY_MMS);
|
||||
assertFalse(nc1.equalsNetCapabilities(nc2));
|
||||
assertNotEquals(nc1, nc2);
|
||||
nc2.addCapability(CAPABILITY);
|
||||
nc2.addCapability(NET_CAPABILITY_MMS);
|
||||
assertTrue(nc1.equalsNetCapabilities(nc2));
|
||||
assertEquals(nc1, nc2);
|
||||
|
||||
nc1.addUnwantedCapability(CAPABILITY);
|
||||
nc1.addUnwantedCapability(NET_CAPABILITY_INTERNET);
|
||||
assertFalse(nc1.equalsNetCapabilities(nc2));
|
||||
nc2.addUnwantedCapability(CAPABILITY);
|
||||
nc2.addUnwantedCapability(NET_CAPABILITY_INTERNET);
|
||||
assertTrue(nc1.equalsNetCapabilities(nc2));
|
||||
|
||||
nc1.removeCapability(CAPABILITY);
|
||||
nc1.removeCapability(NET_CAPABILITY_INTERNET);
|
||||
assertFalse(nc1.equalsNetCapabilities(nc2));
|
||||
nc2.removeCapability(CAPABILITY);
|
||||
nc2.removeCapability(NET_CAPABILITY_INTERNET);
|
||||
assertTrue(nc1.equalsNetCapabilities(nc2));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user