| Index: chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkInfoTest.java
|
| diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkInfoTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkInfoTest.java
|
| index aba6f20baa2756074f6f6d013421ef118e6c3381..f1ccc06de71f495f7c83ae39d499ffb9a0e5700a 100644
|
| --- a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkInfoTest.java
|
| +++ b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkInfoTest.java
|
| @@ -225,4 +225,24 @@ public class WebApkInfoTest {
|
| WebApkInfo info = WebApkInfo.create(intent);
|
| Assert.assertTrue(info.shouldForceNavigation());
|
| }
|
| +
|
| + /**
|
| + * Test that {@link WebApkInfo#source()} returns {@link ShortcutSource#UNKNOWN} if the source
|
| + * in the launch intent > {@link ShortcutSource#COUNT}. This can occur if the user is using a
|
| + * new WebAPK and an old version of Chrome.
|
| + */
|
| + @Test
|
| + public void testOutOfBoundsSource() {
|
| + Bundle bundle = new Bundle();
|
| + bundle.putString(WebApkMetaDataKeys.START_URL, START_URL);
|
| + WebApkTestHelper.registerWebApkWithMetaData(WEBAPK_PACKAGE_NAME, bundle);
|
| +
|
| + Intent intent = new Intent();
|
| + intent.putExtra(WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, WEBAPK_PACKAGE_NAME);
|
| + intent.putExtra(ShortcutHelper.EXTRA_URL, START_URL);
|
| + intent.putExtra(ShortcutHelper.EXTRA_SOURCE, ShortcutSource.COUNT + 1);
|
| +
|
| + WebApkInfo info = WebApkInfo.create(intent);
|
| + Assert.assertEquals(ShortcutSource.UNKNOWN, info.source());
|
| + }
|
| }
|
|
|