browser/devtools/webconsole/test/browser_cached_messages.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/webconsole/test/browser_cached_messages.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,57 @@
     1.4 +/* vim:set ts=2 sw=2 sts=2 et: */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +// Test to see if the cached messages are displayed when the console UI is opened.
    1.10 +
    1.11 +const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-webconsole-error-observer.html";
    1.12 +
    1.13 +function test()
    1.14 +{
    1.15 +  waitForExplicitFinish();
    1.16 +
    1.17 +  expectUncaughtException();
    1.18 +
    1.19 +  addTab(TEST_URI);
    1.20 +  gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
    1.21 +    gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
    1.22 +    testOpenUI(true);
    1.23 +  }, true);
    1.24 +}
    1.25 +
    1.26 +function testOpenUI(aTestReopen)
    1.27 +{
    1.28 +  openConsole(null, function(hud) {
    1.29 +    waitForMessages({
    1.30 +      webconsole: hud,
    1.31 +      messages: [
    1.32 +        {
    1.33 +          text: "log Bazzle",
    1.34 +          category: CATEGORY_WEBDEV,
    1.35 +          severity: SEVERITY_LOG,
    1.36 +        },
    1.37 +        {
    1.38 +          text: "error Bazzle",
    1.39 +          category: CATEGORY_WEBDEV,
    1.40 +          severity: SEVERITY_ERROR,
    1.41 +        },
    1.42 +        {
    1.43 +          text: "bazBug611032",
    1.44 +          category: CATEGORY_JS,
    1.45 +          severity: SEVERITY_ERROR,
    1.46 +        },
    1.47 +        {
    1.48 +          text: "cssColorBug611032",
    1.49 +          category: CATEGORY_CSS,
    1.50 +          severity: SEVERITY_WARNING,
    1.51 +        },
    1.52 +      ],
    1.53 +    }).then(() => {
    1.54 +      closeConsole(gBrowser.selectedTab, function() {
    1.55 +        aTestReopen && info("will reopen the Web Console");
    1.56 +        executeSoon(aTestReopen ? testOpenUI : finishTest);
    1.57 +      });
    1.58 +    });
    1.59 +  });
    1.60 +}

mercurial