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

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

Issue 2758193002: [Android WebAPKs] Don't navigate WebAPK when launching it from launcher (Closed)
Patch Set: Merge branch 'master' into twitter Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.webapps; 5 package org.chromium.chrome.browser.webapps;
6 6
7 import android.content.Intent; 7 import android.content.Intent;
8 import android.os.Bundle; 8 import android.os.Bundle;
9 9
10 import org.junit.Assert; 10 import org.junit.Assert;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 bundle.putInt(WebApkMetaDataKeys.SHELL_APK_VERSION, SHELL_APK_VERSION); 66 bundle.putInt(WebApkMetaDataKeys.SHELL_APK_VERSION, SHELL_APK_VERSION);
67 bundle.putString(WebApkMetaDataKeys.WEB_MANIFEST_URL, MANIFEST_URL); 67 bundle.putString(WebApkMetaDataKeys.WEB_MANIFEST_URL, MANIFEST_URL);
68 bundle.putString(WebApkMetaDataKeys.START_URL, START_URL); 68 bundle.putString(WebApkMetaDataKeys.START_URL, START_URL);
69 bundle.putString(WebApkMetaDataKeys.ICON_URL, ICON_URL); 69 bundle.putString(WebApkMetaDataKeys.ICON_URL, ICON_URL);
70 bundle.putString(WebApkMetaDataKeys.ICON_MURMUR2_HASH, ICON_MURMUR2_HASH + "L"); 70 bundle.putString(WebApkMetaDataKeys.ICON_MURMUR2_HASH, ICON_MURMUR2_HASH + "L");
71 WebApkTestHelper.registerWebApkWithMetaData(bundle); 71 WebApkTestHelper.registerWebApkWithMetaData(bundle);
72 72
73 Intent intent = new Intent(); 73 Intent intent = new Intent();
74 intent.putExtra( 74 intent.putExtra(
75 WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, WebApkTestHelper.WEBA PK_PACKAGE_NAME); 75 WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, WebApkTestHelper.WEBA PK_PACKAGE_NAME);
76 intent.putExtra(WebApkConstants.EXTRA_WEBAPK_FORCE_NAVIGATION, true);
76 intent.putExtra(ShortcutHelper.EXTRA_URL, START_URL); 77 intent.putExtra(ShortcutHelper.EXTRA_URL, START_URL);
77 intent.putExtra(ShortcutHelper.EXTRA_SOURCE, ShortcutSource.NOTIFICATION ); 78 intent.putExtra(ShortcutHelper.EXTRA_SOURCE, ShortcutSource.NOTIFICATION );
78 79
79 WebApkInfo info = WebApkInfo.create(intent); 80 WebApkInfo info = WebApkInfo.create(intent);
80 81
81 Assert.assertEquals(WebApkConstants.WEBAPK_ID_PREFIX + WebApkTestHelper. WEBAPK_PACKAGE_NAME, 82 Assert.assertEquals(WebApkConstants.WEBAPK_ID_PREFIX + WebApkTestHelper. WEBAPK_PACKAGE_NAME,
82 info.id()); 83 info.id());
84 Assert.assertEquals(START_URL, info.uri().toString());
85 Assert.assertTrue(info.shouldForceNavigation());
83 Assert.assertEquals(SCOPE, info.scopeUri().toString()); 86 Assert.assertEquals(SCOPE, info.scopeUri().toString());
84 Assert.assertEquals(NAME, info.name()); 87 Assert.assertEquals(NAME, info.name());
85 Assert.assertEquals(SHORT_NAME, info.shortName()); 88 Assert.assertEquals(SHORT_NAME, info.shortName());
86 Assert.assertEquals(WebDisplayMode.MinimalUi, info.displayMode()); 89 Assert.assertEquals(WebDisplayMode.MinimalUi, info.displayMode());
87 Assert.assertEquals(ScreenOrientationValues.PORTRAIT, info.orientation() ); 90 Assert.assertEquals(ScreenOrientationValues.PORTRAIT, info.orientation() );
88 Assert.assertTrue(info.hasValidThemeColor()); 91 Assert.assertTrue(info.hasValidThemeColor());
89 Assert.assertEquals(1L, info.themeColor()); 92 Assert.assertEquals(1L, info.themeColor());
90 Assert.assertTrue(info.hasValidBackgroundColor()); 93 Assert.assertTrue(info.hasValidBackgroundColor());
91 Assert.assertEquals(2L, info.backgroundColor()); 94 Assert.assertEquals(2L, info.backgroundColor());
92 Assert.assertEquals(WebApkTestHelper.WEBAPK_PACKAGE_NAME, info.webApkPac kageName()); 95 Assert.assertEquals(WebApkTestHelper.WEBAPK_PACKAGE_NAME, info.webApkPac kageName());
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 intent.putExtra( 204 intent.putExtra(
202 WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, WebApkTestHelper.WEBA PK_PACKAGE_NAME); 205 WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, WebApkTestHelper.WEBA PK_PACKAGE_NAME);
203 intent.putExtra(ShortcutHelper.EXTRA_URL, START_URL); 206 intent.putExtra(ShortcutHelper.EXTRA_URL, START_URL);
204 207
205 WebApkInfo info = WebApkInfo.create(intent); 208 WebApkInfo info = WebApkInfo.create(intent);
206 Map<String, String> iconUrlToMurmur2HashMap = info.iconUrlToMurmur2HashM ap(); 209 Map<String, String> iconUrlToMurmur2HashMap = info.iconUrlToMurmur2HashM ap();
207 Assert.assertEquals(1, iconUrlToMurmur2HashMap.size()); 210 Assert.assertEquals(1, iconUrlToMurmur2HashMap.size());
208 Assert.assertTrue(iconUrlToMurmur2HashMap.containsValue(hash)); 211 Assert.assertTrue(iconUrlToMurmur2HashMap.containsValue(hash));
209 } 212 }
210 } 213 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698