conformance/nospeech.html
author Glen Shires <gshires@google.com>
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).
75
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
     1
<!DOCTYPE html>
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
     2
<html>
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
     3
  <head>
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
     4
    <meta charset="utf-8">
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
     5
    <title>SpeechRecognition.onerror no-speech</title>
76
4f41ea1126bb Fixes due to changes in testharness.js: reinstate long timeout, load scripts using same protocol as parent file (http or https).
Glen Shires <gshires@google.com>
parents: 75
diff changeset
     6
    <script type="text/javascript" src="//w3c-test.org/resources/testharness.js">
75
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
     7
    </script>
76
4f41ea1126bb Fixes due to changes in testharness.js: reinstate long timeout, load scripts using same protocol as parent file (http or https).
Glen Shires <gshires@google.com>
parents: 75
diff changeset
     8
    <script type="text/javascript" src="//w3c-test.org/resources/testharnessreport.js">
75
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
     9
    </script>
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    10
    <script type="text/javascript">
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    11
      var TIMEOUT_OVERRIDE = 10000;  // In milliseconds.
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    12
    </script>
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    13
    <script type="text/javascript" src='webspeech.js'></script>
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    14
  </head>
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    15
  <body>
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    16
    <h1>Conformance test for Web Speech API SpeechRecognition.onerror
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    17
      no-speech</h1>
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    18
    <p><b>Version</b>: Test is based on W3C
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    19
      <a href="http://dvcs.w3.org/hg/speech-api/raw-file/9a0075d25326/speechapi.html">
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    20
        Web Speech API Specification</a> 19 October 2012 and
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    21
      <a href="http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi-errata.html">
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    22
        Errata</a> through December 7, 2012.
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    23
      <br>
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    24
      <b>Prerequisites</b>: The machine that the test is executed on must have
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    25
        a microphone.
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    26
      <br>
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    27
      <b>Prefix</b>: Uses webkitSpeechRecognition object. To test conformance
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    28
        with actual spec, should instead use SpeechRecognition object.
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    29
      <br>
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    30
      <b>License</b>: Distributed under both the
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    31
      <a href="http://www.w3.org/Consortium/Legal/2008/04-testsuite-license">
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    32
        W3C Test Suite License</a> and the
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    33
      <a href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license">
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    34
        W3C 3-clause BSD License</a>. To contribute to a W3C Test Suite, see the
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    35
      <a href="http://www.w3.org/2004/10/27-testcases">
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    36
        policies and contribution forms</a>.
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    37
    </p>
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    38
    <hr>
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    39
    <p><b>Instructions:</b> Do NOT speak. Run test in silence.
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    40
      This test may fail if too much noise.</p>
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    41
    <div id="log"></div>
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    42
    <div id="notes"></div>
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    43
    <script type="text/javascript">
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    44
var audioTest = new CycleTest('onaudio');
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    45
reco.onaudiostart = audioTest.startEvent();
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    46
reco.onaudioend = audioTest.endEvent();
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    47
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    48
reco.onsoundstart = neverFireEvent('onsoundstart');
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    49
reco.onsoundend = neverFireEvent('onsoundend');
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    50
reco.onspeechstart = neverFireEvent('onspeechstart');
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    51
reco.onspeechend = neverFireEvent('onsspeechend');
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    52
reco.onresult = neverFireEvent('onresult');
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    53
reco.onnomatch = neverFireEvent('onnomatch');
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    54
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    55
var errorTest = new CountTest('onerror no-speech', 1, 1);
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    56
reco.onerror = errorTest.test().step_func(function(event) {
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    57
  errorTest.count(1);
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    58
  assert_equals(typeof(event.message), 'string', 'typeof(event.message)');
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    59
  notes.innerHTML += 'onerror message is "' + event.message + '"' + '<br>';
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    60
  assert_equals(event.error, 'no-speech', 'onerror event.error');
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    61
});
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    62
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    63
reco.start();
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    64
    </script>
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    65
  </body>
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    66
</html>
6117f5bea58d Conformance Tests from lists.w3.org/Archives/Public/public-speech-api/2012Dec/0001.html
Glen Shires <gshires@google.com>
parents:
diff changeset
    67