Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(435)

Unified Diff: LayoutTests/fast/speechsynthesis/speech-synthesis-speak-multiple.html

Issue 884973003: Extend PlatformSpeechSynthesizerMock with an utterance queue. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..18b3576846a109b0fa446f8cc29fa216d3184db0
--- /dev/null
+++ b/LayoutTests/fast/speechsynthesis/speech-synthesis-speak-multiple.html
@@ -0,0 +1,43 @@
+<!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();
+ 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>

Powered by Google App Engine
This is Rietveld 408576698