Bug 879717: Part 2: Add mochitest for canvas drawImage with video.mozSrcObject=stream r=roc
☠☠ backed out by 189ac924dfa6 ☠ ☠
authorAndreas Pehrson <pehrsons@gmail.com>
Mon, 06 Oct 2014 11:22:55 +0200
changeset 233270 ecd54a3fbfddd0260566ff8a0269e3bca3223a2c
parent 233269 8f472a850073d4b0ad52e276bdfcac39263cf780
child 233271 f749e3f70ffc956291c4738140c896d1a9e718c0
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs879717
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 879717: Part 2: Add mochitest for canvas drawImage with video.mozSrcObject=stream r=roc
content/media/test/mochitest.ini
content/media/test/test_bug879717.html
--- a/content/media/test/mochitest.ini
+++ b/content/media/test/mochitest.ini
@@ -314,16 +314,17 @@ skip-if = buildapp == 'mulet' || os == '
 [test_bug465498.html]
 [test_bug493187.html]
 [test_bug495145.html]
 [test_bug495300.html]
 [test_bug654550.html]
 [test_bug686942.html]
 [test_bug726904.html]
 [test_bug874897.html]
+[test_bug879717.html]
 [test_bug883173.html]
 [test_bug895091.html]
 [test_bug895305.html]
 [test_bug919265.html]
 [test_bug957847.html]
 [test_bug1018933.html]
 [test_can_play_type.html]
 [test_can_play_type_mpeg.html]
new file mode 100644
--- /dev/null
+++ b/content/media/test/test_bug879717.html
@@ -0,0 +1,65 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test for bug 879717, check that a video element can be drawn into a canvas directly on 'play' event</title>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+  <script type="text/javascript" src="manifest.js"></script>
+</head>
+<body>
+<video id="v1" autoplay />
+<video id="v2" autoplay />
+<canvas id="c1" />
+<canvas id="c2" />
+<pre id="test">
+<script class="testbody" type="text/javascript">
+SimpleTest.waitForExplicitFinish();
+
+var media = getPlayableVideo(gSmallTests);
+
+var checkDrawImage = function(video, canvas, name) {
+  var exception = null;
+  var exceptionName = "nothing";
+  try {
+    var ctx = canvas.getContext('2d');
+    ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
+  } catch (e) {
+    exception = e;
+    exceptionName = e.name;
+  }
+  ok(exception === null || video.ended,
+    "drawImage shouldn't throw an exception on play of " + name + ", got " + exceptionName);
+};
+
+if (media == null) {
+  todo(false, "No media supported.");
+  SimpleTest.finish();
+} else {
+  v1.src = media.name;
+  v2.mozSrcObject = v1.mozCaptureStream();
+
+  var v1Tested = false;
+  var v2Tested = false;
+
+  v1.addEventListener('play', function() {
+    checkDrawImage(v1, c1, media.name);
+
+    v1Tested = true;
+    if (v2Tested) {
+      SimpleTest.finish();
+    }
+  });
+
+  v2.addEventListener('play', function() {
+    checkDrawImage(v2, c2, "stream of " + media.name);
+
+    v2Tested = true;
+    if (v1Tested) {
+      SimpleTest.finish();
+    }
+  });
+}
+</script>
+</pre>
+</body>
+</html>