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

Unified Diff: chrome/renderer/resources/extensions/notifications_custom_bindings.gtestjs

Issue 354733002: Notifications API support for images with multiple scale factors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updates custom bindings tests. Created 6 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/renderer/resources/extensions/notifications_custom_bindings.gtestjs
diff --git a/chrome/renderer/resources/extensions/notifications_custom_bindings.gtestjs b/chrome/renderer/resources/extensions/notifications_custom_bindings.gtestjs
index af1e89f4e1a262a914af7557bd8902884b758c6c..d5f22890aa873ccf43e8f893c6c7e8e9e7e0dbfd 100644
--- a/chrome/renderer/resources/extensions/notifications_custom_bindings.gtestjs
+++ b/chrome/renderer/resources/extensions/notifications_custom_bindings.gtestjs
@@ -26,7 +26,7 @@ TEST_F('NotificationsCustomBindingsTest', 'TestImageDataSetter', function () {
var k = "key";
var callback = imageDataSetter(c, k);
callback('val');
- expectTrue(c[k] === 'val');
+ expectTrue(c.src === 'val');
});
TEST_F('NotificationsCustomBindingsTest', 'TestGetUrlSpecs', function () {
@@ -39,15 +39,14 @@ TEST_F('NotificationsCustomBindingsTest', 'TestGetUrlSpecs', function () {
var notificationDetails = {};
- var emptySpecs = getUrlSpecs(imageSizes, notificationDetails);
- expectTrue(emptySpecs.length === 0);
-
notificationDetails.iconUrl = "iconUrl";
notificationDetails.imageUrl = "imageUrl";
notificationDetails.buttons = [
{iconUrl: "buttonOneIconUrl"},
{iconUrl: "buttonTwoIconUrl"}];
+ notificationDetails =
+ translateBitmapUrls("", notificationDetails, undefined)[1];
var allSpecs = getUrlSpecs(imageSizes, notificationDetails);
expectTrue(allSpecs.length === 4);
@@ -65,12 +64,14 @@ TEST_F('NotificationsCustomBindingsTest', 'TestGetUrlSpecs', function () {
spec.callback(spec.path + "|" + spec.width + "|" + spec.height);
}
- expectTrue(notificationDetails.iconBitmap === "iconUrl|10|10");
- expectTrue(notificationDetails.imageBitmap === "imageUrl|24|32");
+ expectTrue(notificationDetails.iconReps[0].src === "iconUrl|10|10");
+ expectTrue(notificationDetails.imageReps[0].src === "imageUrl|24|32");
expectTrue(
- notificationDetails.buttons[0].iconBitmap === "buttonOneIconUrl|2|2");
+ notificationDetails.buttons[0].iconReps[0].src ===
+ "buttonOneIconUrl|2|2");
expectTrue(
- notificationDetails.buttons[1].iconBitmap === "buttonTwoIconUrl|2|2");
+ notificationDetails.buttons[1].iconReps[0].src ===
+ "buttonTwoIconUrl|2|2");
});
TEST_F('NotificationsCustomBindingsTest', 'TestGetUrlSpecsScaled', function () {
@@ -88,6 +89,8 @@ TEST_F('NotificationsCustomBindingsTest', 'TestGetUrlSpecsScaled', function () {
{iconUrl: "buttonTwoIconUrl"}
]
};
+ notificationDetails =
+ translateBitmapUrls("", notificationDetails, undefined)[1];
var allSpecs = getUrlSpecs(imageSizes, notificationDetails);
for (var i = 0; i < allSpecs.length; i++) {
@@ -95,10 +98,10 @@ TEST_F('NotificationsCustomBindingsTest', 'TestGetUrlSpecsScaled', function () {
spec.callback(spec.path + "|" + spec.width + "|" + spec.height);
}
- expectEquals(notificationDetails.iconBitmap, "iconUrl|20|20");
- expectEquals(notificationDetails.imageBitmap, "imageUrl|48|64");
- expectEquals(notificationDetails.buttons[0].iconBitmap,
+ expectEquals(notificationDetails.iconReps[0].src, "iconUrl|20|20");
+ expectEquals(notificationDetails.imageReps[0].src, "imageUrl|48|64");
+ expectEquals(notificationDetails.buttons[0].iconReps[0].src,
"buttonOneIconUrl|4|4");
- expectEquals(notificationDetails.buttons[1].iconBitmap,
+ expectEquals(notificationDetails.buttons[1].iconReps[0].src,
"buttonTwoIconUrl|4|4");
});
« no previous file with comments | « chrome/common/extensions/api/notifications.idl ('k') | chrome/renderer/resources/extensions/notifications_custom_bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698