--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Popcorn Google News Plug-in Test</title>
+ <link rel="stylesheet" href="../../test/qunit/qunit.css" type="text/css" media="screen">
+ <script src="../../test/qunit/qunit.js"></script>
+ <!--
+ do not move - this must be called immediately prior to
+ popcorn-api-draft.js
+ -->
+
+ <script src="../../popcorn.js"></script>
+
+ <script src="popcorn.googlenews.js"></script>
+ <script src="popcorn.googlenews.unit.js"></script>
+</head>
+<body>
+ <h1 id="qunit-header">Popcorn Google News Plugin</h1>
+ <h2 id="qunit-banner"></h2>
+ <div id="qunit-testrunner-toolbar"></div>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture"> </div>
+
+ <video id='video'
+ controls preload='none'
+ 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 id="googlenewsdiv"></div>
+</body>
+</html>
--- /dev/null
+test( "Popcorn google news Plugin", function () {
+
+ var popped = Popcorn( "#video" ),
+ expects = 7,
+ count = 0,
+ googlenewsdiv = document.getElementById( "googlenewsdiv" );
+
+ expect(expects);
+
+ function plus() {
+ if ( ++count===expects ) {
+ start();
+ }
+ }
+
+ stop();
+
+ ok ( "googlenews" in popped, "googlenews is a method of the popped instance" );
+ plus();
+
+ equals ( googlenewsdiv.innerHTML, "", "initially, there is nothing inside the googlenewsdiv" );
+ plus();
+
+ popped.googlenews({
+ start: 0, // seconds
+ end: 5, // seconds
+ topic: "Oil Spill",
+ target: "googlenewsdiv"
+ })
+ .googlenews({
+ start: 3, // seconds
+ end: 10, // seconds
+ topic: "Village Telco",
+ target: "googlenewsdiv"
+ })
+ .volume( 0 );
+
+ popped.exec( 1, function() {
+ equals( googlenewsdiv.childElementCount, 2, "googlenewsdiv now has two inner elements" );
+ plus();
+ equals( googlenewsdiv.children[0].style.display , "inline", "first googlenews is visible on the page" );
+ plus();
+ });
+
+ popped.exec( 4, function() {
+ equals( googlenewsdiv.children[1].style.display , "inline", "second googlenews is visible on the page" );
+ plus();
+ });
+
+ popped.exec( 11, function() {
+ equals( googlenewsdiv.children[1].style.display , "none", "second googlenews is no longer visible on the page" );
+ plus();
+ equals( googlenewsdiv.children[0].style.display , "none", "first googlenews is no longer visible on the page" );
+ plus();
+ });
+
+ popped.play();
+
+});
\ No newline at end of file