DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (409f3966645a)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
<!DOCTYPE HTML>
<html>
<head>
  <title>Test playback of media files that should have errors</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>
<pre id="test">
<script class="testbody" type="text/javascript">

var manager = new MediaTestManager;

function checkDuration(name, e, test) {
  if (test.duration) {
    ok(Math.abs(e.duration - test.duration) < 0.1,
       name + " duration (" + e.duration + ") should be around " + test.duration);
  } else {
    ok(false, "Test doesn't include the duration field!")
  }
}

function startTest(test, token) {
  manager.started(token);

  let v = document.createElement('video');
  v._loadedMetadata = false;
  let name = test.name;

  v.onloadedmetadata = function() {
    v.onloadedmetadata = null;
    v._loadedMetadata = true;
    ok(v._loadedMetadata , name + " has loaded metadata.");
  }

  v.onerror = function() {
    v.onerror = null;
    ok(v._loadedMetadata , name + " should load metadata before getting error.");
    checkDuration(name, v, test);
    manager.finished(token);
  }

  v.src = name;
  document.body.appendChild(v);
  v.play();
}

manager.runTests(gDurationTests, startTest);

</script>
</pre>
</body>
</html>