1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/devtools/server/tests/unit/test_interrupt.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,50 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +var gClient; 1.8 +var gDebuggee; 1.9 + 1.10 +function run_test() 1.11 +{ 1.12 + initTestDebuggerServer(); 1.13 + gDebuggee = testGlobal("test-1"); 1.14 + DebuggerServer.addTestGlobal(gDebuggee); 1.15 + 1.16 + let transport = DebuggerServer.connectPipe(); 1.17 + gClient = new DebuggerClient(transport); 1.18 + gClient.connect(function(aType, aTraits) { 1.19 + attachTestTab(gClient, "test-1", test_attach); 1.20 + }); 1.21 + do_test_pending(); 1.22 +} 1.23 + 1.24 +function test_attach(aResponse, aTabClient) 1.25 +{ 1.26 + aTabClient.attachThread({}, function(aResponse, aThreadClient) { 1.27 + do_check_eq(aThreadClient.paused, true); 1.28 + aThreadClient.resume(function() { 1.29 + test_interrupt(aThreadClient); 1.30 + }); 1.31 + }); 1.32 +} 1.33 + 1.34 +function test_interrupt(aThreadClient) 1.35 +{ 1.36 + do_check_eq(aThreadClient.paused, false); 1.37 + aThreadClient.interrupt(function(aResponse) { 1.38 + do_check_eq(aThreadClient.paused, true); 1.39 + aThreadClient.resume(function() { 1.40 + do_check_eq(aThreadClient.paused, false); 1.41 + cleanup(); 1.42 + }); 1.43 + }); 1.44 +} 1.45 + 1.46 +function cleanup() 1.47 +{ 1.48 + gClient.addListener("closed", function(aEvent) { 1.49 + do_test_finished(); 1.50 + }); 1.51 + gClient.close(); 1.52 +} 1.53 +