[Modern Media Controls] Turn media/modern-media-controls/ios-inline-media-controls...
[WebKit-https.git] / LayoutTests / media / timeranges-nearest.html
1 <!DOCTYPE html>
2 <head>
3     <title>timeranges-nearest</title>
4     <script src="video-test.js"></script>
5     <script>
6     var timeRanges;
7     function runTest() {
8         if (!window.internals) {
9             failTest('This test requires window.internals.');
10             return;
11         }
12
13         var startTimes = new Float32Array([1, 4]);
14         var endTimes = new Float32Array([2, 5]);
15         timeRanges = internals.createTimeRanges(startTimes, endTimes);
16         testExpected("internals.closestTimeToTimeRanges( .5, timeRanges)", 1);
17         testExpected("internals.closestTimeToTimeRanges(1.5, timeRanges)", 1.5);
18         testExpected("internals.closestTimeToTimeRanges(2.1, timeRanges)", 2);
19         testExpected("internals.closestTimeToTimeRanges(3.0, timeRanges)", 2);
20         testExpected("internals.closestTimeToTimeRanges(3.9, timeRanges)", 4);
21         testExpected("internals.closestTimeToTimeRanges(5.5, timeRanges)", 5);
22         endTest();
23     }
24     </script>
25 </head>
26 <body onload="runTest()">
27     <div>This tests the ability of a TimeRanges object to return the time nearest its constituent ranges given a target time.</div>
28 </body>