Bug 592469 - Web Console cleanup: part 9 - tests - getOutputNodeById(); r=dcamp

This commit is contained in:
Mihai Sucan 2011-07-01 23:25:16 +03:00
Родитель fb3f1aab83
Коммит 3ad5e043ee
6 изменённых файлов: 16 добавлений и 31 удалений

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

@ -10,7 +10,7 @@
const TEST_URI = "http://example.com/browser/toolkit/components/console/hudservice/tests/browser/test-console.html";
let inputNode;
let HUD, inputNode;
function tabLoad(aEvent) {
browser.removeEventListener(aEvent.type, arguments.callee, true);
@ -18,11 +18,9 @@ function tabLoad(aEvent) {
waitForFocus(function() {
openConsole();
let hudId = HUDService.getHudIdByWindow(content);
HUD = HUDService.hudReferences[hudId];
HUD = HUDService.getHudByWindow(content);
let display = HUDService.getOutputNodeById(hudId);
inputNode = display.querySelector(".jsterm-input-node");
inputNode = HUD.jsterm.inputNode;
inputNode.focus();
executeSoon(function() {

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

@ -90,19 +90,15 @@ function tab2Loaded(aEvent) {
function tab1Reloaded(aEvent) {
tab1.linkedBrowser.removeEventListener(aEvent.type, arguments.callee, true);
let hudId1 = HUDService.getHudIdByWindow(tab1.linkedBrowser.contentWindow);
let display1 = HUDService.getOutputNodeById(hudId1);
let outputNode1 = display1.querySelector(".hud-output-node");
let hud1 = HUDService.getHudByWindow(tab1.linkedBrowser.contentWindow);
let outputNode1 = hud1.outputNode;
let msg = "Found the iframe network request in tab1";
testLogEntry(outputNode1, TEST_IFRAME_URI, msg, true);
let hudId2 = HUDService.getHudIdByWindow(tab2.linkedBrowser.contentWindow);
let display2 = HUDService.getOutputNodeById(hudId2);
let outputNode2 = display2.querySelector(".hud-output-node");
let hud2 = HUDService.getHudByWindow(tab2.linkedBrowser.contentWindow);
let outputNode2 = hud2.outputNode;
isnot(display1, display2, "the two HUD displays must be different");
isnot(outputNode1, outputNode2,
"the two HUD outputNodes must be different");

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

@ -18,11 +18,9 @@ function tabLoad1(aEvent) {
openConsole();
let hudId = HUDService.getHudIdByWindow(browser.contentWindow);
HUD = HUDService.hudReferences[hudId];
HUD = HUDService.getHudByWindow(content);
let display = HUDService.getOutputNodeById(hudId);
outputNode = display.querySelector(".hud-output-node");
outputNode = HUD.outputNode;
browser.addEventListener("load", tabLoad2, true);

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

@ -19,8 +19,7 @@ function tabLoad(aEvent) {
let hudId = HUDService.getHudIdByWindow(content);
HUD = HUDService.hudReferences[hudId];
let display = HUDService.getOutputNodeById(hudId);
inputNode = display.querySelector(".jsterm-input-node");
inputNode = HUD.jsterm.inputNode;
inputNode.focus();

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

@ -34,8 +34,7 @@ function contentLoaded(aEvent) {
}
function buttonClicked() {
let hudId = HUDService.getHudIdByWindow(content);
let outputNode = HUDService.getOutputNodeById(hudId);
let outputNode = HUDService.getHudByWindow(content).outputNode;
let msg = "the error from the external script was logged";
testLogEntry(outputNode, "bogus", msg);

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

@ -10,7 +10,7 @@
// Tests that copying multiple messages inserts newlines in between.
const TEST_URI = "http://example.com/";
const TEST_URI = "data:text/html,Web Console test for bug 586142";
function test()
{
@ -26,22 +26,17 @@ function onLoad() {
function testNewlines() {
openConsole();
hudId = HUDService.displaysIndex()[0];
ok(hudId != null, "we have the HUD ID");
hud = HUDService.getHudByWindow(content);
HUDService.clearDisplay(hud.hudId);
HUDService.clearDisplay(hudId);
let contentWindow = browser.contentWindow;
let console = contentWindow.wrappedJSObject.console;
let console = content.wrappedJSObject.console;
ok(console != null, "we have the console object");
for (let i = 0; i < 20; i++) {
console.log("Hello world!");
}
let hudNode = HUDService.getOutputNodeById(hudId);
let outputNode = hudNode.querySelector(".hud-output-node");
ok(outputNode != null, "we have the output node");
let outputNode = hud.outputNode;
outputNode.selectAll();
outputNode.focus();