browser/devtools/tilt/test/browser_tilt_picking_inspector.js

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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