browser/devtools/tilt/test/browser_tilt_04_initialization.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.

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 function test() {
michael@0 6 if (!isTiltEnabled()) {
michael@0 7 info("Skipping initialization test because Tilt isn't enabled.");
michael@0 8 return;
michael@0 9 }
michael@0 10 if (!isWebGLSupported()) {
michael@0 11 info("Skipping initialization test because WebGL isn't supported.");
michael@0 12 return;
michael@0 13 }
michael@0 14
michael@0 15 waitForExplicitFinish();
michael@0 16
michael@0 17 createTab(function() {
michael@0 18 let id = TiltUtils.getWindowId(gBrowser.selectedBrowser.contentWindow);
michael@0 19
michael@0 20 is(id, Tilt.currentWindowId,
michael@0 21 "The unique window identifiers should match for the same window.");
michael@0 22
michael@0 23 createTilt({
michael@0 24 onTiltOpen: function(instance)
michael@0 25 {
michael@0 26 is(document.activeElement, instance.presenter.canvas,
michael@0 27 "The visualizer canvas should be focused on initialization.");
michael@0 28
michael@0 29 ok(Tilt.visualizers[id] instanceof TiltVisualizer,
michael@0 30 "A new instance of the visualizer wasn't created properly.");
michael@0 31 ok(Tilt.visualizers[id].isInitialized(),
michael@0 32 "The new instance of the visualizer wasn't initialized properly.");
michael@0 33 },
michael@0 34 onTiltClose: function()
michael@0 35 {
michael@0 36 is(document.activeElement, gBrowser.selectedBrowser,
michael@0 37 "The focus wasn't correctly given back to the selectedBrowser.");
michael@0 38
michael@0 39 is(Tilt.visualizers[id], null,
michael@0 40 "The current instance of the visualizer wasn't destroyed properly.");
michael@0 41 },
michael@0 42 onEnd: function()
michael@0 43 {
michael@0 44 cleanup();
michael@0 45 }
michael@0 46 }, true, function suddenDeath()
michael@0 47 {
michael@0 48 info("Tilt could not be initialized properly.");
michael@0 49 cleanup();
michael@0 50 });
michael@0 51 });
michael@0 52 }
michael@0 53
michael@0 54 function cleanup() {
michael@0 55 gBrowser.removeCurrentTab();
michael@0 56 finish();
michael@0 57 }

mercurial