Bug 592469 - Web Console cleanup: part 7 - tests - displaysIndex(); r=dcamp

This commit is contained in:
Mihai Sucan 2011-07-01 23:03:52 +03:00
Родитель 8248f63ec8
Коммит b92f95c1da
24 изменённых файлов: 43 добавлений и 86 удалений

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

@ -59,7 +59,6 @@ function testPageReload() {
browser.removeEventListener("DOMContentLoaded", testPageReload, false);
let hudId = HUDService.displaysIndex()[0];
let console = browser.contentWindow.wrappedJSObject.console;
is(typeof console, "object", "window.console is an object, after page reload");

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

@ -92,9 +92,7 @@ var consoleObserver = {
Services.console.unregisterListener(this);
hudId = HUDService.displaysIndex()[0];
hud = HUDService.hudReferences[hudId];
outputNode = hud.outputNode;
let outputNode = HUDService.getHudByWindow(content).outputNode;
executeSoon(function() {
let msg = "Found the error message after page reload";

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

@ -52,9 +52,7 @@ function testGroups() {
openConsole();
let hudId = HUDService.displaysIndex()[0];
let HUD = HUDService.hudReferences[hudId];
let HUD = HUDService.getHudByWindow(content);
let jsterm = HUD.jsterm;
let outputNode = jsterm.outputNode;

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

@ -53,7 +53,7 @@ function testDuplicateErrors() {
false);
openConsole();
let hudId = HUDService.displaysIndex()[0];
let hudId = HUDService.getHudIdByWindow(content);
HUDService.clearDisplay(hudId);
Services.console.registerListener(consoleObserver);
@ -74,9 +74,7 @@ var consoleObserver = {
Services.console.unregisterListener(this);
hudId = HUDService.displaysIndex()[0];
hud = HUDService.hudReferences[hudId];
outputNode = hud.outputNode;
outputNode = HUDService.getHudByWindow(content).outputNode;
executeSoon(function () {
var text = outputNode.textContent;

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

@ -21,8 +21,7 @@ function testSelectionWhenMovingBetweenBoxes() {
testSelectionWhenMovingBetweenBoxes, false);
openConsole();
let hudId = HUDService.displaysIndex()[0];
let jsterm = HUDService.hudReferences[hudId].jsterm;
let jsterm = HUDService.getHudByWindow(content).jsterm;
// Fill the console with some output.
jsterm.clearOutput();

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

@ -21,14 +21,12 @@ function tabLoaded() {
// See bugs 574036, 586386 and 587617.
hudId = HUDService.displaysIndex()[0];
let HUD = HUDService.hudReferences[hudId].HUDBox;
let filterBox = HUD.querySelector(".hud-filter-box");
outputNode = HUD.querySelector(".hud-output-node");
let HUD = HUDService.getHudByWindow(content);
outputNode = HUD.outputNode;
let selection = getSelection();
let jstermInput = HUD.querySelector(".jsterm-input-node");
let console = browser.contentWindow.wrappedJSObject.console;
let contentSelection = browser.contentWindow.wrappedJSObject.getSelection();
let jstermInput = HUD.jsterm.inputNode;
let console = content.wrappedJSObject.console;
let contentSelection = content.wrappedJSObject.getSelection();
let make_selection = function () {
let controller =

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

@ -16,16 +16,14 @@ function onContentLoaded()
{
browser.removeEventListener("load", arguments.callee, true);
hudId = HUDService.displaysIndex()[0];
HUD = HUDService.hudReferences[hudId].HUDBox;
let filterBox = HUD.querySelector(".hud-filter-box");
let outputNode = HUD.querySelector(".hud-output-node");
let HUD = HUDService.getHudByWindow(content);
let hudId = HUD.hudId;
let outputNode = HUD.outputNode;
let msg = "the unknown CSS property warning is displayed";
testLogEntry(outputNode, "foobarCssParser", msg, true);
HUDService.setFilterState(hudId, "cssparser", false);
let nodes = HUD.querySelectorAll(".hud-msg-node");
executeSoon(
function (){

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

@ -22,8 +22,8 @@ function testExtraneousClosingBrackets(aEvent) {
browser.removeEventListener(aEvent.type, arguments.callee, true);
openConsole();
let hudId = HUDService.displaysIndex()[0];
let jsterm = HUDService.hudReferences[hudId].jsterm;
let jsterm = HUDService.getHudByWindow(content).jsterm;
jsterm.setInputValue("document.getElementById)");

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

@ -62,7 +62,7 @@ function performTest() {
HUD.console.log("message for tab " + i);
}
let displays = HUDService.displaysIndex();
let displays = Object.keys(HUDService.hudReferences);
is(displays.length, 4, "four displays found");
win2.close();
@ -72,7 +72,7 @@ function performTest() {
win1.gBrowser.removeTab(openTabs[1]);
executeSoon(function() {
displays = HUDService.displaysIndex();
displays = Object.keys(HUDService.hudReferences);
is(displays.length, 0, "no displays found");
ok(!HUDService.storage, "no storage found");
ok(!HUDService.httpObserver, "no httpObserver found");

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

@ -14,8 +14,9 @@ function testFilterButtons() {
browser.removeEventListener("load", testFilterButtons, true);
openConsole();
hudId = HUDService.displaysIndex()[0];
hudBox = HUDService.hudReferences[hudId].HUDBox;
let hud = HUDService.getHudByWindow(content);
hudId = hud.hudId;
hudBox = hud.HUDBox;
testMenuFilterButton("net");
testMenuFilterButton("css");

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

@ -9,11 +9,9 @@ function onContentLoaded()
{
browser.removeEventListener("load", arguments.callee, true);
hudId = HUDService.displaysIndex()[0];
HUD = HUDService.hudReferences[hudId].HUDBox;
jsterm = HUDService.hudReferences[hudId].jsterm;
let filterBox = HUD.querySelector(".hud-filter-box");
let outputNode = HUD.querySelector(".hud-output-node");
let HUD = HUDService.getHudByWindow(content);
let jsterm = HUD.jsterm;
let outputNode = HUD.outputNode;
let msg = "The unknown CSS property warning is displayed only once";
let node = outputNode.firstChild;

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

@ -52,10 +52,7 @@ function testCompletion() {
openConsole();
hudId = HUDService.displaysIndex()[0];
var HUD = HUDService.hudReferences[hudId];
var jsterm = HUD.jsterm;
var jsterm = HUDService.getHudByWindow(content).jsterm;
var input = jsterm.inputNode;
// Test typing 'docu'.
@ -105,7 +102,7 @@ function testCompletion() {
jsterm.complete(jsterm.COMPLETE_HINT_ONLY);
is(jsterm.completeNode.value, " \n e", "multi-line completion");
HUD = jsterm = input = null;
jsterm = input = null;
finishTest();
}

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

@ -23,10 +23,9 @@ function test()
function testOpenWebConsole()
{
openConsole();
is(HUDService.displaysIndex().length, 1, "WebConsole was opened");
hudId = HUDService.displaysIndex()[0];
hud = HUDService.hudReferences[hudId];
hud = HUDService.getHudByWindow(content);
ok(hud, "WebConsole was opened");
testOwnConsole();
}

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

@ -53,10 +53,7 @@ function testExecutionScope() {
openConsole();
let hudId = HUDService.displaysIndex()[0];
let HUD = HUDService.hudReferences[hudId];
let jsterm = HUD.jsterm;
let jsterm = HUDService.getHudByWindow(content).jsterm;
jsterm.clearOutput();
jsterm.execute("location;");

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

@ -56,9 +56,7 @@ function testHistory() {
openConsole();
hudId = HUDService.displaysIndex()[0];
let HUD = HUDService.hudReferences[hudId];
let jsterm = HUD.jsterm;
let jsterm = HUDService.getHudByWindow(content).jsterm;
let input = jsterm.inputNode;
let executeList = ["document", "window", "window.location"];

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

@ -53,9 +53,7 @@ function testHUDGetters() {
openConsole();
hudId = HUDService.displaysIndex()[0];
var HUD = HUDService.hudReferences[hudId];
var HUD = HUDService.getHudByWindow(content);
var jsterm = HUD.jsterm;
var klass = jsterm.inputNode.getAttribute("class");
ok(klass == "jsterm-input-node", "We have the input node.");

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

@ -55,9 +55,7 @@ function testJSInputAndOutputStyling() {
openConsole();
hudId = HUDService.displaysIndex()[0];
let jsterm = HUDService.hudReferences[hudId].jsterm;
let jsterm = HUDService.getHudByWindow(content).jsterm;
jsterm.clearOutput();
jsterm.execute("2 + 2");

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

@ -53,10 +53,7 @@ function testJSInputExpansion() {
openConsole();
hudId = HUDService.displaysIndex()[0];
let HUD = HUDService.hudReferences[hudId];
let jsterm = HUD.jsterm;
let jsterm = HUDService.getHudByWindow(content).jsterm;
let input = jsterm.inputNode;
input.focus();

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

@ -55,11 +55,8 @@ function testNullAndUndefinedOutput() {
openConsole();
hudId = HUDService.displaysIndex()[0];
let HUD = HUDService.hudReferences[hudId];
let jsterm = HUD.jsterm;
outputNode = jsterm.outputNode;
let jsterm = HUDService.getHudByWindow(content).jsterm;
let outputNode = jsterm.outputNode;
jsterm.clearOutput();
jsterm.execute("null;");

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

@ -53,11 +53,8 @@ function testOutputOrder() {
openConsole();
hudId = HUDService.displaysIndex()[0];
let HUD = HUDService.hudReferences[hudId];
let jsterm = HUD.jsterm;
outputNode = jsterm.outputNode;
let jsterm = HUDService.getHudByWindow(content).jsterm;
let outputNode = jsterm.outputNode;
jsterm.clearOutput();
jsterm.execute("console.log('foo', 'bar');");

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

@ -53,10 +53,7 @@ function testPropertyPanel() {
openConsole();
hudId = HUDService.displaysIndex()[0];
var HUD = HUDService.hudReferences[hudId];
var jsterm = HUD.jsterm;
var jsterm = HUDService.getHudByWindow(content).jsterm;
let propPanel = jsterm.openPropertyPanel("Test", [
1,

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

@ -54,9 +54,7 @@ function testPropertyProvider() {
openConsole();
hudId = HUDService.displaysIndex()[0];
var HUD = HUDService.hudReferences[hudId];
var HUD = HUDService.getHudByWindow(content);
var jsterm = HUD.jsterm;
var context = jsterm.sandbox.window;
var completion;

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

@ -53,14 +53,12 @@ function testRegistries() {
openConsole();
var displaysIdx = HUDService.displaysIndex();
ok(displaysIdx.length == 1, "one display id found");
var display = displaysIdx[0];
ok(HUDService.hudReferences[display], "we have a HUD");
let hud = HUDService.getHudByWindow(content);
ok(hud, "we have a HUD");
ok(HUDService.hudReferences[hud.hudId], "we have a HUD in hudReferences");
let windowID = HUDService.getWindowId(content);
is(HUDService.windowIds[windowID], display, "windowIds is working");
is(HUDService.windowIds[windowID], hud.hudId, "windowIds are working");
finishTest();
}

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

@ -49,8 +49,7 @@ let observer = {
};
function findLocationNode() {
hudId = HUDService.displaysIndex()[0];
outputNode = HUDService.hudReferences[hudId].outputNode;
outputNode = HUDService.getHudByWindow(content).outputNode;
let locationNode = outputNode.querySelector(".webconsole-location");
ok(locationNode, "we have the location node");