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

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

Issue 296113009: Revert 272211 "Allow high-res bitmaps to be passed in from notif..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 7 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: trunk/src/chrome/renderer/resources/extensions/notifications_custom_bindings.gtestjs
===================================================================
--- trunk/src/chrome/renderer/resources/extensions/notifications_custom_bindings.gtestjs (revision 272269)
+++ trunk/src/chrome/renderer/resources/extensions/notifications_custom_bindings.gtestjs (working copy)
@@ -1,104 +0,0 @@
-// Copyright 2014 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.
-
-/**
- * Test fixture for the notifications custom bindings adapter.
- * @constructor
- * @extends {testing.Test}
- */
-function NotificationsCustomBindingsTest() {
- testing.Test.call(this);
-}
-
-NotificationsCustomBindingsTest.prototype = {
- __proto__: testing.Test.prototype,
-
- /** @Override */
- extraLibraries: [
- 'notifications_test_util.js',
- 'notifications_custom_bindings.js'
- ],
-};
-
-TEST_F('NotificationsCustomBindingsTest', 'TestImageDataSetter', function () {
- var c = {};
- var k = "key";
- var callback = imageDataSetter(c, k);
- callback('val');
- expectTrue(c[k] === 'val');
-});
-
-TEST_F('NotificationsCustomBindingsTest', 'TestGetUrlSpecs', function () {
- var imageSizes = {
- scaleFactor: 1.0,
- icon: { width: 10, height: 10 },
- image: { width: 24, height: 32 },
- buttonIcon: { width: 2, height: 2}
- };
-
- var notificationDetails = {};
-
- var emptySpecs = getUrlSpecs(imageSizes, notificationDetails);
- expectTrue(emptySpecs.length === 0);
-
- notificationDetails.iconUrl = "iconUrl";
- notificationDetails.imageUrl = "imageUrl";
- notificationDetails.buttons = [
- {iconUrl: "buttonOneIconUrl"},
- {iconUrl: "buttonTwoIconUrl"}];
-
- var allSpecs = getUrlSpecs(imageSizes, notificationDetails);
- expectTrue(allSpecs.length === 4);
-
- expectFalse(notificationDetails.iconBitmap === "test");
- expectFalse(notificationDetails.imageBitmap === "test");
- expectFalse(notificationDetails.buttons[0].iconBitmap === "test");
- expectFalse(notificationDetails.buttons[1].iconBitmap === "test");
-
- for (var i = 0; i < allSpecs.length; i++) {
- var expectedKeys = ['path', 'width', 'height', 'callback'];
- var spec = allSpecs[i];
- for (var j in expectedKeys) {
- expectTrue(spec.hasOwnProperty(expectedKeys[j]));
- }
- spec.callback(spec.path + "|" + spec.width + "|" + spec.height);
- }
-
- expectTrue(notificationDetails.iconBitmap === "iconUrl|10|10");
- expectTrue(notificationDetails.imageBitmap === "imageUrl|24|32");
- expectTrue(
- notificationDetails.buttons[0].iconBitmap === "buttonOneIconUrl|2|2");
- expectTrue(
- notificationDetails.buttons[1].iconBitmap === "buttonTwoIconUrl|2|2");
-});
-
-TEST_F('NotificationsCustomBindingsTest', 'TestGetUrlSpecsScaled', function () {
- var imageSizes = {
- scaleFactor: 2.0,
- icon: { width: 10, height: 10 },
- image: { width: 24, height: 32 },
- buttonIcon: { width: 2, height: 2}
- };
- var notificationDetails = {
- iconUrl: "iconUrl",
- imageUrl: "imageUrl",
- buttons: [
- {iconUrl: "buttonOneIconUrl"},
- {iconUrl: "buttonTwoIconUrl"}
- ]
- };
-
- var allSpecs = getUrlSpecs(imageSizes, notificationDetails);
- for (var i = 0; i < allSpecs.length; i++) {
- var spec = allSpecs[i];
- 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,
- "buttonOneIconUrl|4|4");
- expectEquals(notificationDetails.buttons[1].iconBitmap,
- "buttonTwoIconUrl|4|4");
-});

Powered by Google App Engine
This is Rietveld 408576698