Bug 1287388 - wait for popupshown event in debugger conditional breakpoint tests;r=jlongster

MozReview-Commit-ID: CXCoUKSLiGb
This commit is contained in:
Julian Descottes
2016-07-11 10:01:18 +02:00
parent e8bd4bf867
commit 33d5d3a7b5
6 changed files with 41 additions and 18 deletions

View File

@@ -1168,7 +1168,6 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
*/ */
_onConditionalPopupShowing: function () { _onConditionalPopupShowing: function () {
this._conditionalPopupVisible = true; // Used in tests. this._conditionalPopupVisible = true; // Used in tests.
window.emit(EVENTS.CONDITIONAL_BREAKPOINT_POPUP_SHOWING);
}, },
/** /**
@@ -1177,6 +1176,7 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
_onConditionalPopupShown: function () { _onConditionalPopupShown: function () {
this._cbTextbox.focus(); this._cbTextbox.focus();
this._cbTextbox.select(); this._cbTextbox.select();
window.emit(EVENTS.CONDITIONAL_BREAKPOINT_POPUP_SHOWN);
}, },
/** /**
@@ -1199,6 +1199,7 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
*/ */
_onConditionalPopupHidden: function () { _onConditionalPopupHidden: function () {
this._cbPanel.hidden = true; this._cbPanel.hidden = true;
window.emit(EVENTS.CONDITIONAL_BREAKPOINT_POPUP_HIDDEN);
}, },
/** /**

View File

@@ -51,9 +51,9 @@ const EVENTS = {
BREAKPOINT_HIDDEN_IN_EDITOR: "Debugger:BreakpointHiddenInEditor", BREAKPOINT_HIDDEN_IN_EDITOR: "Debugger:BreakpointHiddenInEditor",
BREAKPOINT_HIDDEN_IN_PANE: "Debugger:BreakpointHiddenInPane", BREAKPOINT_HIDDEN_IN_PANE: "Debugger:BreakpointHiddenInPane",
// When a conditional breakpoint's popup is showing or hiding. // When a conditional breakpoint's popup is shown/hidden.
CONDITIONAL_BREAKPOINT_POPUP_SHOWING: "Debugger:ConditionalBreakpointPopupShowing", CONDITIONAL_BREAKPOINT_POPUP_SHOWN: "Debugger:ConditionalBreakpointPopupShown",
CONDITIONAL_BREAKPOINT_POPUP_HIDING: "Debugger:ConditionalBreakpointPopupHiding", CONDITIONAL_BREAKPOINT_POPUP_HIDDEN: "Debugger:ConditionalBreakpointPopupHidden",
// When event listeners are fetched or event breakpoints are updated. // When event listeners are fetched or event breakpoints are updated.
EVENT_LISTENERS_FETCHED: "Debugger:EventListenersFetched", EVENT_LISTENERS_FETCHED: "Debugger:EventListenersFetched",

View File

@@ -24,6 +24,7 @@ function test() {
const constants = gDebugger.require("./content/constants"); const constants = gDebugger.require("./content/constants");
const actions = bindActionCreators(gPanel); const actions = bindActionCreators(gPanel);
const getState = gDebugger.DebuggerController.getState; const getState = gDebugger.DebuggerController.getState;
const CONDITIONAL_POPUP_SHOWN = gDebugger.EVENTS.CONDITIONAL_BREAKPOINT_POPUP_SHOWN;
// This test forces conditional breakpoints to be evaluated on the // This test forces conditional breakpoints to be evaluated on the
// client-side // client-side
@@ -43,23 +44,32 @@ function test() {
function modBreakpoint2() { function modBreakpoint2() {
setCaretPosition(19); setCaretPosition(19);
let popupShown = waitForDebuggerEvents(gPanel, CONDITIONAL_POPUP_SHOWN);
gSources._onCmdAddConditionalBreakpoint(); gSources._onCmdAddConditionalBreakpoint();
return popupShown;
} }
function addBreakpoint3() { function* addBreakpoint3() {
let finished = waitForDispatch(gPanel, constants.ADD_BREAKPOINT); let finished = waitForDispatch(gPanel, constants.ADD_BREAKPOINT);
let popupShown = waitForDebuggerEvents(gPanel, CONDITIONAL_POPUP_SHOWN);
setCaretPosition(20); setCaretPosition(20);
gSources._onCmdAddConditionalBreakpoint(); gSources._onCmdAddConditionalBreakpoint();
return finished; yield finished;
yield popupShown;
} }
function modBreakpoint3() { function* modBreakpoint3() {
let finished = waitForDispatch(gPanel, constants.SET_BREAKPOINT_CONDITION);
setCaretPosition(20); setCaretPosition(20);
let popupShown = waitForDebuggerEvents(gPanel, CONDITIONAL_POPUP_SHOWN);
gSources._onCmdAddConditionalBreakpoint(); gSources._onCmdAddConditionalBreakpoint();
yield popupShown;
typeText(gSources._cbTextbox, "bamboocha"); typeText(gSources._cbTextbox, "bamboocha");
let finished = waitForDispatch(gPanel, constants.SET_BREAKPOINT_CONDITION);
EventUtils.sendKey("RETURN", gDebugger); EventUtils.sendKey("RETURN", gDebugger);
return finished; yield finished;
} }
function addBreakpoint4() { function addBreakpoint4() {

View File

@@ -49,7 +49,7 @@ function test() {
const bp = queries.getBreakpoint(getState(), location); const bp = queries.getBreakpoint(getState(), location);
is(bp.condition, "hello", "The conditional expression is correct."); is(bp.condition, "hello", "The conditional expression is correct.");
let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.CONDITIONAL_BREAKPOINT_POPUP_SHOWING); let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.CONDITIONAL_BREAKPOINT_POPUP_SHOWN);
EventUtils.sendMouseEvent({ type: "click" }, EventUtils.sendMouseEvent({ type: "click" },
gDebugger.document.querySelector(".dbg-breakpoint"), gDebugger.document.querySelector(".dbg-breakpoint"),
gDebugger); gDebugger);
@@ -63,7 +63,7 @@ function test() {
yield actions.setBreakpointCondition(location, "foo"); yield actions.setBreakpointCondition(location, "foo");
yield actions.addBreakpoint(location); yield actions.addBreakpoint(location);
finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.CONDITIONAL_BREAKPOINT_POPUP_SHOWING); finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.CONDITIONAL_BREAKPOINT_POPUP_SHOWN);
EventUtils.sendMouseEvent({ type: "click" }, EventUtils.sendMouseEvent({ type: "click" },
gDebugger.document.querySelector(".dbg-breakpoint"), gDebugger.document.querySelector(".dbg-breakpoint"),
gDebugger); gDebugger);

View File

@@ -24,6 +24,7 @@ function test() {
const constants = gDebugger.require("./content/constants"); const constants = gDebugger.require("./content/constants");
const actions = bindActionCreators(gPanel); const actions = bindActionCreators(gPanel);
const getState = gDebugger.DebuggerController.getState; const getState = gDebugger.DebuggerController.getState;
const CONDITIONAL_POPUP_SHOWN = gDebugger.EVENTS.CONDITIONAL_BREAKPOINT_POPUP_SHOWN;
function addBreakpoint1() { function addBreakpoint1() {
return actions.addBreakpoint({ actor: gSources.selectedValue, line: 18 }); return actions.addBreakpoint({ actor: gSources.selectedValue, line: 18 });
@@ -38,23 +39,34 @@ function test() {
function modBreakpoint2() { function modBreakpoint2() {
setCaretPosition(19); setCaretPosition(19);
let popupShown = waitForDebuggerEvents(gPanel, CONDITIONAL_POPUP_SHOWN);
gSources._onCmdAddConditionalBreakpoint(); gSources._onCmdAddConditionalBreakpoint();
return popupShown;
} }
function addBreakpoint3() { function* addBreakpoint3() {
let finished = waitForDispatch(gPanel, constants.ADD_BREAKPOINT); let finished = waitForDispatch(gPanel, constants.ADD_BREAKPOINT);
let popupShown = waitForDebuggerEvents(gPanel, CONDITIONAL_POPUP_SHOWN);
setCaretPosition(20); setCaretPosition(20);
gSources._onCmdAddConditionalBreakpoint(); gSources._onCmdAddConditionalBreakpoint();
return finished; yield finished;
yield popupShown;
} }
function modBreakpoint3() { function* modBreakpoint3() {
let finished = waitForDispatch(gPanel, constants.SET_BREAKPOINT_CONDITION);
setCaretPosition(20); setCaretPosition(20);
let popupShown = waitForDebuggerEvents(gPanel, CONDITIONAL_POPUP_SHOWN);
gSources._onCmdAddConditionalBreakpoint(); gSources._onCmdAddConditionalBreakpoint();
yield popupShown;
typeText(gSources._cbTextbox, "bamboocha"); typeText(gSources._cbTextbox, "bamboocha");
let finished = waitForDispatch(gPanel, constants.SET_BREAKPOINT_CONDITION);
EventUtils.sendKey("RETURN", gDebugger); EventUtils.sendKey("RETURN", gDebugger);
return finished; yield finished;
} }
function addBreakpoint4() { function addBreakpoint4() {

View File

@@ -46,7 +46,7 @@ function test() {
const bp = queries.getBreakpoint(getState(), location); const bp = queries.getBreakpoint(getState(), location);
is(bp.condition, "hello", "The conditional expression is correct."); is(bp.condition, "hello", "The conditional expression is correct.");
let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.CONDITIONAL_BREAKPOINT_POPUP_SHOWING); let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.CONDITIONAL_BREAKPOINT_POPUP_SHOWN);
EventUtils.sendMouseEvent({ type: "click" }, EventUtils.sendMouseEvent({ type: "click" },
gDebugger.document.querySelector(".dbg-breakpoint"), gDebugger.document.querySelector(".dbg-breakpoint"),
gDebugger); gDebugger);
@@ -60,7 +60,7 @@ function test() {
yield actions.setBreakpointCondition(location, "foo"); yield actions.setBreakpointCondition(location, "foo");
yield actions.addBreakpoint(location); yield actions.addBreakpoint(location);
finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.CONDITIONAL_BREAKPOINT_POPUP_SHOWING); finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.CONDITIONAL_BREAKPOINT_POPUP_SHOWN);
EventUtils.sendMouseEvent({ type: "click" }, EventUtils.sendMouseEvent({ type: "click" },
gDebugger.document.querySelector(".dbg-breakpoint"), gDebugger.document.querySelector(".dbg-breakpoint"),
gDebugger); gDebugger);