Skip to content

Commit

Permalink
Bug 990150 - Give AccessFu content tests debug output. r=yzen
Browse files Browse the repository at this point in the history
  • Loading branch information
eeejay committed Apr 1, 2014
1 parent 12f06d4 commit 0df2e9e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
4 changes: 4 additions & 0 deletions accessible/src/jsat/content-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
26 changes: 20 additions & 6 deletions accessible/tests/mochitest/jsat/jsatcommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ AccessFuContentTest.prototype = {
currentPair: null,

start: function(aFinishedCallback) {
Logger.logLevel = Logger.DEBUG;
this.finishedCallback = aFinishedCallback;
var self = this;

Expand Down Expand Up @@ -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) {
Expand All @@ -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(
Expand All @@ -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();
}
},

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 0df2e9e

Please sign in to comment.