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

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

Issue 24063004: Adding a dialog on click of "add to homescreen" menu item to edit the title. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments addressed Created 7 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/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 43e0112ba860ea61ccdce8e99277476c8f5e8610..8a329343e04b94055e6d235e447d8454d5e22a5b 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/ShortcutHelperTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ShortcutHelperTest.java
@@ -28,6 +28,7 @@ public class ShortcutHelperTest extends ChromiumTestShellTestBase {
+ "<meta name=\"mobile-web-app-capable\" content=\"yes\" />"
+ "<title>" + WEBAPP_TITLE + "</title>"
+ "</head><body>Webapp capable</body></html>");
+ private static final String EDITED_WEBAPP_TITLE = "Webapp shortcut edited";
private static final String SECOND_WEBAPP_TITLE = "Webapp shortcut #2";
private static final String SECOND_WEBAPP_HTML = UrlUtils.encodeHtmlDataUri(
@@ -82,7 +83,7 @@ public class ShortcutHelperTest extends ChromiumTestShellTestBase {
@Feature("{Webapp}")
public void testAddWebappShortcuts() throws InterruptedException {
// Add a webapp shortcut and make sure the intent's parameters make sense.
- addShortcutToURL(WEBAPP_HTML);
+ addShortcutToURL(WEBAPP_HTML, "");
Intent firedIntent = mTestObserver.firedIntent;
assertEquals(WEBAPP_TITLE, firedIntent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME));
@@ -93,7 +94,7 @@ public class ShortcutHelperTest extends ChromiumTestShellTestBase {
// Add a second shortcut and make sure it matches the second webapp's parameters.
mTestObserver.reset();
- addShortcutToURL(SECOND_WEBAPP_HTML);
+ addShortcutToURL(SECOND_WEBAPP_HTML, "");
Intent newFiredIntent = mTestObserver.firedIntent;
assertEquals(SECOND_WEBAPP_TITLE,
newFiredIntent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME));
@@ -107,7 +108,7 @@ public class ShortcutHelperTest extends ChromiumTestShellTestBase {
@MediumTest
@Feature("{Webapp}")
public void testAddBookmarkShortcut() throws InterruptedException {
- addShortcutToURL(NORMAL_HTML);
+ addShortcutToURL(NORMAL_HTML, "");
// Make sure the intent's parameters make sense.
Intent firedIntent = mTestObserver.firedIntent;
@@ -119,7 +120,25 @@ public class ShortcutHelperTest extends ChromiumTestShellTestBase {
assertNull(launchIntent.getComponent());
}
- private void addShortcutToURL(String url) throws InterruptedException {
+ @MediumTest
+ @Feature("{Webapp}")
+ public void testAddWebappShortcutsWithoutTitleEdit() throws InterruptedException {
+ // Add a webapp shortcut to check unedited title.
+ addShortcutToURL(WEBAPP_HTML, "");
+ Intent firedIntent = mTestObserver.firedIntent;
+ assertEquals(WEBAPP_TITLE, firedIntent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME));
+ }
+
+ @MediumTest
+ @Feature("{Webapp}")
+ public void testAddWebappShortcutsWithTitleEdit() throws InterruptedException {
+ // Add a webapp shortcut to check edited title.
+ addShortcutToURL(WEBAPP_HTML, EDITED_WEBAPP_TITLE);
+ Intent firedIntent = mTestObserver.firedIntent;
+ assertEquals(EDITED_WEBAPP_TITLE , firedIntent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME));
+ }
+
+ private void addShortcutToURL(String url, final String title) throws InterruptedException {
loadUrlWithSanitization(url);
assertTrue(waitForActiveShellToBeDoneLoading());
@@ -127,7 +146,7 @@ public class ShortcutHelperTest extends ChromiumTestShellTestBase {
getInstrumentation().runOnMainSync(new Runnable() {
@Override
public void run() {
- ShortcutHelper.addShortcut(mActivity.getActiveTab());
+ ShortcutHelper.addShortcut(mActivity.getActiveTab(), title);
}
});
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java ('k') | chrome/browser/android/shortcut_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698