content/media/test/test_closing_connections.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/media/test/test_closing_connections.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,57 @@
     1.4 +hg diff<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=479863
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 479863 --- loading many connections</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.13 +  <script type="application/javascript" src="use_large_cache.js"></script>
    1.14 +  <script type="text/javascript" src="manifest.js"></script>
    1.15 +</head>
    1.16 +<body>
    1.17 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=479863">Mozilla Bug 479863</a>
    1.18 +<p id="display"></p>
    1.19 +<div id="content" style="display: none">
    1.20 +  
    1.21 +</div>
    1.22 +
    1.23 +<script type="application/javascript">
    1.24 +window.onload = function() {
    1.25 +  ok(true, "loaded metadata for all videos");
    1.26 +  mediaTestCleanup();
    1.27 +  SimpleTest.finish();
    1.28 +}
    1.29 +
    1.30 +/*   With normal per-domain connection limits and a naive implementation, we
    1.31 +     won't ever be able to load all these videos because the first 15 (or whatever)
    1.32 +     will each take up one HTTP connection (which will be suspended) and then
    1.33 +     the others will be blocked by the per-domain HTTP connection limit. We
    1.34 +     pass this test by closing the connection for non-buffered videos after
    1.35 +     we've got the first frame.
    1.36 +*/
    1.37 +
    1.38 +var resource = getPlayableVideo(gSeekTests);
    1.39 +
    1.40 +SimpleTest.waitForExplicitFinish();
    1.41 +SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, beginTest);
    1.42 +function beginTest() {
    1.43 +  if (resource != null) {
    1.44 +    for (var i=0; i<20; ++i) {
    1.45 +      var v = document.createElement("video");
    1.46 +      v.src = resource.name;
    1.47 +      document.body.appendChild(v);
    1.48 +    }
    1.49 +  } else {
    1.50 +    todo(false, "No types supported");
    1.51 +  }
    1.52 +}
    1.53 +</script>
    1.54 +
    1.55 +<pre id="test">
    1.56 +<script type="application/javascript">
    1.57 +</script>
    1.58 +</pre>
    1.59 +</body>
    1.60 +</html>

mercurial