Index: chrome/android/javatests/src/org/chromium/chrome/browser/ShortcutHelperTest.java |
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ShortcutHelperTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ShortcutHelperTest.java |
index 2321794d2c023f78b7337cc387c3cfdfc02a2c80..addf158cd805e2d9dee975a49dc11f68329d595b 100644 |
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/ShortcutHelperTest.java |
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ShortcutHelperTest.java |
@@ -42,6 +42,14 @@ public class ShortcutHelperTest extends ChromeShellTestBase { |
+ "<head><title>" + NORMAL_TITLE + "</title></head>" |
+ "<body>Not Webapp capable</body></html>"); |
+ private static final String META_APP_NAME_TITLE = "Web application-name"; |
+ private static final String META_APP_NAME_HTML = UrlUtils.encodeHtmlDataUri( |
+ "<html><head>" |
+ + "<meta name=\"mobile-web-app-capable\" content=\"yes\" />" |
+ + "<meta name=\"application-name\" content=\"" + META_APP_NAME_TITLE + "\">" |
+ + "<title>Not the right title</title>" |
+ + "</head><body>Webapp capable</body></html>"); |
+ |
private static class TestObserver implements ChromeShellApplicationObserver { |
Intent mFiredIntent; |
@@ -153,6 +161,19 @@ public class ShortcutHelperTest extends ChromeShellTestBase { |
assertEquals(EDITED_WEBAPP_TITLE , firedIntent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME)); |
} |
+ /** |
+ * @MediumTest |
+ * @Feature("{Webapp}") |
+ * crbug.com/303486 |
+ */ |
+ @FlakyTest |
+ public void testAddWebappShortcutsWithApplicationName() throws InterruptedException { |
+ // Add a webapp shortcut to check edited title. |
+ addShortcutToURL(META_APP_NAME_HTML, ""); |
+ Intent firedIntent = mTestObserver.mFiredIntent; |
+ assertEquals(META_APP_NAME_TITLE , firedIntent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME)); |
+ } |
+ |
private void addShortcutToURL(String url, final String title) throws InterruptedException { |
loadUrlWithSanitization(url); |
assertTrue(waitForActiveShellToBeDoneLoading()); |