Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/mediacapturefromelement/CanvasCaptureMediaStream-offscreencanvas.html

Issue 2632593003: Notify listeners on OffScreenCanvas changes (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src =../../resources/testharness.js></script>
3 <script src =../../resources/testharnessreport.js></script>
4 <script>
5
6 function draw2d(canvas) {
7 var ctx = canvas.getContext('2d');
8 ctx.fillStyle = 'green';
9 ctx.fillRect(0, 0, canvas.width, canvas.height);
10 return ctx;
11 };
12
13 function drawWebGL(canvas) {
14 var gl = canvas.getContext('webgl');
15 gl.clearColor(0, 1, 0, 1);
16 gl.clear(gl.COLOR_BUFFER_BIT);
17 return gl;
18 };
19
20 // Run captureStream() after transferControlToOffscreen().
21 var testOffScreenCanvasCommits = function(drawFunction, message) {
22 async_test(function(test) {
23 var canvas = document.createElement('canvas');
24 var offscreen = canvas.transferControlToOffscreen();
25
26 var recorder = new MediaRecorder(canvas.captureStream());
27 recorder.ondataavailable = test.step_func_done(function(event) {
28 assert_true(event.data.size > 0, 'Recorded data size should be > 0');
29 });
30 recorder.start(0);
31
32 var ctx = drawFunction(offscreen);
33 ctx.commit();
34 }), message;
35 };
36
37 testOffScreenCanvasCommits(draw2d,
38 'capture of an OffscreenCanvas with 2D context');
39 testOffScreenCanvasCommits(drawWebGL,
40 'capture of an OffscreenCanvas with WebGL context');
41 </script>
OLDNEW
« no previous file with comments | « content/test/data/media/canvas_capture.html ('k') | third_party/WebKit/Source/core/html/HTMLCanvasElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698