Bug 845676 - Remove most of the assertion annotations in the content/media mochitests...
[gecko.git] / content / media / test / test_loop.html
blobf20c65df630dbd6669ed746954e43618313d5803
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <title>Test looping support</title>
5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
7 <script type="text/javascript" src="manifest.js"></script>
8 </head>
9 <body>
10 <pre id="test">
11 <script class="testbody" type="text/javascript">
12 var manager = new MediaTestManager;
14 function startTest(test, token) {
15 manager.started(token);
16 var v = document.createElement('video');
17 v.token = token;
18 v.src = test.name;
19 v.name = test.name;
20 v.playCount = 0;
21 v.seekingCount = 0;
22 v.seekedCount = 0;
23 v.loop = true;
25 v.addEventListener("play", function (e) {
26 e.target.playCount += 1;
27 ok(e.target.playCount == 1, "Should get exactly one play event.");
28 }, false);
30 v.addEventListener("seeking", function (e) {
31 e.target.seekingCount += 1;
32 }, false);
34 v.addEventListener("seeked", function (e) {
35 e.target.seekedCount += 1;
36 if (e.target.seekedCount == 3) {
37 ok(e.target.seekingCount == 3, "Expect matched pairs of seeking/seeked events.");
38 e.target.loop = false;
40 }, false);
42 v.addEventListener("ended", function (e) {
43 ok(!e.target.loop, "Shouldn't get ended event while looping.");
44 e.target.parentNode.removeChild(v);
45 manager.finished(e.target.token);
46 }, false);
48 document.body.appendChild(v);
49 v.play();
52 manager.runTests(gSmallTests, startTest);
53 </script>
54 </pre>
55 </body>
56 </html>