Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: chrome/test/data/extensions/api_test/tts/queue_interrupt/test.js

Issue 7282048: Update TTS extension API docs to reflect latest changes. Note that this (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 testQueueInterrupt() { 9 function testQueueInterrupt() {
10 // In this test, two utterances are queued, and then a third 10 // In this test, two utterances are queued, and then a third
11 // interrupts. The first gets interrupted, the second never gets spoken 11 // interrupts. The first gets interrupted, the second never gets spoken
12 // at all. The test expectations in extension_tts_apitest.cc ensure that 12 // at all. The test expectations in extension_tts_apitest.cc ensure that
13 // the first call to tts.speak keeps going until it's interrupted. 13 // the first call to tts.speak keeps going until it's interrupted.
14 var callbacks = 0; 14 var callbacks = 0;
15 chrome.experimental.tts.speak( 15 chrome.experimental.tts.speak(
16 'text 1', 16 'text 1',
17 { 17 {
18 'enqueue': true, 18 'enqueue': true,
19 'onevent': function(event) { 19 'onEvent': function(event) {
20 chrome.test.assertEq('interrupted', event.type); 20 chrome.test.assertEq('interrupted', event.type);
21 callbacks++; 21 callbacks++;
22 } 22 }
23 }, 23 },
24 function() { 24 function() {
25 chrome.test.assertNoLastError(); 25 chrome.test.assertNoLastError();
26 callbacks++; 26 callbacks++;
27 }); 27 });
28 chrome.experimental.tts.speak( 28 chrome.experimental.tts.speak(
29 'text 2', 29 'text 2',
30 { 30 {
31 'enqueue': true, 31 'enqueue': true,
32 'onevent': function(event) { 32 'onEvent': function(event) {
33 chrome.test.assertEq('cancelled', event.type); 33 chrome.test.assertEq('cancelled', event.type);
34 callbacks++; 34 callbacks++;
35 } 35 }
36 }, function() { 36 }, function() {
37 chrome.test.assertNoLastError(); 37 chrome.test.assertNoLastError();
38 callbacks++; 38 callbacks++;
39 }); 39 });
40 chrome.experimental.tts.speak( 40 chrome.experimental.tts.speak(
41 'text 3', 41 'text 3',
42 { 42 {
43 'enqueue': false, 43 'enqueue': false,
44 'onevent': function(event) { 44 'onEvent': function(event) {
45 chrome.test.assertEq('end', event.type); 45 chrome.test.assertEq('end', event.type);
46 callbacks++; 46 callbacks++;
47 if (callbacks == 6) { 47 if (callbacks == 6) {
48 chrome.test.succeed(); 48 chrome.test.succeed();
49 } else { 49 } else {
50 chrome.test.fail(); 50 chrome.test.fail();
51 } 51 }
52 } 52 }
53 }, 53 },
54 function() { 54 function() {
55 chrome.test.assertNoLastError(); 55 chrome.test.assertNoLastError();
56 callbacks++; 56 callbacks++;
57 }); 57 });
58 } 58 }
59 ]); 59 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698