| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Test that calling prompt() before the promise returned by the pre
vious call is resolved throws an exception</title> | 4 <title>Test that calling prompt() before the promise returned by the pre
vious call is resolved throws an exception</title> |
| 5 <script src="../../resources/testharness.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> | 6 <script src="../../resources/testharnessreport.js"></script> |
| 7 <script src="../media-file.js"></script> | 7 <script src="../media-file.js"></script> |
| 8 </head> | 8 </head> |
| 9 <body> | 9 <body> |
| 10 <button id="button">Click me</button> | 10 <button id="button">Click me</button> |
| 11 <script> | 11 <script> |
| 12 function clickOnElem(e) { | 12 function clickOnElem(e) { |
| 13 eventSender.mouseMoveTo( | 13 eventSender.mouseMoveTo( |
| 14 e.offsetLeft + e.offsetWidth / 2, | 14 e.offsetLeft + e.offsetWidth / 2, |
| 15 e.offsetTop + e.offsetHeight / 2); | 15 e.offsetTop + e.offsetHeight / 2); |
| 16 eventSender.mouseDown(); | 16 eventSender.mouseDown(); |
| 17 eventSender.mouseUp(); | 17 eventSender.mouseUp(); |
| 18 } | 18 } |
| 19 | 19 |
| 20 async_test(function(test) | 20 async_test(function(test) |
| 21 { | 21 { |
| 22 var v = document.createElement('video'); | 22 var v = document.createElement('video'); |
| 23 v.src = findMediaFile('video', 'content/test'); | 23 v.src = findMediaFile('video', 'content/test'); |
| 24 document.body.appendChild(v); | 24 document.body.appendChild(v); |
| 25 | 25 |
| 26 internals.mediaPlayerRemoteRouteAvailabilityChanged(v, true); |
| 27 |
| 26 var btn = document.getElementById('button'); | 28 var btn = document.getElementById('button'); |
| 27 btn.onclick = function() { | 29 btn.onclick = function() { |
| 28 v.remote.prompt(); | 30 v.remote.prompt(); |
| 29 | 31 |
| 30 btn.onclick = function() { | 32 btn.onclick = function() { |
| 31 v.remote.prompt().then( | 33 v.remote.prompt().then( |
| 32 test.unreached_func(), | 34 test.unreached_func(), |
| 33 test.step_func_done(function(e) { | 35 test.step_func_done(function(e) { |
| 34 assert_equals(e.name, 'OperationError'); | 36 assert_equals(e.name, 'OperationError'); |
| 35 assert_equals(e.message, 'A prompt is already be
ing shown for this media element.'); | 37 assert_equals(e.message, 'A prompt is already be
ing shown for this media element.'); |
| 36 })); | 38 })); |
| 37 btn.onclick = null; | 39 btn.onclick = null; |
| 38 }; | 40 }; |
| 39 clickOnElem(btn); | 41 clickOnElem(btn); |
| 40 } | 42 } |
| 41 | 43 |
| 42 clickOnElem(btn); | 44 clickOnElem(btn); |
| 43 }, 'Test that calling prompt() before the promise returned by the pr
evious call is resolved throws an exception.'); | 45 }, 'Test that calling prompt() before the promise returned by the pr
evious call is resolved throws an exception.'); |
| 44 </script> | 46 </script> |
| 45 </body> | 47 </body> |
| 46 </html> | 48 </html> |
| OLD | NEW |