browser/devtools/webconsole/test/browser_webconsole_bug_611795.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/webconsole/test/browser_webconsole_bug_611795.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,64 @@
     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 +const TEST_URI = 'data:text/html;charset=utf-8,<div style="-moz-opacity:0;">test repeated' +
     1.9 +                 ' css warnings</div><p style="-moz-opacity:0">hi</p>';
    1.10 +
    1.11 +function onContentLoaded()
    1.12 +{
    1.13 +  browser.removeEventListener("load", onContentLoaded, true);
    1.14 +
    1.15 +  let HUD = HUDService.getHudByWindow(content);
    1.16 +
    1.17 +  let cssWarning = "Unknown property '-moz-opacity'.  Declaration dropped.";
    1.18 +
    1.19 +  waitForMessages({
    1.20 +    webconsole: HUD,
    1.21 +    messages: [{
    1.22 +      text: cssWarning,
    1.23 +      category: CATEGORY_CSS,
    1.24 +      severity: SEVERITY_WARNING,
    1.25 +      repeats: 2,
    1.26 +    }],
    1.27 +  }).then(testConsoleLogRepeats);
    1.28 +}
    1.29 +
    1.30 +function testConsoleLogRepeats()
    1.31 +{
    1.32 +  let HUD = HUDService.getHudByWindow(content);
    1.33 +  let jsterm = HUD.jsterm;
    1.34 +
    1.35 +  jsterm.clearOutput();
    1.36 +
    1.37 +  jsterm.setInputValue("for (let i = 0; i < 10; ++i) console.log('this is a line of reasonably long text that I will use to verify that the repeated text node is of an appropriate size.');");
    1.38 +  jsterm.execute();
    1.39 +
    1.40 +  waitForMessages({
    1.41 +    webconsole: HUD,
    1.42 +    messages: [{
    1.43 +      text: "this is a line of reasonably long text",
    1.44 +      category: CATEGORY_WEBDEV,
    1.45 +      severity: SEVERITY_LOG,
    1.46 +      repeats: 10,
    1.47 +    }],
    1.48 +  }).then(finishTest);
    1.49 +}
    1.50 +
    1.51 +/**
    1.52 + * Unit test for bug 611795:
    1.53 + * Repeated CSS messages get collapsed into one.
    1.54 + */
    1.55 +function test()
    1.56 +{
    1.57 +  addTab(TEST_URI);
    1.58 +  browser.addEventListener("load", function onLoad() {
    1.59 +    browser.removeEventListener("load", onLoad, true);
    1.60 +    openConsole(null, function(aHud) {
    1.61 +      // Clear cached messages that are shown once the Web Console opens.
    1.62 +      aHud.jsterm.clearOutput(true);
    1.63 +      browser.addEventListener("load", onContentLoaded, true);
    1.64 +      content.location.reload();
    1.65 +    });
    1.66 +  }, true);
    1.67 +}

mercurial