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

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

Issue 2457663002: Merge WebappInfo and WebApkMetaData part 1/2 (Closed)
Patch Set: Merge branch 'master' into update_fail_refactor00 Created 4 years, 1 month 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/WebApkMetaDataUtilsTest.java
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkMetaDataUtilsTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkMetaDataUtilsTest.java
index 96174bd0be718756510d1c6eb70da76974259a16..9e528769bc44e50a02879c6a767e6e82ed971f02 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkMetaDataUtilsTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkMetaDataUtilsTest.java
@@ -14,12 +14,8 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import org.chromium.base.ContextUtils;
-import org.chromium.blink_public.platform.WebDisplayMode;
-import org.chromium.content_public.common.ScreenOrientationValues;
import org.chromium.testing.local.LocalRobolectricTestRunner;
-import org.chromium.webapk.lib.common.WebApkConstants;
import org.chromium.webapk.lib.common.WebApkMetaDataKeys;
-import org.chromium.webapk.test.WebApkTestHelper;
/**
* Tests WebApkMetaDataUtils.
@@ -43,54 +39,6 @@ public class WebApkMetaDataUtilsTest {
ContextUtils.initApplicationContextForTests(RuntimeEnvironment.application);
}
- @Test
- public void testSanity() {
- Bundle bundle = new Bundle();
- bundle.putString(WebApkMetaDataKeys.SCOPE, SCOPE);
- bundle.putString(WebApkMetaDataKeys.NAME, NAME);
- bundle.putString(WebApkMetaDataKeys.SHORT_NAME, SHORT_NAME);
- bundle.putString(WebApkMetaDataKeys.DISPLAY_MODE, DISPLAY_MODE);
- bundle.putString(WebApkMetaDataKeys.ORIENTATION, ORIENTATION);
- bundle.putString(WebApkMetaDataKeys.THEME_COLOR, THEME_COLOR);
- bundle.putString(WebApkMetaDataKeys.BACKGROUND_COLOR, BACKGROUND_COLOR);
- WebApkTestHelper.registerWebApkWithMetaData(bundle);
-
- WebappInfo webappInfo = WebApkMetaDataUtils.extractWebappInfoFromWebApk(
- WebApkTestHelper.WEBAPK_PACKAGE_NAME, START_URL, 0);
-
- Assert.assertEquals(WebApkConstants.WEBAPK_ID_PREFIX + WebApkTestHelper.WEBAPK_PACKAGE_NAME,
- webappInfo.id());
- Assert.assertEquals(SCOPE, webappInfo.scopeUri().toString());
- Assert.assertEquals(NAME, webappInfo.name());
- Assert.assertEquals(SHORT_NAME, webappInfo.shortName());
- Assert.assertEquals(WebDisplayMode.MinimalUi, webappInfo.displayMode());
- Assert.assertEquals(ScreenOrientationValues.PORTRAIT, webappInfo.orientation());
- Assert.assertTrue(webappInfo.hasValidThemeColor());
- Assert.assertEquals(1L, webappInfo.themeColor());
- Assert.assertTrue(webappInfo.hasValidBackgroundColor());
- Assert.assertEquals(2L, webappInfo.backgroundColor());
- Assert.assertEquals(WebApkTestHelper.WEBAPK_PACKAGE_NAME, webappInfo.webApkPackageName());
- }
-
- /**
- * Test that WebappInfo are populated with the start URL passed to
- * {@link extractWebappInfoFromWebApk()} not the start URL in the WebAPK's meta data. When a
- * WebAPK is launched via a deep link from a URL within the WebAPK's scope, the WebAPK should
- * open at the URL it was deep linked from not the WebAPK's start URL.
- */
- @Test
- public void testUseStartUrlOverride() {
- String passedInStartUrl = "https://www.google.com/master_override";
-
- Bundle bundle = new Bundle();
- bundle.putString(WebApkMetaDataKeys.START_URL, START_URL);
- WebApkTestHelper.registerWebApkWithMetaData(bundle);
-
- WebappInfo webappInfo = WebApkMetaDataUtils.extractWebappInfoFromWebApk(
- WebApkTestHelper.WEBAPK_PACKAGE_NAME, passedInStartUrl, 0);
- Assert.assertEquals(passedInStartUrl, webappInfo.uri().toString());
- }
-
/**
* WebApkIconHasher generates hashes with values [0, 2^64-1]. 2^64-1 is greater than
* {@link Long#MAX_VALUE}. Test that {@link #getIconMurmur2HashFromMetaData()} can read a hash

Powered by Google App Engine
This is Rietveld 408576698