michael@0: /* vim:set ts=2 sw=2 sts=2 et: */ michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: // Test that console.count() counts as expected. See bug 922208. michael@0: michael@0: const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-count.html"; michael@0: michael@0: function test() { michael@0: Task.spawn(runner).then(finishTest); michael@0: michael@0: function* runner() { michael@0: const {tab} = yield loadTab(TEST_URI); michael@0: const hud = yield openConsole(tab); michael@0: michael@0: let button = content.document.querySelector("#local"); michael@0: ok(button, "we have the local-tests button"); michael@0: EventUtils.sendMouseEvent({ type: "click" }, button, content); michael@0: let messages = []; michael@0: [ michael@0: "start", michael@0: ": 2", michael@0: "console.count() testcounter: 1", michael@0: "console.count() testcounter: 2", michael@0: "console.count() testcounter: 3", michael@0: "console.count() testcounter: 4", michael@0: "end" michael@0: ].forEach(function (msg) { michael@0: messages.push({ michael@0: text: msg, michael@0: category: CATEGORY_WEBDEV, michael@0: severity: SEVERITY_LOG michael@0: }); michael@0: }); michael@0: messages.push({ michael@0: name: "Three local counts with no label and count=1", michael@0: text: ": 1", michael@0: category: CATEGORY_WEBDEV, michael@0: severity: SEVERITY_LOG, michael@0: count: 3 michael@0: }); michael@0: yield waitForMessages({ michael@0: webconsole: hud, michael@0: messages: messages michael@0: }); michael@0: michael@0: hud.jsterm.clearOutput(); michael@0: michael@0: button = content.document.querySelector("#external"); michael@0: ok(button, "we have the external-tests button"); michael@0: EventUtils.sendMouseEvent({ type: "click" }, button, content); michael@0: messages = []; michael@0: [ michael@0: "start", michael@0: "console.count() testcounter: 5", michael@0: "console.count() testcounter: 6", michael@0: "end" michael@0: ].forEach(function (msg) { michael@0: messages.push({ michael@0: text: msg, michael@0: category: CATEGORY_WEBDEV, michael@0: severity: SEVERITY_LOG michael@0: }); michael@0: }); michael@0: messages.push({ michael@0: name: "Two external counts with no label and count=1", michael@0: text: ": 1", michael@0: category: CATEGORY_WEBDEV, michael@0: severity: SEVERITY_LOG, michael@0: count: 2 michael@0: }); michael@0: yield waitForMessages({ michael@0: webconsole: hud, michael@0: messages: messages michael@0: }); michael@0: } michael@0: }