| 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 testInterrupt() { | 9 function testInterrupt() { |
| 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': false, | 14 'enqueue': false, |
| 15 'onevent': function(event) { | 15 'onEvent': function(event) { |
| 16 chrome.test.assertEq('interrupted', event.type); | 16 chrome.test.assertEq('interrupted', 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': false, | 27 'enqueue': false, |
| 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 } | 33 } |
| 34 } | 34 } |
| 35 }, | 35 }, |
| 36 function() { | 36 function() { |
| 37 chrome.test.assertNoLastError(); | 37 chrome.test.assertNoLastError(); |
| 38 callbacks++; | 38 callbacks++; |
| 39 }); | 39 }); |
| 40 } | 40 } |
| 41 ]); | 41 ]); |
| OLD | NEW |