| 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 d7c6f1caabc76af09c180c858eaaf46e0e5357cb..fdb02886a5b35bcfe7142c5d79d816f56b3a7e81 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
|
| @@ -177,6 +177,33 @@ public class WebApkInfoTest {
|
| Assert.assertEquals(START_URL, info.manifestStartUrl());
|
| }
|
|
|
| + /**
|
| + * Test that {@link WebApkInfo#create()} rewrites {@link WebApkInfo#uri()} when the start URL
|
| + * from the intent is outside of the scope in the WebAPK Android Manifest.
|
| + */
|
| + @Test
|
| + public void testRewriteStartUrlSchemeAndHost() {
|
| + final String intentStartUrl = "http://www.google.ca/search_results?q=eh#cr=countryCA";
|
| + final String expectedRewrittenStartUrl =
|
| + "https://www.google.com/search_results?q=eh#cr=countryCA";
|
| + final String manifestStartUrl = "https://www.google.com/";
|
| + final String manifestScope = "https://www.google.com/";
|
| +
|
| + Bundle bundle = new Bundle();
|
| + bundle.putString(WebApkMetaDataKeys.START_URL, manifestStartUrl);
|
| + bundle.putString(WebApkMetaDataKeys.SCOPE, manifestScope);
|
| + 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, intentStartUrl);
|
| +
|
| + WebApkInfo info = WebApkInfo.create(intent);
|
| +
|
| + Assert.assertEquals(expectedRewrittenStartUrl, info.uri().toString());
|
| + Assert.assertEquals(manifestStartUrl, info.manifestStartUrl());
|
| + }
|
| +
|
| /**
|
| * Test that if the scope is empty that the scope is computed from the "start URL specified from
|
| * the Web Manifest" not the "URL the WebAPK initially navigated to". Deep links can open a
|
|
|