use of android.test.FlakyTest in project android_frameworks_base by ParanoidAndroid.
the class BroadcastTest method testReceiveSticky.
// Marking flaky until http://b/issue?id=1191337 is resolved
@FlakyTest(tolerance = 2)
public void testReceiveSticky() throws Exception {
Intent intent = new Intent(LaunchpadActivity.BROADCAST_STICKY1, null);
intent.putExtra("test", LaunchpadActivity.DATA_1);
ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.myUserId());
runLaunchpad(LaunchpadActivity.BROADCAST_STICKY1);
}
use of android.test.FlakyTest in project android_frameworks_base by ParanoidAndroid.
the class AutoCompleteTextViewCallbacks method testPopupEnterSelection.
/** Test that arrow-down into the popup calls the onSelected callback. */
@FlakyTest(tolerance = 3)
public void testPopupEnterSelection() throws Exception {
final AutoCompleteTextViewSimple theActivity = getActivity();
AutoCompleteTextView textView = theActivity.getTextView();
final Instrumentation instrumentation = getInstrumentation();
// focus and type
textView.requestFocus();
instrumentation.waitForIdleSync();
sendKeys("A");
textView.post(new Runnable() {
public void run() {
// prepare to move down into the popup
theActivity.resetItemListeners();
}
});
sendKeys("DPAD_DOWN");
instrumentation.waitForIdleSync();
// give UI time to settle
Thread.sleep(WAIT_TIME);
// now check for selection callbacks.
assertFalse("onItemClick should not be called", theActivity.mItemClickCalled);
assertTrue("onItemSelected should be called", theActivity.mItemSelectedCalled);
assertEquals("onItemSelected position", 0, theActivity.mItemSelectedPosition);
assertFalse("onNothingSelected should not be called", theActivity.mNothingSelectedCalled);
textView.post(new Runnable() {
public void run() {
// try one more time - should move from 0 to 1
theActivity.resetItemListeners();
}
});
sendKeys("DPAD_DOWN");
instrumentation.waitForIdleSync();
// give UI time to settle
Thread.sleep(WAIT_TIME);
// now check for selection callbacks.
assertFalse("onItemClick should not be called", theActivity.mItemClickCalled);
assertTrue("onItemSelected should be called", theActivity.mItemSelectedCalled);
assertEquals("onItemSelected position", 1, theActivity.mItemSelectedPosition);
assertFalse("onNothingSelected should not be called", theActivity.mNothingSelectedCalled);
}
use of android.test.FlakyTest in project android_frameworks_base by ParanoidAndroid.
the class AutoCompleteTextViewPopup method testPopupClearListSelection.
/** Test that we can clear the selection */
@FlakyTest(tolerance = 3)
public void testPopupClearListSelection() throws Throwable {
AutoCompleteTextViewSimple theActivity = getActivity();
final AutoCompleteTextView textView = theActivity.getTextView();
final Instrumentation instrumentation = getInstrumentation();
// focus and type
textView.requestFocus();
instrumentation.waitForIdleSync();
sendKeys("A");
// No initial selection
waitAssertListSelection(textView, ListView.INVALID_POSITION);
// check for selection position as expected
sendKeys("DPAD_DOWN");
waitAssertListSelection(textView, 0);
// clear it
runTestOnUiThread(new Runnable() {
public void run() {
textView.clearListSelection();
}
});
instrumentation.waitForIdleSync();
waitAssertListSelection("setListSelection(ListView.INVALID_POSITION)", textView, ListView.INVALID_POSITION);
// TODO: FlakyTest repeat runs will not currently call setUp, clear state
clearText(textView);
}
use of android.test.FlakyTest in project android_frameworks_base by ParanoidAndroid.
the class AutoCompleteTextViewPopup method testPopupNavigateNoAdapter.
/** Make sure we handle an empty adapter properly */
@FlakyTest(tolerance = 3)
public void testPopupNavigateNoAdapter() throws Throwable {
AutoCompleteTextViewSimple theActivity = getActivity();
final AutoCompleteTextView textView = theActivity.getTextView();
final Instrumentation instrumentation = getInstrumentation();
// focus and type
textView.requestFocus();
instrumentation.waitForIdleSync();
sendKeys("A");
// No initial selection
waitAssertListSelection(textView, ListView.INVALID_POSITION);
// check for selection position as expected
sendKeys("DPAD_DOWN");
waitAssertListSelection(textView, 0);
// Now get rid of the adapter
runTestOnUiThread(new Runnable() {
public void run() {
textView.setAdapter((ArrayAdapter<?>) null);
}
});
instrumentation.waitForIdleSync();
// now try moving "down" - nothing should happen since there's no longer an adapter
sendKeys("DPAD_DOWN");
// TODO: FlakyTest repeat runs will not currently call setUp, clear state
clearText(textView);
}
use of android.test.FlakyTest in project android_frameworks_base by ParanoidAndroid.
the class AutoCompleteTextViewPopup method testPopupSetListSelection.
/** Test that we can move the selection and it responds as expected */
@FlakyTest(tolerance = 3)
public void testPopupSetListSelection() throws Throwable {
AutoCompleteTextViewSimple theActivity = getActivity();
final AutoCompleteTextView textView = theActivity.getTextView();
final Instrumentation instrumentation = getInstrumentation();
// focus and type
textView.requestFocus();
instrumentation.waitForIdleSync();
sendKeys("A");
// No initial selection
waitAssertListSelection(textView, ListView.INVALID_POSITION);
// set and check
runTestOnUiThread(new Runnable() {
public void run() {
textView.setListSelection(0);
}
});
instrumentation.waitForIdleSync();
waitAssertListSelection("set selection to (0)", textView, 0);
// Use movement to cross-check the movement
sendKeys("DPAD_DOWN");
waitAssertListSelection("move selection to (1)", textView, 1);
// TODO: FlakyTest repeat runs will not currently call setUp, clear state
clearText(textView);
}
Aggregations