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 testWordCallbacks() { | 9 function testWordCallbacks() { |
10 var callbacks = 0; | 10 var callbacks = 0; |
11 chrome.experimental.tts.speak( | 11 chrome.experimental.tts.speak( |
12 'one two three', | 12 'one two three', |
13 { | 13 { |
14 'onevent': function(event) { | 14 'onEvent': function(event) { |
15 callbacks++; | 15 callbacks++; |
16 switch(callbacks) { | 16 switch(callbacks) { |
17 case 1: | 17 case 1: |
18 chrome.test.assertEq('word', event.type); | 18 chrome.test.assertEq('word', event.type); |
19 chrome.test.assertEq(0, event.charIndex); | 19 chrome.test.assertEq(0, event.charIndex); |
20 break; | 20 break; |
21 case 2: | 21 case 2: |
22 chrome.test.assertEq('word', event.type); | 22 chrome.test.assertEq('word', event.type); |
23 chrome.test.assertEq(4, event.charIndex); | 23 chrome.test.assertEq(4, event.charIndex); |
24 break; | 24 break; |
25 case 3: | 25 case 3: |
26 chrome.test.assertEq('word', event.type); | 26 chrome.test.assertEq('word', event.type); |
27 chrome.test.assertEq(8, event.charIndex); | 27 chrome.test.assertEq(8, event.charIndex); |
28 break; | 28 break; |
29 case 4: | 29 case 4: |
30 chrome.test.assertEq('end', event.type); | 30 chrome.test.assertEq('end', event.type); |
31 chrome.test.assertEq(13, event.charIndex); | 31 chrome.test.assertEq(13, event.charIndex); |
32 chrome.test.succeed(); | 32 chrome.test.succeed(); |
33 break; | 33 break; |
34 default: | 34 default: |
35 chrome.test.fail(); | 35 chrome.test.fail(); |
36 } | 36 } |
37 } | 37 } |
38 }); | 38 }); |
39 } | 39 } |
40 ]); | 40 ]); |
OLD | NEW |