| 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..3320e4bc63787edfaba97295bea86edfe6cb3fda 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,15 +63,92 @@ 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);
|
| + assertEquals(title, info.name());
|
| + assertEquals(title, info.shortName());
|
| + }
|
| +
|
| + @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(shortName, info.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, title);
|
| + intent.putExtra(ShortcutHelper.EXTRA_SHORT_NAME, shortName);
|
| + intent.putExtra(ShortcutHelper.EXTRA_URL, url);
|
| +
|
| + WebappInfo info = WebappInfo.create(intent);
|
| + assertNotNull(info);
|
| + assertEquals(title, info.name());
|
| + assertEquals(shortName, info.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(name, info.name());
|
| + assertEquals(shortName, info.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);
|
| + assertEquals(ScreenOrientationValues.DEFAULT, info.orientation());
|
| + assertEquals(ShortcutSource.UNKNOWN, info.source());
|
| }
|
| }
|
|
|