| OLD | NEW |
| 1 <!DOCTYPE> | 1 <!DOCTYPE> |
| 2 <script src="../../resources/testharness.js"></script> | 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <script id="myWorker" type="text/worker"> | 4 <script id="myWorker" type="text/worker"> |
| 5 self.onmessage = function(e) { | 5 self.onmessage = function(e) { |
| 6 var offscreenCanvas = new OffscreenCanvas(50, 50); | 6 var offscreenCanvas = new OffscreenCanvas(50, 50); |
| 7 var offscreen2d = offscreenCanvas.getContext("2d"); | 7 var offscreen2d = offscreenCanvas.getContext("2d"); |
| 8 try { | 8 try { |
| 9 offscreen2d.commit(); | 9 offscreen2d.commit(); |
| 10 self.postMessage("NoError"); | 10 self.postMessage("NoError"); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 | 22 |
| 23 test(function() { | 23 test(function() { |
| 24 var offscreenCanvas = new OffscreenCanvas(50, 50); | 24 var offscreenCanvas = new OffscreenCanvas(50, 50); |
| 25 var offscreen2d = offscreenCanvas.getContext("2d"); | 25 var offscreen2d = offscreenCanvas.getContext("2d"); |
| 26 assert_throws("InvalidStateError", function () { | 26 assert_throws("InvalidStateError", function () { |
| 27 offscreen2d.commit(); | 27 offscreen2d.commit(); |
| 28 }); | 28 }); |
| 29 }, "Calling OffscreenCanvas.commit() on main without transferControlToOffscreen
throws exception."); | 29 }, "Calling OffscreenCanvas.commit() on main without transferControlToOffscreen
throws exception."); |
| 30 | 30 |
| 31 test(function() { |
| 32 var offscreenCanvas = new OffscreenCanvas(50, 50); |
| 33 var gl = offscreenCanvas.getContext("webgl"); |
| 34 gl.clearColor(1.0, 0.0, 0.0, 1.0); |
| 35 gl.clear(gl.COLOR_BUFFER_BIT); |
| 36 assert_throws("InvalidStateError", function() { |
| 37 gl.commit(); |
| 38 }); |
| 39 }, "Calling WebGL's commit() on main without transferControlToOffscreen throws e
xception."); |
| 40 |
| 31 async_test(function() { | 41 async_test(function() { |
| 32 var worker = makeWorker(document.getElementById("myWorker").textContent); | 42 var worker = makeWorker(document.getElementById("myWorker").textContent); |
| 33 worker.onmessage = this.step_func(function (e) { | 43 worker.onmessage = this.step_func(function (e) { |
| 34 assert_equals(e.data, "InvalidStateError", "Expected exception on worker
but receives " + e.data); | 44 assert_equals(e.data, "InvalidStateError", "Expected exception on worker
but receives " + e.data); |
| 35 this.done(); | 45 this.done(); |
| 36 }); | 46 }); |
| 37 worker.postMessage(""); | 47 worker.postMessage(""); |
| 38 }, "Calling OffscreenCanvas.commit() on worker without transferControlToOffscree
n throws exception."); | 48 }, "Calling OffscreenCanvas.commit() on worker without transferControlToOffscree
n throws exception."); |
| 39 | 49 |
| 40 | 50 |
| 41 | 51 |
| 42 </script> | 52 </script> |
| OLD | NEW |