| OLD | NEW |
| 1 (function(window) { | 1 (function(window) { |
| 2 EventExpectationsManager = function(test) | 2 EventExpectationsManager = function(test) |
| 3 { | 3 { |
| 4 this.test_ = test; | 4 this.test_ = test; |
| 5 this.eventTargetList_ = []; | 5 this.eventTargetList_ = []; |
| 6 this.waitCallbacks_ = []; | 6 this.waitCallbacks_ = []; |
| 7 }; | 7 }; |
| 8 | 8 |
| 9 EventExpectationsManager.prototype.expectEvent = function(object, eventName,
description) | 9 EventExpectationsManager.prototype.expectEvent = function(object, eventName,
description) |
| 10 { | 10 { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 test.expectEvent = function(object, eventName, description) | 174 test.expectEvent = function(object, eventName, description) |
| 175 { | 175 { |
| 176 test.eventExpectations_.expectEvent(object, eventName, description); | 176 test.eventExpectations_.expectEvent(object, eventName, description); |
| 177 }; | 177 }; |
| 178 | 178 |
| 179 test.waitForExpectedEvents = function(callback) | 179 test.waitForExpectedEvents = function(callback) |
| 180 { | 180 { |
| 181 test.eventExpectations_.waitForExpectedEvents(callback); | 181 test.eventExpectations_.waitForExpectedEvents(callback); |
| 182 }; | 182 }; |
| 183 | 183 |
| 184 test.waitForCurrentTimeChange = function(mediaElement, callback) |
| 185 { |
| 186 var initialTime = mediaElement.currentTime; |
| 187 |
| 188 var onTimeUpdate = test.step_func(function() |
| 189 { |
| 190 if (mediaElement.currentTime != initialTime) { |
| 191 mediaElement.removeEventListener('timeupdate', onTimeUpdate)
; |
| 192 callback(); |
| 193 } |
| 194 }); |
| 195 |
| 196 mediaElement.addEventListener('timeupdate', onTimeUpdate); |
| 197 } |
| 198 |
| 184 var oldTestDone = test.done.bind(test); | 199 var oldTestDone = test.done.bind(test); |
| 185 test.done = function() | 200 test.done = function() |
| 186 { | 201 { |
| 187 if (test.status == test.PASS) | 202 if (test.status == test.PASS) { |
| 188 assert_false(test.eventExpectations_.expectingEvents(), "No pend
ing event expectations."); | 203 assert_false(test.eventExpectations_.expectingEvents(), "No pend
ing event expectations."); |
| 204 } |
| 189 oldTestDone(); | 205 oldTestDone(); |
| 190 }; | 206 }; |
| 191 }; | 207 }; |
| 192 | 208 |
| 193 window['MediaSourceUtil'] = MediaSourceUtil; | 209 window['MediaSourceUtil'] = MediaSourceUtil; |
| 194 window['media_test'] = function(testFunction, description, options) | 210 window['media_test'] = function(testFunction, description, options) |
| 195 { | 211 { |
| 196 options = options || {}; | 212 options = options || {}; |
| 197 return async_test(function(test) | 213 return async_test(function(test) |
| 198 { | 214 { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 220 }; | 236 }; |
| 221 | 237 |
| 222 openMediaSource_(test, mediaTag, function(mediaSource) | 238 openMediaSource_(test, mediaTag, function(mediaSource) |
| 223 { | 239 { |
| 224 testFunction(test, mediaTag, mediaSource); | 240 testFunction(test, mediaTag, mediaSource); |
| 225 }); | 241 }); |
| 226 }, description, options); | 242 }, description, options); |
| 227 | 243 |
| 228 }; | 244 }; |
| 229 })(window); | 245 })(window); |
| OLD | NEW |