| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| </head> |
| <body id="body"> |
| |
| <div id="console"></div> |
| |
| <script> |
| |
| if (window.internals) |
| window.internals.enableMockSpeechSynthesizer(); |
| |
| description("This tests that elapsed time is a number that is reasonable."); |
| |
| if (window.testRunner) |
| testRunner.waitUntilDone(); |
| |
| window.jsTestIsAsync = true; |
| |
| var u = new SpeechSynthesisUtterance("hello word"); |
| |
| var startTime = 0; |
| u.onstart = function(event) { |
| startTime = event.elapsedTime; |
| debug("Our start time for speech should be very small."); |
| shouldBeTrue("startTime < .5"); |
| } |
| u.onboundary = function(event) { |
| debug("Word boundary received: startTime should be less than the current elapsed time."); |
| shouldBeTrue("startTime < event.elapsedTime"); |
| } |
| |
| u.onend = function(event) { |
| debug("The finished elapsed time should be small and the startTime should have occurred before the end."); |
| shouldBeTrue("startTime < event.elapsedTime"); |
| shouldBeTrue("event.elapsedTime < 1"); |
| finishJSTest(); |
| } |
| |
| speechSynthesis.speak(u); |
| |
| </script> |
| |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |