Search in sources :

Example 96 with Suppress

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

the class SearchRecentSuggestionsProviderTest method testReordering.

/**
     * Test that the reordering code works properly.  The most recently injected queries
     * should replace existing queries and be sorted to the top of the list.
     */
// Failing.
@Suppress
public void testReordering() {
    // first we'll make 10 queries named "group1 x"
    final int GROUP_1_COUNT = 10;
    final String GROUP_1_QUERY = "group1 ";
    final String GROUP_1_LINE2 = "line2 ";
    writeEntries(GROUP_1_COUNT, GROUP_1_QUERY, GROUP_1_LINE2);
    // check totals
    checkOpenCursorCount(GROUP_1_COUNT);
    // guarantee that group 1 has older timestamps
    writeDelay();
    // next we'll add 10 entries named "group2 x"
    final int GROUP_2_COUNT = 10;
    final String GROUP_2_QUERY = "group2 ";
    final String GROUP_2_LINE2 = "line2 ";
    writeEntries(GROUP_2_COUNT, GROUP_2_QUERY, GROUP_2_LINE2);
    // check totals
    checkOpenCursorCount(GROUP_1_COUNT + GROUP_2_COUNT);
    // guarantee that group 2 has older timestamps
    writeDelay();
    // now refresh 5 of the 10 from group 1
    // change line2 so they can be more easily tracked
    final int GROUP_3_COUNT = 5;
    final String GROUP_3_QUERY = GROUP_1_QUERY;
    final String GROUP_3_LINE2 = "refreshed ";
    writeEntries(GROUP_3_COUNT, GROUP_3_QUERY, GROUP_3_LINE2);
    // confirm that the total didn't change (those were replacements, not adds)
    checkOpenCursorCount(GROUP_1_COUNT + GROUP_2_COUNT);
    // confirm that the are now 5 in group 1, 10 in group 2, and 5 in group 3
    int newGroup1Count = GROUP_1_COUNT - GROUP_3_COUNT;
    checkResultCounts(GROUP_1_QUERY, newGroup1Count, newGroup1Count, null, GROUP_1_LINE2);
    checkResultCounts(GROUP_2_QUERY, GROUP_2_COUNT, GROUP_2_COUNT, null, null);
    checkResultCounts(GROUP_3_QUERY, GROUP_3_COUNT, GROUP_3_COUNT, null, GROUP_3_LINE2);
    // finally, spot check that the right groups are in the right places
    // the ordering should be group 3 (newest), group 2, group 1 (oldest)
    Cursor c = getQueryCursor(null);
    int colQuery = c.getColumnIndexOrThrow(SearchManager.SUGGEST_COLUMN_QUERY);
    int colDisplay1 = c.getColumnIndexOrThrow(SearchManager.SUGGEST_COLUMN_TEXT_1);
    int colDisplay2 = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_2);
    // Spot check the first and last expected entries of group 3
    c.moveToPosition(0);
    assertTrue("group 3 did not properly reorder to head of list", checkRow(c, colQuery, colDisplay1, colDisplay2, GROUP_3_QUERY, GROUP_3_LINE2));
    c.move(GROUP_3_COUNT - 1);
    assertTrue("group 3 did not properly reorder to head of list", checkRow(c, colQuery, colDisplay1, colDisplay2, GROUP_3_QUERY, GROUP_3_LINE2));
    // Spot check the first and last expected entries of group 2
    c.move(1);
    assertTrue("group 2 not in expected position after reordering", checkRow(c, colQuery, colDisplay1, colDisplay2, GROUP_2_QUERY, GROUP_2_LINE2));
    c.move(GROUP_2_COUNT - 1);
    assertTrue("group 2 not in expected position after reordering", checkRow(c, colQuery, colDisplay1, colDisplay2, GROUP_2_QUERY, GROUP_2_LINE2));
    // Spot check the first and last expected entries of group 1
    c.move(1);
    assertTrue("group 1 not in expected position after reordering", checkRow(c, colQuery, colDisplay1, colDisplay2, GROUP_1_QUERY, GROUP_1_LINE2));
    c.move(newGroup1Count - 1);
    assertTrue("group 1 not in expected position after reordering", checkRow(c, colQuery, colDisplay1, colDisplay2, GROUP_1_QUERY, GROUP_1_LINE2));
    c.close();
}
Also used : Cursor(android.database.Cursor) Suppress(android.test.suitebuilder.annotation.Suppress)

Example 97 with Suppress

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

the class SettingsProviderTest method testRowNumberContentUri.

@MediumTest
// Settings.Bookmarks uses a query format that's not supported now.
@Suppress
public void testRowNumberContentUri() {
    ContentResolver r = getContext().getContentResolver();
    // The bookmarks table (and everything else) uses standard row number content URIs.
    Uri uri = Settings.Bookmarks.add(r, new Intent("TEST"), "Test Title", "Test Folder", '*', 123);
    assertTrue(ContentUris.parseId(uri) > 0);
    assertEquals("TEST", Settings.Bookmarks.getIntentForShortcut(r, '*').getAction());
    ContentValues v = new ContentValues();
    v.put(Settings.Bookmarks.INTENT, "#Intent;action=TOAST;end");
    assertEquals(1, r.update(uri, v, null, null));
    assertEquals("TOAST", Settings.Bookmarks.getIntentForShortcut(r, '*').getAction());
    assertEquals(1, r.delete(uri, null, null));
    assertEquals(null, Settings.Bookmarks.getIntentForShortcut(r, '*'));
}
Also used : ContentValues(android.content.ContentValues) Intent(android.content.Intent) Uri(android.net.Uri) ContentResolver(android.content.ContentResolver) Suppress(android.test.suitebuilder.annotation.Suppress) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 98 with Suppress

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

the class TimeTest method disableTestGetJulianDay.

@Suppress
public void disableTestGetJulianDay() throws Exception {
    Time time = new Time();
    // same Julian day.
    for (int monthDay = 1; monthDay <= 366; monthDay++) {
        for (int zoneIndex = 0; zoneIndex < mTimeZones.length; zoneIndex++) {
            // We leave the "month" as zero because we are changing the
            // "monthDay" from 1 to 366.  The call to normalize() will
            // then change the "month" (but we don't really care).
            time.set(0, 0, 0, monthDay, 0, 2008);
            time.timezone = mTimeZones[zoneIndex];
            long millis = time.normalize(true);
            if (zoneIndex == 0) {
                Log.i("TimeTest", time.format("%B %d, %Y"));
            }
            // This is the Julian day for 12am for this day of the year
            int julianDay = Time.getJulianDay(millis, time.gmtoff);
            // Julian day.
            for (int hour = 0; hour < 24; hour++) {
                for (int minute = 0; minute < 60; minute += 15) {
                    time.set(0, minute, hour, monthDay, 0, 2008);
                    millis = time.normalize(true);
                    int day = Time.getJulianDay(millis, time.gmtoff);
                    if (day != julianDay) {
                        Log.e("TimeTest", "Julian day: " + day + " at time " + time.hour + ":" + time.minute + " != today's Julian day: " + julianDay + " timezone: " + time.timezone);
                    }
                    assertEquals(day, julianDay);
                }
            }
        }
    }
}
Also used : Time(android.text.format.Time) Suppress(android.test.suitebuilder.annotation.Suppress)

Example 99 with Suppress

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

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 100 with Suppress

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

the class SSLTest method testCertificate.

//This test relies on network resources.
@Suppress
public void testCertificate() throws Exception {
    // test www.fortify.net/sslcheck.html
    Socket ssl = SSLCertificateSocketFactory.getDefault().createSocket("www.fortify.net", 443);
    assertNotNull(ssl);
    OutputStream out = ssl.getOutputStream();
    assertNotNull(out);
    InputStream in = ssl.getInputStream();
    assertNotNull(in);
    String get = "GET /sslcheck.html HTTP/1.1\r\nHost: 68.178.217.222\r\n\r\n";
    // System.out.println("going for write...");
    out.write(get.getBytes());
    byte[] b = new byte[1024];
    // System.out.println("going for read...");
    int ret = in.read(b);
// System.out.println(new String(b));
}
Also used : InputStream(java.io.InputStream) OutputStream(java.io.OutputStream) Socket(java.net.Socket) Suppress(android.test.suitebuilder.annotation.Suppress)

Aggregations

Suppress (android.test.suitebuilder.annotation.Suppress)191 MediumTest (android.test.suitebuilder.annotation.MediumTest)69 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)14 ContentValues (android.content.ContentValues)13 NetworkStats (android.net.NetworkStats)13 Uri (android.net.Uri)12 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