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);
}
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);
}
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);
}
Aggregations