browser/devtools/tilt/test/browser_tilt_picking_inspector.js

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

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

mercurial