Commit c329228b authored by amistry's avatar amistry Committed by Commit bot

Delete all uses of SpeechManager from the app list start page.

Constructing the SpeechManager creates a WebAudio instance which creates
an audio output stream that prevents ChromeOS from suspending. This
code is supposed to be dead and is slated for removal. This change gets
rid of the usage and is intended to be mergable into the M42 branch.

BUG=450081

Review URL: https://codereview.chromium.org/966983003

Cr-Commit-Position: refs/heads/master@{#318969}
parent b875af1c
...@@ -6,13 +6,9 @@ ...@@ -6,13 +6,9 @@
* @fileoverview App launcher start page implementation. * @fileoverview App launcher start page implementation.
*/ */
<include src="speech_manager.js">
cr.define('appList.startPage', function() { cr.define('appList.startPage', function() {
'use strict'; 'use strict';
var speechManager = null;
// The element containing the current Google Doodle. // The element containing the current Google Doodle.
var doodle = null; var doodle = null;
...@@ -24,7 +20,6 @@ cr.define('appList.startPage', function() { ...@@ -24,7 +20,6 @@ cr.define('appList.startPage', function() {
* Initialize the page. * Initialize the page.
*/ */
function initialize() { function initialize() {
speechManager = new speech.SpeechManager();
chrome.send('initialize'); chrome.send('initialize');
} }
...@@ -34,7 +29,6 @@ cr.define('appList.startPage', function() { ...@@ -34,7 +29,6 @@ cr.define('appList.startPage', function() {
* @param {boolean} enabled Whether the plugin is enabled or not. * @param {boolean} enabled Whether the plugin is enabled or not.
*/ */
function setHotwordEnabled(enabled) { function setHotwordEnabled(enabled) {
speechManager.setHotwordEnabled(enabled);
} }
/** /**
...@@ -42,7 +36,6 @@ cr.define('appList.startPage', function() { ...@@ -42,7 +36,6 @@ cr.define('appList.startPage', function() {
* @param {string} arch The architecture. * @param {string} arch The architecture.
*/ */
function setNaclArch(arch) { function setNaclArch(arch) {
speechManager.setNaclArch(arch);
} }
/** /**
...@@ -51,8 +44,6 @@ cr.define('appList.startPage', function() { ...@@ -51,8 +44,6 @@ cr.define('appList.startPage', function() {
* @param {boolean} hotwordEnabled Whether the hotword is enabled or not. * @param {boolean} hotwordEnabled Whether the hotword is enabled or not.
*/ */
function onAppListShown(hotwordEnabled, legacySpeechEnabled) { function onAppListShown(hotwordEnabled, legacySpeechEnabled) {
if (legacySpeechEnabled)
speechManager.onShown(hotwordEnabled);
chrome.send('appListShown', [this.doodle != null]); chrome.send('appListShown', [this.doodle != null]);
} }
...@@ -135,7 +126,6 @@ cr.define('appList.startPage', function() { ...@@ -135,7 +126,6 @@ cr.define('appList.startPage', function() {
* Invoked when the app-list bubble is hidden. * Invoked when the app-list bubble is hidden.
*/ */
function onAppListHidden() { function onAppListHidden() {
speechManager.onHidden();
} }
/** /**
...@@ -143,7 +133,6 @@ cr.define('appList.startPage', function() { ...@@ -143,7 +133,6 @@ cr.define('appList.startPage', function() {
* state. * state.
*/ */
function toggleSpeechRecognition() { function toggleSpeechRecognition() {
speechManager.toggleSpeechRecognition();
} }
return { return {
......
...@@ -159,58 +159,3 @@ TEST_F('AppListStartPageWebUITest', 'LoadDoodle', function() { ...@@ -159,58 +159,3 @@ TEST_F('AppListStartPageWebUITest', 'LoadDoodle', function() {
'http://example.com/'); 'http://example.com/');
assertEquals(null, $('doodle')); assertEquals(null, $('doodle'));
}); });
TEST_F('AppListStartPageWebUITest', 'SpeechRecognitionState', function() {
this.mockHandler.expects(once()).setSpeechRecognitionState('READY');
appList.startPage.onAppListShown(false, true);
this.mockHandler.expects(once()).setSpeechRecognitionState('RECOGNIZING');
appList.startPage.toggleSpeechRecognition();
Mock4JS.verifyAllMocks();
Mock4JS.clearMocksToVerify();
this.mockHandler.expects(once()).setSpeechRecognitionState('READY');
for (var i = 0; i < this.audioTrackMocks.length; ++i) {
this.audioTrackMocks[i].expects(once()).stop();
}
appList.startPage.toggleSpeechRecognition();
Mock4JS.verifyAllMocks();
Mock4JS.clearMocksToVerify();
this.mockHandler.expects(once()).setSpeechRecognitionState('RECOGNIZING');
appList.startPage.toggleSpeechRecognition();
Mock4JS.verifyAllMocks();
Mock4JS.clearMocksToVerify();
this.mockHandler.expects(once()).setSpeechRecognitionState('STOPPING');
this.mockHandler.expects(once()).setSpeechRecognitionState('READY');
for (var i = 0; i < this.audioTrackMocks.length; ++i) {
this.audioTrackMocks[i].expects(once()).stop();
}
appList.startPage.onAppListHidden();
});
TEST_F('AppListStartPageWebUITest', 'SpeechRecognition', function() {
this.mockHandler.expects(once()).setSpeechRecognitionState('READY');
appList.startPage.onAppListShown(false, true);
this.mockHandler.expects(once()).setSpeechRecognitionState('RECOGNIZING');
appList.startPage.toggleSpeechRecognition();
Mock4JS.verifyAllMocks();
Mock4JS.clearMocksToVerify();
this.mockHandler.expects(once()).setSpeechRecognitionState('IN_SPEECH');
this.speechRecognizer.onspeechstart();
Mock4JS.verifyAllMocks();
Mock4JS.clearMocksToVerify();
this.mockHandler.expects(once()).speechResult('test,false');
this.sendSpeechResult('test', false);
Mock4JS.verifyAllMocks();
Mock4JS.clearMocksToVerify();
this.mockHandler.expects(once()).speechResult('test,true');
this.mockHandler.expects(once()).setSpeechRecognitionState('READY');
for (var i = 0; i < this.audioTrackMocks.length; ++i) {
this.audioTrackMocks[i].expects(once()).stop();
}
this.sendSpeechResult('test', true);
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment