Search in sources :

Example 91 with SmallTest

use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ResurrectionRemix.

the class IpConnectivityMetricsTest method testLoggingEvents.

@SmallTest
public void testLoggingEvents() throws Exception {
    IpConnectivityLog logger = new IpConnectivityLog(mMockService);
    assertTrue(logger.log(1, FAKE_EV));
    assertTrue(logger.log(2, FAKE_EV));
    assertTrue(logger.log(3, FAKE_EV));
    List<ConnectivityMetricsEvent> got = verifyEvents(3);
    assertEventsEqual(expectedEvent(1), got.get(0));
    assertEventsEqual(expectedEvent(2), got.get(1));
    assertEventsEqual(expectedEvent(3), got.get(2));
}
Also used : IpConnectivityLog(android.net.metrics.IpConnectivityLog) ConnectivityMetricsEvent(android.net.ConnectivityMetricsEvent) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 92 with SmallTest

use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ResurrectionRemix.

the class IpConnectivityMetricsTest method testBufferFlushing.

@SmallTest
public void testBufferFlushing() {
    String output1 = getdump("flush");
    assertEquals("", output1);
    new IpConnectivityLog(mService.impl).log(1, FAKE_EV);
    String output2 = getdump("flush");
    assertFalse("".equals(output2));
    String output3 = getdump("flush");
    assertEquals("", output3);
}
Also used : IpConnectivityLog(android.net.metrics.IpConnectivityLog) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 93 with SmallTest

use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ResurrectionRemix.

the class IpConnectivityEventBuilderTest method testRaEventSerialization.

@SmallTest
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 <", "  time_ms: 1", "  transport: 0", "  ra_event <", "    dnssl_lifetime: -1", "    prefix_preferred_lifetime: 300", "    prefix_valid_lifetime: 400", "    rdnss_lifetime: 1000", "    route_info_lifetime: -1", "    router_lifetime: 2000", "  >", ">", "version: 2");
    verifySerialization(want, ev);
}
Also used : RaEvent(android.net.metrics.RaEvent) ConnectivityMetricsEvent(android.net.ConnectivityMetricsEvent) MetricsTestUtil.aString(com.android.server.connectivity.MetricsTestUtil.aString) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 94 with SmallTest

use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ResurrectionRemix.

the class IpConnectivityEventBuilderTest method testApfProgramEventSerialization.

@SmallTest
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 <", "  time_ms: 1", "  transport: 0", "  apf_program_event <", "    current_ras: 9", "    drop_multicast: true", "    filtered_ras: 7", "    has_ipv4_addr: true", "    lifetime: 200", "    program_length: 2048", "  >", ">", "version: 2");
    verifySerialization(want, ev);
}
Also used : ApfProgramEvent(android.net.metrics.ApfProgramEvent) ConnectivityMetricsEvent(android.net.ConnectivityMetricsEvent) MetricsTestUtil.aString(com.android.server.connectivity.MetricsTestUtil.aString) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 95 with SmallTest

use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ResurrectionRemix.

the class IpConnectivityEventBuilderTest method testDhcpErrorEventSerialization.

@SmallTest
public void testDhcpErrorEventSerialization() {
    ConnectivityMetricsEvent ev = describeIpEvent(aType(DhcpErrorEvent.class), aString("wlan0"), anInt(DhcpErrorEvent.L4_NOT_UDP));
    String want = joinLines("dropped_events: 0", "events <", "  time_ms: 1", "  transport: 0", "  dhcp_event <", "    duration_ms: 0", "    if_name: \"wlan0\"", "    error_code: 50397184", "  >", ">", "version: 2");
    verifySerialization(want, ev);
}
Also used : ConnectivityMetricsEvent(android.net.ConnectivityMetricsEvent) MetricsTestUtil.aString(com.android.server.connectivity.MetricsTestUtil.aString) DhcpErrorEvent(android.net.metrics.DhcpErrorEvent) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Aggregations

SmallTest (android.test.suitebuilder.annotation.SmallTest)2108 Test (org.junit.Test)235 Parcel (android.os.Parcel)153 ArrayList (java.util.ArrayList)104 Time (android.text.format.Time)97 Rect (android.graphics.Rect)94 TelephonyTest (com.android.internal.telephony.TelephonyTest)84 Bundle (android.os.Bundle)77 ByteBuffer (java.nio.ByteBuffer)71 Intent (android.content.Intent)69 LinkProperties (android.net.LinkProperties)68 SpannableString (android.text.SpannableString)61 FlakyTest (android.support.test.filters.FlakyTest)58 DhcpPacket (android.net.dhcp.DhcpPacket)52 Rational (android.util.Rational)50 NetworkRequest (android.net.NetworkRequest)48 File (java.io.File)47 RouteInfo (android.net.RouteInfo)45 BitwiseOutputStream (com.android.internal.util.BitwiseOutputStream)45 ParcelUuid (android.os.ParcelUuid)43