Index: LayoutTests/fast/speechsynthesis/speech-synthesis-speak-multiple.html |
diff --git a/LayoutTests/fast/speechsynthesis/speech-synthesis-speak-multiple.html b/LayoutTests/fast/speechsynthesis/speech-synthesis-speak-multiple.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..37cf969690a650505064ff8ba64f044f6aa69827 |
--- /dev/null |
+++ b/LayoutTests/fast/speechsynthesis/speech-synthesis-speak-multiple.html |
@@ -0,0 +1,47 @@ |
+<!DOCTYPE HTML> |
+<html> |
+<head> |
+<script src="../../resources/js-test.js"></script> |
+</head> |
+<body> |
+<script> |
+ description("This tests that multiple speak utterances are handled in sequence."); |
+ |
+ if (window.internals) |
+ window.internals.enableMockSpeechSynthesizer(document); |
+ |
+ if (window.testRunner) |
+ testRunner.waitUntilDone(); |
+ |
+ window.jsTestIsAsync = true; |
+ |
+ var count = 3; |
+ var i = 0; |
+ |
+ // Start a very short speaking job that will finish quickly. |
+ var u = new SpeechSynthesisUtterance(" "); |
+ u.onstart = function(event) { |
+ shouldBeTrue("event.elapsedTime > 0"); |
+ shouldBeTrue("speechSynthesis.speaking"); |
+ }; |
+ u.onend = function(event) { |
+ shouldBeGreaterThanOrEqual("count", "i"); |
+ shouldBeTrue("event.elapsedTime > 0"); |
+ shouldBeTrue("speechSynthesis.speaking"); |
+ if (++i == count) { |
+ speechSynthesis.cancel(); |
+ // Add a new utterance just after the cancel() to signal test completion. |
+ speechSynthesis.speak(finishingUtterance); |
+ } |
+ }; |
+ |
+ var finishingUtterance = new SpeechSynthesisUtterance(" "); |
+ finishingUtterance.onend = finishJSTest; |
+ |
+ shouldBeFalse("speechSynthesis.speaking"); |
+ // Issue more utterances than where we break off. |
+ for (var j = 0; j < count + 2; ++j) |
+ speechSynthesis.speak(u); |
+</script> |
+</body> |
+</html> |