]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#541] Wrote some unit tests in order to test the timeupdating functionality of the...
authorDavid Seifried <david.c.seifried@gmail.com>
Mon, 6 Jun 2011 18:38:09 +0000 (14:38 -0400)
committerDavid Seifried <david.c.seifried@gmail.com>
Mon, 6 Jun 2011 18:38:09 +0000 (14:38 -0400)
players/baseplayer/popcorn.baseplayer.js
players/baseplayer/popcorn.baseplayer.unit.html
players/baseplayer/popcorn.baseplayer.unit.js

index 4765c6ab5aed52aefc349116e1f461d7558a8afd..9666d4270ce4627cc74038af34935a747fdb9c14 100644 (file)
@@ -59,7 +59,7 @@
       
       setTimeout( function() {
         self.timeupdate.call( self );
-      }, 15 );
+      }, 250 );
     },
     
     // By default, assumes this.resource is a DOM Element
index 676ab77adc72c400adb02e20a80826c8d01b7b35..d2161dcb7433d22155d4b7032a5a696f3e6f9e1d 100644 (file)
       height: 250px;
       background: #FFAAAA;
     }
+
+    #video {
+      position: absolute;
+      left:620px;
+      top: 260px;
+      width: 300px;
+      height: 175px;
+      background: #FFAAAA;
+    }
   </style>
 </head>
 <body>
   <div id="qunit-fixture">  </div>
   
   <span id="player_1">This is a container for the player, auto-sized for testing purposes.</span>
+  <div >
+    <video id='video'
+      controls
+      width= '250px'
+      poster="../../test/poster.png">
+
+      <source id='mp4'
+        src="../../test/trailer.mp4"
+        type='video/mp4; codecs="avc1, mp4a"'>
+
+      <source id='ogv'
+        src="../../test/trailer.ogv"
+        type='video/ogg; codecs="theora, vorbis"'>
+
+      <p>Your user agent does not support the HTML5 Video element.</p>
+
+    </video>
+  </div>
 </body>
 </html>
index d890f908969b6f31f8340158bff65e4ea3f821f1..16e346bbc63c498669c199b848818ca19d5e6621 100644 (file)
@@ -119,16 +119,16 @@ test( "Default Functionality", function () {
     
     player.pause();
   });
-  
   player.play();
 });
 
 
 test( "Extension and Method Overriding", function () {
-  var expects = 4,
+  var expects = 5,
       count = 0,
       player = Popcorn.baseplayer(),
       playerForPopcorn = Popcorn.baseplayer(),
+      player2 = Popcorn("#video"),
       popcorn;
       
   function plus() {
@@ -163,11 +163,14 @@ test( "Extension and Method Overriding", function () {
   
   popcorn = Popcorn( playerForPopcorn )
             .exec( 2, function() {
+              ok( Math.abs(player2.currentTime() - playerForPopcorn.currentTime) < 0.2, "Time update is within a reasonable range" );
+              plus();
               ok( true, "Exec triggereed from popcorn after 2 seconds" );
               plus();
             });
   
   player.load();
+  player2.play();
   player.play();
   
   // Each player will define its own criteria for when readyState should be changed