Commit 17213d4f authored by Benoit Lize's avatar Benoit Lize Committed by Commit Bot

android: Add a test for external VIEW intent without a URI.

This is a non-regression test for the linked bug.

BUG=742294

Change-Id: I749e223b831f7558b53039a14704625e52192a15
Reviewed-on: https://chromium-review.googlesource.com/576173
Commit-Queue: Benoit L <lizeb@chromium.org>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488178}
parent 2e73f36b
......@@ -19,6 +19,7 @@ import org.chromium.base.ApplicationState;
import org.chromium.base.ApplicationStatus;
import org.chromium.base.test.util.RetryOnFailure;
import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.test.ChromeActivityTestCaseBase;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
......@@ -81,6 +82,24 @@ public class LauncherActivityTest extends ChromeActivityTestCaseBase<ChromeActiv
assertEquals("Action was not preserved", intent.getAction(), activityIntent.getAction());
}
@SmallTest
public void testDoesNotCrashWithNoUriInViewIntent() {
// Prepare intent
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setClassName(mContext.getPackageName(), ChromeLauncherActivity.class.getName());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// Could crash after the activity is created, wait for the tab to stop loading.
final ChromeActivity activity = (ChromeActivity) tryLaunchingChrome(intent);
CriteriaHelper.pollUiThread(new Criteria("ChromeActivity does not have a tab.") {
@Override
public boolean isSatisfied() {
Tab tab = activity.getActivityTab();
return tab != null && !tab.isLoading();
}
}, DEVICE_STARTUP_TIMEOUT_MS, CriteriaHelper.DEFAULT_POLLING_INTERVAL);
}
private Activity tryLaunchingChrome(final Intent intent) {
mContext.startActivity(intent);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment