1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/devtools/server/tests/unit/test_frameclient-01.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,53 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +var gDebuggee; 1.8 +var gClient; 1.9 +var gThreadClient; 1.10 + 1.11 +function run_test() 1.12 +{ 1.13 + initTestDebuggerServer(); 1.14 + gDebuggee = addTestGlobal("test-stack"); 1.15 + gClient = new DebuggerClient(DebuggerServer.connectPipe()); 1.16 + gClient.connect(function() { 1.17 + attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { 1.18 + gThreadClient = aThreadClient; 1.19 + test_pause_frame(); 1.20 + }); 1.21 + }); 1.22 + do_test_pending(); 1.23 +} 1.24 + 1.25 +function test_pause_frame() 1.26 +{ 1.27 + gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) { 1.28 + gThreadClient.addOneTimeListener("framesadded", function() { 1.29 + do_check_eq(gThreadClient.cachedFrames.length, 3); 1.30 + do_check_true(gThreadClient.moreFrames); 1.31 + do_check_false(gThreadClient.fillFrames(3)); 1.32 + 1.33 + do_check_true(gThreadClient.fillFrames(30)); 1.34 + gThreadClient.addOneTimeListener("framesadded", function() { 1.35 + do_check_false(gThreadClient.moreFrames); 1.36 + do_check_eq(gThreadClient.cachedFrames.length, 7); 1.37 + gThreadClient.resume(function() { 1.38 + finishClient(gClient); 1.39 + }); 1.40 + }); 1.41 + }); 1.42 + do_check_true(gThreadClient.fillFrames(3)); 1.43 + }); 1.44 + 1.45 + gDebuggee.eval("(" + function() { 1.46 + var recurseLeft = 5; 1.47 + function recurse() { 1.48 + if (--recurseLeft == 0) { 1.49 + debugger; 1.50 + return; 1.51 + } 1.52 + recurse(); 1.53 + }; 1.54 + recurse(); 1.55 + } + ")()"); 1.56 +}