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

Side by Side Diff: LayoutTests/media/video-played-reset.html

Issue 17395006: Fix LayoutTests that assume canplay, playing, and canplaythrough will only fire once. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <title>Test of 'played' attribute</title> 3 <title>Test of 'played' attribute</title>
4 <script src=media-file.js></script> 4 <script src=media-file.js></script>
5 <script src=video-test.js></script> 5 <script src=video-test.js></script>
6 <script src=video-played.js></script> 6 <script src=video-played.js></script>
7 <script> 7 <script>
8 8
9 var testFunctions = 9 var testFunctions =
10 [ 10 [
11 PlayWithNoRanges, 11 PlayWithNoRanges,
12 ResetToAVideoSource, 12 ResetToAVideoSource,
13 JumpAndPlayFwd, 13 JumpAndPlayFwd,
14 ResetToAnEmptyVideoSource 14 ResetToAnEmptyVideoSource
15 ]; 15 ];
16 16
17 // NOTE: Result details are not printed for this test because time v alues are different from machine 17 // NOTE: Result details are not printed for this test because time v alues are different from machine
18 // to machine and run to run. Commenting out the following line turn s on detailed logging back on, which 18 // to machine and run to run. Commenting out the following line turn s on detailed logging back on, which
19 // can be useful for debugging test failure. 19 // can be useful for debugging test failure.
20 disableFullTestDetailsPrinting(); 20 disableFullTestDetailsPrinting();
21 21
22 function PlayWithNoRanges() 22 function PlayWithNoRanges()
23 { 23 {
24 consoleWrite("<br><b><em>Test playing when there are no ranges</ em></b>"); 24 consoleWrite("<br><b><em>Test playing when there are no ranges</ em></b>");
25 25
26 timeRangeCount = currentTimeRange = 0; 26 timeRangeCount = currentTimeRange = 0;
27 willPauseInExistingRange = false; 27 willPauseInExistingRange = false;
28 willExtendAnExistingRange = false; 28 willExtendAnExistingRange = false;
29 29
30 startPlayingInNewRange(); 30 startPlayingInNewRange();
31 } 31 }
32 32
33 function ResetToAVideoSource() 33 function ResetToAVideoSource()
34 { 34 {
35 consoleWrite("<br><b><em>Test to reset to non empty video source </em></b>"); 35 consoleWrite("<br><b><em>Test to reset to non empty video source </em></b>");
36 36
37 timeRangeCount = currentTimeRange = 0; 37 timeRangeCount = currentTimeRange = 0;
38 expectedStartTimes = new Array(); 38 expectedStartTimes = new Array();
39 expectedEndTimes = new Array(); 39 expectedEndTimes = new Array();
40 40
41 willPauseInExistingRange = false; 41 willPauseInExistingRange = false;
42 willExtendAnExistingRange = false; 42 willExtendAnExistingRange = false;
43 43
44 var mediaFile = findMediaFile("video", "content/test"); 44 var mediaFile = findMediaFile("video", "content/test");
45 runSilently("video.src = \"" + mediaFile + "\""); 45 runSilently("video.src = \"" + mediaFile + "\"");
46
47 waitForEventOnce("canplay", canplay);
acolwell GONE FROM CHROMIUM 2013/06/18 21:35:07 This is needed now because of the waitForEventOnce
46 run("video.load()"); // Triggers canplay() 48 run("video.load()"); // Triggers canplay()
47 } 49 }
48 50
49 function JumpAndPlayFwd() 51 function JumpAndPlayFwd()
50 { 52 {
51 consoleWrite("<br><b><em>Test jumping forward into a new range a nd play</em></b>"); 53 consoleWrite("<br><b><em>Test jumping forward into a new range a nd play</em></b>");
52 54
53 var newTime = video.duration - 0.5; 55 var newTime = video.duration - 0.5;
54 runSilently("video.currentTime = " + (newTime.toFixed(2))); 56 runSilently("video.currentTime = " + (newTime.toFixed(2)));
55 57
56 willPauseInExistingRange = false; 58 willPauseInExistingRange = false;
57 willExtendAnExistingRange = false; 59 willExtendAnExistingRange = false;
58 currentTimeRange = 1; 60 currentTimeRange = 1;
59 61
60 startPlayingInNewRange(); 62 startPlayingInNewRange();
61 } 63 }
62 64
63 function ResetToAnEmptyVideoSource() 65 function ResetToAnEmptyVideoSource()
64 { 66 {
65 consoleWrite("<br><b><em>Test to reset to an empty video source< /em></b>"); 67 consoleWrite("<br><b><em>Test to reset to an empty video source< /em></b>");
66 68
67 willPauseInExistingRange = false; 69 willPauseInExistingRange = false;
68 willExtendAnExistingRange = false; 70 willExtendAnExistingRange = false;
69 timeRangeCount = currentTimeRange = 0; 71 timeRangeCount = currentTimeRange = 0;
70 72
71 expectedStartTimes = new Array(); 73 expectedStartTimes = new Array();
72 expectedEndTimes = new Array(); 74 expectedEndTimes = new Array();
73 75
74 run("video.src = \"\""); 76 run("video.src = \"\"");
75 waitForEvent("loadstart", function () { testRanges(); nextTest() ; }); 77 waitForEvent("loadstart", function () { testRanges(); nextTest() ; });
76 run("video.load()"); // Triggers loadstart() 78 run("video.load()"); // Triggers loadstart()
77 } 79 }
78 </script> 80 </script>
79 </head> 81 </head>
80 82
81 <body onload="videoPlayedMain()"> 83 <body onload="videoPlayedMain()">
82 84
83 <video controls></video> 85 <video controls></video>
84 <p>Test of the media element 'played' attribute</p> 86 <p>Test of the media element 'played' attribute</p>
85 87
86 </body> 88 </body>
87 </html> 89 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698