summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/speechsynthesis/speech-synthesis-speak-invalid-argument-throws.html
blob: 22ee002a406f1e0659456fc6eae480cd7822f040 (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
<!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>

    if (window.internals)
        window.internals.enableMockSpeechSynthesizer(document);

    description("This tests that passing an argument other than a SpeechSynthesisUtterance to speechSynthesis.speak throws a TypeError exception.");

    shouldThrow("speechSynthesis.speak()", '"TypeError: Failed to execute \'speak\' on \'SpeechSynthesis\': 1 argument required, but only 0 present."');
    shouldThrow("speechSynthesis.speak(0)", '"TypeError: Invalid utterance argument"');
    shouldThrow("speechSynthesis.speak('')", '"TypeError: Invalid utterance argument"');
    shouldThrow("speechSynthesis.speak(document.body)", '"TypeError: Invalid utterance argument"');
    shouldThrow("speechSynthesis.speak({})", '"TypeError: Invalid utterance argument"');
    shouldThrow("speechSynthesis.speak((new SpeechSynthesisUtterance()).text = 'hello')", '"TypeError: Invalid utterance argument"');

</script>

</body>
</html>