зеркало из https://github.com/mozilla/pjs.git
Bug 592469 - Web Console cleanup: part 8 - tests - getHeadsUpDisplay(); r=dcamp
This commit is contained in:
Родитель
280a6f65c6
Коммит
fb3f1aab83
|
@ -63,11 +63,10 @@ function testWarningPresent() {
|
|||
|
||||
function testOpenWebConsole(shouldWarn) {
|
||||
openConsole();
|
||||
is(HUDService.displaysIndex().length, 1, "WebConsole was opened");
|
||||
|
||||
hudId = HUDService.displaysIndex()[0];
|
||||
hud = HUDService.getHeadsUpDisplay(hudId);
|
||||
hud = HUDService.getHudByWindow(content);
|
||||
ok(hud, "WebConsole was opened");
|
||||
|
||||
let msg = (shouldWarn ? "found" : "didn't find") + " API replacement warning";
|
||||
testLogEntry(hud, "disabled", msg, false, !shouldWarn);
|
||||
testLogEntry(hud.outputNode, "disabled", msg, false, !shouldWarn);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,6 @@ function test() {
|
|||
function onLoad(aEvent) {
|
||||
browser.removeEventListener(aEvent.type, arguments.callee, true);
|
||||
openConsole();
|
||||
hudId = HUDService.displaysIndex()[0];
|
||||
|
||||
browser.addEventListener("load", testBasicNetLogging, true);
|
||||
content.location = TEST_NETWORK_URI;
|
||||
|
@ -60,7 +59,7 @@ function onLoad(aEvent) {
|
|||
function testBasicNetLogging(aEvent) {
|
||||
browser.removeEventListener(aEvent.type, arguments.callee, true);
|
||||
|
||||
outputNode = HUDService.hudReferences[hudId].outputNode;
|
||||
outputNode = HUDService.getHudByWindow(content).outputNode;
|
||||
|
||||
executeSoon(function() {
|
||||
findLogEntry("test-network.html");
|
||||
|
|
|
@ -51,10 +51,8 @@ function testInputFocus() {
|
|||
browser.removeEventListener("DOMContentLoaded", testInputFocus, false);
|
||||
|
||||
openConsole();
|
||||
let hudId = HUDService.displaysIndex()[0];
|
||||
let hudBox = HUDService.getHeadsUpDisplay(hudId);
|
||||
|
||||
let inputNode = hudBox.querySelector(".jsterm-input-node");
|
||||
let inputNode = HUDService.getHudByWindow(content).jsterm.inputNode;
|
||||
ok(inputNode.getAttribute("focused"), "input node is focused");
|
||||
|
||||
finishTest();
|
||||
|
|
|
@ -55,9 +55,7 @@ function testClosingAfterCompletion() {
|
|||
|
||||
openConsole();
|
||||
|
||||
hudId = HUDService.displaysIndex()[0];
|
||||
hudBox = HUDService.getHeadsUpDisplay(hudId);
|
||||
let inputNode = hudBox.querySelector(".jsterm-input-node");
|
||||
let inputNode = HUDService.getHudByWindow(content).jsterm.inputNode;
|
||||
|
||||
let errorWhileClosing = false;
|
||||
function errorListener(evt) {
|
||||
|
|
|
@ -22,12 +22,12 @@ function testCloseButton() {
|
|||
|
||||
openConsole();
|
||||
|
||||
hudId = HUDService.displaysIndex()[0];
|
||||
hudBox = HUDService.getHeadsUpDisplay(hudId);
|
||||
let hud = HUDService.getHudByWindow(content);
|
||||
let hudId = hud.hudId;
|
||||
|
||||
HUDService.disableAnimation(hudId);
|
||||
executeSoon(function() {
|
||||
let closeButton = hudBox.querySelector(".webconsole-close-button");
|
||||
let closeButton = hud.HUDBox.querySelector(".webconsole-close-button");
|
||||
ok(closeButton != null, "we have the close button");
|
||||
|
||||
// XXX: ASSERTION: ###!!! ASSERTION: XPConnect is being called on a scope without a 'Components' property!: 'Error', file /home/ddahl/code/moz/mozilla-central/mozilla-central/js/src/xpconnect/src/xpcwrappednativescope.cpp, line 795
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*
|
||||
* Contributor(s):
|
||||
* Patrick Walton <pcwalton@mozilla.com>
|
||||
* Mihai Șucan <mihai.sucan@gmail.com>
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
@ -24,9 +25,8 @@ function testLineLimit() {
|
|||
|
||||
openConsole();
|
||||
|
||||
hudId = HUDService.displaysIndex()[0];
|
||||
let console = browser.contentWindow.wrappedJSObject.console;
|
||||
hudBox = HUDService.getHeadsUpDisplay(hudId);
|
||||
outputNode = HUDService.getHudByWindow(content).outputNode;
|
||||
|
||||
let prefBranch = Services.prefs.getBranch("devtools.hud.loglimit.");
|
||||
prefBranch.setIntPref("console", 20);
|
||||
|
@ -56,13 +56,11 @@ function testLineLimit() {
|
|||
"the log limit is set to zero");
|
||||
|
||||
prefBranch.clearUserPref("console");
|
||||
prefBranch = console = null;
|
||||
prefBranch = console = outputNode = null;
|
||||
finishTest();
|
||||
}
|
||||
|
||||
function countMessageNodes() {
|
||||
let hudId = HUDService.displaysIndex()[0];
|
||||
let hudBox = HUDService.getHeadsUpDisplay(hudId);
|
||||
return hudBox.querySelectorAll(".hud-msg-node").length;
|
||||
return outputNode.querySelectorAll(".hud-msg-node").length;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,9 +55,7 @@ function testTextNodeInsertion() {
|
|||
false);
|
||||
openConsole();
|
||||
|
||||
hudId = HUDService.displaysIndex()[0];
|
||||
hudBox = HUDService.getHeadsUpDisplay(hudId);
|
||||
let outputNode = hudBox.querySelector(".hud-output-node");
|
||||
let outputNode = HUDService.getHudByWindow(content).outputNode;
|
||||
|
||||
let label = document.createElementNS(
|
||||
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "label");
|
||||
|
|
|
@ -48,9 +48,7 @@ function testInputExpansion() {
|
|||
|
||||
openConsole();
|
||||
|
||||
hudId = HUDService.displaysIndex()[0];
|
||||
hudBox = HUDService.getHeadsUpDisplay(hudId);
|
||||
let input = hudBox.querySelector(".jsterm-input-node");
|
||||
let input = HUDService.getHudByWindow(content).jsterm.inputNode;
|
||||
|
||||
input.focus();
|
||||
|
||||
|
|
|
@ -22,10 +22,9 @@ function test()
|
|||
browser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
openConsole();
|
||||
is(HUDService.displaysIndex().length, 1, "Web Console was opened");
|
||||
|
||||
hudId = HUDService.displaysIndex()[0];
|
||||
hud = HUDService.getHeadsUpDisplay(hudId);
|
||||
hud = HUDService.getHudByWindow(content);
|
||||
ok(hud, "Web Console is now open");
|
||||
|
||||
HUDService.lastFinishedRequestCallback = function(aRequest) {
|
||||
lastRequest = aRequest;
|
||||
|
@ -151,11 +150,9 @@ function testLiveFilteringOnSearchStrings() {
|
|||
}
|
||||
|
||||
function countMessageNodes() {
|
||||
let outputNode = hud.querySelector(".hud-output-node");
|
||||
|
||||
let messageNodes = outputNode.querySelectorAll(".hud-msg-node");
|
||||
let messageNodes = hud.outputNode.querySelectorAll(".hud-msg-node");
|
||||
let displayedMessageNodes = 0;
|
||||
let view = outputNode.ownerDocument.defaultView;
|
||||
let view = hud.chromeWindow;
|
||||
for (let i = 0; i < messageNodes.length; i++) {
|
||||
let computedStyle = view.getComputedStyle(messageNodes[i], null);
|
||||
if (computedStyle.display !== "none")
|
||||
|
@ -167,6 +164,6 @@ function countMessageNodes() {
|
|||
|
||||
function setStringFilter(aValue)
|
||||
{
|
||||
hud.querySelector(".hud-filter-box").value = aValue;
|
||||
HUDService.adjustVisibilityOnSearchStringChange(hudId, aValue);
|
||||
hud.filterBox.value = aValue;
|
||||
HUDService.adjustVisibilityOnSearchStringChange(hud.hudId, aValue);
|
||||
}
|
||||
|
|
|
@ -50,8 +50,7 @@ function testCSSPruning() {
|
|||
browser.removeEventListener("DOMContentLoaded",testCSSPruning, false);
|
||||
|
||||
openConsole();
|
||||
let hudId = HUDService.getHudIdByWindow(content);
|
||||
let hudRef = HUDService.getHudReferenceById(hudId);
|
||||
let hudRef = HUDService.getHudByWindow(content);
|
||||
|
||||
populateConsoleRepeats(hudRef);
|
||||
ok(hudRef.cssNodes["css log x"], "repeated nodes in cssNodes");
|
||||
|
@ -68,7 +67,6 @@ function testCSSPruning() {
|
|||
}
|
||||
|
||||
function countMessageNodes() {
|
||||
let hudId = HUDService.getHudIdByWindow(content);
|
||||
let hudBox = HUDService.getHeadsUpDisplay(hudId);
|
||||
return hudBox.querySelectorAll(".hud-msg-node").length;
|
||||
let outputNode = HUDService.getHudByWindow(content).outputNode;
|
||||
return outputNode.querySelectorAll(".hud-msg-node").length;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
* Rob Campbell <rcampbell@mozilla.com>
|
||||
* Patrick Walton <pwalton@mozilla.com>
|
||||
* David Dahl <ddahl@mozilla.com>
|
||||
* Mihai Șucan <mihai.sucan@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -51,19 +52,16 @@ function testChrome() {
|
|||
|
||||
openConsole();
|
||||
|
||||
hudId = HUDService.displaysIndex()[0];
|
||||
hud = HUDService.hudReferences[hudId];
|
||||
let hud = HUDService.getHudByWindow(content);
|
||||
ok(hud, "we have a console");
|
||||
|
||||
hudBox = HUDService.getHeadsUpDisplay(hudId);
|
||||
ok(hudBox, "we have the console display");
|
||||
|
||||
ok(hud.HUDBox, "we have the console display");
|
||||
|
||||
let jsterm = hud.jsterm;
|
||||
ok(jsterm, "we have a jsterm");
|
||||
|
||||
let input = jsterm.inputNode;
|
||||
let outputNode = hudBox.querySelector(".jsterm-input-node");
|
||||
ok(outputNode, "we have an output node");
|
||||
ok(hud.outputNode, "we have an output node");
|
||||
|
||||
// Test typing 'docu'.
|
||||
input.value = "docu";
|
||||
|
@ -71,7 +69,6 @@ function testChrome() {
|
|||
jsterm.complete(jsterm.COMPLETE_HINT_ONLY);
|
||||
is(jsterm.completeNode.value, " ment", "'docu' completion");
|
||||
|
||||
HUD = jsterm = input = null;
|
||||
finishTest();
|
||||
}
|
||||
|
||||
|
|
|
@ -56,10 +56,7 @@ function onLoad() {
|
|||
|
||||
function testButtonClicked()
|
||||
{
|
||||
let hudId = HUDService.displaysIndex()[0];
|
||||
let console = browser.contentWindow.wrappedJSObject.console;
|
||||
let hudBox = HUDService.getHeadsUpDisplay(hudId);
|
||||
let outputNode = hudBox.querySelector(".hud-output-node");
|
||||
let outputNode = HUDService.getHudByWindow(content).outputNode;
|
||||
let nodes = outputNode.querySelectorAll(".hud-msg-node");
|
||||
is(nodes.length, 2, "two nodes");
|
||||
ok(/start/.test(nodes[0].textContent), "start found");
|
||||
|
|
|
@ -52,6 +52,10 @@ function onLoad() {
|
|||
|
||||
openConsole();
|
||||
|
||||
hud = HUDService.getHudByWindow(content);
|
||||
hudId = hud.hudId;
|
||||
outputNode = hud.outputNode;
|
||||
|
||||
testConsoleLoggingAPI("log");
|
||||
testConsoleLoggingAPI("info");
|
||||
testConsoleLoggingAPI("warn");
|
||||
|
@ -62,10 +66,7 @@ function onLoad() {
|
|||
}
|
||||
|
||||
function testConsoleLoggingAPI(aMethod) {
|
||||
let hudId = HUDService.displaysIndex()[0];
|
||||
let console = browser.contentWindow.wrappedJSObject.console;
|
||||
let hudBox = HUDService.getHeadsUpDisplay(hudId);
|
||||
let outputNode = hudBox.querySelector(".hud-output-node");
|
||||
let console = content.wrappedJSObject.console;
|
||||
|
||||
HUDService.clearDisplay(hudId);
|
||||
|
||||
|
@ -108,8 +109,7 @@ function testConsoleLoggingAPI(aMethod) {
|
|||
}
|
||||
|
||||
function setStringFilter(aId, aValue) {
|
||||
let hudBox = HUDService.getHeadsUpDisplay(aId);
|
||||
hudBox.querySelector(".hud-filter-box").value = aValue;
|
||||
hud.filterBox.value = aValue;
|
||||
HUDService.adjustVisibilityOnSearchStringChange(aId, aValue);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,11 +61,7 @@ function testJSTerm()
|
|||
|
||||
openConsole();
|
||||
|
||||
hudId = HUDService.displaysIndex()[0];
|
||||
let hudBox = HUDService.getHeadsUpDisplay(hudId);
|
||||
hud = HUDService.hudReferences[hudId];
|
||||
jsterm = hud.jsterm;
|
||||
let outputNode = hudBox.querySelector(".hud-output-node");
|
||||
jsterm = HUDService.getHudByWindow(content).jsterm;
|
||||
|
||||
jsterm.clearOutput();
|
||||
jsterm.execute("'id=' + $('header').getAttribute('id')");
|
||||
|
@ -158,5 +154,6 @@ function testJSTerm()
|
|||
jsterm.execute("null");
|
||||
checkResult("null", "null is null", 1);
|
||||
|
||||
jsterm = null;
|
||||
finishTest();
|
||||
}
|
||||
|
|
|
@ -54,20 +54,18 @@ function testLiveFilteringOfMessageTypes() {
|
|||
|
||||
openConsole();
|
||||
|
||||
hudId = HUDService.displaysIndex()[0];
|
||||
hud = HUDService.getHudByWindow(content);
|
||||
let console = browser.contentWindow.wrappedJSObject.console;
|
||||
let hudBox = HUDService.getHeadsUpDisplay(hudId);
|
||||
let outputNode = hudBox.querySelector(".hud-output-node");
|
||||
|
||||
for (let i = 0; i < 50; i++) {
|
||||
console.log("http://www.example.com/");
|
||||
}
|
||||
|
||||
HUDService.setFilterState(hudId, "log", false);
|
||||
HUDService.setFilterState(hud.hudId, "log", false);
|
||||
is(countMessageNodes(), 0, "the log nodes are hidden when the " +
|
||||
"corresponding filter is switched off");
|
||||
|
||||
HUDService.setFilterState(hudId, "log", true);
|
||||
HUDService.setFilterState(hud.hudId, "log", true);
|
||||
isnot(countMessageNodes(), 0, "the log nodes reappear when the " +
|
||||
"corresponding filter is switched on");
|
||||
|
||||
|
@ -75,13 +73,9 @@ function testLiveFilteringOfMessageTypes() {
|
|||
}
|
||||
|
||||
function countMessageNodes() {
|
||||
let hudId = HUDService.displaysIndex()[0];
|
||||
let hudBox = HUDService.getHeadsUpDisplay(hudId);
|
||||
let outputNode = hudBox.querySelector(".hud-output-node");
|
||||
|
||||
let messageNodes = outputNode.querySelectorAll(".hud-log");
|
||||
let messageNodes = hud.outputNode.querySelectorAll(".hud-log");
|
||||
let displayedMessageNodes = 0;
|
||||
let view = outputNode.ownerDocument.defaultView;
|
||||
let view = hud.chromeWindow;
|
||||
for (let i = 0; i < messageNodes.length; i++) {
|
||||
let computedStyle = view.getComputedStyle(messageNodes[i], null);
|
||||
if (computedStyle.display !== "none") {
|
||||
|
|
|
@ -54,10 +54,8 @@ function testLiveFilteringOnSearchStrings() {
|
|||
|
||||
openConsole();
|
||||
|
||||
hudId = HUDService.displaysIndex()[0];
|
||||
hud = HUDService.getHudByWindow(content);
|
||||
let console = browser.contentWindow.wrappedJSObject.console;
|
||||
let hudBox = HUDService.getHeadsUpDisplay(hudId);
|
||||
let outputNode = hudBox.querySelector(".hud-output-node");
|
||||
|
||||
for (let i = 0; i < 50; i++) {
|
||||
console.log("http://www.example.com/");
|
||||
|
@ -107,13 +105,11 @@ function testLiveFilteringOnSearchStrings() {
|
|||
}
|
||||
|
||||
function countMessageNodes() {
|
||||
let hudId = HUDService.displaysIndex()[0];
|
||||
let hudBox = HUDService.getHeadsUpDisplay(hudId);
|
||||
let outputNode = hudBox.querySelector(".hud-output-node");
|
||||
let outputNode = hud.outputNode;
|
||||
|
||||
let messageNodes = outputNode.querySelectorAll(".hud-log");
|
||||
let displayedMessageNodes = 0;
|
||||
let view = outputNode.ownerDocument.defaultView;
|
||||
let view = hud.chromeWindow;
|
||||
for (let i = 0; i < messageNodes.length; i++) {
|
||||
let computedStyle = view.getComputedStyle(messageNodes[i], null);
|
||||
if (computedStyle.display !== "none") {
|
||||
|
@ -126,10 +122,7 @@ function countMessageNodes() {
|
|||
|
||||
function setStringFilter(aValue)
|
||||
{
|
||||
let hudId = HUDService.displaysIndex()[0];
|
||||
let hudBox = HUDService.getHeadsUpDisplay(hudId);
|
||||
|
||||
hudBox.querySelector(".hud-filter-box").value = aValue;
|
||||
HUDService.adjustVisibilityOnSearchStringChange(hudId, aValue);
|
||||
hud.filterBox.value = aValue;
|
||||
HUDService.adjustVisibilityOnSearchStringChange(hud.hudId, aValue);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,10 +54,8 @@ function testLogNodeClasses() {
|
|||
|
||||
openConsole();
|
||||
|
||||
hudId = HUDService.displaysIndex()[0];
|
||||
let console = browser.contentWindow.wrappedJSObject.console;
|
||||
hudBox = HUDService.getHeadsUpDisplay(hudId);
|
||||
outputNode = hudBox.querySelector(".hud-output-node");
|
||||
let outputNode = HUDService.getHudByWindow(content).outputNode;
|
||||
|
||||
ok(console, "console exists");
|
||||
console.log("I am a log message");
|
||||
|
|
|
@ -46,10 +46,8 @@ function onLoad() {
|
|||
browser.removeEventListener("DOMContentLoaded", onLoad, false);
|
||||
openConsole();
|
||||
|
||||
let hudId = HUDService.displaysIndex()[0];
|
||||
let console = browser.contentWindow.wrappedJSObject.console;
|
||||
let hudBox = HUDService.getHeadsUpDisplay(hudId);
|
||||
let outputNode = hudBox.querySelector(".hud-output-node");
|
||||
let console = content.wrappedJSObject.console;
|
||||
let outputNode = HUDService.getHudByWindow(content).outputNode;
|
||||
|
||||
console.log("a log message");
|
||||
|
||||
|
|
|
@ -30,10 +30,9 @@ function test()
|
|||
browser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
openConsole();
|
||||
is(HUDService.displaysIndex().length, 1, "Web Console was opened");
|
||||
|
||||
hudId = HUDService.displaysIndex()[0];
|
||||
hud = HUDService.getHeadsUpDisplay(hudId);
|
||||
hud = HUDService.getHudByWindow(content);
|
||||
ok(hud, "Web Console is now open");
|
||||
|
||||
HUDService.lastFinishedRequestCallback = function(aRequest) {
|
||||
lastRequest = aRequest;
|
||||
|
@ -153,8 +152,7 @@ function testNetworkPanel()
|
|||
{
|
||||
// Open the NetworkPanel. The functionality of the NetworkPanel is tested
|
||||
// within separate test files.
|
||||
let filterBox = hud.querySelector(".hud-filter-box");
|
||||
let networkPanel = HUDService.openNetworkPanel(filterBox, lastRequest);
|
||||
let networkPanel = HUDService.openNetworkPanel(hud.filterBox, lastRequest);
|
||||
is(networkPanel, lastRequest.panels[0].get(),
|
||||
"Network panel stored on lastRequest object");
|
||||
|
||||
|
|
|
@ -98,9 +98,7 @@ function checkNodeKeyValue(aPanel, aId, aKey, aValue) {
|
|||
}
|
||||
|
||||
function testGen() {
|
||||
let hudId = HUDService.displaysIndex()[0];
|
||||
let hudBox = HUDService.getHeadsUpDisplay(hudId);
|
||||
let filterBox = hudBox.querySelector(".hud-filter-box");
|
||||
let filterBox = HUDService.getHudByWindow(content).filterBox;
|
||||
|
||||
var httpActivity = {
|
||||
url: "http://www.testpage.com",
|
||||
|
|
Загрузка…
Ссылка в новой задаче