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 // TTS api test for Chrome on ChromeOS. | 5 // TTS api test for Chrome on ChromeOS. |
6 // browser_tests.exe --gtest_filter="TtsApiTest.*" | 6 // browser_tests.exe --gtest_filter="TtsApiTest.*" |
7 | 7 |
8 chrome.test.runTests([ | 8 chrome.test.runTests([ |
9 function testSpeakError() { | 9 function testSpeakError() { |
10 var callbacks = 0; | 10 var callbacks = 0; |
11 chrome.experimental.tts.speak( | 11 chrome.experimental.tts.speak( |
12 'first try', | 12 'first try', |
13 { | 13 { |
14 'enqueue': true, | 14 'enqueue': true, |
15 'onevent': function(event) { | 15 'onEvent': function(event) { |
16 chrome.test.assertEq('error', event.type); | 16 chrome.test.assertEq('error', event.type); |
17 chrome.test.assertEq('epic fail', event.errorMessage); | 17 chrome.test.assertEq('epic fail', event.errorMessage); |
18 callbacks++; | 18 callbacks++; |
19 } | 19 } |
20 }, | 20 }, |
21 function() { | 21 function() { |
22 chrome.test.assertNoLastError(); | 22 chrome.test.assertNoLastError(); |
23 }); | 23 }); |
24 chrome.experimental.tts.speak( | 24 chrome.experimental.tts.speak( |
25 'second try', | 25 'second try', |
26 { | 26 { |
27 'enqueue': true, | 27 'enqueue': true, |
28 'onevent': function(event) { | 28 'onEvent': function(event) { |
29 chrome.test.assertEq('end', event.type); | 29 chrome.test.assertEq('end', event.type); |
30 callbacks++; | 30 callbacks++; |
31 if (callbacks == 2) { | 31 if (callbacks == 2) { |
32 chrome.test.succeed(); | 32 chrome.test.succeed(); |
33 } else { | 33 } else { |
34 chrome.test.fail(); | 34 chrome.test.fail(); |
35 } | 35 } |
36 } | 36 } |
37 }, | 37 }, |
38 function() { | 38 function() { |
39 chrome.test.assertNoLastError(); | 39 chrome.test.assertNoLastError(); |
40 }); | 40 }); |
41 } | 41 } |
42 ]); | 42 ]); |
OLD | NEW |