browser/devtools/webconsole/test/browser_webconsole_count.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 /* vim:set ts=2 sw=2 sts=2 et: */
michael@0 2 /* Any copyright is dedicated to the Public Domain.
michael@0 3 * http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 4
michael@0 5 // Test that console.count() counts as expected. See bug 922208.
michael@0 6
michael@0 7 const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-count.html";
michael@0 8
michael@0 9 function test() {
michael@0 10 Task.spawn(runner).then(finishTest);
michael@0 11
michael@0 12 function* runner() {
michael@0 13 const {tab} = yield loadTab(TEST_URI);
michael@0 14 const hud = yield openConsole(tab);
michael@0 15
michael@0 16 let button = content.document.querySelector("#local");
michael@0 17 ok(button, "we have the local-tests button");
michael@0 18 EventUtils.sendMouseEvent({ type: "click" }, button, content);
michael@0 19 let messages = [];
michael@0 20 [
michael@0 21 "start",
michael@0 22 "<no label>: 2",
michael@0 23 "console.count() testcounter: 1",
michael@0 24 "console.count() testcounter: 2",
michael@0 25 "console.count() testcounter: 3",
michael@0 26 "console.count() testcounter: 4",
michael@0 27 "end"
michael@0 28 ].forEach(function (msg) {
michael@0 29 messages.push({
michael@0 30 text: msg,
michael@0 31 category: CATEGORY_WEBDEV,
michael@0 32 severity: SEVERITY_LOG
michael@0 33 });
michael@0 34 });
michael@0 35 messages.push({
michael@0 36 name: "Three local counts with no label and count=1",
michael@0 37 text: "<no label>: 1",
michael@0 38 category: CATEGORY_WEBDEV,
michael@0 39 severity: SEVERITY_LOG,
michael@0 40 count: 3
michael@0 41 });
michael@0 42 yield waitForMessages({
michael@0 43 webconsole: hud,
michael@0 44 messages: messages
michael@0 45 });
michael@0 46
michael@0 47 hud.jsterm.clearOutput();
michael@0 48
michael@0 49 button = content.document.querySelector("#external");
michael@0 50 ok(button, "we have the external-tests button");
michael@0 51 EventUtils.sendMouseEvent({ type: "click" }, button, content);
michael@0 52 messages = [];
michael@0 53 [
michael@0 54 "start",
michael@0 55 "console.count() testcounter: 5",
michael@0 56 "console.count() testcounter: 6",
michael@0 57 "end"
michael@0 58 ].forEach(function (msg) {
michael@0 59 messages.push({
michael@0 60 text: msg,
michael@0 61 category: CATEGORY_WEBDEV,
michael@0 62 severity: SEVERITY_LOG
michael@0 63 });
michael@0 64 });
michael@0 65 messages.push({
michael@0 66 name: "Two external counts with no label and count=1",
michael@0 67 text: "<no label>: 1",
michael@0 68 category: CATEGORY_WEBDEV,
michael@0 69 severity: SEVERITY_LOG,
michael@0 70 count: 2
michael@0 71 });
michael@0 72 yield waitForMessages({
michael@0 73 webconsole: hud,
michael@0 74 messages: messages
michael@0 75 });
michael@0 76 }
michael@0 77 }

mercurial