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

Side by Side Diff: LayoutTests/media/video-played.js

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: Fix event-attributes expectations. 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
« no previous file with comments | « LayoutTests/media/video-playbackrate.html ('k') | LayoutTests/media/video-played-reset.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 var expectedStartTimes = new Array(); 2 var expectedStartTimes = new Array();
3 var expectedEndTimes = new Array(); 3 var expectedEndTimes = new Array();
4 var timeRangeCount = 0; 4 var timeRangeCount = 0;
5 var currentTimeRange = 0; 5 var currentTimeRange = 0;
6 var currentTest = 0; 6 var currentTest = 0;
7 var willPauseInExistingRange = false; 7 var willPauseInExistingRange = false;
8 var willExtendAnExistingRange = false; 8 var willExtendAnExistingRange = false;
9 9
10 var testStartTime = 0; 10 var testStartTime = 0;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 109 }
110 110
111 run("video.play()"); 111 run("video.play()");
112 112
113 var startTime = nowInSecs(); 113 var startTime = nowInSecs();
114 var playedFromTime = video.currentTime; 114 var playedFromTime = video.currentTime;
115 var playDuration = milliToSecs(milliseconds); 115 var playDuration = milliToSecs(milliseconds);
116 var callPauseIfTimeIsReached = function () 116 var callPauseIfTimeIsReached = function ()
117 { 117 {
118 var playedTime = video.currentTime - playedFromTime; 118 var playedTime = video.currentTime - playedFromTime;
119 119
120 if (playedTime < 0) { 120 if (playedTime < 0) {
121 // Deal with 'loop' attribue. This work only once, hence the warning 121 // Deal with 'loop' attribue. This work only once, hence the warning
122 // At the begining of playForMillisecs() 122 // At the begining of playForMillisecs()
123 playedTime = video.duration - playedFromTime + video.currentTime; 123 playedTime = video.duration - playedFromTime + video.currentTime;
124 } 124 }
125 125
126 var elapsed = nowInSecs() - startTime; 126 var elapsed = nowInSecs() - startTime;
127 if (elapsed > 2) { 127 if (elapsed > 2) {
128 // Just in case something goes wrong. 128 // Just in case something goes wrong.
129 failTest("ERROR: test stalled, waited " + elapsed + " seconds for mo vie to play " + playedTime + " seconds"); 129 failTest("ERROR: test stalled, waited " + elapsed + " seconds for mo vie to play " + playedTime + " seconds");
(...skipping 16 matching lines...) Expand all
146 function videoPlayedMain() 146 function videoPlayedMain()
147 { 147 {
148 findMediaElement(); 148 findMediaElement();
149 149
150 video.src = findMediaFile("video", "content/test"); 150 video.src = findMediaFile("video", "content/test");
151 151
152 waitForEvent("error"); 152 waitForEvent("error");
153 waitForEvent("loadstart"); 153 waitForEvent("loadstart");
154 waitForEvent("ratechange"); 154 waitForEvent("ratechange");
155 waitForEvent("loadedmetadata"); 155 waitForEvent("loadedmetadata");
156 waitForEvent("canplay", canplay); // Will trigger nextTest() which launches the tests. 156 waitForEventOnce("canplay", canplay); // Will trigger nextTest() which launc hes the tests.
157 waitForEvent("pause", pause); 157 waitForEvent("pause", pause);
158 158
159 video.load(); 159 video.load();
160 } 160 }
OLDNEW
« no previous file with comments | « LayoutTests/media/video-playbackrate.html ('k') | LayoutTests/media/video-played-reset.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698