blob: d98cef5e1668d6dcf8b0b7a38ef3bd2354b2837f [file] [log] [blame]
Tests the basics of SpeechGrammar and SpeechGrammarList
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS 'webkitSpeechGrammar' in window is true
PASS webkitSpeechGrammar == null is false
PASS 'webkitSpeechGrammarList' in window is true
PASS webkitSpeechGrammarList == null is false
window.g = new webkitSpeechGrammar()
PASS g == null is false
PASS g.weight is 1.0
PASS g.src is ''
g.weight = 2
PASS g.weight is 2.0
PASS g.weight = NaN threw exception TypeError: Failed to set the 'weight' property on 'SpeechGrammar': The provided float value is non-finite..
PASS g.weight = Infinity threw exception TypeError: Failed to set the 'weight' property on 'SpeechGrammar': The provided float value is non-finite..
PASS g.weight is 2.0
g.src = 'grammar.xml'
PASS g.src is base + 'grammar.xml'
g.src = 'http://example.tld/grammar.xml'
PASS g.src is 'http://example.tld/grammar.xml'
g.src = 'foo bar'
PASS g.src is base + 'foo%20bar'
window.gs = new webkitSpeechGrammarList()
PASS gs == null is false
PASS gs.length is 0
PASS gs.item(0) == null is true
PASS gs[0] == undefined is true
PASS gs.item(-1) is null
PASS gs[-1] == undefined is true
gs.addFromUri('grammar', 2)
PASS gs.length is 1
PASS gs.item(1) == null is true
PASS gs[1] == undefined is true
PASS gs.item(-1) is null
PASS gs[-1] == undefined is true
PASS gs[0] is gs.item(0)
PASS gs.item(0).src is base + 'grammar'
PASS gs.item(0).weight is 2
gs.addFromUri('http://foo.tld/grammar.xml', 3)
PASS gs.length is 2
PASS gs[1] is gs.item(1)
PASS gs.item(1).src is 'http://foo.tld/grammar.xml'
PASS gs.item(1).weight is 3
gs.addFromString('foo', 4)
PASS gs.length is 3
PASS gs[2] is gs.item(2)
PASS gs.item(2).src is 'data:application/xml,%3Cgrammar%3Efoo%3C/grammar%3E'
PASS gs.item(2).weight is 4
PASS gs[2].src is 'data:application/xml,%3Cgrammar%3Efoo%3C/grammar%3E'
PASS gs[2].weight is 4
PASS gs.addFromUri('http://foo.tld/grammar.xml', NaN) threw exception TypeError: Failed to execute 'addFromUri' on 'SpeechGrammarList': The provided float value is non-finite..
PASS gs.addFromUri('http://foo.tld/grammar.xml', Infinity) threw exception TypeError: Failed to execute 'addFromUri' on 'SpeechGrammarList': The provided float value is non-finite..
PASS gs.addFromString('foo', NaN) threw exception TypeError: Failed to execute 'addFromString' on 'SpeechGrammarList': The provided float value is non-finite..
PASS gs.addFromString('foo', Infinity) threw exception TypeError: Failed to execute 'addFromString' on 'SpeechGrammarList': The provided float value is non-finite..
PASS successfullyParsed is true
TEST COMPLETE