| OLD | NEW |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../js/resources/js-test-pre.js"></script> | 4 <script src="../../js/resources/js-test-pre.js"></script> |
| 5 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <script type="text/javascript"> | 7 <script type="text/javascript"> |
| 8 description('Tests the basics of SpeechGrammar and SpeechGrammarList'); | 8 description('Tests the basics of SpeechGrammar and SpeechGrammarList'); |
| 9 | 9 |
| 10 function run() { | 10 function run() { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 shouldBe("g.src", "'http://example.tld/grammar.xml'"); | 31 shouldBe("g.src", "'http://example.tld/grammar.xml'"); |
| 32 evalAndLog("g.src = 'foo bar'"); | 32 evalAndLog("g.src = 'foo bar'"); |
| 33 shouldBe("g.src", "base + 'foo%20bar'"); | 33 shouldBe("g.src", "base + 'foo%20bar'"); |
| 34 | 34 |
| 35 // Test creating a grammar list. | 35 // Test creating a grammar list. |
| 36 evalAndLog("window.gs = new webkitSpeechGrammarList()"); | 36 evalAndLog("window.gs = new webkitSpeechGrammarList()"); |
| 37 shouldBeFalse("gs == null"); | 37 shouldBeFalse("gs == null"); |
| 38 shouldBe("gs.length", "0"); | 38 shouldBe("gs.length", "0"); |
| 39 shouldBeTrue("gs.item(0) == null"); | 39 shouldBeTrue("gs.item(0) == null"); |
| 40 shouldBeTrue("gs[0] == undefined"); | 40 shouldBeTrue("gs[0] == undefined"); |
| 41 shouldThrow("gs.item(-1)"); | 41 shouldBeNull("gs.item(-1)"); |
| 42 shouldBeTrue("gs[-1] == undefined"); | 42 shouldBeTrue("gs[-1] == undefined"); |
| 43 | 43 |
| 44 evalAndLog("gs.addFromUri('grammar', 2)"); | 44 evalAndLog("gs.addFromUri('grammar', 2)"); |
| 45 shouldBe("gs.length", "1"); | 45 shouldBe("gs.length", "1"); |
| 46 shouldBeTrue("gs.item(1) == null"); | 46 shouldBeTrue("gs.item(1) == null"); |
| 47 shouldBeTrue("gs[1] == undefined"); | 47 shouldBeTrue("gs[1] == undefined"); |
| 48 shouldThrow("gs.item(-1)"); | 48 shouldBeNull("gs.item(-1)"); |
| 49 shouldBeTrue("gs[-1] == undefined"); | 49 shouldBeTrue("gs[-1] == undefined"); |
| 50 shouldBe("gs[0]", "gs.item(0)"); | 50 shouldBe("gs[0]", "gs.item(0)"); |
| 51 shouldBe("gs.item(0).src", "base + 'grammar'"); | 51 shouldBe("gs.item(0).src", "base + 'grammar'"); |
| 52 shouldBe("gs.item(0).weight", "2"); | 52 shouldBe("gs.item(0).weight", "2"); |
| 53 | 53 |
| 54 evalAndLog("gs.addFromUri('http://foo.tld/grammar.xml', 3)"); | 54 evalAndLog("gs.addFromUri('http://foo.tld/grammar.xml', 3)"); |
| 55 shouldBe("gs.length", "2"); | 55 shouldBe("gs.length", "2"); |
| 56 shouldBe("gs[1]", "gs.item(1)"); | 56 shouldBe("gs[1]", "gs.item(1)"); |
| 57 shouldBe("gs.item(1).src", "'http://foo.tld/grammar.xml'"); | 57 shouldBe("gs.item(1).src", "'http://foo.tld/grammar.xml'"); |
| 58 shouldBe("gs.item(1).weight", "3"); | 58 shouldBe("gs.item(1).weight", "3"); |
| 59 | 59 |
| 60 evalAndLog("gs.addFromString('<grammar>foo</grammar>', 4)"); | 60 evalAndLog("gs.addFromString('<grammar>foo</grammar>', 4)"); |
| 61 shouldBe("gs.length", "3"); | 61 shouldBe("gs.length", "3"); |
| 62 shouldBe("gs[2]", "gs.item(2)"); | 62 shouldBe("gs[2]", "gs.item(2)"); |
| 63 shouldBe("gs.item(2).src", "'data:application/xml,%3Cgrammar%3Efoo%3C/gramma
r%3E'"); | 63 shouldBe("gs.item(2).src", "'data:application/xml,%3Cgrammar%3Efoo%3C/gramma
r%3E'"); |
| 64 shouldBe("gs.item(2).weight", "4"); | 64 shouldBe("gs.item(2).weight", "4"); |
| 65 shouldBe("gs[2].src", "'data:application/xml,%3Cgrammar%3Efoo%3C/grammar%3E'
"); | 65 shouldBe("gs[2].src", "'data:application/xml,%3Cgrammar%3Efoo%3C/grammar%3E'
"); |
| 66 shouldBe("gs[2].weight", "4"); | 66 shouldBe("gs[2].weight", "4"); |
| 67 finishJSTest(); | 67 finishJSTest(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 window.onload = run; | 70 window.onload = run; |
| 71 window.jsTestIsAsync = true; | 71 window.jsTestIsAsync = true; |
| 72 </script> | 72 </script> |
| 73 <script src="../../js/resources/js-test-post.js"></script> | 73 <script src="../../js/resources/js-test-post.js"></script> |
| 74 </body> | 74 </body> |
| 75 </html> | 75 </html> |
| OLD | NEW |