Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <script src="../../resources/testharness.js"></script> | |
| 2 <script src="../../resources/testharnessreport.js"></script> | |
| 3 <script> | |
| 4 var tests = []; | |
| 5 function test_back_ref(canvas, context, anotherCanvas, message) | |
| 6 { | |
| 7 assert_equals(context.canvas, canvas); | |
| 8 context.canvas = anotherCanvas; | |
| 9 assert_not_equals(context.canvas, anotherCanvas, message); | |
| 10 } | |
| 11 | |
| 12 // Back reference to html canvas | |
| 13 var htmlCanvas1 = document.createElement("canvas"); | |
| 14 tests.push(["Test back references to html canvas for CanvasRenderingContext2D", | |
| 15 htmlCanvas1, htmlCanvas1.getContext("2d"), document.createElement("canva s"), "ctx2d.canvas is read-only."]); | |
| 16 | |
| 17 var htmlCanvas2 = document.createElement("canvas"); | |
| 18 tests.push(["Test back references to html canvas for WebglRenderingContext", | |
| 19 htmlCanvas2, htmlCanvas2.getContext("webgl"), document.createElement("ca nvas"), "webglCtx.canvas is read-only."]); | |
| 20 | |
| 21 var htmlCanvas3 = document.createElement("canvas"); | |
| 22 tests.push(["Test back references to canvas for ImageBitmapRenderingContext", | |
| 23 htmlCanvas3, htmlCanvas3.getContext("bitmaprenderer"), document.createEl ement("canvas"), "bitmaprenderer.canvas is read-only."]); | |
| 24 | |
| 25 // Back reference to Offscreen canvas | |
| 26 var offscreenCanvas1 = new OffscreenCanvas(10, 10); | |
| 27 tests.push(["Test back references to offscreencanvas for OffscreenCanvasRenderin gContext2D", | |
| 28 offscreenCanvas1, offscreenCanvas1.getContext("2d"), new OffscreenCanvas (10, 10), "ctx2d.canvas is read-only."]); | |
| 29 | |
| 30 var offscreenCanvas2 = new OffscreenCanvas(10, 10); | |
| 31 tests.push(["Test back references to offscreencanvas for WebglRenderingContext", | |
| 32 offscreenCanvas2, offscreenCanvas2.getContext("webgl"), new OffscreenCan vas(10, 10), "webgl.canvas is read-only."]); | |
| 33 | |
| 34 generate_tests(test_back_ref, tests); | |
|
Justin Novosad
2016/08/11 17:37:57
You are not using the test pattern optimally. The
| |
| 35 | |
| 36 </script> | |
| OLD | NEW |