blob: 00bd2823f6aa7bbf664b1dce9ca9b607429bec86 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
<!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 pausing/resuming speech jobs works as expected.");
if (window.testRunner)
testRunner.waitUntilDone();
if (window.internals)
window.internals.enableMockSpeechSynthesizer(document);
window.jsTestIsAsync = true;
var u = new SpeechSynthesisUtterance("this is a test");
// Verify that callbacks and state are correct for paused and speaking states.
u.onpause = function(event) {
debug("On pause event received.");
shouldBeTrue("speechSynthesis.paused");
shouldBeTrue("speechSynthesis.speaking");
}
u.onresume = function(event) {
debug("On resume event received.");
shouldBeFalse("speechSynthesis.paused");
shouldBeTrue("speechSynthesis.speaking");
}
u.onend = function(event) {
debug("On end event received.");
shouldBeFalse("speechSynthesis.paused");
shouldBeFalse("speechSynthesis.speaking");
finishJSTest();
}
speechSynthesis.speak(u);
// Quickly pause and resume the speech job.
setTimeout("speechSynthesis.pause()", 1);
setTimeout("speechSynthesis.resume()", 2);
</script>
<script src="../js/resources/js-test-post.js"></script>
</body>
</html>
|