1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/framework/test/browser_toolbox_ready.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,43 @@ 1.4 +/* vim: set ts=2 et sw=2 tw=80: */ 1.5 +/* Any copyright is dedicated to the Public Domain. 1.6 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.7 + 1.8 +function test() 1.9 +{ 1.10 + waitForExplicitFinish(); 1.11 + 1.12 + gBrowser.selectedTab = gBrowser.addTab(); 1.13 + let target = TargetFactory.forTab(gBrowser.selectedTab); 1.14 + 1.15 + gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) { 1.16 + gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true); 1.17 + gDevTools.showToolbox(target).then(testReady); 1.18 + }, true); 1.19 + 1.20 + content.location = "data:text/html,test for dynamically registering and unregistering tools"; 1.21 +} 1.22 + 1.23 +function testReady(toolbox) 1.24 +{ 1.25 + ok(toolbox.isReady, "toolbox isReady is set"); 1.26 + testDouble(toolbox); 1.27 +} 1.28 + 1.29 +function testDouble(toolbox) 1.30 +{ 1.31 + let target = toolbox.target; 1.32 + let toolId = toolbox.currentToolId; 1.33 + 1.34 + gDevTools.showToolbox(target, toolId).then(function(toolbox2) { 1.35 + is(toolbox2, toolbox, "same toolbox"); 1.36 + cleanup(toolbox); 1.37 + }); 1.38 +} 1.39 + 1.40 +function cleanup(toolbox) 1.41 +{ 1.42 + toolbox.destroy().then(function() { 1.43 + gBrowser.removeCurrentTab(); 1.44 + finish(); 1.45 + }); 1.46 +}