Add ApfCapabilities common test cases
Bug: 129199900 Test: atest FrameworksNetTests Test: atest CtsNetTestCases: added tests pass Change-Id: I737ab11ccd1bf6f92bae4eae21e67d4d6f86a758 Merged-In: Icfd80943212430b2a0e6a4b55f53270cbc3d1693 Merged-In: I737ab11ccd1bf6f92bae4eae21e67d4d6f86a758 (cherry picked from commit ce54fa5cb392c38bfec62b81664fcc25098eb9dc)
This commit is contained in:
@@ -17,7 +17,9 @@
|
||||
package android.net.apf;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import androidx.test.filters.SmallTest;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
@@ -32,8 +34,12 @@ import org.junit.runner.RunWith;
|
||||
@SmallTest
|
||||
public class ApfCapabilitiesTest {
|
||||
@Test
|
||||
public void testParcelUnparcel() {
|
||||
public void testConstructAndParcel() {
|
||||
final ApfCapabilities caps = new ApfCapabilities(123, 456, 789);
|
||||
assertEquals(123, caps.apfVersionSupported);
|
||||
assertEquals(456, caps.maximumApfProgramSize);
|
||||
assertEquals(789, caps.apfPacketFormat);
|
||||
|
||||
ParcelableTestUtil.assertFieldCountEquals(3, ApfCapabilities.class);
|
||||
|
||||
TestUtils.assertParcelingIsLossless(caps);
|
||||
@@ -46,4 +52,14 @@ public class ApfCapabilitiesTest {
|
||||
assertNotEquals(new ApfCapabilities(1, 3, 3), new ApfCapabilities(1, 2, 3));
|
||||
assertNotEquals(new ApfCapabilities(1, 2, 4), new ApfCapabilities(1, 2, 3));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHasDataAccess() {
|
||||
//hasDataAccess is only supported starting at apf version 4.
|
||||
ApfCapabilities caps = new ApfCapabilities(1 /* apfVersionSupported */, 2, 3);
|
||||
assertFalse(caps.hasDataAccess());
|
||||
|
||||
caps = new ApfCapabilities(4 /* apfVersionSupported */, 5, 6);
|
||||
assertTrue(caps.hasDataAccess());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user