use of android.net.ConnectivityMetricsEvent in project platform_frameworks_base by android.
the class IpConnectivityEventBuilderTest method testRaEventSerialization.
public void testRaEventSerialization() {
ConnectivityMetricsEvent ev = describeIpEvent(aType(RaEvent.class), aLong(2000), aLong(400), aLong(300), aLong(-1), aLong(1000), aLong(-1));
String want = joinLines("dropped_events: 0", "events <", " ra_event <", " dnssl_lifetime: -1", " prefix_preferred_lifetime: 300", " prefix_valid_lifetime: 400", " rdnss_lifetime: 1000", " route_info_lifetime: -1", " router_lifetime: 2000", " >", " time_ms: 1", ">", "version: 2");
verifySerialization(want, ev);
}
use of android.net.ConnectivityMetricsEvent in project platform_frameworks_base by android.
the class IpConnectivityEventBuilderTest method testDefaultNetworkEventSerialization.
public void testDefaultNetworkEventSerialization() {
ConnectivityMetricsEvent ev = describeIpEvent(aType(DefaultNetworkEvent.class), anInt(102), anIntArray(1, 2, 3), anInt(101), aBool(true), aBool(false));
String want = joinLines("dropped_events: 0", "events <", " default_network_event <", " network_id <", " network_id: 102", " >", " previous_network_id <", " network_id: 101", " >", " previous_network_ip_support: 1", " transport_types: 1", " transport_types: 2", " transport_types: 3", " >", " time_ms: 1", ">", "version: 2");
verifySerialization(want, ev);
}
use of android.net.ConnectivityMetricsEvent in project platform_frameworks_base by android.
the class IpConnectivityEventBuilderTest method testApfProgramEventSerialization.
public void testApfProgramEventSerialization() {
ConnectivityMetricsEvent ev = describeIpEvent(aType(ApfProgramEvent.class), aLong(200), anInt(7), anInt(9), anInt(2048), anInt(3));
String want = joinLines("dropped_events: 0", "events <", " apf_program_event <", " current_ras: 9", " drop_multicast: true", " filtered_ras: 7", " has_ipv4_addr: true", " lifetime: 200", " program_length: 2048", " >", " time_ms: 1", ">", "version: 2");
verifySerialization(want, ev);
}
use of android.net.ConnectivityMetricsEvent in project platform_frameworks_base by android.
the class IpConnectivityMetricsTest method testLoggingEventsWithMultipleCallers.
public void testLoggingEventsWithMultipleCallers() throws Exception {
IpConnectivityLog logger = new IpConnectivityLog(mMockService);
final int nCallers = 10;
final int nEvents = 10;
for (int n = 0; n < nCallers; n++) {
final int i = n;
new Thread() {
public void run() {
for (int j = 0; j < nEvents; j++) {
assertTrue(logger.log(i * 100 + j, FAKE_EV));
}
}
}.start();
}
List<ConnectivityMetricsEvent> got = verifyEvents(nCallers * nEvents, 100);
Collections.sort(got, EVENT_COMPARATOR);
Iterator<ConnectivityMetricsEvent> iter = got.iterator();
for (int i = 0; i < nCallers; i++) {
for (int j = 0; j < nEvents; j++) {
int expectedTimestamp = i * 100 + j;
assertEventsEqual(expectedEvent(expectedTimestamp), iter.next());
}
}
}
use of android.net.ConnectivityMetricsEvent in project android_frameworks_base by crdroidandroid.
the class IpConnectivityEventBuilder method toProto.
public static List<IpConnectivityEvent> toProto(List<ConnectivityMetricsEvent> eventsIn) {
final ArrayList<IpConnectivityEvent> eventsOut = new ArrayList<>(eventsIn.size());
for (ConnectivityMetricsEvent in : eventsIn) {
final IpConnectivityEvent out = toProto(in);
if (out == null) {
continue;
}
eventsOut.add(out);
}
return eventsOut;
}
Aggregations