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
Родитель 552a5c4ba4
Коммит 838a814cf8
2 изменённых файлов: 49 добавлений и 0 удалений

Просмотреть файл

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

Просмотреть файл

@ -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();
}