summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/new/test/mochitest/browser_dbg-editor-select.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /devtools/client/debugger/new/test/mochitest/browser_dbg-editor-select.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/debugger/new/test/mochitest/browser_dbg-editor-select.js')
-rw-r--r--devtools/client/debugger/new/test/mochitest/browser_dbg-editor-select.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/devtools/client/debugger/new/test/mochitest/browser_dbg-editor-select.js b/devtools/client/debugger/new/test/mochitest/browser_dbg-editor-select.js
new file mode 100644
index 000000000..8b954f899
--- /dev/null
+++ b/devtools/client/debugger/new/test/mochitest/browser_dbg-editor-select.js
@@ -0,0 +1,54 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Tests that the editor highlights the correct location when the
+// debugger pauses
+
+// checks to see if the first breakpoint is visible
+function isElementVisible(dbg, elementName) {
+ const bpLine = findElement(dbg, elementName);
+ const cm = findElement(dbg, "codeMirror");
+ return bpLine && isVisibleWithin(cm, bpLine);
+}
+
+add_task(function* () {
+ // This test runs too slowly on linux debug. I'd like to figure out
+ // which is the slowest part of this and make it run faster, but to
+ // fix a frequent failure allow a longer timeout.
+ requestLongerTimeout(2);
+
+ const dbg = yield initDebugger("doc-scripts.html");
+ const { selectors: { getSelectedSource }, getState } = dbg;
+ const simple1 = findSource(dbg, "simple1.js");
+ const simple2 = findSource(dbg, "simple2.js");
+
+ // Set the initial breakpoint.
+ yield addBreakpoint(dbg, simple1, 4);
+ ok(!getSelectedSource(getState()), "No selected source");
+
+ // Call the function that we set a breakpoint in.
+ invokeInTab("main");
+ yield waitForPaused(dbg);
+ assertPausedLocation(dbg, simple1, 4);
+
+ // Step through to another file and make sure it's paused in the
+ // right place.
+ yield stepIn(dbg);
+ assertPausedLocation(dbg, simple2, 2);
+
+ // Step back out to the initial file.
+ yield stepOut(dbg);
+ yield stepOut(dbg);
+ assertPausedLocation(dbg, simple1, 5);
+ yield resume(dbg);
+
+ // Make sure that we can set a breakpoint on a line out of the
+ // viewport, and that pausing there scrolls the editor to it.
+ let longSrc = findSource(dbg, "long.js");
+ yield addBreakpoint(dbg, longSrc, 66);
+
+ invokeInTab("testModel");
+ yield waitForPaused(dbg);
+ assertPausedLocation(dbg, longSrc, 66);
+ ok(isElementVisible(dbg, "breakpoint"), "Breakpoint is visible");
+});