Bug 968634 - Test for InvalidStateError on all speech recognition handlers. r=smaug

This patch updates the test to make sure we throw InvalidStateError on every
event handler while not on STATE_IDLE.
This commit is contained in:
Guilherme Goncalves 2014-02-10 15:58:46 -05:00
parent d698dad175
commit 1a9473b950

View File

@ -30,6 +30,17 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=650295
info("Successfully start() from end() callback");
}
function expectExceptionHandler(evt, sr) {
try {
sr.start();
} catch (err) {
is(err.name, "InvalidStateError");
return;
}
ok(false, "Calling start() didn't raise InvalidStateError");
}
performTest({
eventsToRequest: [
'EVENT_START',
@ -37,11 +48,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=650295
'EVENT_RECOGNITIONSERVICE_FINAL_RESULT'
],
expectedEvents: {
'start': null,
'audiostart': null,
'speechstart': null,
'speechend': null,
'audioend': null,
'start': expectExceptionHandler,
'audiostart': expectExceptionHandler,
'speechstart': expectExceptionHandler,
'speechend': expectExceptionHandler,
'audioend': expectExceptionHandler,
'result': buildResultCallback("Mock final result"),
'end': endHandler,
},