| 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 testSpeechInputStartStop() { | 9 function testSpeechInputStartStop() { |
| 10 var count = 0; | 10 var count = 0; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 chrome.experimental.speechInput.start({}, started); | 37 chrome.experimental.speechInput.start({}, started); |
| 38 else | 38 else |
| 39 chrome.test.succeed(); | 39 chrome.test.succeed(); |
| 40 }); | 40 }); |
| 41 } | 41 } |
| 42 }, | 42 }, |
| 43 | 43 |
| 44 function testSpeechInputInvalidOperation() { | 44 function testSpeechInputInvalidOperation() { |
| 45 // Calling start once recording should generate an invalid operation error. | 45 // Calling start once recording should generate an invalid operation error. |
| 46 chrome.experimental.speechInput.stop(function() { | 46 chrome.experimental.speechInput.stop(function() { |
| 47 chrome.test.assertEq(chrome.extension.lastError.message, | 47 chrome.test.assertEq(chrome.runtime.lastError.message, |
| 48 "invalidOperation"); | 48 "invalidOperation"); |
| 49 chrome.experimental.speechInput.start({}, started); | 49 chrome.experimental.speechInput.start({}, started); |
| 50 }); | 50 }); |
| 51 | 51 |
| 52 // Calling stop before recording should generate an invalid operation error. | 52 // Calling stop before recording should generate an invalid operation error. |
| 53 function started() { | 53 function started() { |
| 54 chrome.test.assertNoLastError(); | 54 chrome.test.assertNoLastError(); |
| 55 chrome.experimental.speechInput.start({}, function() { | 55 chrome.experimental.speechInput.start({}, function() { |
| 56 chrome.test.assertEq(chrome.extension.lastError.message, | 56 chrome.test.assertEq(chrome.runtime.lastError.message, |
| 57 "invalidOperation"); | 57 "invalidOperation"); |
| 58 chrome.test.succeed(); | 58 chrome.test.succeed(); |
| 59 }); | 59 }); |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 ]); | 62 ]); |
| OLD | NEW |