1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/debugger/test/browser_dbg_conditional-breakpoints-03.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,87 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +/** 1.8 + * Tests that conditional breakpoint expressions survive disabled breakpoints. 1.9 + */ 1.10 + 1.11 +const TAB_URL = EXAMPLE_URL + "doc_conditional-breakpoints.html"; 1.12 + 1.13 +function test() { 1.14 + let gTab, gDebuggee, gPanel, gDebugger; 1.15 + let gSources, gBreakpoints, gLocation; 1.16 + 1.17 + initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { 1.18 + gTab = aTab; 1.19 + gDebuggee = aDebuggee; 1.20 + gPanel = aPanel; 1.21 + gDebugger = gPanel.panelWin; 1.22 + gSources = gDebugger.DebuggerView.Sources; 1.23 + gBreakpoints = gDebugger.DebuggerController.Breakpoints; 1.24 + 1.25 + // This test forces conditional breakpoints to be evaluated on the 1.26 + // client-side 1.27 + var client = gPanel.target.client; 1.28 + client.mainRoot.traits.conditionalBreakpoints = false; 1.29 + 1.30 + gLocation = { url: gSources.selectedValue, line: 18 }; 1.31 + 1.32 + waitForSourceAndCaretAndScopes(gPanel, ".html", 17) 1.33 + .then(addBreakpoint) 1.34 + .then(setConditional) 1.35 + .then(() => { 1.36 + let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.BREAKPOINT_REMOVED); 1.37 + toggleBreakpoint(); 1.38 + return finished; 1.39 + }) 1.40 + .then(() => { 1.41 + let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.BREAKPOINT_ADDED); 1.42 + toggleBreakpoint(); 1.43 + return finished; 1.44 + }) 1.45 + .then(testConditionalExpressionOnClient) 1.46 + .then(() => { 1.47 + let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.CONDITIONAL_BREAKPOINT_POPUP_SHOWING); 1.48 + openConditionalPopup(); 1.49 + return finished; 1.50 + }) 1.51 + .then(testConditionalExpressionInPopup) 1.52 + .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) 1.53 + .then(null, aError => { 1.54 + ok(false, "Got an error: " + aError.message + "\n" + aError.stack); 1.55 + }); 1.56 + 1.57 + gDebuggee.ermahgerd(); 1.58 + }); 1.59 + 1.60 + function addBreakpoint() { 1.61 + return gPanel.addBreakpoint(gLocation); 1.62 + } 1.63 + 1.64 + function setConditional(aClient) { 1.65 + aClient.conditionalExpression = "hello"; 1.66 + } 1.67 + 1.68 + function toggleBreakpoint() { 1.69 + EventUtils.sendMouseEvent({ type: "click" }, 1.70 + gDebugger.document.querySelector(".dbg-breakpoint-checkbox"), 1.71 + gDebugger); 1.72 + } 1.73 + 1.74 + function openConditionalPopup() { 1.75 + EventUtils.sendMouseEvent({ type: "click" }, 1.76 + gDebugger.document.querySelector(".dbg-breakpoint"), 1.77 + gDebugger); 1.78 + } 1.79 + 1.80 + function testConditionalExpressionOnClient() { 1.81 + return gBreakpoints._getAdded(gLocation).then(aClient => { 1.82 + is(aClient.conditionalExpression, "hello", "The expression is correct (1)."); 1.83 + }); 1.84 + } 1.85 + 1.86 + function testConditionalExpressionInPopup() { 1.87 + let textbox = gDebugger.document.getElementById("conditional-breakpoint-panel-textbox"); 1.88 + is(textbox.value, "hello", "The expression is correct (2).") 1.89 + } 1.90 +}