Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/canvas/rendering-contexts-back-references.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/canvas/rendering-contexts-back-references.html b/third_party/WebKit/LayoutTests/fast/canvas/rendering-contexts-back-references.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b6a3538e492819a6606e6510f6cd5a447883b985 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/fast/canvas/rendering-contexts-back-references.html |
| @@ -0,0 +1,38 @@ |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<script> |
| +function generateTest(canvas, context, anotherCanvas, message) |
|
Justin Novosad
2016/08/10 18:56:33
I meant use "generate_tests" from testharness.js i
xlai (Olivia)
2016/08/10 20:51:29
Done.
|
| +{ |
| + assert_equals(context.canvas, canvas); |
| + context.canvas = anotherCanvas; |
| + assert_not_equals(context.canvas, anotherCanvas, message); |
| +} |
| + |
| +// Back reference to html canvas |
| +test(function() { |
| + var htmlCanvas = document.createElement("canvas"); |
| + generateTest(htmlCanvas, htmlCanvas.getContext("2d"), document.createElement("canvas"), "ctx2d.canvas is read-only."); |
| +}, "Test back references to html canvas for CanvasRenderingContext2D"); |
| + |
| +test(function() { |
| + var htmlCanvas = document.createElement("canvas"); |
| + generateTest(htmlCanvas, htmlCanvas.getContext("webgl"), document.createElement("canvas"), "webglCtx.canvas is read-only."); |
| +}, "back references to html canvas for WebglRenderingContext"); |
| + |
| +test(function() { |
| + var htmlCanvas = document.createElement("canvas"); |
| + generateTest(htmlCanvas, htmlCanvas.getContext("bitmaprenderer"), document.createElement("canvas"), "bitmaprenderer.canvas is read-only."); |
| +}, "back references to canvas for ImageBitmapRenderingContext"); |
| + |
| +// Back reference to Offscreen canvas |
| +test(function() { |
| + var offscreenCanvas = new OffscreenCanvas(10, 10); |
| + generateTest(offscreenCanvas, offscreenCanvas.getContext("2d"), new OffscreenCanvas(10, 10), "ctx2d.canvas is read-only."); |
| +}, "back references to offscreencanvas for OffscreenCanvasRenderingContext2D"); |
| + |
| +test(function() { |
| + var offscreenCanvas = new OffscreenCanvas(10, 10); |
| + generateTest(offscreenCanvas, offscreenCanvas.getContext("webgl"), new OffscreenCanvas(10, 10), "webgl.canvas is read-only."); |
| +}, "back references to offscreencanvas for WebglRenderingContext"); |
| + |
| +</script> |