Bug 581231 - Part 4: Add the Close button to the Web Console and style it on the Mac. r=dietrich a=dietrich

This commit is contained in:
Patrick Walton 2010-09-08 17:08:42 -07:00
parent b995a4da65
commit 49ed265ef8
2 changed files with 49 additions and 0 deletions

View File

@ -46,6 +46,7 @@ include $(topsrcdir)/config/rules.mk
_BROWSER_TEST_FILES = \ _BROWSER_TEST_FILES = \
browser_HUDServiceTestsAll.js \ browser_HUDServiceTestsAll.js \
browser_webconsole_netlogging.js \ browser_webconsole_netlogging.js \
browser_webconsole_bug_581231_close_button.js \
$(NULL) $(NULL)
_BROWSER_TEST_PAGES = \ _BROWSER_TEST_PAGES = \

View File

@ -0,0 +1,48 @@
/* vim:set ts=2 sw=2 sts=2 et: */
/* ***** BEGIN LICENSE BLOCK *****
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*
* Contributor(s):
* Patrick Walton <pcwalton@mozilla.com>
*
* ***** END LICENSE BLOCK ***** */
// Tests that the Web Console close button functions.
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/HUDService.jsm");
const TEST_URI = "http://example.com/browser/toolkit/components/console/hudservice/tests/browser/test-console.html";
function test() {
waitForExplicitFinish();
content.location.href = TEST_URI;
waitForFocus(onFocus);
}
function onFocus() {
let tabBrowser = gBrowser.getBrowserForTab(gBrowser.selectedTab);
tabBrowser.addEventListener("DOMContentLoaded", testCloseButton, false);
}
function testCloseButton() {
let tabBrowser = gBrowser.getBrowserForTab(gBrowser.selectedTab);
tabBrowser.removeEventListener("DOMContentLoaded", testCloseButton, false);
HUDService.activateHUDForContext(gBrowser.selectedTab);
let hudId = HUDService.displaysIndex()[0];
let hudBox = HUDService.getHeadsUpDisplay(hudId);
let closeButton = hudBox.querySelector(".jsterm-close-button");
ok(closeButton != null, "we have the close button");
EventUtils.synthesizeMouse(closeButton, 0, 0, {});
ok(!(hudId in HUDService.windowRegistry), "the console is closed when the " +
"close button is pressed");
finish();
}