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

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

Issue 1391993004: WebApp splashscreen: add UMA to record how a splashscreen is constructed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 5 years, 2 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/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..16fd45f3b3c05c5e8e6e5f05fcf34b69414a9ca9
--- /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(
+ 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(
+ HISTOGRAM_SPLASHSCREEN_ICON_SIZE, sizeInDp));
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698