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 testEnqueue() { | 9 function testEnqueue() { |
10 var callbacks = 0; | 10 var callbacks = 0; |
11 chrome.experimental.tts.speak( | 11 chrome.experimental.tts.speak( |
12 'text 1', | 12 'text 1', |
13 { | 13 { |
14 'enqueue': true, | 14 'enqueue': true, |
15 'onevent': function(event) { | 15 'onEvent': function(event) { |
16 chrome.test.assertEq('end', event.type); | 16 chrome.test.assertEq('end', event.type); |
17 callbacks++; | 17 callbacks++; |
18 } | 18 } |
19 }, | 19 }, |
20 function() { | 20 function() { |
21 chrome.test.assertNoLastError(); | 21 chrome.test.assertNoLastError(); |
22 callbacks++; | 22 callbacks++; |
23 }); | 23 }); |
24 chrome.experimental.tts.speak( | 24 chrome.experimental.tts.speak( |
25 'text 2', | 25 'text 2', |
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 == 4) { | 31 if (callbacks == 4) { |
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 callbacks++; | 40 callbacks++; |
41 }); | 41 }); |
42 } | 42 } |
43 ]); | 43 ]); |
OLD | NEW |