diff options
author | xlai <xlai@chromium.org> | 2016-02-02 15:19:18 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-02 23:20:58 +0000 |
commit | d3991457ab5fcb905f2a8a07657e26b16b2974fa (patch) | |
tree | 7a2b2598864892fa2a53188b732677dc2aba2bee /third_party/WebKit/LayoutTests/fast/canvas | |
parent | efdf4fd25177c3e45bc373ce4574cfdce11c58b3 (diff) | |
download | chromium_src-d3991457ab5fcb905f2a8a07657e26b16b2974fa.zip chromium_src-d3991457ab5fcb905f2a8a07657e26b16b2974fa.tar.gz chromium_src-d3991457ab5fcb905f2a8a07657e26b16b2974fa.tar.bz2 |
Simplify CanvasAsyncBlobCreator by removing ContextObserver and related tests
After we confirm to use idle-tasks implementation in toBlob, the cancellation
mechanism for async thread implementation is no longer useful. First, compositor
thread is definitely alive when users open Chrome browser; so the alternative
code path for PNG image encoding when compositor thread is disabled would be
unreachable in real-world situations; as a result, PNG image encoding happens
in idle tasks only. Second, JPEG and WEBP image formats do not have progressive
encoding at this moment and thus cancellation mechanism is not useful to them
either; once their progressive encoding implementations are completed, they
would be moved over to idle-tasks implementation too.
This patch removes ContextObserver and CanvasAsyncBlobCreatorTest; it also moves
all layout tests that use toBlob on PNG image formats to virtual/threaded as
idle tasks require compositor thread to be alive. There is no need to perform
tests on toBlob (png) in scenarios when compositor thread is not available.
BUG=581574
Review URL: https://codereview.chromium.org/1653253003
Cr-Commit-Position: refs/heads/master@{#373068}
Diffstat (limited to 'third_party/WebKit/LayoutTests/fast/canvas')
12 files changed, 0 insertions, 323 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-blob-in-workers-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-blob-in-workers-expected.txt deleted file mode 100644 index 1a07f4a..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-blob-in-workers-expected.txt +++ /dev/null @@ -1,11 +0,0 @@ -Test createImageBitmap with blob in workers. - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -Starting worker: ./resources/canvas-createImageBitmap-blob-in-workers.js -PASS ImageBitmaps created from blob in worker and in main have the same pixel data -PASS successfullyParsed is true - -TEST COMPLETE - diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-blob-in-workers.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-blob-in-workers.html deleted file mode 100644 index ea845ef..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-blob-in-workers.html +++ /dev/null @@ -1,78 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> -<body> -<script> -jsTestIsAsync = true; -var worker = startWorker('./resources/canvas-createImageBitmap-blob-in-workers.js'); - -description('Test createImageBitmap with blob in workers.'); - -var imgWidth = 20; -var imgHeight = 20; -var imageData2; -var numOfBitmaps = 5; -var bitmapArray = []; - -var canvas1 = document.createElement("canvas"); -var ctx1 = canvas1.getContext("2d"); -ctx1.fillStyle = "#FF0000"; -ctx1.fillRect(0, 0, imgWidth, imgHeight); - -function compareImageData(data1, data2) -{ - if (data1.length != data2.length) { - testFailed("The two image have different dimensions"); - finishJSTest(); - } - for (var i = 0; i < data1.length; i++) { - if (data1[i] != data2[i]) { - testFailed("The two image have different pixel data"); - finishJSTest(); - } - } -} - -var newImg = new Image(); -newImg.onload = function() { - var canvas2 = document.createElement("canvas"); - var ctx2 = canvas2.getContext("2d"); - ctx2.drawImage(newImg, 0, 0, imgWidth, imgHeight); - imageData2 = ctx2.getImageData(0, 0, imgWidth, imgHeight).data; - - var canvas3 = document.createElement("canvas"); - var ctx3 = canvas3.getContext("2d"); - for (var i = 0; i < numOfBitmaps; i++) { - ctx3.clearRect(0, 0, imgWidth, imgHeight); - ctx3.drawImage(bitmapArray[i], 0, 0, imgWidth, imgHeight); - var imageData = ctx3.getImageData(0, 0, imgWidth, imgHeight).data; - compareImageData(imageData, imageData2); - } - - worker.onmessage = function(e) { - var newImageBitmap = e.data.data; - ctx3.clearRect(0, 0, imgWidth, imgHeight); - ctx3.drawImage(newImageBitmap, 0, 0, imgWidth, imgHeight); - var imageData = ctx3.getImageData(0, 0, imgWidth, imgHeight).data; - compareImageData(imageData, imageData2); - testPassed("ImageBitmaps created from blob in worker and in main have the same pixel data"); - finishJSTest(); - } -} - -canvas1.toBlob(function(blob) { - worker.postMessage(blob); - for (var i = 0; i < numOfBitmaps; i++) { - createImageBitmap(blob).then(imageBitmap => { - bitmapArray.push(imageBitmap); - }); - } - url = URL.createObjectURL(blob); - newImg.src = url; -}); - -</script> -</body> -</html> diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-from-canvas-toBlob-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-from-canvas-toBlob-expected.txt deleted file mode 100644 index d5353c2..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-from-canvas-toBlob-expected.txt +++ /dev/null @@ -1,10 +0,0 @@ -Tests that createImageBitmap from a canvas.toBlob object should have the same pixel data as the blob. - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS image data from the created ImageBitmap and the originated blob is the same -PASS successfullyParsed is true - -TEST COMPLETE - diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-from-canvas-toBlob.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-from-canvas-toBlob.html deleted file mode 100644 index 99da913..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-from-canvas-toBlob.html +++ /dev/null @@ -1,47 +0,0 @@ -<!DOCTYPE html> -<script src="../../resources/js-test.js"></script> -<script> -jsTestIsAsync = true; - -description("Tests that createImageBitmap from a canvas.toBlob object should have the same pixel data as the blob."); - -var imageData2; -var imageData3; - -var canvas1 = document.createElement("canvas"); -var ctx1 = canvas1.getContext("2d"); -ctx1.fillStyle = "#FF0000"; -ctx1.fillRect(0, 0, 150, 75); - -var newImg = new Image(); -newImg.onload = function() { - var canvas3 = document.createElement("canvas"); - var ctx3 = canvas3.getContext("2d"); - ctx3.drawImage(newImg, 0, 0, 150, 75); - - imageData3 = ctx3.getImageData(0, 0, 150, 75).data; - var imageMatched = true; - for (var i = 1; i < imageData2.length; i++) { - if (imageData2[i] != imageData3[i]) { - imageMatched = false; - break; - } - } - if (imageMatched) - testPassed("image data from the created ImageBitmap and the originated blob is the same"); - else - testFailed("image data from the created ImageBitmap and the originated blob is NOT the same"); - finishJSTest(); -} - -canvas1.toBlob(function(blob) { - createImageBitmap(blob).then(imageBitmap => { - var canvas2 = document.createElement("canvas"); - var ctx2 = canvas2.getContext("2d"); - ctx2.drawImage(imageBitmap, 0, 0, 150, 75); - imageData2 = ctx2.getImageData(0, 0, 150, 75).data; - url = URL.createObjectURL(blob); - newImg.src = url; - }); -}); -</script> diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype-expected.txt deleted file mode 100644 index def2f15..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype-expected.txt +++ /dev/null @@ -1,13 +0,0 @@ -Test that toBlob(mimeType) ignores the case of 'mimeType'. - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS successfullyParsed is true - -TEST COMPLETE -PASS -PASS -PASS -PASS - diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype.html deleted file mode 100644 index dc48053..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype.html +++ /dev/null @@ -1,45 +0,0 @@ -<script src = "../../resources/js-test.js"></script> -<script type = "text/javascript"> -if (window.testRunner) -{ - testRunner.dumpAsText(); - testRunner.waitUntilDone(); -} - -description("Test that toBlob(mimeType) ignores the case of 'mimeType'."); - -canvas = document.createElement('canvas'); -var counter; - -function tryMimeType(mimeType, expectedMimeType) -{ - canvas.toBlob(function(blob) { - if (blob.type === expectedMimeType) { - testPassed(""); - } - else { - testFailed(blob.type + " does not match " + expectedMimeType); - } - counter = counter - 1; - if (window.testRunner) { - if (counter == 0) { - testRunner.notifyDone(); - } - } - }, mimeType); -} - -counter = 4; - -//Note that due to the async nature of toBlob, these callbacks may complete -// at random order but they will all print PASS when they pass. -tryMimeType("image/PNG", "image/png"); - -tryMimeType("imaGE/jpEg", "image/jpeg"); - -tryMimeType("ImAgE/WeBp", "image/webp"); - -//Unsupported mime type falls back to png -tryMimeType("image/bmp", "image/png"); - -</Script> diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-file-vs-blob-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-file-vs-blob-expected.txt deleted file mode 100644 index 843f9a4..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-file-vs-blob-expected.txt +++ /dev/null @@ -1,11 +0,0 @@ -Test if toBlob creates a Blob-type object. - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS successfullyParsed is true - -TEST COMPLETE -PASS resultImageObject instanceof File is false -PASS resultImageObject instanceof Blob is true - diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-file-vs-blob.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-file-vs-blob.html deleted file mode 100644 index 66e448d..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-file-vs-blob.html +++ /dev/null @@ -1,20 +0,0 @@ -<script src = "../../resources/js-test.js"></script> -<script type = "text/javascript"> -if (window.testRunner) -{ - testRunner.dumpAsText(); - testRunner.waitUntilDone(); -} - -description("Test if toBlob creates a Blob-type object."); - -var resultImageObject = null; -canvas = document.createElement('canvas'); -canvas.toBlob(function(b) { - resultImageObject = b; - shouldBeFalse('resultImageObject instanceof File'); - shouldBeTrue('resultImageObject instanceof Blob'); - if (window.testRunner) - testRunner.notifyDone(); -}); -</Script> diff --git a/third_party/WebKit/LayoutTests/fast/canvas/toBlob/canvas-toBlob-defaultpng-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/toBlob/canvas-toBlob-defaultpng-expected.txt deleted file mode 100644 index fed3498..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/toBlob/canvas-toBlob-defaultpng-expected.txt +++ /dev/null @@ -1,10 +0,0 @@ -Test that verifies whether the image data survives the toBlob process after async image encoding - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS image data survives through the toBlob and PNG Image encoder -PASS successfullyParsed is true - -TEST COMPLETE - diff --git a/third_party/WebKit/LayoutTests/fast/canvas/toBlob/canvas-toBlob-defaultpng.html b/third_party/WebKit/LayoutTests/fast/canvas/toBlob/canvas-toBlob-defaultpng.html deleted file mode 100644 index c68d3ea..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/toBlob/canvas-toBlob-defaultpng.html +++ /dev/null @@ -1,47 +0,0 @@ -<script src = "../../../resources/js-test.js"></script> -<script type = 'text/javascript'> -jsTestIsAsync = true; -description("Test that verifies whether the image data survives the toBlob process after async image encoding"); - -if (window.testRunner) { - testRunner.dumpAsText(); - testRunner.waitUntilDone(); -} - -var canvas = document.createElement("canvas"); -var ctx = canvas.getContext("2d"); -ctx.fillStyle = "#FF0000"; -ctx.fillRect(0, 0, 150, 75); -var canvas2 = document.createElement("canvas"); -var ctx2 = canvas2.getContext("2d"); - -var newImg = new Image(); -newImg.onload = function() { - // 300x150 is the default size of the canvas, which is the source of the newImg. - ctx2.drawImage(newImg, 0, 0, 300, 150); - - var imageData1 = ctx.getImageData(0, 0, 150, 75).data; - var imageData2 = ctx2.getImageData(0, 0, 150, 75).data; - var imageMatched = true; - for (var i = 1; i < imageData1.length; i++) - { - if (imageData1[i]!=imageData2[i]) - { - imageMatched = false; - break; - } - } - if (imageMatched) - testPassed("image data survives through the toBlob and PNG Image encoder"); - else - testFailed("image data does not survive through the toBlob and PNG Image encoder"); - - finishJSTest(); -} - -canvas.toBlob(function(blob) { - url = URL.createObjectURL(blob); - newImg.src = url; -}); - -</script> diff --git a/third_party/WebKit/LayoutTests/fast/canvas/toBlob/canvas-toBlob-toDataURL-race-imageEncoder-png-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/toBlob/canvas-toBlob-toDataURL-race-imageEncoder-png-expected.txt deleted file mode 100644 index ac789eb..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/toBlob/canvas-toBlob-toDataURL-race-imageEncoder-png-expected.txt +++ /dev/null @@ -1,10 +0,0 @@ -Verifies if synchronous PNG image encoding (toDataURL) conflicts with asynchronous image encoding (toBlob) - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS All images encoded by both async and main threads match one another -PASS successfullyParsed is true - -TEST COMPLETE - diff --git a/third_party/WebKit/LayoutTests/fast/canvas/toBlob/canvas-toBlob-toDataURL-race-imageEncoder-png.html b/third_party/WebKit/LayoutTests/fast/canvas/toBlob/canvas-toBlob-toDataURL-race-imageEncoder-png.html deleted file mode 100644 index 806cc27..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/toBlob/canvas-toBlob-toDataURL-race-imageEncoder-png.html +++ /dev/null @@ -1,21 +0,0 @@ -<script src = "../../../resources/js-test.js"></script> -<script src = "../script-tests/canvas-toBlob-toDataURL-race.js"></script> -<script type = 'text/javascript'> -description("Verifies if synchronous PNG image encoding (toDataURL) conflicts with asynchronous image encoding (toBlob)"); - -//Fire a bunch of toBlob operations of canvas to keep the async thread busy -var j = 0; // due to async nature of toBlob we need a separate counter -for (var i = 0; i < numToBlobCalls; i++) -{ - canvas.toBlob(function(blob) { - url = URL.createObjectURL(blob); - testImages[j++].src = url; - }); -} - -//Then file a bunch of toDataURL operation on main thread, so both threads now compete for image encoding -for (var i = numToBlobCalls; i < (numToDataURLCalls + numToBlobCalls); i++) -{ - testImages[i].src = canvas.toDataURL(); -} -</script> |