Index: LayoutTests/fast/speechsynthesis/speech-synthesis-cancel.html |
diff --git a/LayoutTests/fast/speechsynthesis/speech-synthesis-cancel.html b/LayoutTests/fast/speechsynthesis/speech-synthesis-cancel.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8ee35181f8d558e9fce07a49bb6d6b2cce60ea0d |
--- /dev/null |
+++ b/LayoutTests/fast/speechsynthesis/speech-synthesis-cancel.html |
@@ -0,0 +1,54 @@ |
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
+<html> |
+<head> |
+<script src="../js/resources/js-test-pre.js"></script> |
+</head> |
+<body id="body"> |
+ |
+<div id="console"></div> |
+ |
+<script> |
+ |
+ description("This tests that cancelling a speech job fires the right events."); |
+ |
+ if (window.testRunner) |
+ testRunner.waitUntilDone(); |
+ |
+ if (window.internals) |
+ window.internals.enableMockSpeechSynthesizer(); |
+ |
+ window.jsTestIsAsync = true; |
+ |
+ var u = new SpeechSynthesisUtterance("this is a test"); |
+ u.onstart = function(event) { |
+ debug("Speech started"); |
+ } |
+ |
+ u.onerror = function(event) { |
+ debug("Speech error received because we cancelled and speech should no longer be pending."); |
+ shouldBeFalse("speechSynthesis.pending"); |
+ finishJSTest(); |
+ } |
+ |
+ // Queue the first job which will start speaking immediately. |
+ speechSynthesis.speak(u); |
+ |
+ // Make a few more jobs, so that when we cancel, it will clear the entire queue. |
+ var u2 = new SpeechSynthesisUtterance("this is a second test"); |
+ speechSynthesis.speak(u2); |
+ |
+ // Make a few more jobs, so that when we cancel, it will clear the entire queue. |
+ var u3 = new SpeechSynthesisUtterance("this is a third test"); |
+ speechSynthesis.speak(u3); |
+ |
+ // While we have two jobs, speech synthesis should report that it's pending. |
+ shouldBeTrue("speechSynthesis.pending"); |
+ |
+ // Cancel speaking. |
+ setTimeout("speechSynthesis.cancel()", 1); |
+ |
+</script> |
+ |
+<script src="../js/resources/js-test-post.js"></script> |
+</body> |
+</html> |