- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / data / extensions / api_test / tts / enqueue / test.js
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.
4
5 // TTS api test for Chrome on ChromeOS.
6 // browser_tests.exe --gtest_filter="TtsApiTest.*"
7
8 chrome.test.runTests([
9   function testEnqueue() {
10     var callbacks = 0;
11     chrome.tts.speak(
12         'text 1',
13         {
14          'enqueue': true,
15          'onEvent': function(event) {
16            chrome.test.assertEq('end', event.type);
17            callbacks++;
18          }
19         },
20         function() {
21           chrome.test.assertNoLastError();
22           callbacks++;
23         });
24     chrome.tts.speak(
25         'text 2',
26         {
27          'enqueue': true,
28          'onEvent': function(event) {
29            chrome.test.assertEq('end', event.type);
30            callbacks++;
31            if (callbacks == 4) {
32              chrome.test.succeed();
33            } else {
34              chrome.test.fail();
35            }
36          }
37         },
38         function() {
39           chrome.test.assertNoLastError();
40           callbacks++;
41         });
42   }
43 ]);