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

Unified Diff: content/test/data/media/canvas_capture.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: content/test/data/media/canvas_capture.html
diff --git a/content/test/data/media/canvas_capture.html b/content/test/data/media/canvas_capture.html
index 15a904264cd67b56b580adbe8d4a03ca7311dda7..d93dd9ceb956fbae1b63ea48fcef42550802366f 100644
--- a/content/test/data/media/canvas_capture.html
+++ b/content/test/data/media/canvas_capture.html
@@ -1,10 +1,10 @@
<!DOCTYPE html>
<html>
<head>
-<title>Media Capture from DOM Elements (video/audio) Browser Test</title>
+<title>Media Capture from Canvas ElementsBrowser Test</title>
</head>
<body>
- <div> Capture and playback from video/audio elements.</div>
+ <div> Capture and playback from canvas elements.</div>
</body>
<script type="text/javascript" src="webrtc_test_utilities.js"></script>
<script>
@@ -33,8 +33,17 @@ function drawWebGL(canvas, drawCounter) {
checkForRedraw(canvas, drawCounter, drawWebGL);
};
+function drawOffscreenCanvasCommit(canvas, drawCounter) {
+ var ctx = canvas.getContext('2d');
+ ctx.fillStyle = 'green';
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
+ ctx.commit();
+ checkForRedraw(canvas, drawCounter, drawOffscreenCanvasCommit);
+};
+
function testCanvasCapture(drawFunction) {
var canvas = document.createElement('canvas');
+ canvas.width = canvas.height = 64;
document.body.appendChild(canvas);
var stream = canvas.captureStream();
@@ -54,7 +63,12 @@ function testCanvasCapture(drawFunction) {
};
recorder.start(0);
- drawFunction(canvas, 0);
+ if (drawFunction.toString() == drawOffscreenCanvasCommit.toString()) {
+ var offscreen = canvas.transferControlToOffscreen();
+ drawFunction(offscreen, 0);
+ } else {
+ drawFunction(canvas, 0);
+ }
}
</script>

Powered by Google App Engine
This is Rietveld 408576698