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

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

Issue 2331773002: Take Murmur2 hash of untransformed icon when creating WebAPK part 2/2 (Closed)
Patch Set: Merge branch 'master' into icon_hasher2 Created 4 years, 3 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/ManifestUpgradeDetectorTest.java
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/ManifestUpgradeDetectorTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/ManifestUpgradeDetectorTest.java
index 62be1fea05c6780121092ceb0e68f9af80521b08..1c40d0caff632cc5e533daac664878a6e10074bc 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/ManifestUpgradeDetectorTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/ManifestUpgradeDetectorTest.java
@@ -42,7 +42,7 @@ public class ManifestUpgradeDetectorTest {
private static final String WEBAPK_NAME = "Long Name";
private static final String WEBAPK_SHORT_NAME = "Short Name";
private static final String WEBAPK_ICON_URL = "/icon.png";
- private static final long WEBAPK_ICON_MURMUR2_HASH = 3L;
+ private static final String WEBAPK_ICON_MURMUR2_HASH = "3";
private static final int WEBAPK_DISPLAY_MODE = WebDisplayMode.Standalone;
private static final int WEBAPK_ORIENTATION = ScreenOrientationValues.LANDSCAPE;
private static final long WEBAPK_THEME_COLOR = 1L;
@@ -180,7 +180,7 @@ public class ManifestUpgradeDetectorTest {
}
private Bundle createBundleWithMetadata(
- String manifestUrl, String startUrl, String iconUrl, long iconMurmur2Hash) {
+ String manifestUrl, String startUrl, String iconUrl, String iconMurmur2Hash) {
Bundle bundle = new Bundle();
bundle.putString(WebApkMetaDataKeys.WEB_MANIFEST_URL, manifestUrl);
bundle.putString(WebApkMetaDataKeys.START_URL, startUrl);
@@ -260,7 +260,7 @@ public class ManifestUpgradeDetectorTest {
@Test
public void testHomescreenIconChangeShouldUpgrade() {
FetchedManifestData fetchedData = createDefaultFetchedManifestData();
- fetchedData.iconMurmur2Hash = WEBAPK_ICON_MURMUR2_HASH + 1;
+ fetchedData.iconMurmur2Hash = WEBAPK_ICON_MURMUR2_HASH + "1";
fetchedData.icon = createBitmap(Color.BLUE);
TestCallback callback = new TestCallback();
TestManifestUpgradeDetector detector = createDetectorWithFetchedData(fetchedData, callback);
@@ -286,23 +286,4 @@ public class ManifestUpgradeDetectorTest {
Assert.assertTrue(callback.mWasCalled);
Assert.assertTrue(callback.mIsUpgraded);
}
-
- /**
- * Test that an upgrade is not requested when:
- * - WebAPK was generated using icon at {@link WEBAPK_ICON_URL} from Web Manifest.
- * - Web Manifest was updated and now does not contain any icon URLs.
- */
- @Test
- public void testHomescreenIconUrlsRemovedShouldNotUpgrade() {
- FetchedManifestData fetchedData = createDefaultFetchedManifestData();
- fetchedData.iconUrl = "";
- fetchedData.iconMurmur2Hash = 0L;
- fetchedData.icon = null;
-
- TestCallback callback = new TestCallback();
- TestManifestUpgradeDetector detector = createDetectorWithFetchedData(fetchedData, callback);
- detector.start();
- Assert.assertTrue(callback.mWasCalled);
- Assert.assertFalse(callback.mIsUpgraded);
- }
}

Powered by Google App Engine
This is Rietveld 408576698