browser/devtools/scratchpad/test/browser_scratchpad_open_error_console.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/scratchpad/test/browser_scratchpad_open_error_console.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,37 @@
     1.4 +/* vim: set ts=2 et sw=2 tw=80: */
     1.5 +/* Any copyright is dedicated to the Public Domain.
     1.6 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.7 +
     1.8 +function test()
     1.9 +{
    1.10 +  waitForExplicitFinish();
    1.11 +
    1.12 +  gBrowser.selectedTab = gBrowser.addTab();
    1.13 +  gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
    1.14 +    gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
    1.15 +    openScratchpad(runTests);
    1.16 +  }, true);
    1.17 +
    1.18 +  content.location = "data:text/html;charset=utf8,test Scratchpad." +
    1.19 +                     "openErrorConsole()";
    1.20 +}
    1.21 +
    1.22 +function runTests()
    1.23 +{
    1.24 +  Services.obs.addObserver(function observer(aSubject) {
    1.25 +    Services.obs.removeObserver(observer, "web-console-created");
    1.26 +    aSubject.QueryInterface(Ci.nsISupportsString);
    1.27 +
    1.28 +    let hud = HUDService.getBrowserConsole();
    1.29 +    ok(hud, "browser console is open");
    1.30 +    is(aSubject.data, hud.hudId, "notification hudId is correct");
    1.31 +
    1.32 +    HUDService.toggleBrowserConsole().then(finish);
    1.33 +  }, "web-console-created", false);
    1.34 +
    1.35 +  let hud = HUDService.getBrowserConsole();
    1.36 +  ok(!hud, "browser console is not open");
    1.37 +  info("wait for the browser console to open from Scratchpad");
    1.38 +
    1.39 +  gScratchpadWindow.Scratchpad.openErrorConsole();
    1.40 +}

mercurial