Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=650295 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <meta charset="utf-8"> |
michael@0 | 8 | <title>Test for Bug 650295 -- Call abort from inside handlers</title> |
michael@0 | 9 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 10 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 11 | <script type="application/javascript" src="head.js"></script> |
michael@0 | 12 | </head> |
michael@0 | 13 | <body> |
michael@0 | 14 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=650295">Mozilla Bug 650295</a> |
michael@0 | 15 | <p id="display"></p> |
michael@0 | 16 | <div id="content" style="display: none"> |
michael@0 | 17 | |
michael@0 | 18 | </div> |
michael@0 | 19 | <pre id="test"> |
michael@0 | 20 | <script type="text/javascript"> |
michael@0 | 21 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 22 | |
michael@0 | 23 | // Abort inside event handlers, should't get a |
michael@0 | 24 | // result after that |
michael@0 | 25 | |
michael@0 | 26 | var nextEventIdx = 0; |
michael@0 | 27 | var eventsToAbortOn = [ |
michael@0 | 28 | "start", |
michael@0 | 29 | "audiostart", |
michael@0 | 30 | "speechstart", |
michael@0 | 31 | "speechend", |
michael@0 | 32 | "audioend" |
michael@0 | 33 | ]; |
michael@0 | 34 | |
michael@0 | 35 | function doNextTest() { |
michael@0 | 36 | var nextEvent = eventsToAbortOn[nextEventIdx]; |
michael@0 | 37 | var expectedEvents = { |
michael@0 | 38 | "start": null, |
michael@0 | 39 | "audiostart": null, |
michael@0 | 40 | "audioend": null, |
michael@0 | 41 | "end": null |
michael@0 | 42 | }; |
michael@0 | 43 | |
michael@0 | 44 | if (nextEventIdx >= eventsToAbortOn.indexOf("speechstart")) { |
michael@0 | 45 | expectedEvents["speechstart"] = null; |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | if (nextEventIdx >= eventsToAbortOn.indexOf("speechend")) { |
michael@0 | 49 | expectedEvents["speechend"] = null; |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | info("Aborting on " + nextEvent); |
michael@0 | 53 | expectedEvents[nextEvent] = function(evt, sr) { |
michael@0 | 54 | sr.abort(); |
michael@0 | 55 | }; |
michael@0 | 56 | |
michael@0 | 57 | nextEventIdx++; |
michael@0 | 58 | |
michael@0 | 59 | performTest({ |
michael@0 | 60 | eventsToRequest: ["EVENT_START", "EVENT_AUDIO_DATA"], |
michael@0 | 61 | expectedEvents: expectedEvents, |
michael@0 | 62 | doneFunc: (nextEventIdx < eventsToAbortOn.length) ? doNextTest : SimpleTest.finish, |
michael@0 | 63 | prefs: [["media.webspeech.test.fake_fsm_events", true], ["media.webspeech.test.fake_recognition_service", true]] |
michael@0 | 64 | }); |
michael@0 | 65 | } |
michael@0 | 66 | |
michael@0 | 67 | doNextTest(); |
michael@0 | 68 | </script> |
michael@0 | 69 | </pre> |
michael@0 | 70 | </body> |
michael@0 | 71 | </html> |