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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java

Issue 1845233002: Store standalone web app data in WebappDataStorage as well as the homescreen intent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notification-deep-linking
Patch Set: Improve comments Created 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java
index 15de88434d8e4ff6627bd0b0c2f642ebf3639c5e..ae1282897707b337264a34bfaa4b20234da7eabd 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java
@@ -55,20 +55,17 @@ public class WebappModeTest extends MultiActivityTestBase {
+ "content='width=device-width initial-scale=0.5, maximum-scale=0.5'></head>"
+ "<body bgcolor='#011684'>Webapp 1</body></html>");
private static final String WEBAPP_1_TITLE = "Web app #1";
- private static final String WEBAPP_1_ORIGIN = "https://www.google.com";
private static final String WEBAPP_2_ID = "webapp_id_2";
private static final String WEBAPP_2_URL =
UrlUtils.encodeHtmlDataUri("<html><body bgcolor='#840116'>Webapp 2</body></html>");
private static final String WEBAPP_2_TITLE = "Web app #2";
- private static final String WEBAPP_2_ORIGIN = "http://google.com";
private static final String WEBAPP_ICON = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAACXB"
+ "IWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3wQIFB4cxOfiSQAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdG"
+ "ggR0lNUFeBDhcAAAAMSURBVAjXY2AUawEAALcAnI/TkI8AAAAASUVORK5CYII=";
- private void fireWebappIntent(String id, String url, String title, String icon,
- boolean addMac) throws Exception {
+ private Intent createIntent(String id, String url, String title, String icon, boolean addMac) {
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setPackage(getInstrumentation().getTargetContext().getPackageName());
@@ -86,6 +83,13 @@ public class WebappModeTest extends MultiActivityTestBase {
ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false);
webappInfo.setWebappIntentExtras(intent);
+ return intent;
+ }
+
+ private void fireWebappIntent(String id, String url, String title, String icon,
+ boolean addMac) throws Exception {
+ Intent intent = createIntent(id, url, title, icon, addMac);
+
getInstrumentation().getTargetContext().startActivity(intent);
getInstrumentation().waitForIdleSync();
ApplicationTestUtils.waitUntilChromeInForeground();
@@ -98,10 +102,12 @@ public class WebappModeTest extends MultiActivityTestBase {
// Register the webapps so when the data storage is opened, the test doesn't crash. There is
// no race condition with the retrival as AsyncTasks are run sequentially on the background
// thread.
- WebappRegistry.registerWebapp(getInstrumentation().getTargetContext(), WEBAPP_1_ID,
- WEBAPP_1_ORIGIN);
- WebappRegistry.registerWebapp(getInstrumentation().getTargetContext(), WEBAPP_2_ID,
- WEBAPP_2_ORIGIN);
+ WebappRegistry.registerWebapp(getInstrumentation().getTargetContext(), WEBAPP_1_ID)
+ .updateFromShortcutIntent(createIntent(
+ WEBAPP_1_ID, WEBAPP_1_URL, WEBAPP_1_TITLE, WEBAPP_ICON, true));
+ WebappRegistry.registerWebapp(getInstrumentation().getTargetContext(), WEBAPP_2_ID)
+ .updateFromShortcutIntent(createIntent(
+ WEBAPP_1_ID, WEBAPP_1_URL, WEBAPP_1_TITLE, WEBAPP_ICON, true));
}
/**

Powered by Google App Engine
This is Rietveld 408576698