OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Extension Speech Input api test. | 5 // Extension Speech Input api test. |
6 // browser_tests --gtest_filter="ExtensionSpeechInputApiTest.*" | 6 // browser_tests --gtest_filter="ExtensionSpeechInputApiTest.*" |
7 | 7 |
8 chrome.test.runTests([ | 8 chrome.test.runTests([ |
9 function testSpeechInputStartError() { | 9 function testSpeechInputStartError() { |
10 | 10 |
11 // Recording is not active, start it. | 11 // Recording is not active, start it. |
12 chrome.experimental.speechInput.isRecording(function(recording) { | 12 chrome.experimental.speechInput.isRecording(function(recording) { |
13 chrome.test.assertNoLastError(); | 13 chrome.test.assertNoLastError(); |
14 chrome.test.assertFalse(recording); | 14 chrome.test.assertFalse(recording); |
15 chrome.experimental.speechInput.start({}, started); | 15 chrome.experimental.speechInput.start({}, started); |
16 }); | 16 }); |
17 | 17 |
18 // Start should fail because no devices are available. | 18 // Start should fail because no devices are available. |
19 function started() { | 19 function started() { |
20 chrome.test.assertEq(chrome.extension.lastError.message, | 20 chrome.test.assertEq(chrome.runtime.lastError.message, |
21 "noRecordingDeviceFound"); | 21 "noRecordingDeviceFound"); |
22 | 22 |
23 // Recording shouldn't have started. | 23 // Recording shouldn't have started. |
24 chrome.experimental.speechInput.isRecording(function(recording) { | 24 chrome.experimental.speechInput.isRecording(function(recording) { |
25 chrome.test.assertNoLastError(); | 25 chrome.test.assertNoLastError(); |
26 chrome.test.assertFalse(recording); | 26 chrome.test.assertFalse(recording); |
27 | 27 |
28 // Stopping should fail since we're back in the idle state. | 28 // Stopping should fail since we're back in the idle state. |
29 chrome.experimental.speechInput.stop(function() { | 29 chrome.experimental.speechInput.stop(function() { |
30 chrome.test.assertEq(chrome.extension.lastError.message, | 30 chrome.test.assertEq(chrome.runtime.lastError.message, |
31 "invalidOperation"); | 31 "invalidOperation"); |
32 chrome.test.succeed(); | 32 chrome.test.succeed(); |
33 }); | 33 }); |
34 }); | 34 }); |
35 } | 35 } |
36 } | 36 } |
37 ]); | 37 ]); |
OLD | NEW |