]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#390] Adds removeInstanceById existance test
authorrwldrn <waldron.rick@gmail.com>
Tue, 8 Mar 2011 20:11:16 +0000 (15:11 -0500)
committerrwldrn <waldron.rick@gmail.com>
Tue, 8 Mar 2011 20:11:16 +0000 (15:11 -0500)
plugins/index.html [new file with mode: 0644]
test/outbound.html [new file with mode: 0644]
test/popcorn.unit.js

diff --git a/plugins/index.html b/plugins/index.html
new file mode 100644 (file)
index 0000000..1451fc2
--- /dev/null
@@ -0,0 +1,58 @@
+<!DOCTYPE>
+<html>
+<head>
+  <title>Popcorn Plug-in Unit Tests</title>  
+</head>
+<body onload="runAllTests();">
+  <div style="position:absolute;top:0px;left:0px;width:150px;height:100%">
+    <h1>Popcorn Plug-in Unit Tests</h1>
+    <button type="button" onclick="runAllTests();">Run all Tests</button>
+    <ul id="menuItems">
+      <li><a onclick="clearEvents();" target="out" href="attribution/popcorn.attribution.unit.html">attribution</a></li>
+      <li><a onclick="clearEvents();" target="out" href="flickr/popcorn.flickr.unit.html">flickr</a></li>
+      <li><a onclick="clearEvents();" target="out" href="footnote/popcorn.footnote.unit.html">footnote</a></li>
+      <li><a onclick="clearEvents();" target="out" href="googlemap/popcorn.googlemap.unit.html">googlemap</a></li>
+      <li><a onclick="clearEvents();" target="out" href="googlenews/popcorn.googlenews.unit.html">googlenews</a></li>
+      <li><a onclick="clearEvents();" target="out" href="image/popcorn.image.unit.html">image</a></li>
+      <li><a onclick="clearEvents();" target="out" href="lowerthird/popcorn.lowerthird.unit.html">lowerthird</a></li>
+      <li><a onclick="clearEvents();" target="out" href="subtitle/popcorn.subtitle.unit.html">subtitle</a></li>
+      <li><a onclick="clearEvents();" target="out" href="tagthisperson/popcorn.tagthisperson.unit.html">tagthisperson</a></li>
+      <li><a onclick="clearEvents();" target="out" href="twitter/popcorn.twitter.unit.html">twitter</a></li>
+      <li><a onclick="clearEvents();" target="out" href="webpage/popcorn.webpage.unit.html">webpage</a></li>
+      <li><a onclick="clearEvents();" target="out" href="wikipedia/popcorn.wikipedia.unit.html">wikipedia</a></li>
+    </ul>
+  </div>
+  <iframe id="out" name="out" style="position:absolute;top:0px;left:150px;height:100%;width:100%"></iframe>
+  <script>
+  var eventList = [];
+  function runAllTests(){
+    var testUrl = [ "attribution", "flickr", "footnote", "googlemap", 
+                    "googlenews", "image", "lowerthird", "subtitle", 
+                    "tagthisperson", "twitter", "webpage", "wikipedia" ];
+    //googlenews and lowerthird tests do not exist, therefore their test time is set to 0
+    var testDur = [ 15000, 10000, 20000, 10000, 0, 10000, 
+                    0, 25000, 15000, 10000, 20000, 15000 ];
+    
+    var setTest = function( index ) {
+      var url = function( str ) {
+        return str + "/popcorn." + str + ".unit.html";
+      };
+      document.getElementById('out').src = url( testUrl[ index ] );
+    };
+      
+    for ( var i = 0, delay = 0; i < 10; delay += testDur[i], i++ ) {
+      (function ( j ) {
+        eventList[j] = setTimeout(function() {
+          setTest( j );
+        }, delay);
+      })( i );
+    }
+  }
+  function clearEvents(){
+    for( x in eventList ) {
+      clearTimeout( x );
+    }
+  }
+  </script>
+</body>
+</html>
diff --git a/test/outbound.html b/test/outbound.html
new file mode 100644 (file)
index 0000000..73948da
--- /dev/null
@@ -0,0 +1,41 @@
+<!DOCTYPE html>\r
+<html>\r
+<head>\r
+  <title>Popcorn API: Outbound Link Pausing</title>\r
+  <link rel="stylesheet" href="qunit/qunit.css" type="text/css" media="screen">\r
+  <script src="../popcorn.js"></script>\r
+  <script>\r
+  \r
+  document.addEventListener( "DOMContentLoaded", function() {\r
+\r
+    Popcorn("#video").play();\r
+\r
+  }, false);  \r
+  </script>\r
+  \r
+</head>\r
+<body>\r
+\r
+  <ul>\r
+    <li><a href="http://mozilla.org" target="_blank">Mozilla.org</a></li>\r
+    <li><a href="http://popcornjs.org" target="_blank">Popcornjs.org</a></li>\r
+\r
+  </ul>\r
+\r
+  <video id='video' style="display:" \r
+    controls \r
+    poster="http://media.w3.org/2010/05/sintel/poster.png"> \r
+\r
+    <source id='mp4'\r
+      src="http://media.w3.org/2010/05/sintel/trailer.mp4"\r
+      type='video/mp4; codecs="avc1, mp4a"'> \r
+\r
+    <source id='ogv'\r
+      src="http://media.w3.org/2010/05/sintel/trailer.ogv"\r
+      type='video/ogg; codecs="theora, vorbis"'> \r
+\r
+    <p>Your user agent does not support the HTML5 Video element.</p> \r
+\r
+  </video>   \r
+</body>\r
+</html>\r
index a13ce555a7d0f3cb3c4d0d20b9cfe03b659e86f9..56a061e236db1f83a9b9fa92e65bbd01dfafba50 100755 (executable)
@@ -68,7 +68,7 @@ test("Utility", function () {
 });
 
 test("Instances", function() {
-  var expects = 10, 
+  var expects = 11, 
       count   = 0,
       instance;
   
@@ -90,6 +90,9 @@ test("Instances", function() {
   
   ok( typeof Popcorn.getInstanceById === "function" , "Popcorn.getInstanceById is a provided utility function");
   plus();
+
+  ok( typeof Popcorn.removeInstanceById === "function" , "Popcorn.removeInstanceById is a provided utility function");  
+  plus();
   
   ok( typeof Popcorn.instanceIds === "object" , "Popcorn.instanceIds is a provided cache object");
   plus();