Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!-- Used by media_seek_perf to record seek perf metrics. --> | |
| 2 <!DOCTYPE html> | |
| 3 <html lang="en-US"> | |
| 4 <head> | |
| 5 <title>CNS Seek Tests</title> | |
| 6 <script src="utils.js" type="text/javascript"></script> | |
| 7 </head> | |
| 8 | |
| 9 <body> | |
| 10 <video height=350 controls></video> | |
|
DaleCurtis
2012/04/18 18:57:53
Why set height?
shadi
2012/04/19 04:16:59
I had it while running the tests manually. Took it
| |
| 11 <div id="log"></div> | |
|
DaleCurtis
2012/04/18 18:57:53
Don't need the id anymore since you're using query
shadi
2012/04/19 04:16:59
Done.
| |
| 12 </body> | |
| 13 | |
| 14 <script type="text/javascript"> | |
| 15 var video = document.querySelector("video"); | |
| 16 var log_div = document.querySelector("div"); | |
| 17 | |
| 18 function log(text) { | |
| 19 log_div.innerText += text + "\n"; | |
| 20 } | |
| 21 | |
| 22 // Called by the PyAuto controller to initiate testing. | |
| 23 function startTest(src) { | |
| 24 if (window.domAutomationController) | |
| 25 window.domAutomationController.send(true); | |
| 26 | |
| 27 cached_seeks = []; | |
| 28 uncached_seeks = []; | |
| 29 cached_after_seek = []; | |
| 30 endTest = false; | |
| 31 errorMsg = ""; | |
| 32 timer = new Timer(); | |
| 33 | |
| 34 iteration = 0; | |
| 35 originalSrc = src; | |
| 36 video.addEventListener("playing", playing); | |
| 37 video.addEventListener("seeked", seeked); | |
| 38 video.addEventListener("error", | |
| 39 function() { end("Error loading media"); }); | |
| 40 IterationTest(); | |
| 41 } | |
| 42 | |
| 43 function IterationTest() { | |
| 44 if (iteration < 3) { | |
|
DaleCurtis
2012/04/18 18:57:53
Set iterations in startTest or in a const at the t
shadi
2012/04/19 04:16:59
Done.
| |
| 45 iteration++; | |
| 46 seek_turn = 0; | |
|
DaleCurtis
2012/04/18 18:57:53
seek_turn is a bit opaque, might be clearer as see
shadi
2012/04/19 04:16:59
Done.
| |
| 47 video.src = generateSrc(originalSrc); | |
| 48 video.play(); | |
| 49 } | |
| 50 else { | |
|
DaleCurtis
2012/04/18 18:57:53
Else goes on previous line.
shadi
2012/04/19 04:16:59
Done.
| |
| 51 endTest = true; | |
| 52 log (cached_seeks); | |
|
DaleCurtis
2012/04/18 18:57:53
s/log (/log(/ here and elsewhere.
shadi
2012/04/19 04:16:59
Done.
| |
| 53 log (uncached_seeks); | |
| 54 log (cached_after_seek); | |
|
DaleCurtis
2012/04/18 18:57:53
Instead of having cached, uncached, cached_after_s
shadi
2012/04/19 04:16:59
Done.
| |
| 55 } | |
| 56 } | |
| 57 | |
| 58 function playing() { | |
| 59 if (seek_turn == 0) { | |
| 60 timer.start(); | |
| 61 video.currentTime = 1; | |
| 62 } | |
| 63 } | |
| 64 | |
| 65 function seeked() { | |
| 66 delta = timer.stop(); | |
| 67 switch (seek_turn) { | |
| 68 // first short seek | |
| 69 case 0: | |
| 70 cached_seeks.push(delta) | |
| 71 log ("short seek in " + delta + "ms.") | |
| 72 timer.start(); | |
| 73 seek_turn++; | |
|
DaleCurtis
2012/04/18 18:57:53
Set seek_turn prior to timer.start() here and belo
shadi
2012/04/19 04:16:59
Done.
| |
| 74 video.currentTime = video.duration - 1; | |
| 75 break; | |
| 76 // Seek to almost end of file (uncached) | |
| 77 case 1: | |
| 78 uncached_seeks.push(delta) | |
| 79 log ("long seek in " + delta + "ms.") | |
| 80 timer.start(); | |
| 81 seek_turn++; | |
| 82 video.currentTime = 1; | |
| 83 break; | |
| 84 // Second seek to a buffered aread. | |
| 85 case 2: | |
| 86 cached_after_seek.push(delta) | |
| 87 log ("cached_after_seek seek in " + delta + "ms.") | |
| 88 IterationTest(); | |
| 89 break; | |
| 90 default: | |
| 91 end("An un-expected seek occured."); | |
| 92 } | |
| 93 } | |
| 94 | |
| 95 function end(msg) { | |
| 96 errorMsg = msg; | |
| 97 endTest = true; | |
| 98 log (msg); | |
| 99 } | |
| 100 </script> | |
| 101 </html> | |
| OLD | NEW |