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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/mediacapturefromelement/CanvasCaptureMediaStream-offscreencanvas.html
diff --git a/third_party/WebKit/LayoutTests/fast/mediacapturefromelement/CanvasCaptureMediaStream-offscreencanvas.html b/third_party/WebKit/LayoutTests/fast/mediacapturefromelement/CanvasCaptureMediaStream-offscreencanvas.html
new file mode 100644
index 0000000000000000000000000000000000000000..5b4349f64208fb21543a463ecb97ce46c1724248
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/mediacapturefromelement/CanvasCaptureMediaStream-offscreencanvas.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<script src =../../resources/testharness.js></script>
+<script src =../../resources/testharnessreport.js></script>
+<script>
+
+function draw2d(canvas) {
+ var ctx = canvas.getContext('2d');
+ ctx.fillStyle = 'green';
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
+ return ctx;
+};
+
+function drawWebGL(canvas) {
+ var gl = canvas.getContext('webgl');
+ gl.clearColor(0, 1, 0, 1);
+ gl.clear(gl.COLOR_BUFFER_BIT);
+ return gl;
+};
+
+// Run captureStream() after transferControlToOffscreen().
+var testOffScreenCanvasCommits = function(drawFunction, message) {
+ async_test(function(test) {
+ var canvas = document.createElement('canvas');
+ var offscreen = canvas.transferControlToOffscreen();
+
+ var recorder = new MediaRecorder(canvas.captureStream());
+ recorder.ondataavailable = test.step_func_done(function(event) {
+ assert_true(event.data.size > 0, 'Recorded data size should be > 0');
+ });
+ recorder.start(0);
+
+ var ctx = drawFunction(offscreen);
+ ctx.commit();
+ }), message;
+};
+
+testOffScreenCanvasCommits(draw2d,
+ 'capture of an OffscreenCanvas with 2D context');
+testOffScreenCanvasCommits(drawWebGL,
+ 'capture of an OffscreenCanvas with WebGL context');
+</script>
« 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