file_global_queue.html (2641B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1188099 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for Bug 1188099: Global queue should correctly schedule utterances</title> 9 <script type="application/javascript"> 10 window.SimpleTest = parent.SimpleTest; 11 window.info = parent.info; 12 window.is = parent.is; 13 window.isnot = parent.isnot; 14 window.ok = parent.ok; 15 window.todo = parent.todo; 16 </script> 17 <script type="application/javascript" src="common.js"></script> 18 </head> 19 <body> 20 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1188099">Mozilla Bug 1188099</a> 21 <iframe id="frame1"></iframe> 22 <iframe id="frame2"></iframe> 23 <div id="content" style="display: none"> 24 25 </div> 26 <pre id="test"> 27 <script type="application/javascript"> 28 Promise.all([loadFrame('frame1'), loadFrame('frame2')]).then(function ([frame1, frame2]) { 29 var win1 = frame1.contentWindow; 30 var win2 = frame2.contentWindow; 31 var utterance1 = new win1.SpeechSynthesisUtterance("hello, losers"); 32 var utterance2 = new win1.SpeechSynthesisUtterance("hello, losers three"); 33 var utterance3 = new win2.SpeechSynthesisUtterance("hello, losers too"); 34 var eventOrder = ['start1', 'end1', 'start3', 'end3', 'start2', 'end2']; 35 utterance1.addEventListener('start', function(e) { 36 is(eventOrder.shift(), 'start1', 'start1'); 37 testSynthState(win1, { speaking: true, pending: true }); 38 testSynthState(win2, { speaking: true, pending: true }); 39 }); 40 utterance1.addEventListener('end', function(e) { 41 is(eventOrder.shift(), 'end1', 'end1'); 42 }); 43 utterance3.addEventListener('start', function(e) { 44 is(eventOrder.shift(), 'start3', 'start3'); 45 testSynthState(win1, { speaking: true, pending: true }); 46 testSynthState(win2, { speaking: true, pending: false }); 47 }); 48 utterance3.addEventListener('end', function(e) { 49 is(eventOrder.shift(), 'end3', 'end3'); 50 }); 51 utterance2.addEventListener('start', function(e) { 52 is(eventOrder.shift(), 'start2', 'start2'); 53 testSynthState(win1, { speaking: true, pending: false }); 54 testSynthState(win2, { speaking: true, pending: false }); 55 }); 56 utterance2.addEventListener('end', function(e) { 57 is(eventOrder.shift(), 'end2', 'end2'); 58 testSynthState(win1, { speaking: false, pending: false }); 59 testSynthState(win2, { speaking: false, pending: false }); 60 SimpleTest.finish(); 61 }); 62 win1.speechSynthesis.speak(utterance1); 63 win1.speechSynthesis.speak(utterance2); 64 win2.speechSynthesis.speak(utterance3); 65 }); 66 </script> 67 </pre> 68 </body> 69 </html>