summaryrefslogtreecommitdiff
path: root/toolkit/devtools/tilt/test/browser_tilt_04_initialization.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2016-10-16 19:34:53 -0400
committerMatt A. Tobin <email@mattatobin.com>2016-10-16 19:34:53 -0400
commit81805ce3f63e2e4a799bd54f174083c58a9b5640 (patch)
tree6e13374b213ac9b2ae74c25d8aac875faf71fdd0 /toolkit/devtools/tilt/test/browser_tilt_04_initialization.js
parent28c8da71bf521bb3ee76f27b8a241919e24b7cd5 (diff)
downloadpalemoon-gre-81805ce3f63e2e4a799bd54f174083c58a9b5640.tar.gz
Move Mozilla DevTools to Platform - Part 3: Merge the browser/devtools and toolkit/devtools adjusting for directory collisions
Diffstat (limited to 'toolkit/devtools/tilt/test/browser_tilt_04_initialization.js')
-rw-r--r--toolkit/devtools/tilt/test/browser_tilt_04_initialization.js59
1 files changed, 59 insertions, 0 deletions
diff --git a/toolkit/devtools/tilt/test/browser_tilt_04_initialization.js b/toolkit/devtools/tilt/test/browser_tilt_04_initialization.js
new file mode 100644
index 000000000..da0a936a2
--- /dev/null
+++ b/toolkit/devtools/tilt/test/browser_tilt_04_initialization.js
@@ -0,0 +1,59 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+"use strict";
+
+function test() {
+ if (!isTiltEnabled()) {
+ aborting();
+ info("Skipping initialization test because Tilt isn't enabled.");
+ return;
+ }
+ if (!isWebGLSupported()) {
+ aborting();
+ info("Skipping initialization test because WebGL isn't supported.");
+ return;
+ }
+
+ waitForExplicitFinish();
+
+ createTab(function() {
+ let id = TiltUtils.getWindowId(gBrowser.selectedBrowser.contentWindow);
+
+ is(id, Tilt.currentWindowId,
+ "The unique window identifiers should match for the same window.");
+
+ createTilt({
+ onTiltOpen: function(instance)
+ {
+ is(document.activeElement, instance.presenter.canvas,
+ "The visualizer canvas should be focused on initialization.");
+
+ ok(Tilt.visualizers[id] instanceof TiltVisualizer,
+ "A new instance of the visualizer wasn't created properly.");
+ ok(Tilt.visualizers[id].isInitialized(),
+ "The new instance of the visualizer wasn't initialized properly.");
+ },
+ onTiltClose: function()
+ {
+ is(document.activeElement, gBrowser.selectedBrowser,
+ "The focus wasn't correctly given back to the selectedBrowser.");
+
+ is(Tilt.visualizers[id], null,
+ "The current instance of the visualizer wasn't destroyed properly.");
+ },
+ onEnd: function()
+ {
+ cleanup();
+ }
+ }, true, function suddenDeath()
+ {
+ ok(false, "Tilt could not be initialized properly.");
+ cleanup();
+ });
+ });
+}
+
+function cleanup() {
+ gBrowser.removeCurrentTab();
+ finish();
+}