use of android.test.suitebuilder.annotation.Suppress in project platform_frameworks_base by android.
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);
}
}
use of android.test.suitebuilder.annotation.Suppress in project platform_frameworks_base by android.
the class ListWithScreenOfNoSelectablesTest method testGoFromNoSelectionToSelectionExists.
@MediumTest
// Failing.
@Suppress
public void testGoFromNoSelectionToSelectionExists() {
// go down untile first (and only selectable) item is off screen
View first = mListView.getChildAt(0);
while (first.getParent() != null) {
sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
}
// nothing should be selected
assertEquals("selected position", ListView.INVALID_POSITION, mListView.getSelectedItemPosition());
assertNull("selected view", mListView.getSelectedView());
// go up once to bring the selectable back on screen
sendKeys(KeyEvent.KEYCODE_DPAD_UP);
assertEquals("first visible position", 0, mListView.getFirstVisiblePosition());
assertEquals("selected position", ListView.INVALID_POSITION, mListView.getSelectedItemPosition());
// up once more should give it selection
sendKeys(KeyEvent.KEYCODE_DPAD_UP);
assertEquals("selected position", 0, mListView.getSelectedItemPosition());
}
use of android.test.suitebuilder.annotation.Suppress in project platform_frameworks_base by android.
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());
}
use of android.test.suitebuilder.annotation.Suppress in project platform_frameworks_base by android.
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();
}
use of android.test.suitebuilder.annotation.Suppress in project platform_frameworks_base by android.
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, '*'));
}
Aggregations