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.

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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
<!DOCTYPE HTML>
<html>
<head>
  <title>Media test: seeking to a negative time with readyState HAVE_NOTHING</title>
  <script 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 startTest(test, token) {
  var type = getMajorMimeType(test.type);
  var v = document.createElement(type);
  v.token = token;
  manager.started(token);

  // Seek to negative start time.
  v.currentTime = -123;
  is(v.readyState, v.HAVE_NOTHING, "readyState is HAVE_NOTHING");
  ok(!v.seeking, "can't be seeking prior src defined");
  is(v.currentTime, -123, "currentTime is original seek time");

  v.src = test.name;

  // Initialize running variables.
  v._name = test.name;
  v._seekStarted = false;
  v._seekCompleted = false;
  v._metadata = false;

  var events = [ "suspend", "play", "canplay", "canplaythrough", "loadstart",
                 "loadedmetadata", "loadeddata", "playing", "ended", "error",
                 "stalled", "emptied", "abort", "waiting", "pause" ];
  function logEvent(e) {
    var video = e.target;
    Log(e.target.token, "got " + e.type + " with currentTime = " + video.currentTime);
  }
  events.forEach(function(e) {
    v.addEventListener(e, logEvent);
  });

  once(v, "seeking", function() {
    v._seekStarted = true;
    ok(v.currentTime >= 0, "currentTime should be positive");
  });
  once(v, "seeked", function() {
    v._seekCompleted = true;
    ok(v.currentTime >= 0, "currentTime should be positive");
  });
  once(v, "loadedmetadata", function() {
    v._metadata = true;
    ok(v.seeking, "element is seeking once readyState is HAVE_METADATA");
    ok(v.currentTime >= 0, "currentTime should be positive");
  });
  once(v, "ended", function() {
    ok(v._seekStarted, "seek should have started");
    ok(v._seekCompleted, "seek should have completed");
    ok(v._metadata, "loadedmetadata fired");
    ok(v.currentTime >= 0, "currentTime should be positive");
    removeNodeAndSource(v);
    manager.finished(v.token);
  });

  v.play();
}


manager.runTests(gSmallTests, startTest);

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