Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / test / data / extensions / api_test / tts / word_callbacks / test.js
blobe4cea5406f6e9f0f05260c8eca8a04089cfaad1e
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
3 // found in the LICENSE file.
5 // TTS api test for Chrome on ChromeOS.
6 // browser_tests.exe --gtest_filter="TtsApiTest.*"
8 chrome.test.runTests([
9   function testWordCallbacks() {
10     var callbacks = 0;
11     chrome.tts.speak(
12         'one two three',
13         {
14          'onEvent': function(event) {
15            callbacks++;
16            switch(callbacks) {
17            case 1:
18              chrome.test.assertEq('word', event.type);
19              chrome.test.assertEq(0, event.charIndex);
20              break;
21            case 2:
22              chrome.test.assertEq('word', event.type);
23              chrome.test.assertEq(4, event.charIndex);
24              break;
25            case 3:
26              chrome.test.assertEq('word', event.type);
27              chrome.test.assertEq(8, event.charIndex);
28              break;
29            case 4:
30              chrome.test.assertEq('end', event.type);
31              chrome.test.assertEq(13, event.charIndex);
32              chrome.test.succeed();
33              break;
34            default:
35              chrome.test.fail();
36            }
37          }
38         });
39   }
40 ]);