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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationUIManagerTest.java

Issue 1370733002: Revert of Scale large notification icons according to device settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationUIManagerTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationUIManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationUIManagerTest.java
index 0686ee5e6f4624221c6388218d98e6c509f6f209..3034fd516b133da9a8625777fac5a57f46794067 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationUIManagerTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationUIManagerTest.java
@@ -8,8 +8,6 @@
import android.annotation.SuppressLint;
import android.app.Notification;
-import android.content.Context;
-import android.content.res.Resources;
import android.graphics.Bitmap;
import android.os.Build;
import android.test.suitebuilder.annotation.LargeTest;
@@ -226,12 +224,10 @@
assertEquals("NoIconNotification", notification.extras.getString(Notification.EXTRA_TITLE));
assertNotNull(notification.largeIcon);
- NotificationUIManager manager = NotificationUIManager.getInstanceForTests();
- assertNotNull(manager);
-
// Create a second rounded icon for the test's origin, and compare its dimensions against
// those of the icon associated to the notification itself.
- RoundedIconGenerator generator = manager.mIconGenerator;
+ RoundedIconGenerator generator = NotificationUIManager.createRoundedIconGenerator(
+ getActivity().getApplicationContext());
assertNotNull(generator);
Bitmap generatedIcon = generator.generateIconForUrl(getOrigin());
@@ -239,55 +235,6 @@
assertEquals(generatedIcon.getWidth(), notification.largeIcon.getWidth());
assertEquals(generatedIcon.getHeight(), notification.largeIcon.getHeight());
- }
-
- /**
- * Tests the three paths for ensuring that a notification will be shown with a normalized icon:
- * (1) NULL bitmaps should have an auto-generated image.
- * (2) Large bitmaps should be resized to the device's intended size.
- * (3) Smaller bitmaps should be left alone.
- */
- @MediumTest
- @Feature({"Browser", "Notifications"})
- public void testEnsureNormalizedIconBehavior() throws Exception {
- setNotificationContentSettingForCurrentOrigin(ContentSetting.ALLOW);
-
- // Create a notification to ensure that the NotificationUIManager is initialized.
- showAndGetNotification("MyNotification", "{}");
-
- // Get the dimensions of the notification icon that will be presented to the user.
- Context appContext = getInstrumentation().getTargetContext().getApplicationContext();
- Resources resources = appContext.getResources();
-
- int largeIconWidthPx =
- resources.getDimensionPixelSize(android.R.dimen.notification_large_icon_width);
- int largeIconHeightPx =
- resources.getDimensionPixelSize(android.R.dimen.notification_large_icon_height);
-
- String origin = "https://example.com";
-
- NotificationUIManager manager = NotificationUIManager.getInstanceForTests();
- assertNotNull(manager);
-
- Bitmap fromNullIcon = manager.ensureNormalizedIcon(null, origin);
- assertNotNull(fromNullIcon);
- assertEquals(largeIconWidthPx, fromNullIcon.getWidth());
- assertEquals(largeIconHeightPx, fromNullIcon.getHeight());
-
- Bitmap largeIcon = Bitmap.createBitmap(largeIconWidthPx * 2, largeIconHeightPx * 2,
- Bitmap.Config.ALPHA_8);
-
- Bitmap fromLargeIcon = manager.ensureNormalizedIcon(largeIcon, origin);
- assertNotNull(fromLargeIcon);
- assertEquals(largeIconWidthPx, fromLargeIcon.getWidth());
- assertEquals(largeIconHeightPx, fromLargeIcon.getHeight());
-
- Bitmap smallIcon = Bitmap.createBitmap(largeIconWidthPx / 2, largeIconHeightPx / 2,
- Bitmap.Config.ALPHA_8);
-
- Bitmap fromSmallIcon = manager.ensureNormalizedIcon(smallIcon, origin);
- assertNotNull(fromSmallIcon);
- assertEquals(smallIcon, fromSmallIcon);
}
/*
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698