Search in sources :

Example 11 with Suppress

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

the class MediaPlayerInvokeTest method testPing.

// Generate a random number, sends it to the ping test player.
@Suppress
@MediumTest
public void testPing() throws Exception {
    mPlayer.setDataSource("test:invoke_mock_media_player.so?url=ping");
    Parcel request = mPlayer.newRequest();
    Parcel reply = Parcel.obtain();
    int val = rnd.nextInt();
    request.writeInt(val);
    mPlayer.invoke(request, reply);
    assertEquals(val, reply.readInt());
}
Also used : Parcel(android.os.Parcel) Suppress(android.test.suitebuilder.annotation.Suppress) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 12 with Suppress

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

the class NetworkStatsServiceTest method testStatsBucketResize.

// TODO: simulate reboot to test bucket resize
@Suppress
public void testStatsBucketResize() throws Exception {
    NetworkStatsHistory history = null;
    assertStatsFilesExist(false);
    // pretend that wifi network comes online; service should ask about full
    // network state, and poll any existing interfaces before updating.
    expectCurrentTime();
    expectSettings(0L, HOUR_IN_MILLIS, WEEK_IN_MILLIS);
    expectNetworkState(buildWifiState());
    expectNetworkStatsSummary(buildEmptyStats());
    expectNetworkStatsUidDetail(buildEmptyStats());
    expectNetworkStatsPoll();
    expectBandwidthControlCheck();
    replay();
    mService.forceUpdateIfaces();
    verifyAndReset();
    // modify some number on wifi, and trigger poll event
    incrementCurrentTime(2 * HOUR_IN_MILLIS);
    expectCurrentTime();
    expectSettings(0L, HOUR_IN_MILLIS, WEEK_IN_MILLIS);
    expectNetworkStatsSummary(new NetworkStats(getElapsedRealtime(), 1).addIfaceValues(TEST_IFACE, 512L, 4L, 512L, 4L));
    expectNetworkStatsUidDetail(buildEmptyStats());
    expectNetworkStatsPoll();
    replay();
    forcePollAndWaitForIdle();
    // verify service recorded history
    history = mSession.getHistoryForNetwork(sTemplateWifi, FIELD_ALL);
    assertValues(history, Long.MIN_VALUE, Long.MAX_VALUE, 512L, 4L, 512L, 4L, 0);
    assertEquals(HOUR_IN_MILLIS, history.getBucketDuration());
    assertEquals(2, history.size());
    verifyAndReset();
    // now change bucket duration setting and trigger another poll with
    // exact same values, which should resize existing buckets.
    expectCurrentTime();
    expectSettings(0L, 30 * MINUTE_IN_MILLIS, WEEK_IN_MILLIS);
    expectNetworkStatsSummary(buildEmptyStats());
    expectNetworkStatsUidDetail(buildEmptyStats());
    expectNetworkStatsPoll();
    replay();
    forcePollAndWaitForIdle();
    // verify identical stats, but spread across 4 buckets now
    history = mSession.getHistoryForNetwork(sTemplateWifi, FIELD_ALL);
    assertValues(history, Long.MIN_VALUE, Long.MAX_VALUE, 512L, 4L, 512L, 4L, 0);
    assertEquals(30 * MINUTE_IN_MILLIS, history.getBucketDuration());
    assertEquals(4, history.size());
    verifyAndReset();
}
Also used : NetworkStats(android.net.NetworkStats) NetworkStatsHistory(android.net.NetworkStatsHistory) Suppress(android.test.suitebuilder.annotation.Suppress)

Example 13 with Suppress

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

the class LinkPropertiesTest method testIsReachable.

@SmallTest
// Failing.
@Suppress
public void testIsReachable() {
    final LinkProperties v4lp = new LinkProperties();
    assertFalse(v4lp.isReachable(DNS1));
    assertFalse(v4lp.isReachable(DNS2));
    // Add an on-link route, making the on-link DNS server reachable,
    // but there is still no IPv4 address.
    assertTrue(v4lp.addRoute(new RouteInfo(new IpPrefix(NetworkUtils.numericToInetAddress("75.208.0.0"), 16))));
    assertFalse(v4lp.isReachable(DNS1));
    assertFalse(v4lp.isReachable(DNS2));
    // Adding an IPv4 address (right now, any IPv4 address) means we use
    // the routes to compute likely reachability.
    assertTrue(v4lp.addLinkAddress(new LinkAddress(ADDRV4, 16)));
    assertTrue(v4lp.isReachable(DNS1));
    assertFalse(v4lp.isReachable(DNS2));
    // Adding a default route makes the off-link DNS server reachable.
    assertTrue(v4lp.addRoute(new RouteInfo(GATEWAY1)));
    assertTrue(v4lp.isReachable(DNS1));
    assertTrue(v4lp.isReachable(DNS2));
    final LinkProperties v6lp = new LinkProperties();
    final InetAddress kLinkLocalDns = NetworkUtils.numericToInetAddress("fe80::6:1");
    final InetAddress kLinkLocalDnsWithScope = NetworkUtils.numericToInetAddress("fe80::6:2%43");
    final InetAddress kOnLinkDns = NetworkUtils.numericToInetAddress("2001:db8:85a3::53");
    assertFalse(v6lp.isReachable(kLinkLocalDns));
    assertFalse(v6lp.isReachable(kLinkLocalDnsWithScope));
    assertFalse(v6lp.isReachable(kOnLinkDns));
    assertFalse(v6lp.isReachable(DNS6));
    // Add a link-local route, making the link-local DNS servers reachable. Because
    // we assume the presence of an IPv6 link-local address, link-local DNS servers
    // are considered reachable, but only those with a non-zero scope identifier.
    assertTrue(v6lp.addRoute(new RouteInfo(new IpPrefix(NetworkUtils.numericToInetAddress("fe80::"), 64))));
    assertFalse(v6lp.isReachable(kLinkLocalDns));
    assertTrue(v6lp.isReachable(kLinkLocalDnsWithScope));
    assertFalse(v6lp.isReachable(kOnLinkDns));
    assertFalse(v6lp.isReachable(DNS6));
    // Add a link-local address--nothing changes.
    assertTrue(v6lp.addLinkAddress(LINKADDRV6LINKLOCAL));
    assertFalse(v6lp.isReachable(kLinkLocalDns));
    assertTrue(v6lp.isReachable(kLinkLocalDnsWithScope));
    assertFalse(v6lp.isReachable(kOnLinkDns));
    assertFalse(v6lp.isReachable(DNS6));
    // Add a global route on link, but no global address yet. DNS servers reachable
    // via a route that doesn't require a gateway: give them the benefit of the
    // doubt and hope the link-local source address suffices for communication.
    assertTrue(v6lp.addRoute(new RouteInfo(new IpPrefix(NetworkUtils.numericToInetAddress("2001:db8:85a3::"), 64))));
    assertFalse(v6lp.isReachable(kLinkLocalDns));
    assertTrue(v6lp.isReachable(kLinkLocalDnsWithScope));
    assertTrue(v6lp.isReachable(kOnLinkDns));
    assertFalse(v6lp.isReachable(DNS6));
    // Add a global address; the on-link global address DNS server is (still)
    // presumed reachable.
    assertTrue(v6lp.addLinkAddress(new LinkAddress(ADDRV6, 64)));
    assertFalse(v6lp.isReachable(kLinkLocalDns));
    assertTrue(v6lp.isReachable(kLinkLocalDnsWithScope));
    assertTrue(v6lp.isReachable(kOnLinkDns));
    assertFalse(v6lp.isReachable(DNS6));
    // Adding a default route makes the off-link DNS server reachable.
    assertTrue(v6lp.addRoute(new RouteInfo(GATEWAY62)));
    assertFalse(v6lp.isReachable(kLinkLocalDns));
    assertTrue(v6lp.isReachable(kLinkLocalDnsWithScope));
    assertTrue(v6lp.isReachable(kOnLinkDns));
    assertTrue(v6lp.isReachable(DNS6));
    // Check isReachable on stacked links. This requires that the source IP address be assigned
    // on the interface returned by the route lookup.
    LinkProperties stacked = new LinkProperties();
    // Can't add a stacked link without an interface name.
    stacked.setInterfaceName("v4-test0");
    v6lp.addStackedLink(stacked);
    InetAddress stackedAddress = Address("192.0.0.4");
    LinkAddress stackedLinkAddress = new LinkAddress(stackedAddress, 32);
    assertFalse(v6lp.isReachable(stackedAddress));
    stacked.addLinkAddress(stackedLinkAddress);
    assertFalse(v6lp.isReachable(stackedAddress));
    stacked.addRoute(new RouteInfo(stackedLinkAddress));
    assertTrue(stacked.isReachable(stackedAddress));
    assertTrue(v6lp.isReachable(stackedAddress));
    assertFalse(v6lp.isReachable(DNS1));
    stacked.addRoute(new RouteInfo((IpPrefix) null, stackedAddress));
    assertTrue(v6lp.isReachable(DNS1));
}
Also used : IpPrefix(android.net.IpPrefix) LinkAddress(android.net.LinkAddress) RouteInfo(android.net.RouteInfo) LinkProperties(android.net.LinkProperties) InetAddress(java.net.InetAddress) SmallTest(android.test.suitebuilder.annotation.SmallTest) Suppress(android.test.suitebuilder.annotation.Suppress)

Example 14 with Suppress

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

the class NetworkStatsHistoryTest method testFuzzing.

@Suppress
public void testFuzzing() throws Exception {
    try {
        // fuzzing with random events, looking for crashes
        final NetworkStats.Entry entry = new NetworkStats.Entry();
        final Random r = new Random();
        for (int i = 0; i < 500; i++) {
            stats = new NetworkStatsHistory(r.nextLong());
            for (int j = 0; j < 10000; j++) {
                if (r.nextBoolean()) {
                    // add range
                    final long start = r.nextLong();
                    final long end = start + r.nextInt();
                    entry.rxBytes = nextPositiveLong(r);
                    entry.rxPackets = nextPositiveLong(r);
                    entry.txBytes = nextPositiveLong(r);
                    entry.txPackets = nextPositiveLong(r);
                    entry.operations = nextPositiveLong(r);
                    stats.recordData(start, end, entry);
                } else {
                    // trim something
                    stats.removeBucketsBefore(r.nextLong());
                }
            }
            assertConsistent(stats);
        }
    } catch (Throwable e) {
        Log.e(TAG, String.valueOf(stats));
        throw new RuntimeException(e);
    }
}
Also used : Random(java.util.Random) Suppress(android.test.suitebuilder.annotation.Suppress)

Example 15 with Suppress

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

the class ListOfItemsShorterThanScreenTest method testMoveDownToItemRequiringScrolling.

@MediumTest
// Failing.
@Suppress
public void testMoveDownToItemRequiringScrolling() {
    final int lastOnScreenItemIndex = mListView.getChildCount() - 1;
    final View lastItem = mListView.getChildAt(lastOnScreenItemIndex);
    assertTrue("last item should be partially off screen", lastItem.getBottom() > mListView.getBottom());
    assertEquals(mListView.getListPaddingTop(), mListView.getSelectedView().getTop());
    for (int i = 0; i < lastOnScreenItemIndex; i++) {
        sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
    }
    assertEquals(lastOnScreenItemIndex, mListView.getSelectedItemPosition());
    assertEquals(getTopOfBottomFadingEdge(), mListView.getSelectedView().getBottom());
    // there should be a peeking view
    // the current view isn't the last anymore...
    assertEquals(mListView.getSelectedView(), mListView.getChildAt(mListView.getChildCount() - 2));
    // peeking view is now last
    final TextView view = (TextView) mListView.getChildAt(mListView.getChildCount() - 1);
    assertEquals(mActivity.getValueAtPosition(lastOnScreenItemIndex + 1), view.getText());
    assertFalse(view.isSelected());
}
Also used : TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View) ListView(android.widget.ListView) Suppress(android.test.suitebuilder.annotation.Suppress) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Aggregations

Suppress (android.test.suitebuilder.annotation.Suppress)199 MediumTest (android.test.suitebuilder.annotation.MediumTest)73 ServiceStatus (com.vodafone360.people.service.ServiceStatus)39 Cursor (android.database.Cursor)29 Contact (com.vodafone360.people.datatypes.Contact)28 ArrayList (java.util.ArrayList)26 SmallTest (android.test.suitebuilder.annotation.SmallTest)17 ContactDetail (com.vodafone360.people.datatypes.ContactDetail)16 Intent (android.content.Intent)15 LargeTest (android.test.suitebuilder.annotation.LargeTest)15 ContentValues (android.content.ContentValues)13 NetworkStats (android.net.NetworkStats)13 Uri (android.net.Uri)13 Time (android.text.format.Time)12 Random (java.util.Random)12 DatabaseHelper (com.vodafone360.people.database.DatabaseHelper)11 IEngineEventCallback (com.vodafone360.people.engine.IEngineEventCallback)11 IContactSyncCallback (com.vodafone360.people.engine.contactsync.IContactSyncCallback)11 ProcessorFactory (com.vodafone360.people.engine.contactsync.ProcessorFactory)11 DownloadManager (android.app.DownloadManager)10