browser/devtools/inspector/test/browser_inspector_destroyselection.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/inspector/test/browser_inspector_destroyselection.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,52 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +function test()
     1.8 +{
     1.9 +  waitForExplicitFinish();
    1.10 +
    1.11 +  let node, iframe, inspector;
    1.12 +
    1.13 +  gBrowser.selectedTab = gBrowser.addTab();
    1.14 +  gBrowser.selectedBrowser.addEventListener("load", function onload() {
    1.15 +    gBrowser.selectedBrowser.removeEventListener("load", onload, true);
    1.16 +    waitForFocus(setupTest, content);
    1.17 +  }, true);
    1.18 +
    1.19 +  content.location = "http://mochi.test:8888/browser/browser/devtools/inspector/test/browser_inspector_destroyselection.html";
    1.20 +
    1.21 +  function setupTest()
    1.22 +  {
    1.23 +    iframe = content.document.querySelector("iframe");
    1.24 +    node = iframe.contentDocument.querySelector("span");
    1.25 +    openInspector(runTests);
    1.26 +  }
    1.27 +
    1.28 +  function runTests(aInspector)
    1.29 +  {
    1.30 +    inspector = aInspector;
    1.31 +    inspector.selection.setNode(node);
    1.32 +
    1.33 +    inspector.once("inspector-updated", () => {
    1.34 +      iframe.parentNode.removeChild(iframe);
    1.35 +      iframe = null;
    1.36 +
    1.37 +      let tmp = {};
    1.38 +      Cu.import("resource://gre/modules/devtools/LayoutHelpers.jsm", tmp);
    1.39 +      let lh = new tmp.LayoutHelpers(window.content);
    1.40 +      ok(!lh.isNodeConnected(node), "Node considered as disconnected.");
    1.41 +      ok(!inspector.selection.isConnected(), "Selection considered as disconnected");
    1.42 +
    1.43 +      inspector.once("inspector-updated", () => {
    1.44 +        finishUp();
    1.45 +      });
    1.46 +    });
    1.47 +  }
    1.48 +
    1.49 +  function finishUp() {
    1.50 +    node = inspector = null;
    1.51 +    gBrowser.removeCurrentTab();
    1.52 +    finish();
    1.53 +  }
    1.54 +}
    1.55 +

mercurial