OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Extension Speech Input api test. | |
6 // browser_tests --gtest_filter="ExtensionSpeechInputApiTest.*" | |
7 | |
8 chrome.test.runTests([ | |
9 function testSpeechInputRecognitionError() { | |
10 // Results should never be provided in this test case. | |
11 chrome.experimental.speechInput.onResult.addListener(function(event) { | |
12 chrome.test.fail(); | |
13 }); | |
14 | |
15 // Ensure the recognition error happens. | |
16 chrome.experimental.speechInput.onError.addListener(function(error) { | |
17 chrome.test.assertEq(error.code, "networkError"); | |
18 | |
19 // No recording should be happening after an error. | |
20 chrome.experimental.speechInput.isRecording(function(recording) { | |
21 chrome.test.assertNoLastError(); | |
22 chrome.test.assertFalse(recording); | |
23 | |
24 // Stopping should fail since we're in the idle state again. | |
25 chrome.experimental.speechInput.stop(function() { | |
26 chrome.test.assertEq(chrome.runtime.lastError.message, | |
27 "invalidOperation"); | |
28 chrome.test.succeed(); | |
29 }); | |
30 }); | |
31 }); | |
32 | |
33 // Start recording. | |
34 chrome.experimental.speechInput.start({}, function() { | |
35 chrome.test.assertNoLastError(); | |
36 }); | |
37 } | |
38 ]); | |
OLD | NEW |