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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-ImageBitmap-close.html

Issue 1911793003: drawImage throw when ImageBitmap is neutered (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/canvas-ImageBitmap-close-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script> 2 <script src="../../resources/js-test.js"></script>
3 <script> 3 <script>
4 jsTestIsAsync = true; 4 jsTestIsAsync = true;
5 var worker = new Worker('./resources/worker-onmessage-noop.js'); 5 var worker = new Worker('./resources/worker-onmessage-noop.js');
6 6
7 description("Tests that the close method of ImageBitmap does dispose the image d ata"); 7 description("Tests that the close method of ImageBitmap does dispose the image d ata");
8 8
9 var imgHeight = 10; 9 var imgHeight = 10;
10 var imgWidth = 10; 10 var imgWidth = 10;
11 var imageData = new ImageData(10, 10); 11 var imageData = new ImageData(10, 10);
12 var bitmap; 12 var bitmap;
13 var ctx;
13 createImageBitmap(imageData).then(imageBitmap => { 14 createImageBitmap(imageData).then(imageBitmap => {
14 bitmap = imageBitmap; 15 bitmap = imageBitmap;
15 shouldBe("bitmap.width", "imgWidth"); 16 shouldBe("bitmap.width", "imgWidth");
16 shouldBe("bitmap.height", "imgHeight"); 17 shouldBe("bitmap.height", "imgHeight");
17 18
18 // Apply structured clone to the bitmap, nothing should be changed 19 // Apply structured clone to the bitmap, nothing should be changed
19 worker.postMessage({data: bitmap}); 20 worker.postMessage({data: bitmap});
20 shouldBe("bitmap.width", "imgWidth"); 21 shouldBe("bitmap.width", "imgWidth");
21 shouldBe("bitmap.height", "imgHeight"); 22 shouldBe("bitmap.height", "imgHeight");
22 23
23 // After calling close, the image data associated with the bitmap should no longer exist 24 // After calling close, the image data associated with the bitmap should no longer exist
24 bitmap.close(); 25 bitmap.close();
25 shouldBe("bitmap.width", "0"); 26 shouldBe("bitmap.width", "0");
26 shouldBe("bitmap.height", "0"); 27 shouldBe("bitmap.height", "0");
27 28
29 var canvas = document.createElement("canvas");
30 canvas.width = imgWidth;
31 canvas.height = imgHeight;
32 ctx = canvas.getContext("2d");
33 shouldThrow("ctx.drawImage(bitmap, 0, 0)");
34
28 // Try to apply structured clone to an already closed bitmap 35 // Try to apply structured clone to an already closed bitmap
29 try { 36 try {
30 worker.postMessage({data: bitmap}); 37 worker.postMessage({data: bitmap});
31 testFailed("Apply structured clone to an already closed bitmap passed un expectedly"); 38 testFailed("Apply structured clone to an already closed bitmap passed un expectedly");
32 } catch(ex) { 39 } catch(ex) {
33 testPassed("Apply structured clone to an already closed bitmap is reject ed as expected: " + ex); 40 testPassed("Apply structured clone to an already closed bitmap is reject ed as expected: " + ex);
34 } 41 }
35 42
36 // Try to apply transfering to an already closed bitmap 43 // Try to apply transfering to an already closed bitmap
37 try { 44 try {
(...skipping 30 matching lines...) Expand all
68 75
69 // Calling close to a neutered bitmap should be noop. 76 // Calling close to a neutered bitmap should be noop.
70 bitmap.close(); 77 bitmap.close();
71 shouldBe("bitmap.width", "0"); 78 shouldBe("bitmap.width", "0");
72 shouldBe("bitmap.height", "0"); 79 shouldBe("bitmap.height", "0");
73 }); 80 });
74 }).catch(function(ex) { 81 }).catch(function(ex) {
75 testFailed("Unexpected failure: " + ex); 82 testFailed("Unexpected failure: " + ex);
76 }).then(() => { finishJSTest(); }); 83 }).then(() => { finishJSTest(); });
77 </script> 84 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/canvas-ImageBitmap-close-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698