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 testSpeechInputStartError() { | |
10 | |
11 // Recording is not active, start it. | |
12 chrome.experimental.speechInput.isRecording(function(recording) { | |
13 chrome.test.assertNoLastError(); | |
14 chrome.test.assertFalse(recording); | |
15 chrome.experimental.speechInput.start({}, started); | |
16 }); | |
17 | |
18 // Start should fail because no devices are available. | |
19 function started() { | |
20 chrome.test.assertEq(chrome.runtime.lastError.message, | |
21 "noRecordingDeviceFound"); | |
22 | |
23 // Recording shouldn't have started. | |
24 chrome.experimental.speechInput.isRecording(function(recording) { | |
25 chrome.test.assertNoLastError(); | |
26 chrome.test.assertFalse(recording); | |
27 | |
28 // Stopping should fail since we're back in the idle state. | |
29 chrome.experimental.speechInput.stop(function() { | |
30 chrome.test.assertEq(chrome.runtime.lastError.message, | |
31 "invalidOperation"); | |
32 chrome.test.succeed(); | |
33 }); | |
34 }); | |
35 } | |
36 } | |
37 ]); | |
OLD | NEW |