Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Unified Diff: chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkInfoTest.java

Issue 2847973002: Don't update unbound WebApks. (Closed)
Patch Set: Don't upadte unbound WebApks. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 790d8ffd9b14a411d9407e72d94e53bd203ef14d..aba6f20baa2756074f6f6d013421ef118e6c3381 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
@@ -32,6 +32,7 @@ import java.util.Map;
@RunWith(LocalRobolectricTestRunner.class)
@Config(manifest = Config.NONE)
public class WebApkInfoTest {
+ private static final String WEBAPK_PACKAGE_NAME = "org.chromium.webapk.test_package";
// Android Manifest meta data for {@link PACKAGE_NAME}.
private static final String START_URL = "https://www.google.com/scope/a_is_for_apple";
@@ -68,19 +69,17 @@ public class WebApkInfoTest {
bundle.putString(WebApkMetaDataKeys.START_URL, START_URL);
bundle.putString(WebApkMetaDataKeys.ICON_URL, ICON_URL);
bundle.putString(WebApkMetaDataKeys.ICON_MURMUR2_HASH, ICON_MURMUR2_HASH + "L");
- WebApkTestHelper.registerWebApkWithMetaData(bundle);
+ WebApkTestHelper.registerWebApkWithMetaData(WEBAPK_PACKAGE_NAME, bundle);
Intent intent = new Intent();
- intent.putExtra(
- WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, WebApkTestHelper.WEBAPK_PACKAGE_NAME);
+ intent.putExtra(WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, WEBAPK_PACKAGE_NAME);
intent.putExtra(WebApkConstants.EXTRA_WEBAPK_FORCE_NAVIGATION, true);
intent.putExtra(ShortcutHelper.EXTRA_URL, START_URL);
intent.putExtra(ShortcutHelper.EXTRA_SOURCE, ShortcutSource.NOTIFICATION);
WebApkInfo info = WebApkInfo.create(intent);
- Assert.assertEquals(WebApkConstants.WEBAPK_ID_PREFIX + WebApkTestHelper.WEBAPK_PACKAGE_NAME,
- info.id());
+ Assert.assertEquals(WebApkConstants.WEBAPK_ID_PREFIX + WEBAPK_PACKAGE_NAME, info.id());
Assert.assertEquals(START_URL, info.uri().toString());
Assert.assertTrue(info.shouldForceNavigation());
Assert.assertEquals(SCOPE, info.scopeUri().toString());
@@ -92,7 +91,7 @@ public class WebApkInfoTest {
Assert.assertEquals(1L, info.themeColor());
Assert.assertTrue(info.hasValidBackgroundColor());
Assert.assertEquals(2L, info.backgroundColor());
- Assert.assertEquals(WebApkTestHelper.WEBAPK_PACKAGE_NAME, info.webApkPackageName());
+ Assert.assertEquals(WEBAPK_PACKAGE_NAME, info.webApkPackageName());
Assert.assertEquals(SHELL_APK_VERSION, info.shellApkVersion());
Assert.assertEquals(MANIFEST_URL, info.manifestUrl());
Assert.assertEquals(START_URL, info.manifestStartUrl());
@@ -116,11 +115,10 @@ public class WebApkInfoTest {
Bundle bundle = new Bundle();
bundle.putString(WebApkMetaDataKeys.START_URL, START_URL);
- WebApkTestHelper.registerWebApkWithMetaData(bundle);
+ WebApkTestHelper.registerWebApkWithMetaData(WEBAPK_PACKAGE_NAME, bundle);
Intent intent = new Intent();
- intent.putExtra(
- WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, WebApkTestHelper.WEBAPK_PACKAGE_NAME);
+ intent.putExtra(WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, WEBAPK_PACKAGE_NAME);
intent.putExtra(ShortcutHelper.EXTRA_URL, intentStartUrl);
WebApkInfo info = WebApkInfo.create(intent);
@@ -148,11 +146,10 @@ public class WebApkInfoTest {
Bundle bundle = new Bundle();
bundle.putString(WebApkMetaDataKeys.START_URL, manifestStartUrl);
bundle.putString(WebApkMetaDataKeys.SCOPE, "");
- WebApkTestHelper.registerWebApkWithMetaData(bundle);
+ WebApkTestHelper.registerWebApkWithMetaData(WEBAPK_PACKAGE_NAME, bundle);
Intent intent = new Intent();
- intent.putExtra(
- WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, WebApkTestHelper.WEBAPK_PACKAGE_NAME);
+ intent.putExtra(WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, WEBAPK_PACKAGE_NAME);
intent.putExtra(ShortcutHelper.EXTRA_URL, intentStartUrl);
WebApkInfo info = WebApkInfo.create(intent);
@@ -174,10 +171,9 @@ public class WebApkInfoTest {
bundle.putString(WebApkMetaDataKeys.START_URL, START_URL);
bundle.putString(WebApkMetaDataKeys.ICON_URLS_AND_ICON_MURMUR2_HASHES,
iconUrl1 + " " + murmur2Hash1 + " " + iconUrl2 + " " + murmur2Hash2);
- WebApkTestHelper.registerWebApkWithMetaData(bundle);
+ WebApkTestHelper.registerWebApkWithMetaData(WEBAPK_PACKAGE_NAME, bundle);
Intent intent = new Intent();
- intent.putExtra(
- WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, WebApkTestHelper.WEBAPK_PACKAGE_NAME);
+ intent.putExtra(WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, WEBAPK_PACKAGE_NAME);
intent.putExtra(ShortcutHelper.EXTRA_URL, START_URL);
WebApkInfo info = WebApkInfo.create(intent);
@@ -199,10 +195,9 @@ public class WebApkInfoTest {
Bundle bundle = new Bundle();
bundle.putString(WebApkMetaDataKeys.START_URL, START_URL);
bundle.putString(WebApkMetaDataKeys.ICON_URLS_AND_ICON_MURMUR2_HASHES, "randomUrl " + hash);
- WebApkTestHelper.registerWebApkWithMetaData(bundle);
+ WebApkTestHelper.registerWebApkWithMetaData(WEBAPK_PACKAGE_NAME, bundle);
Intent intent = new Intent();
- intent.putExtra(
- WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, WebApkTestHelper.WEBAPK_PACKAGE_NAME);
+ intent.putExtra(WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, WEBAPK_PACKAGE_NAME);
intent.putExtra(ShortcutHelper.EXTRA_URL, START_URL);
WebApkInfo info = WebApkInfo.create(intent);
@@ -221,11 +216,10 @@ public class WebApkInfoTest {
public void testForceNavigationNotSpecified() {
Bundle bundle = new Bundle();
bundle.putString(WebApkMetaDataKeys.START_URL, START_URL);
- WebApkTestHelper.registerWebApkWithMetaData(bundle);
+ WebApkTestHelper.registerWebApkWithMetaData(WEBAPK_PACKAGE_NAME, bundle);
Intent intent = new Intent();
- intent.putExtra(
- WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, WebApkTestHelper.WEBAPK_PACKAGE_NAME);
+ intent.putExtra(WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, WEBAPK_PACKAGE_NAME);
intent.putExtra(ShortcutHelper.EXTRA_URL, START_URL);
WebApkInfo info = WebApkInfo.create(intent);

Powered by Google App Engine
This is Rietveld 408576698