OLD | NEW |
---|---|
(Empty) | |
1 | |
wolenetz
2015/02/13 23:47:46
nit: drop blank line
chcunningham
2015/02/14 02:47:17
Done.
| |
2 <!DOCTYPE html> | |
3 <html> | |
4 <head> | |
5 <script src=media-file.js></script> | |
6 <script src=video-test.js></script> | |
7 | |
8 <script> | |
9 function start() | |
10 { | |
11 findMediaElement(); | |
12 var mediaFile = findMediaFile("video", "content/test"); | |
13 video.src = mediaFile; | |
14 | |
wolenetz
2015/02/13 23:47:45
nit: drop the trailing spaces on this line
fyi htt
chcunningham
2015/02/14 02:47:17
Done. And added the trim on save to my config.
| |
15 consoleWrite("<br><em>++ Video is initially paused and 'loop' un set.</em>"); | |
wolenetz
2015/02/13 23:47:45
nit ditto (trailing spaces)
chcunningham
2015/02/14 02:47:17
Done.
| |
16 testExpected("video.paused", true) | |
17 testExpected("video.loop", false); | |
18 | |
19 playWhenReady(); | |
wolenetz
2015/02/13 23:47:46
nit: s/play/seekThenPlay/ ? no strong feeling thou
chcunningham
2015/02/14 02:47:17
Done.
| |
20 } | |
21 | |
22 function playWhenReady() { | |
23 if (video.readyState < HTMLMediaElement.HAVE_METADATA) { | |
24 setTimeout(playWhenReady, 100); | |
25 return; | |
26 } | |
27 | |
28 consoleWrite("<br><em>++ Seek to just before the end of the vide o and play.</em>"); | |
29 run("video.currentTime = video.duration - .5"); | |
wolenetz
2015/02/13 23:47:45
nit: why .5 versus .4? No strong feeling.. just cu
chcunningham
2015/02/14 02:47:17
This file doesn't reference .4 at all. .4 seemed a
| |
30 waitForEvent("play"); | |
31 waitForEvent("ended", ended); | |
32 run("video.play()"); | |
33 consoleWrite(""); | |
34 } | |
35 | |
36 function ended() | |
wolenetz
2015/02/13 23:47:45
nit ditto (trailing spaces)
chcunningham
2015/02/14 02:47:17
Done.
| |
37 { | |
38 consoleWrite("<br><em>++ Verify played to end and stopped.</em>" ); | |
39 testExpected("video.ended", true); | |
40 testExpected("video.paused", true); | |
41 // Using reportExpected to avoid logging floating point value wh ich may differ across engines. | |
42 reportExpected(video.currentTime == video.duration, "video.curre ntTime", "==", "video.duration", video.currentTime); | |
43 | |
44 | |
wolenetz
2015/02/13 23:47:45
nit: remove extra blank line
chcunningham
2015/02/14 02:47:17
Done.
| |
45 consoleWrite("<br><em>++ With playback ended, set 'loop' attribu te. This will cause ended == false; looping video cannot be 'ended', only paused .</em>"); | |
46 testExpected("video.loop", false); | |
47 run("video.loop = true"); | |
48 testExpected("video.loop", true); | |
49 testExpected("video.ended", false); | |
50 testExpected("video.paused", true); | |
51 | |
52 consoleWrite("<br><em>++ Play video with 'loop' set. Expect seek back to start.<em>"); | |
53 waitForEvent("seeked", seeked); | |
54 run("video.play()"); | |
55 consoleWrite(""); | |
56 } | |
57 | |
58 function seeked() | |
59 { | |
60 consoleWrite("<br><em>++ Observed seek. Verify current time decr eased and still playing.</em>"); | |
61 testExpected("video.loop", true); | |
62 testExpected("video.paused", false); | |
63 testExpected("video.ended", false); | |
64 // Using reportExpected to avoid logging floating point value wh ich may differ across engines. | |
65 reportExpected(video.currentTime < video.duration, "video.curren tTime", "<", "video.duration", video.currentTime); | |
66 | |
67 consoleWrite("<br><em>++ Pausing now that test is over to preven t additional unwanted looping.</em>"); | |
68 run("video.pause()"); | |
69 consoleWrite(""); | |
70 endTest(); | |
71 } | |
72 </script> | |
73 | |
74 </head> | |
75 <body> | |
76 <video controls></video> | |
77 <p><b>Test looping edge case to verifies crbug.com/364442. Steps:</b> | |
78 <ol> | |
79 <li>Seek toward end of video (for faster testing).</li> | |
80 <li>Play video to end with 'loop' set to false.</li> | |
81 <li>Once ended, set 'loop' to true.</li> | |
82 <li>Call play.</li> | |
83 <li>Verify that 'seeked' event fires, seeking back to the beginning. </li> | |
84 <li>Pause video and end test.</li> | |
85 </ol> | |
86 </p> | |
87 <script>start()</script> | |
88 </body> | |
89 </html> | |
OLD | NEW |