Loading tests/net/java/android/net/apf/ApfTest.java +12 −8 Original line number Diff line number Diff line Loading @@ -32,7 +32,8 @@ import android.os.Parcelable; import android.system.ErrnoException; import android.system.Os; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.SmallTest; import android.test.suitebuilder.annotation.MediumTest; import static android.system.OsConstants.*; import com.android.frameworks.tests.net.R; Loading Loading @@ -154,7 +155,7 @@ public class ApfTest extends AndroidTestCase { * generating bytecode for that program and running it through the * interpreter to verify it functions correctly. */ @LargeTest @MediumTest public void testApfInstructions() throws IllegalInstructionException { // Empty program should pass because having the program counter reach the // location immediately after the program indicates the packet should be Loading Loading @@ -562,7 +563,7 @@ public class ApfTest extends AndroidTestCase { * Generate some BPF programs, translate them to APF, then run APF and BPF programs * over packet traces and verify both programs filter out the same packets. */ @LargeTest @MediumTest public void testApfAgainstBpf() throws Exception { String[] tcpdump_filters = new String[]{ "udp", "tcp", "icmp", "icmp6", "udp port 53", "arp", "dst 239.255.255.250", "arp or tcp or udp port 53", "net 192.168.1.0/24", Loading Loading @@ -720,7 +721,7 @@ public class ApfTest extends AndroidTestCase { private static final byte[] ANOTHER_IPV4_ADDR = {10, 0, 0, 2}; private static final byte[] IPV4_ANY_HOST_ADDR = {0, 0, 0, 0}; @LargeTest @MediumTest public void testApfFilterIPv4() throws Exception { MockIpManagerCallback ipManagerCallback = new MockIpManagerCallback(); LinkAddress link = new LinkAddress(InetAddress.getByAddress(MOCK_IPV4_ADDR), 19); Loading Loading @@ -775,7 +776,7 @@ public class ApfTest extends AndroidTestCase { apfFilter.shutdown(); } @LargeTest @MediumTest public void testApfFilterIPv6() throws Exception { MockIpManagerCallback ipManagerCallback = new MockIpManagerCallback(); ApfFilter apfFilter = new TestApfFilter(ipManagerCallback, ALLOW_MULTICAST, mLog); Loading @@ -801,7 +802,7 @@ public class ApfTest extends AndroidTestCase { apfFilter.shutdown(); } @LargeTest @MediumTest public void testApfFilterMulticast() throws Exception { final byte[] unicastIpv4Addr = {(byte)192,0,2,63}; final byte[] broadcastIpv4Addr = {(byte)192,0,2,(byte)255}; Loading Loading @@ -911,7 +912,7 @@ public class ApfTest extends AndroidTestCase { assertDrop(program, garpReply()); } @LargeTest @MediumTest public void testApfFilterArp() throws Exception { MockIpManagerCallback ipManagerCallback = new MockIpManagerCallback(); ApfFilter apfFilter = new TestApfFilter(ipManagerCallback, ALLOW_MULTICAST, mLog); Loading Loading @@ -1030,7 +1031,7 @@ public class ApfTest extends AndroidTestCase { ipManagerCallback.assertNoProgramUpdate(); } @LargeTest @MediumTest public void testApfFilterRa() throws Exception { MockIpManagerCallback ipManagerCallback = new MockIpManagerCallback(); TestApfFilter apfFilter = new TestApfFilter(ipManagerCallback, DROP_MULTICAST, mLog); Loading Loading @@ -1147,6 +1148,7 @@ public class ApfTest extends AndroidTestCase { buffer.position(original); } @SmallTest public void testRaParsing() throws Exception { final int maxRandomPacketSize = 512; final Random r = new Random(); Loading @@ -1164,6 +1166,7 @@ public class ApfTest extends AndroidTestCase { } } @SmallTest public void testRaProcessing() throws Exception { final int maxRandomPacketSize = 512; final Random r = new Random(); Loading Loading @@ -1201,6 +1204,7 @@ public class ApfTest extends AndroidTestCase { private native static boolean compareBpfApf(String filter, String pcap_filename, byte[] apf_program); @SmallTest public void testBytesToInt() { assertEquals(0x00000000, ApfFilter.bytesToInt(IPV4_ANY_HOST_ADDR)); assertEquals(0xffffffff, ApfFilter.bytesToInt(IPV4_BROADCAST_ADDRESS)); Loading Loading
tests/net/java/android/net/apf/ApfTest.java +12 −8 Original line number Diff line number Diff line Loading @@ -32,7 +32,8 @@ import android.os.Parcelable; import android.system.ErrnoException; import android.system.Os; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.SmallTest; import android.test.suitebuilder.annotation.MediumTest; import static android.system.OsConstants.*; import com.android.frameworks.tests.net.R; Loading Loading @@ -154,7 +155,7 @@ public class ApfTest extends AndroidTestCase { * generating bytecode for that program and running it through the * interpreter to verify it functions correctly. */ @LargeTest @MediumTest public void testApfInstructions() throws IllegalInstructionException { // Empty program should pass because having the program counter reach the // location immediately after the program indicates the packet should be Loading Loading @@ -562,7 +563,7 @@ public class ApfTest extends AndroidTestCase { * Generate some BPF programs, translate them to APF, then run APF and BPF programs * over packet traces and verify both programs filter out the same packets. */ @LargeTest @MediumTest public void testApfAgainstBpf() throws Exception { String[] tcpdump_filters = new String[]{ "udp", "tcp", "icmp", "icmp6", "udp port 53", "arp", "dst 239.255.255.250", "arp or tcp or udp port 53", "net 192.168.1.0/24", Loading Loading @@ -720,7 +721,7 @@ public class ApfTest extends AndroidTestCase { private static final byte[] ANOTHER_IPV4_ADDR = {10, 0, 0, 2}; private static final byte[] IPV4_ANY_HOST_ADDR = {0, 0, 0, 0}; @LargeTest @MediumTest public void testApfFilterIPv4() throws Exception { MockIpManagerCallback ipManagerCallback = new MockIpManagerCallback(); LinkAddress link = new LinkAddress(InetAddress.getByAddress(MOCK_IPV4_ADDR), 19); Loading Loading @@ -775,7 +776,7 @@ public class ApfTest extends AndroidTestCase { apfFilter.shutdown(); } @LargeTest @MediumTest public void testApfFilterIPv6() throws Exception { MockIpManagerCallback ipManagerCallback = new MockIpManagerCallback(); ApfFilter apfFilter = new TestApfFilter(ipManagerCallback, ALLOW_MULTICAST, mLog); Loading @@ -801,7 +802,7 @@ public class ApfTest extends AndroidTestCase { apfFilter.shutdown(); } @LargeTest @MediumTest public void testApfFilterMulticast() throws Exception { final byte[] unicastIpv4Addr = {(byte)192,0,2,63}; final byte[] broadcastIpv4Addr = {(byte)192,0,2,(byte)255}; Loading Loading @@ -911,7 +912,7 @@ public class ApfTest extends AndroidTestCase { assertDrop(program, garpReply()); } @LargeTest @MediumTest public void testApfFilterArp() throws Exception { MockIpManagerCallback ipManagerCallback = new MockIpManagerCallback(); ApfFilter apfFilter = new TestApfFilter(ipManagerCallback, ALLOW_MULTICAST, mLog); Loading Loading @@ -1030,7 +1031,7 @@ public class ApfTest extends AndroidTestCase { ipManagerCallback.assertNoProgramUpdate(); } @LargeTest @MediumTest public void testApfFilterRa() throws Exception { MockIpManagerCallback ipManagerCallback = new MockIpManagerCallback(); TestApfFilter apfFilter = new TestApfFilter(ipManagerCallback, DROP_MULTICAST, mLog); Loading Loading @@ -1147,6 +1148,7 @@ public class ApfTest extends AndroidTestCase { buffer.position(original); } @SmallTest public void testRaParsing() throws Exception { final int maxRandomPacketSize = 512; final Random r = new Random(); Loading @@ -1164,6 +1166,7 @@ public class ApfTest extends AndroidTestCase { } } @SmallTest public void testRaProcessing() throws Exception { final int maxRandomPacketSize = 512; final Random r = new Random(); Loading Loading @@ -1201,6 +1204,7 @@ public class ApfTest extends AndroidTestCase { private native static boolean compareBpfApf(String filter, String pcap_filename, byte[] apf_program); @SmallTest public void testBytesToInt() { assertEquals(0x00000000, ApfFilter.bytesToInt(IPV4_ANY_HOST_ADDR)); assertEquals(0xffffffff, ApfFilter.bytesToInt(IPV4_BROADCAST_ADDRESS)); Loading