summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/speech/scripted/basics.html
blob: 083b784c78b7a6c1026a66888e8ad5b1f983719b (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
54
55
56
57
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<script type="text/javascript">
description('Tests the basics of the Speech JavaScript API');

function run() {
    // Check availability of constructors.
    shouldBeTrue("'webkitSpeechRecognition' in self");
    shouldBeFalse("webkitSpeechRecognition == null");

    // Check for members of SpeechRecognition.
    window.speechReco = new webkitSpeechRecognition();
    shouldBeFalse("speechReco == null");
    shouldBeTrue("'grammars' in speechReco");
    shouldBeFalse("speechReco.grammars == null");
    shouldBeTrue("speechReco.grammars.length === 0");
    shouldBeTrue("'lang' in speechReco");
    shouldBeTrue("'continuous' in speechReco");
    shouldBeTrue("'interimResults' in speechReco");
    shouldBeTrue("'maxAlternatives' in speechReco");
    shouldBeTrue("'start' in speechReco");
    shouldBeTrue("'stop' in speechReco");
    shouldBeTrue("'abort' in speechReco");
    shouldBeTrue("'onaudiostart' in speechReco");
    shouldBeTrue("'onsoundstart' in speechReco");
    shouldBeTrue("'onspeechstart' in speechReco");
    shouldBeTrue("'onspeechend' in speechReco");
    shouldBeTrue("'onsoundend' in speechReco");
    shouldBeTrue("'onaudioend' in speechReco");
    shouldBeTrue("'onresult' in speechReco");
    shouldBeTrue("'onnomatch' in speechReco");
    shouldBeTrue("'onerror' in speechReco");
    shouldBeTrue("'onstart' in speechReco");
    shouldBeTrue("'onend' in speechReco");

    shouldBeTrue("'addEventListener' in speechReco");
    shouldBeTrue("'removeEventListener' in speechReco");
    shouldBeTrue("'dispatchEvent' in speechReco");

    // Check default values.
    // FIXME: The spec should say what the default value for .grammars is.
    shouldBe("speechReco.lang", "''");
    shouldBe("speechReco.continuous", "false");
    shouldBe("speechReco.maxAlternatives", "1");

    finishJSTest();
}

window.onload = run;
window.jsTestIsAsync = true;
</script>
</body>
</html>