4 https://bugzilla.mozilla.org/show_bug.cgi?id=804875
8 <title>Test for bug
804875</title>
9 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
10 <script type=
"text/javascript" src=
"manifest.js"></script>
11 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
15 href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=804875">Mozilla Bug
804875</a>
20 <script class=
"testbody" type=
"text/javascript">
22 var manager = new MediaTestManager;
25 removeNodeAndSource(v);
26 manager.finished(v.token);
29 function onLoadedData_Audio(e) {
31 is(t.videoHeight,
0, t.name +
": videoHeight should be zero when there is no video.");
32 is(t.videoWidth,
0, t.name +
": videoWidth should be zero when there is no video.");
33 is(t.mozPaintedFrames,
0, t.name +
": mozPaintedFrames should be zero when there is no video.");
34 is(t.mozFrameDelay,
0, t.name +
": mozFrameDelay should be zero when there is no video.");
35 var c = document.getElementsByTagName(
"canvas")[
0].getContext(
"2d");
38 c.drawImage(t,
0,
0, t.videoHeight, t.videoWidth);
42 ok(!threw, t.name +
": Even though we don't succeed to draw a video frame on the canvas, we shouldn't throw.");
46 function onTimeUpdate_Video(e) {
48 if (t.currentTime < t.duration /
4) {
51 t.removeEventListener(
"timeupdate", onTimeUpdate_Video);
52 // There's no guarantee that a video frame composite notification reaches
53 // us before timeupdate fires.
54 ok(t.mozPaintedFrames
>=
0, t.name +
": mozPaintedFrames should be positive or zero, is " + t.mozPaintedFrames +
".");
55 ok(t.mozFrameDelay
>=
0, t.name +
": mozFrameDelay should be positive or zero, is " + t.mozFrameDelay +
".");
58 // eslint-disable-next-line no-self-assign
62 var source = getPlayableAudio(gPlayTests);
64 todo(
"No audio file available.")
67 t.removeEventListener(
"loadeddata", onLoadedData_Video);
68 t.addEventListener(
"loadeddata", onLoadedData_Audio);
74 function onLoadedData_Video(e) {
76 isnot(t.videoHeight,
0, t.name +
": We should have a videoHeight.");
77 isnot(t.videoWidth,
0, t.name +
": We should have a videoWidth.");
78 t.addEventListener(
"timeupdate", onTimeUpdate_Video);
82 function startTest(test, token) {
83 var v = document.createElement('video');
84 document.body.appendChild(v);
86 v.addEventListener(
"loadeddata", onLoadedData_Video);
91 manager.started(token);
94 manager.runTests(getPlayableVideos(gSmallTests.concat(gSeekTests)), startTest);