Search in sources :

Example 1 with Reference

use of android.net.ConnectivityMetricsEvent.Reference in project android_frameworks_base by ResurrectionRemix.

the class MetricsLoggerServiceTest method testMultipleGetAll.

public void testMultipleGetAll() throws Exception {
    mService.mBinder.logEvents(Arrays.copyOf(EVENTS, 3));
    Reference r1 = new Reference(0);
    assertArrayEquals(Arrays.copyOf(EVENTS, 3), mService.mBinder.getEvents(r1));
    assertEquals(3, r1.getValue());
    mService.mBinder.logEvents(Arrays.copyOfRange(EVENTS, 3, 10));
    Reference r2 = new Reference(0);
    assertArrayEquals(EVENTS, mService.mBinder.getEvents(r2));
    assertEquals(N_EVENTS, r2.getValue());
}
Also used : Reference(android.net.ConnectivityMetricsEvent.Reference)

Example 2 with Reference

use of android.net.ConnectivityMetricsEvent.Reference in project android_frameworks_base by ResurrectionRemix.

the class MetricsLoggerServiceTest method testLogOneByOne.

public void testLogOneByOne() throws Exception {
    for (ConnectivityMetricsEvent ev : EVENTS) {
        mService.mBinder.logEvent(ev);
    }
    Reference r = new Reference(0);
    assertArrayEquals(EVENTS, mService.mBinder.getEvents(r));
    assertEquals(N_EVENTS, r.getValue());
    assertArrayEquals(NO_EVENTS, mService.mBinder.getEvents(r));
    assertEquals(N_EVENTS, r.getValue());
}
Also used : Reference(android.net.ConnectivityMetricsEvent.Reference) ConnectivityMetricsEvent(android.net.ConnectivityMetricsEvent)

Example 3 with Reference

use of android.net.ConnectivityMetricsEvent.Reference in project android_frameworks_base by ResurrectionRemix.

the class MetricsLoggerServiceTest method testGetNoEvents.

public void testGetNoEvents() throws Exception {
    Reference r = new Reference(0);
    assertArrayEquals(NO_EVENTS, mService.mBinder.getEvents(r));
    assertEquals(0, r.getValue());
}
Also used : Reference(android.net.ConnectivityMetricsEvent.Reference)

Example 4 with Reference

use of android.net.ConnectivityMetricsEvent.Reference in project android_frameworks_base by ResurrectionRemix.

the class MetricsLoggerServiceTest method testInterleavedLogAndGet.

public void testInterleavedLogAndGet() throws Exception {
    mService.mBinder.logEvents(Arrays.copyOfRange(EVENTS, 0, 3));
    Reference r = new Reference(0);
    assertArrayEquals(Arrays.copyOfRange(EVENTS, 0, 3), mService.mBinder.getEvents(r));
    assertEquals(3, r.getValue());
    mService.mBinder.logEvents(Arrays.copyOfRange(EVENTS, 3, 8));
    mService.mBinder.logEvents(Arrays.copyOfRange(EVENTS, 8, 10));
    assertArrayEquals(Arrays.copyOfRange(EVENTS, 3, 10), mService.mBinder.getEvents(r));
    assertEquals(N_EVENTS, r.getValue());
    assertArrayEquals(NO_EVENTS, mService.mBinder.getEvents(r));
    assertEquals(N_EVENTS, r.getValue());
}
Also used : Reference(android.net.ConnectivityMetricsEvent.Reference)

Example 5 with Reference

use of android.net.ConnectivityMetricsEvent.Reference in project android_frameworks_base by DirtyUnicorns.

the class MetricsLoggerServiceTest method testMultipleGetAll.

public void testMultipleGetAll() throws Exception {
    mService.mBinder.logEvents(Arrays.copyOf(EVENTS, 3));
    Reference r1 = new Reference(0);
    assertArrayEquals(Arrays.copyOf(EVENTS, 3), mService.mBinder.getEvents(r1));
    assertEquals(3, r1.getValue());
    mService.mBinder.logEvents(Arrays.copyOfRange(EVENTS, 3, 10));
    Reference r2 = new Reference(0);
    assertArrayEquals(EVENTS, mService.mBinder.getEvents(r2));
    assertEquals(N_EVENTS, r2.getValue());
}
Also used : Reference(android.net.ConnectivityMetricsEvent.Reference)

Aggregations

Reference (android.net.ConnectivityMetricsEvent.Reference)18 ConnectivityMetricsEvent (android.net.ConnectivityMetricsEvent)6 FileDescriptor (java.io.FileDescriptor)3 FileOutputStream (java.io.FileOutputStream)3 CountDownLatch (java.util.concurrent.CountDownLatch)3