summaryrefslogtreecommitdiff
path: root/toolkit/devtools/debugger/test/browser_dbg_hit-counts-01.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2016-10-16 19:34:53 -0400
committerMatt A. Tobin <email@mattatobin.com>2016-10-16 19:34:53 -0400
commit81805ce3f63e2e4a799bd54f174083c58a9b5640 (patch)
tree6e13374b213ac9b2ae74c25d8aac875faf71fdd0 /toolkit/devtools/debugger/test/browser_dbg_hit-counts-01.js
parent28c8da71bf521bb3ee76f27b8a241919e24b7cd5 (diff)
downloadpalemoon-gre-81805ce3f63e2e4a799bd54f174083c58a9b5640.tar.gz
Move Mozilla DevTools to Platform - Part 3: Merge the browser/devtools and toolkit/devtools adjusting for directory collisions
Diffstat (limited to 'toolkit/devtools/debugger/test/browser_dbg_hit-counts-01.js')
-rw-r--r--toolkit/devtools/debugger/test/browser_dbg_hit-counts-01.js61
1 files changed, 61 insertions, 0 deletions
diff --git a/toolkit/devtools/debugger/test/browser_dbg_hit-counts-01.js b/toolkit/devtools/debugger/test/browser_dbg_hit-counts-01.js
new file mode 100644
index 000000000..841362b7a
--- /dev/null
+++ b/toolkit/devtools/debugger/test/browser_dbg_hit-counts-01.js
@@ -0,0 +1,61 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/**
+ * Evaluating two functions on the same line and checking for correct hit count
+ * for both of them in CodeMirror's gutter.
+ */
+
+const TAB_URL = EXAMPLE_URL + "doc_same-line-functions.html";
+const CODE_URL = "code_same-line-functions.js";
+
+let gTab, gPanel, gDebugger;
+let gEditor;
+
+function test() {
+ Task.async(function* () {
+ yield pushPrefs(["devtools.debugger.tracer", true]);
+
+ initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
+ gTab = aTab;
+ gPanel = aPanel;
+ gDebugger = gPanel.panelWin;
+ gEditor = gDebugger.DebuggerView.editor;
+
+ Task.async(function* () {
+ yield waitForSourceShown(gPanel, CODE_URL);
+ yield startTracing(gPanel);
+
+ clickButton();
+
+ yield waitForClientEvents(aPanel, "traces");
+
+ testHitCounts();
+
+ yield stopTracing(gPanel);
+ yield popPrefs();
+ yield closeDebuggerAndFinish(gPanel);
+ })();
+ });
+ })().catch(e => {
+ ok(false, "Got an error: " + e.message + "\n" + e.stack);
+ });
+}
+
+function clickButton() {
+ sendMouseClickToTab(gTab, content.document.querySelector("button"));
+}
+
+function testHitCounts() {
+ let marker = gEditor.getMarker(0, 'hit-counts');
+
+ is(marker.innerHTML, "1\u00D7|1\u00D7",
+ "Both functions should be hit only once.");
+}
+
+registerCleanupFunction(function() {
+ gTab = null;
+ gPanel = null;
+ gDebugger = null;
+ gEditor = null;
+});