Bug 990150 - Give AccessFu content tests debug output. r=yzen

This commit is contained in:
Eitan Isaacson 2014-04-01 13:46:02 -07:00
parent 1ed411f765
commit 4f1ba6fe4f
2 changed files with 24 additions and 6 deletions

View File

@ -128,6 +128,10 @@ function adjustRange(aMessage) {
addMessageListener(
'AccessFu:Start',
function(m) {
if (m.json.logLevel) {
Logger.logLevel = Logger[m.json.logLevel];
}
Logger.debug('AccessFu:Start');
if (m.json.buildApp)
Utils.MozBuildApp = m.json.buildApp;

View File

@ -164,6 +164,7 @@ AccessFuContentTest.prototype = {
currentPair: null,
start: function(aFinishedCallback) {
Logger.logLevel = Logger.DEBUG;
this.finishedCallback = aFinishedCallback;
var self = this;
@ -194,6 +195,16 @@ AccessFuContentTest.prototype = {
});
},
finish: function() {
Logger.logLevel = Logger.INFO;
for (var mm of this.mms) {
mm.sendAsyncMessage('AccessFu:Stop');
}
if (this.finishedCallback) {
this.finishedCallback();
}
},
setupMessageManager: function (aMessageManager, aCallback) {
function contentScript() {
addMessageListener('AccessFuTest:Focus', function (aMessage) {
@ -213,7 +224,9 @@ AccessFuContentTest.prototype = {
aMessageManager.addMessageListener('AccessFu:Ready', function () {
aMessageManager.addMessageListener('AccessFu:ContentStarted', aCallback);
aMessageManager.sendAsyncMessage('AccessFu:Start',
{ buildApp: 'browser', androidSdkVersion: Utils.AndroidSdkVersion});
{ buildApp: 'browser',
androidSdkVersion: Utils.AndroidSdkVersion,
logLevel: 'DEBUG' });
});
aMessageManager.loadFrameScript(
@ -236,11 +249,8 @@ AccessFuContentTest.prototype = {
if (!this.currentPair[1]) {
this.pump();
}
} else if (this.finishedCallback) {
for (var mm of this.mms) {
mm.sendAsyncMessage('AccessFu:Stop');
}
this.finishedCallback();
} else {
this.finish();
}
},
@ -301,6 +311,10 @@ AccessFuContentTest.prototype = {
},
extractUtterance: function(aData) {
if (!aData) {
return null;
}
for (var output of aData) {
if (output && output.type === 'Speech') {
for (var action of output.details.actions) {