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

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: minor test tidying 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
« no previous file with comments | « no previous file | LayoutTests/fast/speechsynthesis/speech-synthesis-speak-multiple-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | LayoutTests/fast/speechsynthesis/speech-synthesis-speak-multiple-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698