Bug 1300036 - Ensure waiting for source shown when reloading tab in debugger tests. r=jlongster
MozReview-Commit-ID: 9R5R3SWawEb
--- a/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-reload.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-reload.js
@@ -22,19 +22,18 @@ var test = Task.async(function* () {
const sources = panel.panelWin.DebuggerView.Sources;
yield actions.addBreakpoint({
actor: sources.selectedValue,
line: 10 // "break on me" string
});
const paused = waitForThreadEvents(panel, "paused");
- reloadActiveTab(panel);
+ yield reloadActiveTab(panel, panel.panelWin.EVENTS.SOURCE_SHOWN);
const packet = yield paused;
is(packet.why.type, "breakpoint",
"Should have hit the breakpoint after the reload");
is(packet.frame.where.line, 10,
"Should have stopped at line 10, where we set the breakpoint");
- yield waitForDebuggerEvents(panel, panel.panelWin.EVENTS.SOURCE_SHOWN);
yield resumeDebuggerThenCloseAndFinish(panel);
});
--- a/devtools/client/debugger/test/mochitest/browser_dbg_location-changes-03-new.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg_location-changes-03-new.js
@@ -27,17 +27,17 @@ function test() {
Task.spawn(function* () {
let onCaretUpdated = waitForCaretUpdated(gPanel, 14);
callInTab(gTab, "simpleCall");
yield onCaretUpdated;
const startedLoading = waitForNextDispatch(gDebugger.DebuggerController,
constants.LOAD_SOURCE_TEXT);
- navigateActiveTabTo(gPanel, TAB_URL_2);
+ navigateActiveTabTo(gPanel, TAB_URL_2, gDebugger.EVENTS.SOURCE_SHOWN);
yield startedLoading;
isnot(gDebugger.gThreadClient.state, "paused",
"Should not be paused after a tab navigation.");
is(gFrames.itemCount, 0,
"Should have no frames.");
is(gSources.itemCount, 1,
"Found the expected number of entries in the sources widget.");
--- a/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-11.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg_pretty-print-11.js
@@ -26,18 +26,18 @@ function test() {
gSources = gDebugger.DebuggerView.Sources;
testSourceIsUgly();
const finished = waitForCaretUpdated(gPanel, 7);
clickPrettyPrintButton();
finished.then(testSourceIsPretty)
.then(() => {
const finished = waitForCaretUpdated(gPanel, 7);
- reloadActiveTab(gPanel);
- return finished;
+ const reloaded = reloadActiveTab(gPanel, gDebugger.EVENTS.SOURCE_SHOWN);
+ return Promise.all([finished, reloaded]);
})
.then(testSourceIsPretty)
.then(() => resumeDebuggerThenCloseAndFinish(gPanel))
.then(null, aError => {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(aError));
});
});
}