michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: "use strict"; michael@0: michael@0: function test() { michael@0: if (!isTiltEnabled()) { michael@0: info("Skipping initialization test because Tilt isn't enabled."); michael@0: return; michael@0: } michael@0: if (!isWebGLSupported()) { michael@0: info("Skipping initialization test because WebGL isn't supported."); michael@0: return; michael@0: } michael@0: michael@0: waitForExplicitFinish(); michael@0: michael@0: createTab(function() { michael@0: let id = TiltUtils.getWindowId(gBrowser.selectedBrowser.contentWindow); michael@0: michael@0: is(id, Tilt.currentWindowId, michael@0: "The unique window identifiers should match for the same window."); michael@0: michael@0: createTilt({ michael@0: onTiltOpen: function(instance) michael@0: { michael@0: is(document.activeElement, instance.presenter.canvas, michael@0: "The visualizer canvas should be focused on initialization."); michael@0: michael@0: ok(Tilt.visualizers[id] instanceof TiltVisualizer, michael@0: "A new instance of the visualizer wasn't created properly."); michael@0: ok(Tilt.visualizers[id].isInitialized(), michael@0: "The new instance of the visualizer wasn't initialized properly."); michael@0: }, michael@0: onTiltClose: function() michael@0: { michael@0: is(document.activeElement, gBrowser.selectedBrowser, michael@0: "The focus wasn't correctly given back to the selectedBrowser."); michael@0: michael@0: is(Tilt.visualizers[id], null, michael@0: "The current instance of the visualizer wasn't destroyed properly."); michael@0: }, michael@0: onEnd: function() michael@0: { michael@0: cleanup(); michael@0: } michael@0: }, true, function suddenDeath() michael@0: { michael@0: info("Tilt could not be initialized properly."); michael@0: cleanup(); michael@0: }); michael@0: }); michael@0: } michael@0: michael@0: function cleanup() { michael@0: gBrowser.removeCurrentTab(); michael@0: finish(); michael@0: }