|
1 /* vim: set ts=2 et sw=2 tw=80: */ |
|
2 /* Any copyright is dedicated to the Public Domain. |
|
3 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
4 |
|
5 function test() |
|
6 { |
|
7 waitForExplicitFinish(); |
|
8 |
|
9 gBrowser.selectedTab = gBrowser.addTab(); |
|
10 gBrowser.selectedBrowser.addEventListener("load", function onLoad() { |
|
11 gBrowser.selectedBrowser.removeEventListener("load", onLoad, true); |
|
12 openScratchpad(runTests); |
|
13 }, true); |
|
14 |
|
15 content.location = "data:text/html;charset=utf8,test Scratchpad." + |
|
16 "openErrorConsole()"; |
|
17 } |
|
18 |
|
19 function runTests() |
|
20 { |
|
21 Services.obs.addObserver(function observer(aSubject) { |
|
22 Services.obs.removeObserver(observer, "web-console-created"); |
|
23 aSubject.QueryInterface(Ci.nsISupportsString); |
|
24 |
|
25 let hud = HUDService.getBrowserConsole(); |
|
26 ok(hud, "browser console is open"); |
|
27 is(aSubject.data, hud.hudId, "notification hudId is correct"); |
|
28 |
|
29 HUDService.toggleBrowserConsole().then(finish); |
|
30 }, "web-console-created", false); |
|
31 |
|
32 let hud = HUDService.getBrowserConsole(); |
|
33 ok(!hud, "browser console is not open"); |
|
34 info("wait for the browser console to open from Scratchpad"); |
|
35 |
|
36 gScratchpadWindow.Scratchpad.openErrorConsole(); |
|
37 } |