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

Side by Side Diff: chrome/test/data/extensions/api_test/speech_input/start_stop/test.js

Issue 14230005: Remove all code for chrome.experimental.speechInput extension API (Closed) Base URL: https://src.chromium.org/svn/trunk/src/
Patch Set: rebase Created 7 years, 8 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
OLDNEW
(Empty)
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 // Extension Speech Input api test.
6 // browser_tests --gtest_filter="ExtensionSpeechInputApiTest.*"
7
8 chrome.test.runTests([
9 function testSpeechInputStartStop() {
10 var count = 0;
11
12 // Recording is not active, start it.
13 chrome.experimental.speechInput.isRecording(function(recording) {
14 chrome.test.assertNoLastError();
15 chrome.test.assertFalse(recording);
16 chrome.experimental.speechInput.start({}, started);
17 });
18
19 // There should be no error and recording should be active. Stop it.
20 function started() {
21 chrome.test.assertNoLastError();
22 chrome.experimental.speechInput.isRecording(function(recording) {
23 chrome.test.assertNoLastError();
24 chrome.test.assertTrue(recording);
25 chrome.experimental.speechInput.stop(stopped);
26 });
27 }
28
29 // There should be no error and recording shouldn't be active again.
30 // Restart recording if not repeated at least 3 times.
31 function stopped() {
32 chrome.test.assertNoLastError();
33 chrome.experimental.speechInput.isRecording(function(recording) {
34 chrome.test.assertNoLastError();
35 chrome.test.assertFalse(recording);
36 if (++count < 3)
37 chrome.experimental.speechInput.start({}, started);
38 else
39 chrome.test.succeed();
40 });
41 }
42 },
43
44 function testSpeechInputInvalidOperation() {
45 // Calling start once recording should generate an invalid operation error.
46 chrome.experimental.speechInput.stop(function() {
47 chrome.test.assertEq(chrome.runtime.lastError.message,
48 "invalidOperation");
49 chrome.experimental.speechInput.start({}, started);
50 });
51
52 // Calling stop before recording should generate an invalid operation error.
53 function started() {
54 chrome.test.assertNoLastError();
55 chrome.experimental.speechInput.start({}, function() {
56 chrome.test.assertEq(chrome.runtime.lastError.message,
57 "invalidOperation");
58 chrome.test.succeed();
59 });
60 }
61 }
62 ]);
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/speech_input/start_stop/test.html ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698