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

Side by Side Diff: chrome/test/data/extensions/platform_apps/speech/background_page/test.js

Issue 24292004: Allow webkitSpeechRecognition work from an app's background page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync + add ctor/dtor for test class. Created 7 years, 2 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 2013 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 chrome.app.runtime.onLaunched.addListener(function() {
6 chrome.test.runTests([
7 function testWebkitSpeechRecognition() {
8 var succeeded = false;
9
10 var r = new webkitSpeechRecognition();
11 r.onerror = function(e) {
12 if (succeeded) {
13 return;
14 }
15 chrome.test.fail();
16 };
17 r.onstart = function() {
18 succeeded = true;
19 chrome.test.succeed();
20 };
21 // With FakeSpeechRecognitionManager, we do not get onstart event. We
22 // directly get results instead.
23 r.onresult = function(e) {
24 succeeded = true;
25 chrome.test.assertTrue(e.results.length > 0);
26 var transcript = e.results[0][0].transcript;
27 chrome.test.assertEq('Pictures of the moon', transcript);
28 chrome.test.succeed();
29 };
30 r.start();
31 }
32 ]);
33 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698