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

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

Issue 14874017: Add speech synthesizer tests (from WebKit). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix ScriptWrappable::init and address nits Created 7 years, 7 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-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>

Powered by Google App Engine
This is Rietveld 408576698