Index: chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenHomescreenIconTest.java |
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenHomescreenIconTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenHomescreenIconTest.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..70afbfaa0771b01c14f26b8493f17e98f1298bd6 |
--- /dev/null |
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenHomescreenIconTest.java |
@@ -0,0 +1,43 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package org.chromium.chrome.browser.webapps; |
+ |
+import android.content.Intent; |
+import android.graphics.Bitmap; |
+import android.test.suitebuilder.annotation.SmallTest; |
+ |
+import org.chromium.base.metrics.RecordHistogram; |
+import org.chromium.base.test.util.Feature; |
+import org.chromium.chrome.browser.ShortcutHelper; |
+import org.chromium.chrome.browser.metrics.WebappUma; |
+ |
+/** |
+ * Tests for splash screens with EXTRA_ICON specified in the Intent. |
+ */ |
+public class WebappSplashScreenHomescreenIconTest extends WebappActivityTestBase { |
+ |
+ @Override |
+ protected Intent createIntent() { |
+ Intent intent = super.createIntent(); |
+ intent.putExtra(ShortcutHelper.EXTRA_ICON, TEST_ICON); |
+ return intent; |
+ } |
+ |
+ // TODO(mlamouri): test that we actually show the icon. |
+ |
+ @SmallTest |
+ @Feature({"Webapps"}) |
+ public void testUmaFallbackIcon() { |
+ assertEquals(1, RecordHistogram.getHistogramValueCountForTesting( |
+ WebappUma.HISTOGRAM_SPLASHSCREEN_ICON_TYPE, |
+ WebappUma.SPLASHSCREEN_ICON_TYPE_FALLBACK)); |
+ |
+ Bitmap icon = ShortcutHelper.decodeBitmapFromString(TEST_ICON); |
+ int sizeInDp = Math.round((float) icon.getWidth() |
+ / getActivity().getResources().getDisplayMetrics().density); |
+ assertEquals(1, RecordHistogram.getHistogramValueCountForTesting( |
+ WebappUma.HISTOGRAM_SPLASHSCREEN_ICON_SIZE, sizeInDp)); |
+ } |
+} |