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

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

Issue 1234653004: webapps: utilize manifest theme colors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Mounir's comments Created 5 years, 5 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/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..bb60034feba18a8d15a4f29bdef0f15dbaae5704 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_OR_MISSING);
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_OR_MISSING);
assertNotNull(info);
}
@@ -58,13 +61,80 @@ 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_OR_MISSING);
+ assertNotNull(info);
+ assertEquals(info.themeColor(), ShortcutHelper.THEME_COLOR_INVALID_OR_MISSING);
+ }
+
+ @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);
+
+ long bundleColor = bundle.getLong(ShortcutHelper.EXTRA_THEME_COLOR,
+ ShortcutHelper.THEME_COLOR_INVALID_OR_MISSING);
+ assertEquals(bundleColor, themeColor);
+ }
+
+ @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_OR_MISSING);
assertNotNull(info);
assertEquals(info.orientation(), ScreenOrientationValues.DEFAULT);
assertEquals(info.source(), ShortcutHelper.SOURCE_UNKNOWN);

Powered by Google App Engine
This is Rietveld 408576698