blob: b4d20bc19b314407d25fceef8271061285367f60 [file] [log] [blame]
<!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>
description("This tests that pausing/resuming speech jobs works as expected.");
if (window.testRunner)
testRunner.waitUntilDone();
if (window.internals)
window.internals.enableMockSpeechSynthesizer();
window.jsTestIsAsync = true;
var u = new SpeechSynthesisUtterance("this is a test");
// Verify that callbacks and state are correct for paused and speaking states.
u.onpause = function(event) {
debug("On pause event received.");
shouldBeTrue("speechSynthesis.paused");
shouldBeTrue("speechSynthesis.speaking");
}
u.onresume = function(event) {
debug("On resume event received.");
shouldBeFalse("speechSynthesis.paused");
shouldBeTrue("speechSynthesis.speaking");
}
u.onend = function(event) {
debug("On end event received.");
shouldBeFalse("speechSynthesis.paused");
shouldBeFalse("speechSynthesis.speaking");
finishJSTest();
}
speechSynthesis.speak(u);
// Quickly pause and resume the speech job.
setTimeout("speechSynthesis.pause()", "1");
setTimeout("speechSynthesis.resume()", "2");
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>