browser/devtools/commandline/test/browser_cmd_commands.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 // Test various GCLI commands
michael@0 5
michael@0 6 const TEST_URI = "data:text/html;charset=utf-8,gcli-commands";
michael@0 7
michael@0 8 function test() {
michael@0 9 return Task.spawn(spawnTest).then(finish, helpers.handleError);
michael@0 10 }
michael@0 11
michael@0 12 function spawnTest() {
michael@0 13 let options = yield helpers.openTab(TEST_URI);
michael@0 14 yield helpers.openToolbar(options);
michael@0 15
michael@0 16 let subjectPromise = helpers.observeOnce("web-console-created");
michael@0 17
michael@0 18 helpers.audit(options, [
michael@0 19 {
michael@0 20 setup: "console open",
michael@0 21 exec: { }
michael@0 22 }
michael@0 23 ]);
michael@0 24
michael@0 25 let subject = yield subjectPromise;
michael@0 26
michael@0 27 subject.QueryInterface(Ci.nsISupportsString);
michael@0 28 let hud = HUDService.getHudReferenceById(subject.data);
michael@0 29 ok(hud, "console open");
michael@0 30
michael@0 31 let jstermExecute = helpers.promiseify(hud.jsterm.execute, hud.jsterm);
michael@0 32 let msg = yield jstermExecute("pprint(window)");
michael@0 33
michael@0 34 ok(msg, "output for pprint(window)");
michael@0 35
michael@0 36 let oncePromise = hud.jsterm.once("messages-cleared");
michael@0 37
michael@0 38 helpers.audit(options, [
michael@0 39 {
michael@0 40 setup: "console clear",
michael@0 41 exec: { output: "" }
michael@0 42 }
michael@0 43 ]);
michael@0 44
michael@0 45 yield oncePromise;
michael@0 46
michael@0 47 let labels = hud.outputNode.querySelectorAll(".message");
michael@0 48 is(labels.length, 0, "no output in console");
michael@0 49
michael@0 50 yield helpers.audit(options, [
michael@0 51 {
michael@0 52 setup: "console close",
michael@0 53 exec: { output: true }
michael@0 54 }
michael@0 55 ]);
michael@0 56
michael@0 57 ok(!HUDService.getHudReferenceById(hud.hudId), "console closed");
michael@0 58
michael@0 59 yield helpers.closeToolbar(options);
michael@0 60 yield helpers.closeTab(options);
michael@0 61 }

mercurial