content/media/test/test_no_load_event.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/media/test/test_no_load_event.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,59 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=715469
     1.8 +-->
     1.9 +<head>
    1.10 +  <meta charset="utf-8">
    1.11 +  <title>Test for Bug 715469</title>
    1.12 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +  <script type="text/javascript" src="manifest.js"></script>
    1.15 +</head>
    1.16 +<body onload="start();">
    1.17 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=715469">Mozilla Bug 715469</a>
    1.18 +<p id="display"></p>
    1.19 +<div id="content" style="display: none">
    1.20 +  
    1.21 +</div>
    1.22 +<pre id="test">
    1.23 +
    1.24 +<script type="application/javascript">
    1.25 +
    1.26 +/** Test for Bug 715469 **/
    1.27 +
    1.28 +var gotLoadEvent = false;
    1.29 +
    1.30 +function start() {
    1.31 +  var resource = getPlayableVideo(gSmallTests);
    1.32 +  if (resource == null) {
    1.33 +    todo(false, "No types supported");
    1.34 +  } else {
    1.35 +    SimpleTest.waitForExplicitFinish();
    1.36 +    var v = document.createElement("video");
    1.37 +    v.src = resource.name;
    1.38 +    v.addEventListener("loadeddata", function(){v.play();}, false);
    1.39 +    v.controls = "true";
    1.40 +    
    1.41 +    v.addEventListener("load",
    1.42 +      function(){
    1.43 +        gotLoadEvent = true;
    1.44 +      },
    1.45 +      false);
    1.46 +      
    1.47 +    v.addEventListener("ended", finished, false);
    1.48 +    
    1.49 +    document.body.appendChild(v);
    1.50 +  }
    1.51 +}
    1.52 +
    1.53 +function finished() {
    1.54 +  is(gotLoadEvent, false, "Should not receive a load on the video element");
    1.55 +  SimpleTest.finish();
    1.56 +}
    1.57 +
    1.58 +
    1.59 +</script>
    1.60 +</pre>
    1.61 +</body>
    1.62 +</html>

mercurial