Bug 1030318 - Enable devtools/framework tests with e10s. r=mratcliffe

--HG--
extra : rebase_source : 2e8ea32540aa53661cb6985bbb55f9dfb4e2a30c
This commit is contained in:
Brian Grinstead 2014-08-06 06:16:00 -04:00
parent 3718b6da0c
commit 782fef284e
8 changed files with 48 additions and 42 deletions

View File

@ -9,7 +9,6 @@ support-files =
[browser_devtools_api.js]
[browser_dynamic_tool_enabling.js]
[browser_keybindings.js]
skip-if = e10s # Bug 1030318
[browser_new_activation_workflow.js]
[browser_target_events.js]
[browser_target_remote.js]
@ -19,6 +18,7 @@ skip-if = e10s # Bug 1030318
[browser_toolbox_options.js]
[browser_toolbox_options_disable_buttons.js]
[browser_toolbox_options_disable_cache.js]
skip-if = e10s # Bug 1030318
[browser_toolbox_options_disable_js.js]
# [browser_toolbox_raise.js] # Bug 962258
# skip-if = os == "win"

View File

@ -18,7 +18,7 @@ function test()
gBrowser.selectedBrowser.removeEventListener("load", onload, true);
doc = content.document;
node = doc.querySelector("h1");
waitForFocus(setupKeyBindingsTest, content);
waitForFocus(setupKeyBindingsTest);
}, true);
content.location = "data:text/html,<html><head><title>Test for the " +

View File

@ -32,7 +32,8 @@ function onHidden() {
function onVisible() {
ok(true, "Visible event received");
target.once("will-navigate", onWillNavigate);
gBrowser.contentWindow.location = "data:text/html,test navigation";
let mm = getFrameScript();
mm.sendAsyncMessage("devtools:test:navigate", { location: "data:text/html,<meta charset='utf8'/>test navigation" });
}
function onWillNavigate(event, request) {

View File

@ -131,7 +131,8 @@ function reloadTab(tabX) {
}, true);
info("Reloading tab " + tabX.title);
content.document.location.reload(false);
let mm = getFrameScript();
mm.sendAsyncMessage("devtools:test:reload");
return def.promise;
}
@ -139,15 +140,17 @@ function reloadTab(tabX) {
function* destroyTab(tabX) {
let toolbox = gDevTools.getToolbox(tabX.target);
let onceDestroyed = promise.resolve();
if (toolbox) {
onceDestroyed = gDevTools.once("toolbox-destroyed");
}
info("Removing tab " + tabX.title);
gBrowser.removeTab(tabX.tab);
info("Removed tab " + tabX.title);
if (toolbox) {
info("Waiting for toolbox-destroyed");
yield gDevTools.once("toolbox-destroyed");
info("toolbox-destroyed event received for " + tabX.title);
}
info("Waiting for toolbox-destroyed");
yield onceDestroyed;
}
function* finishUp() {

View File

@ -32,13 +32,11 @@ function testJSEnabled(event, tool, secondPass) {
ok(true, "Toolbox selected via selectTool method");
info("Testing that JS is enabled");
let logJSEnabled = doc.getElementById("logJSEnabled");
let output = doc.getElementById("output");
// We use executeSoon here because switching docSehll.allowJavascript to true
// takes a while to become live.
executeSoon(function() {
EventUtils.synthesizeMouseAtCenter(logJSEnabled, {}, doc.defaultView);
let output = doc.getElementById("output");
doc.querySelector("#logJSEnabled").click();
is(output.textContent, "JavaScript Enabled", 'Output is "JavaScript Enabled"');
testJSEnabledIframe(secondPass);
});
@ -49,12 +47,10 @@ function testJSEnabledIframe(secondPass) {
let iframe = doc.querySelector("iframe");
let iframeDoc = iframe.contentDocument;
let logJSEnabled = iframeDoc.getElementById("logJSEnabled");
let output = iframeDoc.getElementById("output");
EventUtils.synthesizeMouseAtCenter(logJSEnabled, {}, iframe.contentWindow);
iframeDoc.querySelector("#logJSEnabled").click();
is(output.textContent, "JavaScript Enabled",
'Output is "JavaScript Enabled" in iframe');
'Output is "JavaScript Enabled" in iframe');
if (secondPass) {
finishUp();
} else {
@ -75,18 +71,13 @@ function toggleJS() {
info("Checking checkbox to disable JS");
}
// After uising scrollIntoView() we need to use executeSoon() to wait for the
// browser to scroll.
executeSoon(function() {
gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) {
gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
doc = content.document;
gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) {
gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
doc = content.document;
deferred.resolve();
}, true);
deferred.resolve();
}, true);
EventUtils.synthesizeMouseAtCenter(cbx, {}, panel.panelWin);
});
cbx.click();
return deferred.promise;
}
@ -94,13 +85,11 @@ function toggleJS() {
function testJSDisabled() {
info("Testing that JS is disabled");
let logJSDisabled = doc.getElementById("logJSDisabled");
let output = doc.getElementById("output");
doc.querySelector("#logJSDisabled").click();
EventUtils.synthesizeMouseAtCenter(logJSDisabled, {}, doc.defaultView);
ok(output.textContent !== "JavaScript Disabled",
'output is not "JavaScript Disabled"');
testJSDisabledIframe();
}
@ -109,10 +98,8 @@ function testJSDisabledIframe() {
let iframe = doc.querySelector("iframe");
let iframeDoc = iframe.contentDocument;
let logJSDisabled = iframeDoc.getElementById("logJSDisabled");
let output = iframeDoc.getElementById("output");
EventUtils.synthesizeMouseAtCenter(logJSDisabled, {}, iframe.contentWindow);
iframeDoc.querySelector("#logJSDisabled").click();
ok(output.textContent !== "JavaScript Disabled",
'output is not "JavaScript Disabled" in iframe');
toggleJS().then(function() {

View File

@ -16,6 +16,16 @@ waitForExplicitFinish();
// Uncomment this pref to dump all devtools emitted events to the console.
// Services.prefs.setBoolPref("devtools.dump.emit", true);
function getFrameScript() {
let mm = gBrowser.selectedBrowser.messageManager;
let frameURL = "chrome://browser/content/devtools/frame-script-utils.js";
mm.loadFrameScript(frameURL, false);
SimpleTest.registerCleanupFunction(() => {
mm = null;
});
return mm;
}
gDevTools.testing = true;
SimpleTest.registerCleanupFunction(() => {
gDevTools.testing = false;

View File

@ -1356,16 +1356,12 @@ Toolbox.prototype = {
}
// Destroying the walker and inspector fronts
outstanding.push(this.destroyInspector());
// Removing buttons
outstanding.push(() => {
outstanding.push(this.destroyInspector().then(() => {
// Removing buttons
this._pickerButton.removeEventListener("command", this._togglePicker, false);
this._pickerButton = null;
let container = this.doc.getElementById("toolbox-buttons");
while (container.firstChild) {
container.removeChild(container.firstChild);
}
});
}));
// Remove the host UI
outstanding.push(this.destroyHost());

View File

@ -7,3 +7,12 @@
addMessageListener("devtools:test:history", function ({ data }) {
content.history[data.direction]();
});
addMessageListener("devtools:test:navigate", function ({ data }) {
content.location = data.location;
});
addMessageListener("devtools:test:reload", function ({ data }) {
data = data || {};
content.location.reload(data.forceget);
});