author | Carsten "Tomcat" Book <cbook@mozilla.com> |
Thu, 07 Jul 2016 08:39:01 +0200 | |
changeset 304085 | 1a38e8bf11b6bac4954194805d6db33369c683fc |
parent 304084 | 9ef4fa72ea0b689ed56fdbeafe69f023bd2c1f8f |
child 304086 | b9cc2dcbf4363c8049183110fe79e026fae87ecb |
push id | 30411 |
push user | kwierso@gmail.com |
push date | Fri, 08 Jul 2016 00:26:45 +0000 |
treeherder | mozilla-central@23dc78b7b57e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1171614 |
milestone | 50.0a1 |
backs out | 0dafaad484d42acb5f411b51c700e47ede4f0321 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/devtools/server/tests/mochitest/inspector_getImageData.html +++ b/devtools/server/tests/mochitest/inspector_getImageData.html @@ -1,16 +1,15 @@ <html> <head> <body> <img class="custom"> - <img class="big-horizontal" src="large-image.jpg" style="width:500px;"> + <img class="big-horizontal" src="large-image.jpg" style="width:500px;" /> <canvas class="big-vertical" style="width:500px;"></canvas> - <img class="small" src="small-image.gif"> - <img class="data" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAJklEQVRIie3NMREAAAgAoe9fWls4eAzMVM0xoVAoFAqFQqFQ+C9chp4NHvu+4Q4AAAAASUVORK5CYII="> + <img class="small" src="small-image.gif"></img> <script> window.onload = () => { var canvas = document.querySelector("canvas"), ctx = canvas.getContext("2d"); canvas.width = 1000; canvas.height = 2000; ctx.fillStyle = "red"; ctx.fillRect(0, 0, 1000, 2000);
--- a/devtools/server/tests/mochitest/test_inspector_getImageData.html +++ b/devtools/server/tests/mochitest/test_inspector_getImageData.html @@ -42,17 +42,17 @@ addTest(function testLargeImage() { ok(imageData.data, "Image data actor was sent back"); ok(imageData.size, "Image size info was sent back too"); is(imageData.size.naturalWidth, 5333, "Natural width of the image correct"); is(imageData.size.naturalHeight, 3000, "Natural width of the image correct"); ok(imageData.size.resized, "Image was resized"); imageData.data.string().then(str => { ok(str, "We have an image data string!"); - testResizing(imageData, str); + runNextTest(); }); }); }); }); addTest(function testLargeCanvas() { // Select the canvas node from the test page gWalker.querySelector(gWalker.rootNode, ".big-vertical").then(canvas => { @@ -63,17 +63,17 @@ addTest(function testLargeCanvas() { ok(imageData.data, "Image data actor was sent back"); ok(imageData.size, "Image size info was sent back too"); is(imageData.size.naturalWidth, 1000, "Natural width of the image correct"); is(imageData.size.naturalHeight, 2000, "Natural width of the image correct"); ok(imageData.size.resized, "Image was resized"); imageData.data.string().then(str => { ok(str, "We have an image data string!"); - testResizing(imageData, str); + runNextTest(); }); }); }); }); addTest(function testSmallImage() { // Select the small image node from the test page gWalker.querySelector(gWalker.rootNode, ".small").then(img => { @@ -84,38 +84,17 @@ addTest(function testSmallImage() { ok(imageData.data, "Image data actor was sent back"); ok(imageData.size, "Image size info was sent back too"); is(imageData.size.naturalWidth, 245, "Natural width of the image correct"); is(imageData.size.naturalHeight, 240, "Natural width of the image correct"); ok(!imageData.size.resized, "Image was NOT resized"); imageData.data.string().then(str => { ok(str, "We have an image data string!"); - testResizing(imageData, str); - }); - }); - }); -}); - -addTest(function testDataImage() { - // Select the data image node from the test page - gWalker.querySelector(gWalker.rootNode, ".data").then(img => { - ok(img, "Image node found in the test page"); - ok(img.getImageData, "Image node has the getImageData function"); - - img.getImageData(14).then(imageData => { - ok(imageData.data, "Image data actor was sent back"); - ok(imageData.size, "Image size info was sent back too"); - is(imageData.size.naturalWidth, 28, "Natural width of the image correct"); - is(imageData.size.naturalHeight, 28, "Natural width of the image correct"); - ok(imageData.size.resized, "Image was resized"); - - imageData.data.string().then(str => { - ok(str, "We have an image data string!"); - testResizing(imageData, str); + runNextTest(); }); }); }); }); addTest(function testNonImgOrCanvasElements() { gWalker.querySelector(gWalker.rootNode, "body").then(body => { ensureRejects(body.getImageData(), "Invalid element").then(runNextTest); @@ -123,30 +102,16 @@ addTest(function testNonImgOrCanvasEleme }); addTest(function cleanup() { delete gWalker; runNextTest(); }); /** - * Checks if the server told the truth about resizing the image - */ -function testResizing(imageData, str) { - let img = document.createElement("img"); - img.addEventListener("load", () => { - let resized = !(img.naturalWidth == imageData.size.naturalWidth && - img.naturalHeight == imageData.size.naturalHeight); - is(imageData.size.resized, resized, "Server told the truth about resizing"); - runNextTest(); - }, false); - img.src = str; -} - -/** * Asserts that the given promise rejects. */ function ensureRejects(promise, desc) { return promise.then(() => { ok(false, desc + ": promise resolved unexpectedly."); }, () => { ok(true, desc + ": promise rejected as expected."); });