Search in sources :

Example 56 with ConnectivityMetricsEvent

use of android.net.ConnectivityMetricsEvent in project android_frameworks_base by crdroidandroid.

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 57 with ConnectivityMetricsEvent

use of android.net.ConnectivityMetricsEvent in project platform_frameworks_base by android.

the class IpConnectivityEventBuilderTest method testDhcpClientEventSerialization.

public void testDhcpClientEventSerialization() {
    ConnectivityMetricsEvent ev = describeIpEvent(aType(DhcpClientEvent.class), aString("wlan0"), aString("SomeState"), anInt(192));
    String want = joinLines("dropped_events: 0", "events <", "  dhcp_event <", "    duration_ms: 192", "    error_code: 0", "    if_name: \"wlan0\"", "    state_transition: \"SomeState\"", "  >", "  time_ms: 1", ">", "version: 2");
    verifySerialization(want, ev);
}
Also used : DhcpClientEvent(android.net.metrics.DhcpClientEvent) ConnectivityMetricsEvent(android.net.ConnectivityMetricsEvent) MetricsTestUtil.aString(com.android.server.connectivity.MetricsTestUtil.aString)

Example 58 with ConnectivityMetricsEvent

use of android.net.ConnectivityMetricsEvent in project platform_frameworks_base by android.

the class IpConnectivityEventBuilderTest method testNetworkEventSerialization.

public void testNetworkEventSerialization() {
    ConnectivityMetricsEvent ev = describeIpEvent(aType(NetworkEvent.class), anInt(100), anInt(5), aLong(20410));
    String want = joinLines("dropped_events: 0", "events <", "  network_event <", "    event_type: 5", "    latency_ms: 20410", "    network_id <", "      network_id: 100", "    >", "  >", "  time_ms: 1", ">", "version: 2");
    verifySerialization(want, ev);
}
Also used : NetworkEvent(android.net.metrics.NetworkEvent) DefaultNetworkEvent(android.net.metrics.DefaultNetworkEvent) ConnectivityMetricsEvent(android.net.ConnectivityMetricsEvent) MetricsTestUtil.aString(com.android.server.connectivity.MetricsTestUtil.aString)

Example 59 with ConnectivityMetricsEvent

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);
}
Also used : RaEvent(android.net.metrics.RaEvent) ConnectivityMetricsEvent(android.net.ConnectivityMetricsEvent) MetricsTestUtil.aString(com.android.server.connectivity.MetricsTestUtil.aString)

Example 60 with ConnectivityMetricsEvent

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);
}
Also used : DefaultNetworkEvent(android.net.metrics.DefaultNetworkEvent) ConnectivityMetricsEvent(android.net.ConnectivityMetricsEvent) MetricsTestUtil.aString(com.android.server.connectivity.MetricsTestUtil.aString)

Aggregations

ConnectivityMetricsEvent (android.net.ConnectivityMetricsEvent)63 MetricsTestUtil.aString (com.android.server.connectivity.MetricsTestUtil.aString)44 SmallTest (android.test.suitebuilder.annotation.SmallTest)39 DefaultNetworkEvent (android.net.metrics.DefaultNetworkEvent)8 IpConnectivityLog (android.net.metrics.IpConnectivityLog)8 Reference (android.net.ConnectivityMetricsEvent.Reference)6 IpConnectivityEvent (com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityEvent)5 ArrayList (java.util.ArrayList)5 ApfProgramEvent (android.net.metrics.ApfProgramEvent)4 ApfStats (android.net.metrics.ApfStats)4 DhcpClientEvent (android.net.metrics.DhcpClientEvent)4 DhcpErrorEvent (android.net.metrics.DhcpErrorEvent)4 DnsEvent (android.net.metrics.DnsEvent)4 IpManagerEvent (android.net.metrics.IpManagerEvent)4 IpReachabilityEvent (android.net.metrics.IpReachabilityEvent)4 NetworkEvent (android.net.metrics.NetworkEvent)4 RaEvent (android.net.metrics.RaEvent)4 ValidationProbeEvent (android.net.metrics.ValidationProbeEvent)4 FileDescriptor (java.io.FileDescriptor)3 FileOutputStream (java.io.FileOutputStream)3