1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/devtools/server/tests/unit/test_register_actor.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,43 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +"use strict"; 1.8 + 1.9 +const Profiler = Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler); 1.10 + 1.11 +function check_actors(expect) { 1.12 + do_check_eq(expect, DebuggerServer.tabActorFactories.hasOwnProperty("registeredActor1")); 1.13 + do_check_eq(expect, DebuggerServer.tabActorFactories.hasOwnProperty("registeredActor2")); 1.14 + 1.15 + do_check_eq(expect, DebuggerServer.globalActorFactories.hasOwnProperty("registeredActor2")); 1.16 + do_check_eq(expect, DebuggerServer.globalActorFactories.hasOwnProperty("registeredActor1")); 1.17 +} 1.18 + 1.19 +function run_test() 1.20 +{ 1.21 + DebuggerServer.init(function () { return true; }); 1.22 + // The xpcshell-test/ path maps to resource://test/ 1.23 + DebuggerServer.registerModule("xpcshell-test/registertestactors-01"); 1.24 + DebuggerServer.registerModule("xpcshell-test/registertestactors-02"); 1.25 + 1.26 + check_actors(true); 1.27 + 1.28 + check_except(() => { 1.29 + DebuggerServer.registerModule("xpcshell-test/registertestactors-01"); 1.30 + }); 1.31 + check_except(() => { 1.32 + DebuggerServer.registerModule("xpcshell-test/registertestactors-02"); 1.33 + }); 1.34 + 1.35 + DebuggerServer.unregisterModule("xpcshell-test/registertestactors-01"); 1.36 + DebuggerServer.unregisterModule("xpcshell-test/registertestactors-02"); 1.37 + check_actors(false); 1.38 + 1.39 + DebuggerServer.registerModule("xpcshell-test/registertestactors-01"); 1.40 + DebuggerServer.registerModule("xpcshell-test/registertestactors-02"); 1.41 + check_actors(true); 1.42 + 1.43 + DebuggerServer.destroy(); 1.44 + check_actors(false); 1.45 +} 1.46 +