Bug 1244755 - 1 - Enable browser_layout.js with e10s by using the testActor draft
authorPatrick Brosset <pbrosset@mozilla.com>
Mon, 01 Feb 2016 17:26:08 +0100
changeset 328955 b14f4678f8696c73b912d8fac6ae786d2ea07516
parent 328954 8b22e807786d84480bc59a41f6ddbe4b302ce2bb
child 328956 dc1f71d1bae9500b935c35a4be3ef38741a9e104
push id10441
push userpbrosset@mozilla.com
push dateThu, 04 Feb 2016 20:01:18 +0000
bugs1244755
milestone47.0a1
Bug 1244755 - 1 - Enable browser_layout.js with e10s by using the testActor
devtools/client/inspector/layout/test/browser.ini
devtools/client/inspector/layout/test/browser_layout.js
devtools/client/inspector/layout/test/head.js
devtools/client/inspector/test/head.js
--- a/devtools/client/inspector/layout/test/browser.ini
+++ b/devtools/client/inspector/layout/test/browser.ini
@@ -1,11 +1,10 @@
 [DEFAULT]
 tags = devtools
-skip-if = e10s # Bug ?????? - devtools tests disabled with e10s
 subsuite = devtools
 support-files =
   doc_layout_iframe1.html
   doc_layout_iframe2.html
   head.js
 
 [browser_layout.js]
 [browser_layout_editablemodel.js]
--- a/devtools/client/inspector/layout/test/browser_layout.js
+++ b/devtools/client/inspector/layout/test/browser_layout.js
@@ -122,42 +122,46 @@ var res2 = [
   },
   {
     selector: ".layout-border.layout-right > span",
     value: 10
   },
 ];
 
 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",
 function*(inspector, view) {
   let viewdoc = view.doc;
 
   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.");
   }
 });
--- a/devtools/client/inspector/layout/test/head.js
+++ b/devtools/client/inspector/layout/test/head.js
@@ -47,33 +47,34 @@ function selectAndHighlightNode(nodeOrSe
 
 /**
  * Open the toolbox, with the inspector tool visible, and the layout-view
  * sidebar tab selected.
  * @return a promise that resolves when the inspector is ready and the layout
  * 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
     };
   });
 }
 
 /**
  * Wait for the layoutview-updated event.
  * @return a promise
  */
--- a/devtools/client/inspector/test/head.js
+++ b/devtools/client/inspector/test/head.js
@@ -195,24 +195,25 @@ var clickOnInspectMenuItem = Task.async(
  * Open the toolbox, with the inspector tool visible, and the one of the sidebar
  * tabs selected.
  * @param {String} id The ID of the sidebar tab to be opened
  * @param {String} hostType Optional hostType, as defined in Toolbox.HostType
  * @return a promise that resolves when the inspector is ready and the tab is
  * 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
   };
 });
 
 /**
  * Get the NodeFront for a node that matches a given css selector, via the
  * protocol.
  * @param {String|NodeFront} selector
  * @param {InspectorPanel} inspector The instance of InspectorPanel currently