| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Test the play() behaviour with regards to the returned promise for media
elements.</title> | 2 <title>Test the play() behaviour with regards to the returned promise for media
elements.</title> |
| 3 <script src="../resources/testharness.js"></script> | 3 <script src="../resources/testharness.js"></script> |
| 4 <script src="../resources/testharnessreport.js"></script> | 4 <script src="../resources/testharnessreport.js"></script> |
| 5 <script src="media-file.js"></script> | 5 <script src="media-file.js"></script> |
| 6 <script> | 6 <script> |
| 7 // This is testing the behavior of play() with regards to the returned | 7 // This is testing the behavior of play() with regards to the returned |
| 8 // promise. This test file is creating a small framework in order to be able | 8 // promise. This test file is creating a small framework in order to be able |
| 9 // to test different cases easily and independently of each other. | 9 // to test different cases easily and independently of each other. |
| 10 // All tests have to be part of the tests and testsWithUserGesture arrays. | 10 // All tests have to be part of the tests and testsWithUserGesture arrays. |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 assert_true(audio.paused); | 289 assert_true(audio.paused); |
| 290 }, | 290 }, |
| 291 | 291 |
| 292 // Test that when the load algorithm is run, if it rejects multiple | 292 // Test that when the load algorithm is run, if it rejects multiple |
| 293 // promises, they are rejected in the order in which they were added. | 293 // promises, they are rejected in the order in which they were added. |
| 294 function loadAlgorithmResolveOrdering(t, audio) { | 294 function loadAlgorithmResolveOrdering(t, audio) { |
| 295 var firstPromiseRejected = false; | 295 var firstPromiseRejected = false; |
| 296 audio.play().then(t.unreached_func(), t.step_func(function(e) { | 296 audio.play().then(t.unreached_func(), t.step_func(function(e) { |
| 297 assert_equals(e.name, 'AbortError'); | 297 assert_equals(e.name, 'AbortError'); |
| 298 assert_equals(e.message, | 298 assert_equals(e.message, |
| 299 'The play() request was interrupted by a call to pause().'); | 299 'The play() request was interrupted by a call to pause(). https:
//goo.gl/LdLk22'); |
| 300 firstPromiseRejected = true; | 300 firstPromiseRejected = true; |
| 301 })); | 301 })); |
| 302 | 302 |
| 303 audio.play().then(t.unreached_func(), t.step_func_done(function(e) { | 303 audio.play().then(t.unreached_func(), t.step_func_done(function(e) { |
| 304 assert_equals(e.name, 'AbortError'); | 304 assert_equals(e.name, 'AbortError'); |
| 305 assert_equals(e.message, | 305 assert_equals(e.message, |
| 306 'The play() request was interrupted by a call to pause().'); | 306 'The play() request was interrupted by a call to pause(). https:
//goo.gl/LdLk22'); |
| 307 assert_true(firstPromiseRejected); | 307 assert_true(firstPromiseRejected); |
| 308 })); | 308 })); |
| 309 | 309 |
| 310 setTimeout(t.step_func(function() { | 310 setTimeout(t.step_func(function() { |
| 311 audio.pause(); | 311 audio.pause(); |
| 312 audio.src = findMediaFile('audio', 'content/test'); | 312 audio.src = findMediaFile('audio', 'content/test'); |
| 313 }), 0); | 313 }), 0); |
| 314 }, | 314 }, |
| 315 ]; | 315 ]; |
| 316 | 316 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 function playWithUserGesture(t, audio) { | 363 function playWithUserGesture(t, audio) { |
| 364 document.onclick = function() { | 364 document.onclick = function() { |
| 365 playExpectingResolvedPromise(t, audio); | 365 playExpectingResolvedPromise(t, audio); |
| 366 document.onclick = null; | 366 document.onclick = null; |
| 367 }; | 367 }; |
| 368 | 368 |
| 369 eventSender.mouseDown(); | 369 eventSender.mouseDown(); |
| 370 eventSender.mouseUp(); | 370 eventSender.mouseUp(); |
| 371 } | 371 } |
| 372 </script> | 372 </script> |
| OLD | NEW |