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..04e2500ee5d8987706b71e18bd377f1b48a8180e |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/fast/canvas/rendering-contexts-back-references.html |
| @@ -0,0 +1,28 @@ |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<script> |
| +function make_canvas(type) |
| +{ |
| + if (type == "html") |
| + return document.createElement("canvas"); |
| + return new OffscreenCanvas(10, 10); |
| +} |
| + |
| +function test_back_ref(contextType, canvasType) |
| +{ |
| + var canvas = make_canvas(canvasType); |
| + var ctx = canvas.getContext(contextType); |
| + assert_equals(ctx.canvas, canvas, "Back reference to canvas should work."); |
| + var anotherCanvas = make_canvas(canvasType); |
| + ctx.canvas = anotherCanvas; |
| + assert_not_equals(ctx.canvas, anotherCanvas, "Canvas attribute is read only."); |
| +} |
| + |
| +generate_tests(test_back_ref, [ |
| + ["2d context on html canvas", "2d", "html"], |
|
Justin Novosad
2016/08/11 17:57:14
Nit: funky indent
|
| + ["webgl context on html canvas", "webgl", "html"], |
| + ["bitmaprenderer context on html canvas", "bitmaprenderer", "html"], |
| + ["2d context on offscreen canvas", "2d", "offscreen"], |
| + ["webgl context on offscreen canvas", "webgl", "offscreen"], |
| +]); |
| +</script> |