| 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..ae5518421c9ae9a6f525906e14e24f1870f67e35
|
| --- /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"],
|
| + ["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>
|
|
|