1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/webconsole/test/browser_webconsole_count.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,77 @@ 1.4 +/* vim:set ts=2 sw=2 sts=2 et: */ 1.5 +/* Any copyright is dedicated to the Public Domain. 1.6 + * http://creativecommons.org/publicdomain/zero/1.0/ */ 1.7 + 1.8 +// Test that console.count() counts as expected. See bug 922208. 1.9 + 1.10 +const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-count.html"; 1.11 + 1.12 +function test() { 1.13 + Task.spawn(runner).then(finishTest); 1.14 + 1.15 + function* runner() { 1.16 + const {tab} = yield loadTab(TEST_URI); 1.17 + const hud = yield openConsole(tab); 1.18 + 1.19 + let button = content.document.querySelector("#local"); 1.20 + ok(button, "we have the local-tests button"); 1.21 + EventUtils.sendMouseEvent({ type: "click" }, button, content); 1.22 + let messages = []; 1.23 + [ 1.24 + "start", 1.25 + "<no label>: 2", 1.26 + "console.count() testcounter: 1", 1.27 + "console.count() testcounter: 2", 1.28 + "console.count() testcounter: 3", 1.29 + "console.count() testcounter: 4", 1.30 + "end" 1.31 + ].forEach(function (msg) { 1.32 + messages.push({ 1.33 + text: msg, 1.34 + category: CATEGORY_WEBDEV, 1.35 + severity: SEVERITY_LOG 1.36 + }); 1.37 + }); 1.38 + messages.push({ 1.39 + name: "Three local counts with no label and count=1", 1.40 + text: "<no label>: 1", 1.41 + category: CATEGORY_WEBDEV, 1.42 + severity: SEVERITY_LOG, 1.43 + count: 3 1.44 + }); 1.45 + yield waitForMessages({ 1.46 + webconsole: hud, 1.47 + messages: messages 1.48 + }); 1.49 + 1.50 + hud.jsterm.clearOutput(); 1.51 + 1.52 + button = content.document.querySelector("#external"); 1.53 + ok(button, "we have the external-tests button"); 1.54 + EventUtils.sendMouseEvent({ type: "click" }, button, content); 1.55 + messages = []; 1.56 + [ 1.57 + "start", 1.58 + "console.count() testcounter: 5", 1.59 + "console.count() testcounter: 6", 1.60 + "end" 1.61 + ].forEach(function (msg) { 1.62 + messages.push({ 1.63 + text: msg, 1.64 + category: CATEGORY_WEBDEV, 1.65 + severity: SEVERITY_LOG 1.66 + }); 1.67 + }); 1.68 + messages.push({ 1.69 + name: "Two external counts with no label and count=1", 1.70 + text: "<no label>: 1", 1.71 + category: CATEGORY_WEBDEV, 1.72 + severity: SEVERITY_LOG, 1.73 + count: 2 1.74 + }); 1.75 + yield waitForMessages({ 1.76 + webconsole: hud, 1.77 + messages: messages 1.78 + }); 1.79 + } 1.80 +}