1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/tilt/test/browser_tilt_picking_inspector.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,61 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 +"use strict"; 1.7 + 1.8 +let presenter; 1.9 + 1.10 +function test() { 1.11 + if (!isTiltEnabled()) { 1.12 + info("Skipping highlight test because Tilt isn't enabled."); 1.13 + return; 1.14 + } 1.15 + if (!isWebGLSupported()) { 1.16 + info("Skipping highlight test because WebGL isn't supported."); 1.17 + return; 1.18 + } 1.19 + 1.20 + waitForExplicitFinish(); 1.21 + 1.22 + createTab(function() { 1.23 + let { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); 1.24 + let target = devtools.TargetFactory.forTab(gBrowser.selectedTab); 1.25 + 1.26 + gDevTools.showToolbox(target, "inspector").then(function(toolbox) { 1.27 + let contentDocument = toolbox.target.tab.linkedBrowser.contentDocument; 1.28 + let div = contentDocument.getElementById("first-law"); 1.29 + toolbox.getCurrentPanel().selection.setNode(div); 1.30 + 1.31 + createTilt({ 1.32 + onTiltOpen: function(instance) 1.33 + { 1.34 + presenter = instance.presenter; 1.35 + whenOpen(); 1.36 + } 1.37 + }, false, function suddenDeath() 1.38 + { 1.39 + info("Tilt could not be initialized properly."); 1.40 + cleanup(); 1.41 + }); 1.42 + }); 1.43 + }); 1.44 +} 1.45 + 1.46 +function whenOpen() { 1.47 + ok(presenter._currentSelection > 0, 1.48 + "Highlighting a node didn't work properly."); 1.49 + ok(!presenter._highlight.disabled, 1.50 + "After highlighting a node, it should be highlighted. D'oh."); 1.51 + ok(!presenter.controller.arcball._resetInProgress, 1.52 + "Highlighting a node that's already visible shouldn't trigger a reset."); 1.53 + 1.54 + executeSoon(function() { 1.55 + Services.obs.addObserver(cleanup, DESTROYED, false); 1.56 + Tilt.destroy(Tilt.currentWindowId); 1.57 + }); 1.58 +} 1.59 + 1.60 +function cleanup() { 1.61 + Services.obs.removeObserver(cleanup, DESTROYED); 1.62 + gBrowser.removeCurrentTab(); 1.63 + finish(); 1.64 +}