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

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, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLCanvasElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src=../../resources/testharness.js></script>
3 <script src=../../resources/testharnessreport.js></script>
4 <script src="resources/webgl-test.js"></script>
5 <script>
6
7 function drawOn2DContext(canvas) {
8 var ctx = canvas.getContext('2d');
9 ctx.strokeStyle="#FF0204";
10 ctx.beginPath();
11 ctx.moveTo(0,0);
12 ctx.lineTo(100, 100);
13 ctx.stroke();
14 return ctx;
15 };
16
17 function drawOnWebGLContext(canvas) {
18 var ctx = create3DContext(canvas);
19 ctx.drawArrays(ctx.TRIANGLES, 0, 3);
20 return ctx;
21 };
22
23 // Run captureStream() after transferControlToOffscreen().
24 var testOffScreenCanvasCommits = function(drawFunction, message) {
25 async_test(function(test) {
26 var canvas = document.createElement('canvas');
27 var offscreen = canvas.transferControlToOffscreen();
28
29 var recorder = new MediaRecorder(canvas.captureStream());
30 recorder.ondataavailable = test.step_func_done(function(event) {
31 assert_true(event.data.size > 0, 'Recorded data size should be > 0');
32 });
33 recorder.start(0);
34
35 var ctx = drawFunction(offscreen);
36 ctx.commit();
37 }), message;
38 };
39
40 generate_tests(testOffScreenCanvasCommits, [
Justin Novosad 2017/01/19 19:06:31 The testharness documentation says you can't use g
emircan 2017/01/19 20:50:52 Sorry for missing that. I just removed generate_te
41 [ "2d", drawOn2DContext, 'capture of an OffscreenCanvas with 2D context' ],
42 [ "webgl", drawOnWebGLContext, 'capture of an OffscreenCanvas with WebGL con text' ]
43 ]);
44
45 // Run captureStream() on OffscreenCanvas that uses transferFromImageBitmap().
46 var testOffScreenCanvasTransferBitmaps = function(drawFunction, message) {
47 async_test(function(test) {
48 var canvas = document.createElement('canvas');
49 var ctx = canvas.getContext('bitmaprenderer');
50 var offscreen = new OffscreenCanvas(400,200);
51
52 var recorder = new MediaRecorder(canvas.captureStream());
53 recorder.ondataavailable = test.step_func_done(function(event) {
54 assert_true(event.data.size > 0, 'Recorded data size should be > 0');
55 });
56 recorder.start(0);
57
58 drawFunction(offscreen);
59 var image = offscreen.transferToImageBitmap();
60 assert_equals(image.width, 400);
61 assert_equals(image.height, 200);
62 ctx.transferFromImageBitmap(offscreen.transferToImageBitmap());
63 }), message;
64 };
65
66 generate_tests(testOffScreenCanvasTransferBitmaps, [
67 [ "2d", drawOn2DContext, 'capture of an OffscreenCanvas with 2D context' ],
68 [ "webgl", drawOnWebGLContext, 'capture of an OffscreenCanvas with WebGL con text' ]
69 ]);
70
71 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLCanvasElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698