Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Unified Diff: chrome/test/data/media/html/media_seek.html

Issue 9960063: CNS seek tests for <video>. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Re-write. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/data/media/html/utils.js » ('j') | chrome/test/data/media/html/utils.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/media/html/media_seek.html
diff --git a/chrome/test/data/media/html/media_seek.html b/chrome/test/data/media/html/media_seek.html
new file mode 100644
index 0000000000000000000000000000000000000000..177fba0c2a584cd65bf3535db146d9abfd880293
--- /dev/null
+++ b/chrome/test/data/media/html/media_seek.html
@@ -0,0 +1,101 @@
+<!-- Used by media_seek_perf to record seek perf metrics. -->
+<!DOCTYPE html>
+<html lang="en-US">
+ <head>
+ <title>CNS Seek Tests</title>
+ <script src="utils.js" type="text/javascript"></script>
+ </head>
+
+ <body>
+ <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
+ <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.
+ </body>
+
+ <script type="text/javascript">
+ var video = document.querySelector("video");
+ var log_div = document.querySelector("div");
+
+ function log(text) {
+ log_div.innerText += text + "\n";
+ }
+
+ // Called by the PyAuto controller to initiate testing.
+ function startTest(src) {
+ if (window.domAutomationController)
+ window.domAutomationController.send(true);
+
+ cached_seeks = [];
+ uncached_seeks = [];
+ cached_after_seek = [];
+ endTest = false;
+ errorMsg = "";
+ timer = new Timer();
+
+ iteration = 0;
+ originalSrc = src;
+ video.addEventListener("playing", playing);
+ video.addEventListener("seeked", seeked);
+ video.addEventListener("error",
+ function() { end("Error loading media"); });
+ IterationTest();
+ }
+
+ function IterationTest() {
+ 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.
+ iteration++;
+ 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.
+ video.src = generateSrc(originalSrc);
+ video.play();
+ }
+ else {
DaleCurtis 2012/04/18 18:57:53 Else goes on previous line.
shadi 2012/04/19 04:16:59 Done.
+ endTest = true;
+ log (cached_seeks);
DaleCurtis 2012/04/18 18:57:53 s/log (/log(/ here and elsewhere.
shadi 2012/04/19 04:16:59 Done.
+ log (uncached_seeks);
+ 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.
+ }
+ }
+
+ function playing() {
+ if (seek_turn == 0) {
+ timer.start();
+ video.currentTime = 1;
+ }
+ }
+
+ function seeked() {
+ delta = timer.stop();
+ switch (seek_turn) {
+ // first short seek
+ case 0:
+ cached_seeks.push(delta)
+ log ("short seek in " + delta + "ms.")
+ timer.start();
+ 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.
+ video.currentTime = video.duration - 1;
+ break;
+ // Seek to almost end of file (uncached)
+ case 1:
+ uncached_seeks.push(delta)
+ log ("long seek in " + delta + "ms.")
+ timer.start();
+ seek_turn++;
+ video.currentTime = 1;
+ break;
+ // Second seek to a buffered aread.
+ case 2:
+ cached_after_seek.push(delta)
+ log ("cached_after_seek seek in " + delta + "ms.")
+ IterationTest();
+ break;
+ default:
+ end("An un-expected seek occured.");
+ }
+ }
+
+ function end(msg) {
+ errorMsg = msg;
+ endTest = true;
+ log (msg);
+ }
+ </script>
+</html>
« no previous file with comments | « no previous file | chrome/test/data/media/html/utils.js » ('j') | chrome/test/data/media/html/utils.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698