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 f380a477b0d83598ea4639a3ddd3a6d15c681acd..b83c1ff709fb23093707c295665a12d185cf32cc 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 |
| @@ -5,6 +5,7 @@ |
| package org.chromium.chrome.browser.webapps; |
| import android.content.Intent; |
| +import android.os.Bundle; |
| import android.test.InstrumentationTestCase; |
| import android.test.suitebuilder.annotation.SmallTest; |
| @@ -24,7 +25,8 @@ public class WebappInfoTest extends InstrumentationTestCase { |
| String url = "about:blank"; |
| WebappInfo info = WebappInfo.create(id, url, |
| - null, title, ScreenOrientationValues.DEFAULT, ShortcutHelper.SOURCE_UNKNOWN); |
| + null, title, ScreenOrientationValues.DEFAULT, ShortcutHelper.SOURCE_UNKNOWN, |
| + ShortcutHelper.THEME_COLOR_INVALID); |
| assertNotNull(info); |
| } |
| @@ -36,7 +38,8 @@ public class WebappInfoTest extends InstrumentationTestCase { |
| String url = "http://google.com"; |
| WebappInfo info = WebappInfo.create(id, url, |
| - null, title, ScreenOrientationValues.DEFAULT, ShortcutHelper.SOURCE_UNKNOWN); |
| + null, title, ScreenOrientationValues.DEFAULT, ShortcutHelper.SOURCE_UNKNOWN, |
| + ShortcutHelper.THEME_COLOR_INVALID); |
| assertNotNull(info); |
| } |
| @@ -58,13 +61,78 @@ public class WebappInfoTest extends InstrumentationTestCase { |
| @SmallTest |
| @Feature({"Webapps"}) |
| + public void testNormalThemeColor() { |
| + String id = "webapp id"; |
| + String title = "webapp title"; |
| + String url = "http://money.cnn.com"; |
| + long themeColor = 0xFF0000FF; |
| + |
| + WebappInfo info = WebappInfo.create(id, url, null, title, |
| + ScreenOrientationValues.DEFAULT, ShortcutHelper.SOURCE_UNKNOWN, |
| + themeColor); |
| + assertNotNull(info); |
| + assertEquals(info.themeColor(), themeColor); |
| + } |
| + |
| + @SmallTest |
| + @Feature({"Webapps"}) |
| + public void testInvalidThemeColor() { |
| + String id = "webapp id"; |
| + String title = "webapp title"; |
| + String url = "http://money.cnn.com"; |
| + |
| + WebappInfo info = WebappInfo.create(id, url, null, title, |
| + ScreenOrientationValues.DEFAULT, ShortcutHelper.SOURCE_UNKNOWN, |
| + ShortcutHelper.THEME_COLOR_INVALID); |
| + assertNotNull(info); |
| + assertEquals(info.themeColor(), -1); |
|
mlamouri (slow - plz ping)
2015/07/17 13:28:29
Use ShortcutHelper.THEME_COLOR_INVALID
Lalit Maganti
2015/07/17 14:34:15
Done.
|
| + } |
| + |
| + @SmallTest |
| + @Feature({"Webapps"}) |
| + public void testThemeColorIntentCreation() { |
| + String id = "webapp id"; |
| + String url = "http://money.cnn.com"; |
| + |
| + Intent intent = new Intent(); |
| + long themeColor = 0xFF0000FFL; |
| + intent.putExtra(ShortcutHelper.EXTRA_THEME_COLOR, themeColor); |
| + intent.putExtra(ShortcutHelper.EXTRA_ID, id); |
| + intent.putExtra(ShortcutHelper.EXTRA_URL, url); |
| + |
| + WebappInfo info = WebappInfo.create(intent); |
| + assertNotNull(info); |
| + assertEquals(info.themeColor(), themeColor); |
| + } |
| + |
| + @SmallTest |
| + @Feature({"Webapps"}) |
| + public void testThemeColorWrittenToBundle() { |
| + String id = "webapp id"; |
| + String title = "webapp title"; |
| + String url = "http://money.cnn.com"; |
| + long themeColor = 0xFF0000FF; |
| + |
| + WebappInfo info = WebappInfo.create(id, url, null, title, |
| + ScreenOrientationValues.DEFAULT, ShortcutHelper.SOURCE_UNKNOWN, |
| + themeColor); |
| + |
| + Bundle bundle = new Bundle(); |
| + info.writeToBundle(bundle); |
| + |
| + assertEquals(bundle.getLong(ShortcutHelper.EXTRA_THEME_COLOR, -1), themeColor); |
|
mlamouri (slow - plz ping)
2015/07/17 13:28:29
use ShortcutHelper.THEME_COLOR_INVALID
Lalit Maganti
2015/07/17 14:34:15
Done.
|
| + } |
| + |
| + @SmallTest |
| + @Feature({"Webapps"}) |
| public void testOrientationAndSource() { |
| String id = "webapp id"; |
| String title = "webapp title"; |
| String url = "http://money.cnn.com"; |
| WebappInfo info = WebappInfo.create(id, url, |
| - null, title, ScreenOrientationValues.DEFAULT, ShortcutHelper.SOURCE_UNKNOWN); |
| + null, title, ScreenOrientationValues.DEFAULT, ShortcutHelper.SOURCE_UNKNOWN, |
| + ShortcutHelper.THEME_COLOR_INVALID); |
| assertNotNull(info); |
| assertEquals(info.orientation(), ScreenOrientationValues.DEFAULT); |
| assertEquals(info.source(), ShortcutHelper.SOURCE_UNKNOWN); |