use of android.test.FlakyTest in project platform_frameworks_base by android.
the class AutoCompleteTextViewCallbacks method testPopupNoSelection.
/** Test that the initial popup of the suggestions does not select anything.
*/
@FlakyTest(tolerance = 3)
public void testPopupNoSelection() throws Exception {
AutoCompleteTextViewSimple theActivity = getActivity();
AutoCompleteTextView textView = theActivity.getTextView();
final Instrumentation instrumentation = getInstrumentation();
// focus and type
textView.requestFocus();
instrumentation.waitForIdleSync();
sendKeys("A");
instrumentation.waitForIdleSync();
// give UI time to settle
Thread.sleep(WAIT_TIME);
// now check for selection callbacks. Nothing should be clicked or selected.
assertFalse("onItemClick should not be called", theActivity.mItemClickCalled);
assertFalse("onItemSelected should not be called", theActivity.mItemSelectedCalled);
// arguably, this should be "false", because we aren't deselecting - we shouldn't
// really be calling it. But it's not the end of the world, and we might wind up
// breaking something if we change this.
//assertTrue("onNothingSelected should be called", theActivity.mNothingSelectedCalled);
}
use of android.test.FlakyTest in project double-espresso by JakeWharton.
the class KeyEventActionIntegrationTest method testClickOnBackFromFragment.
@SuppressWarnings("unchecked")
// uses native fragments.
@SdkSuppress(versions = { 7, 8, 10 }, bugId = -1)
@FlakyTest
public void testClickOnBackFromFragment() {
Intent fragmentStack = new Intent().setClassName(getInstrumentation().getTargetContext(), "com.google.android.apps.common.testing.ui.testapp.FragmentStack");
fragmentStack.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getInstrumentation().startActivitySync(fragmentStack);
onView(allOf(withParent(withId(R.id.simple_fragment)), isAssignableFrom(TextView.class))).check(matches(withText(containsString("#1"))));
try {
pressBack();
fail("Should have thrown NoActivityResumedException");
} catch (NoActivityResumedException expected) {
}
getInstrumentation().startActivitySync(fragmentStack);
onView(withId(R.id.new_fragment)).perform(click()).perform(click()).perform(click());
onView(allOf(withParent(withId(R.id.simple_fragment)), isAssignableFrom(TextView.class))).check(matches(withText(containsString("#4"))));
pressBack();
onView(allOf(withParent(withId(R.id.simple_fragment)), isAssignableFrom(TextView.class))).check(matches(withText(containsString("#3"))));
pressBack();
onView(allOf(withParent(withId(R.id.simple_fragment)), isAssignableFrom(TextView.class))).check(matches(withText(containsString("#2"))));
pressBack();
onView(allOf(withParent(withId(R.id.simple_fragment)), isAssignableFrom(TextView.class))).check(matches(withText(containsString("#1"))));
try {
pressBack();
fail("Should have thrown NoActivityResumedException");
} catch (NoActivityResumedException expected) {
}
}
use of android.test.FlakyTest in project android_frameworks_base by DirtyUnicorns.
the class BroadcastTest method testReceive2Sticky.
// Marking flaky until http://b/issue?id=1191337 is resolved
@FlakyTest(tolerance = 2)
public void testReceive2Sticky() throws Exception {
Intent intent = new Intent(LaunchpadActivity.BROADCAST_STICKY1, null);
intent.putExtra("test", LaunchpadActivity.DATA_1);
ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.myUserId());
intent = new Intent(LaunchpadActivity.BROADCAST_STICKY2, null);
intent.putExtra("test", LaunchpadActivity.DATA_2);
ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.myUserId());
runLaunchpad(LaunchpadActivity.BROADCAST_STICKY2);
}
use of android.test.FlakyTest in project android_frameworks_base by AOSPA.
the class AutoCompleteTextViewCallbacks method testPopupNoSelection.
/** Test that the initial popup of the suggestions does not select anything.
*/
@FlakyTest(tolerance = 3)
public void testPopupNoSelection() throws Exception {
AutoCompleteTextViewSimple theActivity = getActivity();
AutoCompleteTextView textView = theActivity.getTextView();
final Instrumentation instrumentation = getInstrumentation();
// focus and type
textView.requestFocus();
instrumentation.waitForIdleSync();
sendKeys("A");
instrumentation.waitForIdleSync();
// give UI time to settle
Thread.sleep(WAIT_TIME);
// now check for selection callbacks. Nothing should be clicked or selected.
assertFalse("onItemClick should not be called", theActivity.mItemClickCalled);
assertFalse("onItemSelected should not be called", theActivity.mItemSelectedCalled);
// arguably, this should be "false", because we aren't deselecting - we shouldn't
// really be calling it. But it's not the end of the world, and we might wind up
// breaking something if we change this.
//assertTrue("onNothingSelected should be called", theActivity.mNothingSelectedCalled);
}
use of android.test.FlakyTest in project android_frameworks_base by AOSPA.
the class AutoCompleteTextViewCallbacks method testPopupLeaveSelection.
/** Test that arrow-up out of the popup calls the onNothingSelected callback */
@FlakyTest(tolerance = 3)
public void testPopupLeaveSelection() {
final AutoCompleteTextViewSimple theActivity = getActivity();
AutoCompleteTextView textView = theActivity.getTextView();
final Instrumentation instrumentation = getInstrumentation();
// focus and type
textView.requestFocus();
instrumentation.waitForIdleSync();
sendKeys("A");
instrumentation.waitForIdleSync();
// move down into the popup
sendKeys("DPAD_DOWN");
instrumentation.waitForIdleSync();
textView.post(new Runnable() {
public void run() {
// prepare to move down into the popup
theActivity.resetItemListeners();
}
});
sendKeys("DPAD_UP");
instrumentation.waitForIdleSync();
// now check for selection callbacks.
assertFalse("onItemClick should not be called", theActivity.mItemClickCalled);
assertFalse("onItemSelected should not be called", theActivity.mItemSelectedCalled);
assertTrue("onNothingSelected should be called", theActivity.mNothingSelectedCalled);
}
Aggregations