Bug 1244755 - 1 - Enable browser_layout.js with e10s by using the testActor; r=miker

--HG--
extra : commitid : 8leAzjkOtri
extra : rebase_source : fc651e0af92495cae1b835dbf7b89d8c7ac6fe28
extra : histedit_source : 859047cf767b5a4809d4466eac03ceed2f71e9a5
This commit is contained in:
Patrick Brosset 2016-02-01 17:26:08 +01:00
parent 61e89b55eb
commit 47facd047c
4 changed files with 22 additions and 17 deletions

View File

@ -1,6 +1,5 @@
[DEFAULT]
tags = devtools
skip-if = e10s # Bug ?????? - devtools tests disabled with e10s
subsuite = devtools
support-files =
doc_layout_iframe1.html

View File

@ -127,14 +127,16 @@ var res2 = [
];
add_task(function*() {
let style = "div { position: absolute; top: 42px; left: 42px; height: 100.111px; width: 100px; border: 10px solid black; padding: 20px; margin: 30px auto;}";
let style = "div { position: absolute; top: 42px; left: 42px; " +
"height: 100.111px; width: 100px; border: 10px solid black; " +
"padding: 20px; margin: 30px auto;}";
let html = "<style>" + style + "</style><div></div>";
yield addTab("data:text/html," + encodeURIComponent(html));
let {toolbox, inspector, view} = yield openLayoutView();
let {inspector, view, testActor} = yield openLayoutView();
yield selectNode("div", inspector);
yield runTests(inspector, view);
yield runTests(inspector, view, testActor);
});
addTest("Test that the initial values of the box model are correct",
@ -143,21 +145,23 @@ function*(inspector, view) {
for (let i = 0; i < res1.length; i++) {
let elt = viewdoc.querySelector(res1[i].selector);
is(elt.textContent, res1[i].value, res1[i].selector + " has the right value.");
is(elt.textContent, res1[i].value,
res1[i].selector + " has the right value.");
}
});
addTest("Test that changing the document updates the box model",
function*(inspector, view) {
function*(inspector, view, testActor) {
let viewdoc = view.doc;
let onUpdated = waitForUpdate(inspector);
inspector.selection.node.style.height = "150px";
inspector.selection.node.style.paddingRight = "50px";
yield testActor.setAttribute("div", "style",
"height:150px;padding-right:50px;");
yield onUpdated;
for (let i = 0; i < res2.length; i++) {
let elt = viewdoc.querySelector(res2[i].selector);
is(elt.textContent, res2[i].value, res2[i].selector + " has the right value after style update.");
is(elt.textContent, res2[i].value,
res2[i].selector + " has the right value after style update.");
}
});

View File

@ -52,23 +52,24 @@ function selectAndHighlightNode(nodeOrSelector, inspector) {
* view is visible and ready
*/
function openLayoutView() {
return openInspectorSidebarTab("layoutview").then(({toolbox, inspector}) => {
return openInspectorSidebarTab("layoutview").then(data => {
// The actual highligher show/hide methods are mocked in layoutview tests.
// The highlighter is tested in devtools/inspector/test.
function mockHighlighter({highlighter}) {
highlighter.showBoxModel = function(nodeFront, options) {
highlighter.showBoxModel = function(nodeFront) {
return promise.resolve();
};
highlighter.hideBoxModel = function() {
return promise.resolve();
};
}
mockHighlighter(toolbox);
mockHighlighter(data.toolbox);
return {
toolbox,
inspector,
view: inspector.layoutview
toolbox: data.toolbox,
inspector: data.inspector,
view: data.inspector.layoutview,
testActor: data.testActor
};
});
}

View File

@ -170,14 +170,15 @@ function getActiveInspector() {
* visible and ready
*/
var openInspectorSidebarTab = Task.async(function*(id, hostType) {
let {toolbox, inspector} = yield openInspector();
let {toolbox, inspector, testActor} = yield openInspector();
info("Selecting the " + id + " sidebar");
inspector.sidebar.select(id);
return {
toolbox,
inspector
inspector,
testActor
};
});