Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/ */
4 // Tests that the calllog commands works as they should
6 const TEST_URI = "data:text/html;charset=utf-8,gcli-calllog";
8 let tests = {};
10 function test() {
11 return Task.spawn(function() {
12 let options = yield helpers.openTab(TEST_URI);
13 yield helpers.openToolbar(options);
15 yield helpers.runTests(options, tests);
17 yield helpers.closeToolbar(options);
18 yield helpers.closeTab(options);
19 }).then(finish, helpers.handleError);
20 }
22 tests.testCallLogStatus = function(options) {
23 return helpers.audit(options, [
24 {
25 setup: "calllog",
26 check: {
27 input: 'calllog',
28 hints: '',
29 markup: 'IIIIIII',
30 status: 'ERROR'
31 }
32 },
33 {
34 setup: "calllog start",
35 check: {
36 input: 'calllog start',
37 hints: '',
38 markup: 'VVVVVVVVVVVVV',
39 status: 'VALID'
40 }
41 },
42 {
43 setup: "calllog stop",
44 check: {
45 input: 'calllog stop',
46 hints: '',
47 markup: 'VVVVVVVVVVVV',
48 status: 'VALID'
49 }
50 },
51 ]);
52 };
54 tests.testCallLogExec = function(options) {
55 var deferred = promise.defer();
57 var onWebConsoleOpen = function(subject) {
58 Services.obs.removeObserver(onWebConsoleOpen, "web-console-created");
60 subject.QueryInterface(Ci.nsISupportsString);
61 let hud = HUDService.getHudReferenceById(subject.data);
62 ok(hud, "console open");
64 helpers.audit(options, [
65 {
66 setup: "calllog stop",
67 exec: {
68 output: /Stopped call logging/,
69 }
70 },
71 {
72 setup: "console clear",
73 exec: {
74 output: "",
75 },
76 post: function() {
77 let labels = hud.outputNode.querySelectorAll(".webconsole-msg-output");
78 is(labels.length, 0, "no output in console");
79 }
80 },
81 {
82 setup: "console close",
83 exec: {
84 output: "",
85 }
86 },
87 ]).then(function() {
88 deferred.resolve();
89 });
90 };
91 Services.obs.addObserver(onWebConsoleOpen, "web-console-created", false);
93 helpers.audit(options, [
94 {
95 setup: "calllog stop",
96 exec: {
97 output: /No call logging/,
98 }
99 },
100 {
101 name: "calllog start",
102 setup: function() {
103 // This test wants to be in a different event
104 var deferred = promise.defer();
105 executeSoon(function() {
106 helpers.setInput(options, "calllog start").then(() => {
107 deferred.resolve();
108 });
109 });
110 return deferred.promise;
111 },
112 exec: {
113 output: /Call logging started/,
114 },
115 },
116 ]);
118 return deferred.promise;
119 };