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

Unified Diff: third_party/WebKit/LayoutTests/fast/mediacapturefromelement/CanvasCaptureMediaStream-capture-out-of-DOM-element.html

Issue 2653933003: Make stream captures work on canvases that are not in the DOM. (Closed)
Patch Set: rebase 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-capture-out-of-DOM-element.html
diff --git a/third_party/WebKit/LayoutTests/fast/mediacapturefromelement/CanvasCaptureMediaStream-capture-out-of-DOM-element.html b/third_party/WebKit/LayoutTests/fast/mediacapturefromelement/CanvasCaptureMediaStream-capture-out-of-DOM-element.html
new file mode 100644
index 0000000000000000000000000000000000000000..bed039a28cf412c59deeaba48e5f5da2e7409104
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/mediacapturefromelement/CanvasCaptureMediaStream-capture-out-of-DOM-element.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<script src =../../resources/testharness.js></script>
+<script src =../../resources/testharnessreport.js></script>
+<script>
+
+async_test(t => {
+ var canvas = document.createElement('canvas');
+
+ var recorder = new MediaRecorder(canvas.captureStream());
+ recorder.ondataavailable = function() {
+ t.step_func_done(function() {
+ assert_true(event.data.size > 0, 'Recorded data size should be > 0');
+ })();
+ recorder.stop();
+ }
+ recorder.start(0);
+
+ var ctx = canvas.getContext('2d');
+ ctx.fillStyle = 'green';
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
+}, "Verify that drawing to a 2D canvas that is not attached to the DOM dispatches a frame to an attached MediaRecorder." );
+
+async_test(t => {
+ var canvas = document.createElement('canvas');
+
+ var recorder = new MediaRecorder(canvas.captureStream());
+ recorder.ondataavailable = function() {
+ t.step_func_done(function() {
+ assert_true(event.data.size > 0, 'Recorded data size should be > 0');
+ })();
+ recorder.stop();
+ }
+ recorder.start(0);
+
+ var gl = canvas.getContext('webgl');
+ gl.clearColor(0, 1, 0, 1);
+ gl.clear(gl.COLOR_BUFFER_BIT);
+}, "Verify that drawing to a webgl canvas that is not attached to the DOM dispatches a frame to an attached MediaRecorder." );
+</script>

Powered by Google App Engine
This is Rietveld 408576698