Search in sources :

Example 6 with ApfProgramEvent

use of android.net.metrics.ApfProgramEvent in project android_frameworks_base by ResurrectionRemix.

the class IpConnectivityMetricsTest method testRateLimiting.

@SmallTest
public void testRateLimiting() {
    final IpConnectivityLog logger = new IpConnectivityLog(mService.impl);
    final ApfProgramEvent ev = new ApfProgramEvent(0, 0, 0, 0, 0);
    final long fakeTimestamp = 1;
    // More than burst quota, but less than buffer size.
    int attempt = 100;
    for (int i = 0; i < attempt; i++) {
        logger.log(ev);
    }
    String output1 = getdump("flush");
    assertFalse("".equals(output1));
    for (int i = 0; i < attempt; i++) {
        assertFalse("expected event to be dropped", logger.log(fakeTimestamp, ev));
    }
    String output2 = getdump("flush");
    assertEquals("", output2);
}
Also used : IpConnectivityLog(android.net.metrics.IpConnectivityLog) ApfProgramEvent(android.net.metrics.ApfProgramEvent) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 7 with ApfProgramEvent

use of android.net.metrics.ApfProgramEvent in project android_frameworks_base by crdroidandroid.

the class IpConnectivityMetricsTest method testRateLimiting.

@SmallTest
public void testRateLimiting() {
    final IpConnectivityLog logger = new IpConnectivityLog(mService.impl);
    final ApfProgramEvent ev = new ApfProgramEvent(0, 0, 0, 0, 0);
    final long fakeTimestamp = 1;
    // More than burst quota, but less than buffer size.
    int attempt = 100;
    for (int i = 0; i < attempt; i++) {
        logger.log(ev);
    }
    String output1 = getdump("flush");
    assertFalse("".equals(output1));
    for (int i = 0; i < attempt; i++) {
        assertFalse("expected event to be dropped", logger.log(fakeTimestamp, ev));
    }
    String output2 = getdump("flush");
    assertEquals("", output2);
}
Also used : IpConnectivityLog(android.net.metrics.IpConnectivityLog) ApfProgramEvent(android.net.metrics.ApfProgramEvent) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 8 with ApfProgramEvent

use of android.net.metrics.ApfProgramEvent in project platform_frameworks_base by android.

the class IpConnectivityMetricsTest method testRateLimiting.

public void testRateLimiting() {
    final IpConnectivityLog logger = new IpConnectivityLog(mService.impl);
    final ApfProgramEvent ev = new ApfProgramEvent(0, 0, 0, 0, 0);
    final long fakeTimestamp = 1;
    // More than burst quota, but less than buffer size.
    int attempt = 100;
    for (int i = 0; i < attempt; i++) {
        logger.log(ev);
    }
    String output1 = getdump("flush");
    assertFalse("".equals(output1));
    for (int i = 0; i < attempt; i++) {
        assertFalse("expected event to be dropped", logger.log(fakeTimestamp, ev));
    }
    String output2 = getdump("flush");
    assertEquals("", output2);
}
Also used : IpConnectivityLog(android.net.metrics.IpConnectivityLog) ApfProgramEvent(android.net.metrics.ApfProgramEvent)

Aggregations

ApfProgramEvent (android.net.metrics.ApfProgramEvent)8 ApfGenerator (android.net.apf.ApfGenerator)4 IllegalInstructionException (android.net.apf.ApfGenerator.IllegalInstructionException)4 IpConnectivityLog (android.net.metrics.IpConnectivityLog)4 GuardedBy (com.android.internal.annotations.GuardedBy)4 VisibleForTesting (com.android.internal.annotations.VisibleForTesting)4 ArrayList (java.util.ArrayList)4 SmallTest (android.test.suitebuilder.annotation.SmallTest)3