use of android.test.FlakyTest in project facebook-android-sdk by facebook.
the class FacebookAppLinkResolverTests method testCachedAppLinkData.
@FlakyTest
public void testCachedAppLinkData() {
String testUrlString = "https://fb.me/732873156764191";
Uri testUrl = Uri.parse(testUrlString);
Uri testWebUri = Uri.parse("http://www.facebook.com/");
ArrayList<AppLink.Target> testTargets = new ArrayList<AppLink.Target>();
testTargets.add(new AppLink.Target("com.myapp", null, Uri.parse("myapp://3"), "my app"));
testTargets.add(new AppLink.Target("com.myapp-test", null, Uri.parse("myapp-test://4"), "my test app"));
try {
FacebookAppLinkResolver resolver = new FacebookAppLinkResolver();
// This will prefetch the app link
executeResolverOnBlockerThread(resolver, testUrl);
getTestBlocker().waitForSignals(1);
assertNotNull(resolveTask);
// Now let's fetch it again. This should complete the task synchronously.
Task<AppLink> cachedUrlResolveTask = resolver.getAppLinkFromUrlInBackground(testUrl);
assertTrue(cachedUrlResolveTask.isCompleted() && !cachedUrlResolveTask.isCancelled() && !cachedUrlResolveTask.isFaulted());
AppLink appLink = cachedUrlResolveTask.getResult();
assertEquals(appLink.getSourceUrl(), testUrl);
assertEquals(appLink.getWebUrl(), testWebUri);
assertTrue(targetListsAreEqual(appLink.getTargets(), testTargets));
} catch (Exception e) {
// Forcing the test to fail with details
assertNull(e);
}
}
use of android.test.FlakyTest in project android_frameworks_base by ParanoidAndroid.
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 ParanoidAndroid.
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 ParanoidAndroid.
the class AutoCompleteTextViewPopup method testPopupShow.
/** Test the show/hide behavior of the drop-down. */
@FlakyTest(tolerance = 3)
public void testPopupShow() throws Throwable {
AutoCompleteTextViewSimple theActivity = getActivity();
final AutoCompleteTextView textView = theActivity.getTextView();
final Instrumentation instrumentation = getInstrumentation();
// Drop-down should not be showing when no text has been entered
assertFalse("isPopupShowing() on start", textView.isPopupShowing());
// focus and type
textView.requestFocus();
instrumentation.waitForIdleSync();
sendKeys("A");
// Drop-down should now be visible
waitAssertPopupShowState("isPopupShowing() after typing", textView, true);
// Clear the text
runTestOnUiThread(new Runnable() {
public void run() {
textView.setText("");
}
});
instrumentation.waitForIdleSync();
// Drop-down should be hidden when text is cleared
waitAssertPopupShowState("isPopupShowing() after text cleared", textView, false);
// Set the text, without filtering
runTestOnUiThread(new Runnable() {
public void run() {
textView.setText("a", false);
}
});
instrumentation.waitForIdleSync();
// Drop-down should still be hidden
waitAssertPopupShowState("isPopupShowing() after setText(\"a\", false)", textView, false);
// Set the text, now with filtering
runTestOnUiThread(new Runnable() {
public void run() {
textView.setText("a");
}
});
instrumentation.waitForIdleSync();
// Drop-down should show up after setText() with filtering
waitAssertPopupShowState("isPopupShowing() after text set", textView, true);
// 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 testPopupGetListSelection.
/** Test that we can look at the selection as we move around */
@FlakyTest(tolerance = 3)
public void testPopupGetListSelection() 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("move selection to (0)", textView, 0);
// Repeat for one more 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