| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 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> | 4 <script> |
| 5 | 5 |
| 6 async_test(t => { | 6 async_test(t => { |
| 7 var canvas = document.createElement('canvas'); | 7 var canvas = document.createElement('canvas'); |
| 8 var ctx = canvas.getContext('2d'); |
| 9 ctx.fillStyle = 'green'; |
| 10 var recorder = new MediaRecorder(canvas.captureStream()); |
| 11 var frameCount = 0; |
| 8 | 12 |
| 13 recorder.ondataavailable = function() { |
| 14 t.step(function() { |
| 15 assert_true(event.data.size > 0, 'Recorded data size should be > 0'); |
| 16 }); |
| 17 |
| 18 frameCount = frameCount + 1; |
| 19 if (frameCount > 3) { |
| 20 recorder.stop(); |
| 21 t.done(); |
| 22 } else { |
| 23 ctx.fillRect(0, 0, canvas.width, canvas.height); |
| 24 } |
| 25 } |
| 26 |
| 27 recorder.start(0); |
| 28 ctx.fillRect(0, 0, canvas.width, canvas.height); |
| 29 }, "Verify that drawing to a 2D canvas that is not attached to the DOM dispatche
s frames to an attached MediaRecorder." ); |
| 30 |
| 31 async_test(t => { |
| 32 var canvas = document.createElement('canvas'); |
| 33 var gl = canvas.getContext('webgl'); |
| 34 gl.clearColor(0, 1, 0, 1); |
| 9 var recorder = new MediaRecorder(canvas.captureStream()); | 35 var recorder = new MediaRecorder(canvas.captureStream()); |
| 36 var frameCount = 0; |
| 37 |
| 10 recorder.ondataavailable = function() { | 38 recorder.ondataavailable = function() { |
| 11 t.step_func_done(function() { | 39 t.step(function() { |
| 12 assert_true(event.data.size > 0, 'Recorded data size should be > 0'); | 40 assert_true(event.data.size > 0, 'Recorded data size should be > 0'); |
| 13 })(); | 41 }); |
| 14 recorder.stop(); | 42 |
| 43 frameCount = frameCount + 1; |
| 44 if (frameCount > 3) { |
| 45 recorder.stop(); |
| 46 t.done(); |
| 47 } else { |
| 48 gl.clear(gl.COLOR_BUFFER_BIT); |
| 49 } |
| 15 } | 50 } |
| 16 recorder.start(0); | 51 recorder.start(0); |
| 17 | 52 |
| 18 var ctx = canvas.getContext('2d'); | |
| 19 ctx.fillStyle = 'green'; | |
| 20 ctx.fillRect(0, 0, canvas.width, canvas.height); | |
| 21 }, "Verify that drawing to a 2D canvas that is not attached to the DOM dispatche
s a frame to an attached MediaRecorder." ); | |
| 22 | |
| 23 async_test(t => { | |
| 24 var canvas = document.createElement('canvas'); | |
| 25 | |
| 26 var recorder = new MediaRecorder(canvas.captureStream()); | |
| 27 recorder.ondataavailable = function() { | |
| 28 t.step_func_done(function() { | |
| 29 assert_true(event.data.size > 0, 'Recorded data size should be > 0'); | |
| 30 })(); | |
| 31 recorder.stop(); | |
| 32 } | |
| 33 recorder.start(0); | |
| 34 | |
| 35 var gl = canvas.getContext('webgl'); | |
| 36 gl.clearColor(0, 1, 0, 1); | |
| 37 gl.clear(gl.COLOR_BUFFER_BIT); | 53 gl.clear(gl.COLOR_BUFFER_BIT); |
| 38 }, "Verify that drawing to a webgl canvas that is not attached to the DOM dispat
ches a frame to an attached MediaRecorder." ); | 54 }, "Verify that drawing to a webgl canvas that is not attached to the DOM dispat
ches frames to an attached MediaRecorder." ); |
| 39 </script> | 55 </script> |
| OLD | NEW |