Chromium Code Reviews| Index: chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappInfoTest.java |
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappInfoTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappInfoTest.java |
| index 63f08f02d1447cc2186fcaa1ae441f9f7d032fb9..9d0bb37ebcfd0b5d81614344ee5b8e9191d78515 100644 |
| --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappInfoTest.java |
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappInfoTest.java |
| @@ -21,11 +21,12 @@ public class WebappInfoTest extends InstrumentationTestCase { |
| @Feature({"Webapps"}) |
| public void testAbout() { |
| String id = "webapp id"; |
| - String title = "webapp title"; |
| + String name = "longName"; |
| + String shortName = "name"; |
| String url = "about:blank"; |
| - WebappInfo info = WebappInfo.create(id, url, |
| - null, title, ScreenOrientationValues.DEFAULT, ShortcutSource.UNKNOWN); |
| + WebappInfo info = WebappInfo.create(id, url, null, name, shortName, |
| + ScreenOrientationValues.DEFAULT, ShortcutSource.UNKNOWN); |
| assertNotNull(info); |
| } |
| @@ -33,11 +34,12 @@ public class WebappInfoTest extends InstrumentationTestCase { |
| @Feature({"Webapps"}) |
| public void testRandomUrl() { |
| String id = "webapp id"; |
| - String title = "webapp title"; |
| + String name = "longName"; |
| + String shortName = "name"; |
| String url = "http://google.com"; |
| - WebappInfo info = WebappInfo.create(id, url, |
| - null, title, ScreenOrientationValues.DEFAULT, ShortcutSource.UNKNOWN); |
| + WebappInfo info = WebappInfo.create(id, url, null, name, shortName, |
| + ScreenOrientationValues.DEFAULT, ShortcutSource.UNKNOWN); |
| assertNotNull(info); |
| } |
| @@ -45,12 +47,14 @@ public class WebappInfoTest extends InstrumentationTestCase { |
| @Feature({"Webapps"}) |
| public void testSpacesInUrl() { |
| String id = "webapp id"; |
| - String title = "webapp title"; |
| + String name = "longName"; |
| + String shortName = "name"; |
| String bustedUrl = "http://money.cnn.com/?category=Latest News"; |
| Intent intent = new Intent(); |
| intent.putExtra(ShortcutHelper.EXTRA_ID, id); |
| - intent.putExtra(ShortcutHelper.EXTRA_TITLE, title); |
| + intent.putExtra(ShortcutHelper.EXTRA_NAME, name); |
| + intent.putExtra(ShortcutHelper.EXTRA_SHORT_NAME, shortName); |
| intent.putExtra(ShortcutHelper.EXTRA_URL, bustedUrl); |
| WebappInfo info = WebappInfo.create(intent); |
| @@ -59,13 +63,90 @@ public class WebappInfoTest extends InstrumentationTestCase { |
| @SmallTest |
| @Feature({"Webapps"}) |
| - public void testOrientationAndSource() { |
| + public void testIntentTitleFallBack() { |
| + String id = "webapp id"; |
| + String title = "webapp title"; |
| + String url = "about:blank"; |
| + |
| + Intent intent = new Intent(); |
| + intent.putExtra(ShortcutHelper.EXTRA_ID, id); |
| + intent.putExtra(ShortcutHelper.EXTRA_TITLE, title); |
| + intent.putExtra(ShortcutHelper.EXTRA_URL, url); |
| + |
| + WebappInfo info = WebappInfo.create(intent); |
| + assertNotNull(info); |
|
gone
2015/07/20 22:20:16
nit: the expected values are always first in test
Lalit Maganti
2015/07/21 09:07:27
Swapped.
|
| + assertEquals(info.name(), title); |
| + assertEquals(info.shortName(), title); |
| + } |
| + |
| + @SmallTest |
| + @Feature({"Webapps"}) |
| + public void testIntentNameBlankNoTitle() { |
| + String id = "webapp id"; |
| + String shortName = "name"; |
| + String url = "about:blank"; |
| + |
| + Intent intent = new Intent(); |
| + intent.putExtra(ShortcutHelper.EXTRA_ID, id); |
| + intent.putExtra(ShortcutHelper.EXTRA_SHORT_NAME, shortName); |
| + intent.putExtra(ShortcutHelper.EXTRA_URL, url); |
| + |
| + WebappInfo info = WebappInfo.create(intent); |
| + assertNotNull(info); |
| + assertEquals(info.name(), ""); |
| + assertEquals(info.shortName(), shortName); |
| + } |
| + |
| + @SmallTest |
| + @Feature({"Webapps"}) |
| + public void testIntentShortNameFallBack() { |
| String id = "webapp id"; |
| String title = "webapp title"; |
| + String shortName = "name"; |
| + String url = "about:blank"; |
| + |
| + Intent intent = new Intent(); |
| + intent.putExtra(ShortcutHelper.EXTRA_ID, id); |
| + intent.putExtra(ShortcutHelper.EXTRA_TITLE, shortName); |
| + intent.putExtra(ShortcutHelper.EXTRA_SHORT_NAME, shortName); |
| + intent.putExtra(ShortcutHelper.EXTRA_URL, url); |
| + |
| + WebappInfo info = WebappInfo.create(intent); |
| + assertNotNull(info); |
| + assertEquals(info.name(), title); |
| + assertEquals(info.shortName(), shortName); |
| + } |
| + |
| + @SmallTest |
| + @Feature({"Webapps"}) |
| + public void testIntentNameShortname() { |
| + String id = "webapp id"; |
| + String name = "longName"; |
| + String shortName = "name"; |
| + String url = "about:blank"; |
| + |
| + Intent intent = new Intent(); |
| + intent.putExtra(ShortcutHelper.EXTRA_ID, id); |
| + intent.putExtra(ShortcutHelper.EXTRA_NAME, name); |
| + intent.putExtra(ShortcutHelper.EXTRA_SHORT_NAME, shortName); |
| + intent.putExtra(ShortcutHelper.EXTRA_URL, url); |
| + |
| + WebappInfo info = WebappInfo.create(intent); |
| + assertNotNull(info); |
| + assertEquals(info.name(), name); |
| + assertEquals(info.shortName(), shortName); |
| + } |
| + |
| + @SmallTest |
| + @Feature({"Webapps"}) |
| + public void testOrientationAndSource() { |
| + String id = "webapp id"; |
| + String name = "longName"; |
| + String shortName = "name"; |
| String url = "http://money.cnn.com"; |
| - WebappInfo info = WebappInfo.create(id, url, |
| - null, title, ScreenOrientationValues.DEFAULT, ShortcutSource.UNKNOWN); |
| + WebappInfo info = WebappInfo.create(id, url, null, name, shortName, |
| + ScreenOrientationValues.DEFAULT, ShortcutSource.UNKNOWN); |
| assertNotNull(info); |
| assertEquals(info.orientation(), ScreenOrientationValues.DEFAULT); |
| assertEquals(info.source(), ShortcutSource.UNKNOWN); |