author Glen Shires <>
Fri, 20 Feb 2015 09:41:13 -0800
changeset 76 4f41ea1126bb
parent 75 6117f5bea58d
permissions -rw-r--r--
Fixes due to changes in testharness.js: reinstate long timeout, load scripts using same protocol as parent file (http or https).
<!DOCTYPE html>
    <meta charset="utf-8">
    <title>SpeechRecognition.onerror no-speech</title>
    <script type="text/javascript" src="//">
    <script type="text/javascript" src="//">
    <script type="text/javascript">
      var TIMEOUT_OVERRIDE = 10000;  // In milliseconds.
    <script type="text/javascript" src='webspeech.js'></script>
    <h1>Conformance test for Web Speech API SpeechRecognition.onerror
    <p><b>Version</b>: Test is based on W3C
      <a href="">
        Web Speech API Specification</a> 19 October 2012 and
      <a href="">
        Errata</a> through December 7, 2012.
      <b>Prerequisites</b>: The machine that the test is executed on must have
        a microphone.
      <b>Prefix</b>: Uses webkitSpeechRecognition object. To test conformance
        with actual spec, should instead use SpeechRecognition object.
      <b>License</b>: Distributed under both the
      <a href="">
        W3C Test Suite License</a> and the
      <a href="">
        W3C 3-clause BSD License</a>. To contribute to a W3C Test Suite, see the
      <a href="">
        policies and contribution forms</a>.
    <p><b>Instructions:</b> Do NOT speak. Run test in silence.
      This test may fail if too much noise.</p>
    <div id="log"></div>
    <div id="notes"></div>
    <script type="text/javascript">
var audioTest = new CycleTest('onaudio');
reco.onaudiostart = audioTest.startEvent();
reco.onaudioend = audioTest.endEvent();

reco.onsoundstart = neverFireEvent('onsoundstart');
reco.onsoundend = neverFireEvent('onsoundend');
reco.onspeechstart = neverFireEvent('onspeechstart');
reco.onspeechend = neverFireEvent('onsspeechend');
reco.onresult = neverFireEvent('onresult');
reco.onnomatch = neverFireEvent('onnomatch');

var errorTest = new CountTest('onerror no-speech', 1, 1);
reco.onerror = errorTest.test().step_func(function(event) {
  assert_equals(typeof(event.message), 'string', 'typeof(event.message)');
  notes.innerHTML += 'onerror message is "' + event.message + '"' + '<br>';
  assert_equals(event.error, 'no-speech', 'onerror event.error');