browser/devtools/commandline/test/browser_cmd_calllog_chrome.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:2fca1089b074
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 // Tests that the calllog commands works as they should
5
6 const TEST_URI = "data:text/html;charset=utf-8,cmd-calllog-chrome";
7
8 let tests = {};
9
10 function test() {
11 return Task.spawn(function() {
12 let options = yield helpers.openTab(TEST_URI);
13 yield helpers.openToolbar(options);
14
15 yield helpers.runTests(options, tests);
16
17 yield helpers.closeToolbar(options);
18 yield helpers.closeTab(options);
19 }).then(finish, helpers.handleError);
20 }
21
22 tests.testCallLogStatus = function(options) {
23 return helpers.audit(options, [
24 {
25 setup: "calllog",
26 check: {
27 status: "ERROR",
28 emptyParameters: [ " " ]
29 }
30 },
31 {
32 setup: "calllog chromestop",
33 check: {
34 status: "VALID",
35 emptyParameters: [ " " ]
36 }
37 },
38 {
39 setup: "calllog chromestart content-variable window",
40 check: {
41 status: "VALID",
42 emptyParameters: [ " " ]
43 }
44 },
45 {
46 setup: "calllog chromestart javascript \"({a1: function() {this.a2()},a2: function() {}});\"",
47 check: {
48 status: "VALID",
49 emptyParameters: [ " " ]
50 }
51 },
52 ]);
53 };
54
55 tests.testCallLogExec = function(options) {
56 let deferred = promise.defer();
57
58 function onWebConsoleOpen(subject) {
59 Services.obs.removeObserver(onWebConsoleOpen, "web-console-created");
60
61 subject.QueryInterface(Ci.nsISupportsString);
62 let hud = HUDService.getHudReferenceById(subject.data);
63 ok(hud, "console open");
64
65 helpers.audit(options, [
66 {
67 setup: "calllog chromestop",
68 exec: {
69 output: /Stopped call logging/,
70 }
71 },
72 {
73 setup: "calllog chromestart javascript XXX",
74 exec: {
75 output: /following exception/,
76 }
77 },
78 {
79 setup: "console clear",
80 exec: {
81 output: '',
82 },
83 post: function() {
84 let labels = hud.jsterm.outputNode.querySelectorAll(".webconsole-msg-output");
85 is(labels.length, 0, "no output in console");
86 }
87 },
88 {
89 setup: "console close",
90 exec: {
91 output: '',
92 },
93 },
94 ]).then(function() {
95 deferred.resolve();
96 });
97 }
98 Services.obs.addObserver(onWebConsoleOpen, "web-console-created", false);
99
100 helpers.audit(options, [
101 {
102 setup: "calllog chromestop",
103 exec: {
104 output: /No call logging/
105 }
106 },
107 {
108 setup: "calllog chromestart javascript \"({a1: function() {this.a2()},a2: function() {}});\"",
109 exec: {
110 output: /Call logging started/,
111 }
112 },
113 ]);
114
115 return deferred.promise;
116 };

mercurial