browser/devtools/tilt/test/browser_tilt_picking_inspector.js

Wed, 31 Dec 2014 07:53:36 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:53:36 +0100
branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
permissions
-rw-r--r--

Correct small whitespace inconsistency, lost while renaming variables.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     3 "use strict";
     5 let presenter;
     7 function test() {
     8   if (!isTiltEnabled()) {
     9     info("Skipping highlight test because Tilt isn't enabled.");
    10     return;
    11   }
    12   if (!isWebGLSupported()) {
    13     info("Skipping highlight test because WebGL isn't supported.");
    14     return;
    15   }
    17   waitForExplicitFinish();
    19   createTab(function() {
    20     let { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
    21     let target = devtools.TargetFactory.forTab(gBrowser.selectedTab);
    23     gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
    24       let contentDocument = toolbox.target.tab.linkedBrowser.contentDocument;
    25       let div = contentDocument.getElementById("first-law");
    26       toolbox.getCurrentPanel().selection.setNode(div);
    28       createTilt({
    29         onTiltOpen: function(instance)
    30         {
    31           presenter = instance.presenter;
    32           whenOpen();
    33         }
    34       }, false, function suddenDeath()
    35       {
    36         info("Tilt could not be initialized properly.");
    37         cleanup();
    38       });
    39     });
    40   });
    41 }
    43 function whenOpen() {
    44   ok(presenter._currentSelection > 0,
    45     "Highlighting a node didn't work properly.");
    46   ok(!presenter._highlight.disabled,
    47     "After highlighting a node, it should be highlighted. D'oh.");
    48   ok(!presenter.controller.arcball._resetInProgress,
    49     "Highlighting a node that's already visible shouldn't trigger a reset.");
    51   executeSoon(function() {
    52     Services.obs.addObserver(cleanup, DESTROYED, false);
    53     Tilt.destroy(Tilt.currentWindowId);
    54   });
    55 }
    57 function cleanup() {
    58   Services.obs.removeObserver(cleanup, DESTROYED);
    59   gBrowser.removeCurrentTab();
    60   finish();
    61 }

mercurial