browser/devtools/commandline/test/browser_cmd_calllog_chrome.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial