2012-07-13 09:06:46 -07:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
|
|
|
// Tests that the calllog commands works as they should
|
|
|
|
|
|
|
|
const TEST_URI = "data:text/html;charset=utf-8,gcli-calllog";
|
|
|
|
|
2013-03-12 21:51:30 -07:00
|
|
|
let tests = {};
|
2012-07-13 09:06:46 -07:00
|
|
|
|
2013-03-12 21:51:30 -07:00
|
|
|
function test() {
|
|
|
|
helpers.addTabWithToolbar(TEST_URI, function(options) {
|
|
|
|
return helpers.runTests(options, tests);
|
|
|
|
}).then(finish);
|
2012-07-13 09:06:46 -07:00
|
|
|
}
|
|
|
|
|
2013-03-12 21:51:30 -07:00
|
|
|
tests.testCallLogStatus = function(options) {
|
|
|
|
return helpers.audit(options, [
|
|
|
|
{
|
|
|
|
setup: "calllog",
|
|
|
|
check: {
|
|
|
|
input: 'calllog',
|
|
|
|
hints: '',
|
|
|
|
markup: 'IIIIIII',
|
|
|
|
status: 'ERROR'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
setup: "calllog start",
|
|
|
|
check: {
|
|
|
|
input: 'calllog start',
|
|
|
|
hints: '',
|
|
|
|
markup: 'VVVVVVVVVVVVV',
|
|
|
|
status: 'VALID'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
setup: "calllog stop",
|
|
|
|
check: {
|
|
|
|
input: 'calllog stop',
|
|
|
|
hints: '',
|
|
|
|
markup: 'VVVVVVVVVVVV',
|
|
|
|
status: 'VALID'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
]);
|
|
|
|
};
|
|
|
|
|
|
|
|
tests.testCallLogExec = function(options) {
|
2013-07-11 00:12:20 -07:00
|
|
|
var deferred = promise.defer();
|
2013-03-12 21:51:30 -07:00
|
|
|
|
|
|
|
var onWebConsoleOpen = function(subject) {
|
2012-07-26 08:06:04 -07:00
|
|
|
Services.obs.removeObserver(onWebConsoleOpen, "web-console-created");
|
2012-07-13 09:06:46 -07:00
|
|
|
|
2013-03-12 21:51:30 -07:00
|
|
|
subject.QueryInterface(Ci.nsISupportsString);
|
|
|
|
let hud = HUDService.getHudReferenceById(subject.data);
|
2013-08-02 10:11:57 -07:00
|
|
|
ok(hud, "console open");
|
2013-03-12 21:51:30 -07:00
|
|
|
|
|
|
|
helpers.audit(options, [
|
|
|
|
{
|
|
|
|
setup: "calllog stop",
|
|
|
|
exec: {
|
|
|
|
output: /Stopped call logging/,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
setup: "console clear",
|
|
|
|
exec: {
|
|
|
|
output: "",
|
|
|
|
},
|
|
|
|
post: function() {
|
|
|
|
let labels = hud.outputNode.querySelectorAll(".webconsole-msg-output");
|
|
|
|
is(labels.length, 0, "no output in console");
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
setup: "console close",
|
|
|
|
exec: {
|
|
|
|
output: "",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
]).then(function() {
|
|
|
|
deferred.resolve();
|
2012-07-26 08:06:04 -07:00
|
|
|
});
|
2013-03-12 21:51:30 -07:00
|
|
|
};
|
2012-07-26 08:06:04 -07:00
|
|
|
Services.obs.addObserver(onWebConsoleOpen, "web-console-created", false);
|
2012-07-13 09:06:46 -07:00
|
|
|
|
2013-03-12 21:51:30 -07:00
|
|
|
helpers.audit(options, [
|
|
|
|
{
|
|
|
|
setup: "calllog stop",
|
|
|
|
exec: {
|
|
|
|
output: /No call logging/,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "calllog start",
|
|
|
|
setup: function() {
|
|
|
|
// This test wants to be in a different event
|
2013-07-11 00:12:20 -07:00
|
|
|
var deferred = promise.defer();
|
2013-03-12 21:51:30 -07:00
|
|
|
executeSoon(function() {
|
|
|
|
helpers.setInput(options, "calllog start");
|
|
|
|
deferred.resolve();
|
|
|
|
});
|
|
|
|
return deferred.promise;
|
|
|
|
},
|
|
|
|
exec: {
|
|
|
|
output: /Call logging started/,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]);
|
|
|
|
|
|
|
|
return deferred.promise;
|
|
|
|
};
|