Bug 1530133 Part 4 - Add logpoint tests.

--HG--
extra : rebase_source : 8dbfcbf4fe1b92918905b1286375a4febe3b4723
This commit is contained in:
Brian Hackett 2019-02-23 16:19:59 -10:00
Родитель da5ea03e75
Коммит 8e4f3cd0e5
21 изменённых файлов: 113 добавлений и 43 удалений

Просмотреть файл

@ -742,10 +742,10 @@ async function navigate(dbg, url, ...sources) {
* @return {Promise}
* @static
*/
function addBreakpoint(dbg, source, line, column) {
function addBreakpoint(dbg, source, line, column, options) {
source = findSource(dbg, source);
const sourceId = source.id;
dbg.actions.addBreakpoint({ sourceId, line, column });
dbg.actions.addBreakpoint({ sourceId, line, column }, options);
return waitForDispatch(dbg, "ADD_BREAKPOINT");
}
@ -756,6 +756,13 @@ function disableBreakpoint(dbg, source, line, column) {
return waitForDispatch(dbg, "DISABLE_BREAKPOINT");
}
function setBreakpointOptions(dbg, source, line, column, options) {
source = findSource(dbg, source);
const sourceId = source.id;
dbg.actions.setBreakpointOptions({ sourceId, line, column }, options);
return waitForDispatch(dbg, "SET_BREAKPOINT_OPTIONS");
}
function findBreakpoint(dbg, url, line) {
const {
selectors: { getBreakpoint },

Просмотреть файл

@ -2,17 +2,14 @@
tags = devtools-webreplay
subsuite = devtools-webreplay
# Feel free to set this to true if an impending change breaks Web Replay and
# fixing it would be annoying or difficult. This will avoid running all tests
# that use Web Replay; we don't want this experimental feature to impede
# development in the rest of Gecko.
#
# Please file a bug against the 'Core > Web Replay' component if you do so,
# so that the problem can be fixed and tests reenabled.
skip-if = os != "mac" || debug || !nightly_build
support-files =
head.js
!/devtools/client/shared/test/shared-head.js
!/devtools/client/shared/test/telemetry-test-helpers.js
!/devtools/client/debugger/new/test/mochitest/helpers.js
!/devtools/client/debugger/new/test/mochitest/helpers/context.js
examples/doc_rr_basic.html
examples/doc_rr_continuous.html
examples/doc_rr_logs.html
@ -36,3 +33,5 @@ skip-if = true # See bug 1481009
[browser_dbg_rr_replay-03.js]
[browser_dbg_rr_console_warp-01.js]
[browser_dbg_rr_console_warp-02.js]
[browser_dbg_rr_logpoint-01.js]
[browser_dbg_rr_logpoint-02.js]

Просмотреть файл

@ -6,8 +6,6 @@
"use strict";
// To disable all Web Replay tests, see browser.ini
// Test basic breakpoint functionality in web replay.
add_task(async function() {
const dbg = await attachRecordingDebugger(

Просмотреть файл

@ -6,8 +6,6 @@
"use strict";
// To disable all Web Replay tests, see browser.ini
// Test unhandled divergence while evaluating at a breakpoint with Web Replay.
add_task(async function() {
const dbg = await attachRecordingDebugger("doc_rr_basic.html",

Просмотреть файл

@ -6,8 +6,6 @@
"use strict";
// To disable all Web Replay tests, see browser.ini
// Test some issues when stepping around after hitting a breakpoint while recording.
add_task(async function() {
const dbg = await attachRecordingDebugger("doc_rr_continuous.html");

Просмотреть файл

@ -6,8 +6,6 @@
"use strict";
// To disable all Web Replay tests, see browser.ini
// Test navigating back to earlier breakpoints while recording, then resuming
// recording.
add_task(async function() {

Просмотреть файл

@ -6,8 +6,6 @@
"use strict";
// To disable all Web Replay tests, see browser.ini
// Test hitting breakpoints when rewinding past the point where the breakpoint
// script was created.
add_task(async function() {

Просмотреть файл

@ -6,8 +6,6 @@
"use strict";
// To disable all Web Replay tests, see browser.ini
// Test basic console time warping functionality in web replay.
add_task(async function() {
const dbg = await attachRecordingDebugger(

Просмотреть файл

@ -6,8 +6,6 @@
"use strict";
// To disable all Web Replay tests, see browser.ini
// Test basic console time warping functionality in web replay.
add_task(async function() {
const dbg = await attachRecordingDebugger(

Просмотреть файл

@ -0,0 +1,46 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable no-undef */
"use strict";
// Test basic logpoint functionality in web replay. When logpoints are added,
// new messages should appear in the correct order and allow time warping.
add_task(async function() {
const dbg = await attachRecordingDebugger(
"doc_rr_basic.html",
{ waitForRecording: true }
);
const {tab, toolbox, threadClient} = dbg;
const console = await getDebuggerSplitConsole(dbg);
const hud = console.hud;
const bp1 = await setBreakpoint(threadClient, "doc_rr_basic.html", 21,
{ logValue: `"Logpoint Number " + number` });
const bp2 = await setBreakpoint(threadClient, "doc_rr_basic.html", 6,
{ logValue: `"Logpoint Beginning"` });
const bp3 = await setBreakpoint(threadClient, "doc_rr_basic.html", 8,
{ logValue: `"Logpoint Ending"` });
const messages = await waitForMessageCount(hud, "Logpoint", 12);
ok(messages[0].textContent.includes("Beginning"));
for (let i = 1; i <= 10; i++) {
ok(messages[i].textContent.includes("Number " + i));
}
ok(messages[11].textContent.includes("Ending"));
await warpToMessage(hud, dbg, "Number 5");
await threadClient.interrupt();
await checkEvaluateInTopFrame(threadClient, "number", 5);
await reverseStepOverToLine(threadClient, 20);
await threadClient.removeBreakpoint(bp1);
await threadClient.removeBreakpoint(bp2);
await threadClient.removeBreakpoint(bp3);
await toolbox.destroy();
await gBrowser.removeTab(tab);
});

Просмотреть файл

@ -0,0 +1,40 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable no-undef */
"use strict";
// Test that logpoints appear and disappear as expected as breakpoints are
// modified. Also test that conditional logpoints work.
add_task(async function() {
const dbg = await attachRecordingDebugger(
"doc_rr_basic.html",
{ waitForRecording: true }
);
const {tab, toolbox} = dbg;
const console = await getDebuggerSplitConsole(dbg);
const hud = console.hud;
await addBreakpoint(dbg, "doc_rr_basic.html", 21, undefined,
{ logValue: `"Logpoint Number " + number` });
await addBreakpoint(dbg, "doc_rr_basic.html", 6, undefined,
{ logValue: `"Logpoint Beginning"` });
await addBreakpoint(dbg, "doc_rr_basic.html", 8, undefined,
{ logValue: `"Logpoint Ending"` });
await waitForMessageCount(hud, "Logpoint", 12);
await disableBreakpoint(dbg, findSource(dbg, "doc_rr_basic.html"), 6);
await waitForMessageCount(hud, "Logpoint", 11);
await setBreakpointOptions(dbg, "doc_rr_basic.html", 21, undefined,
{ logValue: `"Logpoint Number " + number`, condition: `number % 2 == 0` });
await waitForMessageCount(hud, "Logpoint", 6);
await dbg.actions.removeAllBreakpoints();
await toolbox.destroy();
await gBrowser.removeTab(tab);
});

Просмотреть файл

@ -6,8 +6,6 @@
"use strict";
// To disable all Web Replay tests, see browser.ini
// Test basic recording of a tab without any debugging.
add_task(async function() {
const recordingTab = BrowserTestUtils.addTab(gBrowser, null, { recordExecution: "*" });

Просмотреть файл

@ -6,8 +6,6 @@
"use strict";
// To disable all Web Replay tests, see browser.ini
// Test basic recovery of crashed child processes in web replay.
add_task(async function() {
const tab = BrowserTestUtils.addTab(gBrowser, null, { recordExecution: "*" });

Просмотреть файл

@ -6,8 +6,6 @@
"use strict";
// To disable all Web Replay tests, see browser.ini
// Basic test for saving a recording and then replaying it in a new tab.
add_task(async function() {
const recordingFile = newRecordingFile();

Просмотреть файл

@ -6,8 +6,6 @@
"use strict";
// To disable all Web Replay tests, see browser.ini
// Test ending a recording at a breakpoint and then separately replaying to the end.
add_task(async function() {
waitForExplicitFinish();

Просмотреть файл

@ -6,8 +6,6 @@
"use strict";
// To disable all Web Replay tests, see browser.ini
// Test for saving a recording and then replaying it in a new tab,
// with rewinding disabled.
add_task(async function() {

Просмотреть файл

@ -6,8 +6,6 @@
"use strict";
// To disable all Web Replay tests, see browser.ini
// Test basic step-over/back functionality in web replay.
add_task(async function() {
const tab = BrowserTestUtils.addTab(gBrowser, null, { recordExecution: "*" });

Просмотреть файл

@ -6,8 +6,6 @@
"use strict";
// To disable all Web Replay tests, see browser.ini
// Test fixes for some simple stepping bugs.
add_task(async function() {
const tab = BrowserTestUtils.addTab(gBrowser, null, { recordExecution: "*" });

Просмотреть файл

@ -6,8 +6,6 @@
"use strict";
// To disable all Web Replay tests, see browser.ini
// Test stepping back while recording, then resuming recording.
add_task(async function() {
const tab = BrowserTestUtils.addTab(gBrowser, null, { recordExecution: "*" });

Просмотреть файл

@ -6,8 +6,6 @@
"use strict";
// To disable all Web Replay tests, see browser.ini
// Stepping past the beginning or end of a frame should act like a step-out.
add_task(async function() {
const tab = BrowserTestUtils.addTab(gBrowser, null, { recordExecution: "*" });

Просмотреть файл

@ -45,12 +45,12 @@ async function attachRecordingDebugger(url,
}
// Return a promise that resolves when a breakpoint has been set.
async function setBreakpoint(threadClient, expectedFile, lineno) {
async function setBreakpoint(threadClient, expectedFile, lineno, options = {}) {
const {sources} = await threadClient.getSources();
ok(sources.length == 1, "Got one source");
ok(RegExp(expectedFile).test(sources[0].url), "Source is " + expectedFile);
const location = { sourceUrl: sources[0].url, line: lineno };
await threadClient.setBreakpoint(location, {});
await threadClient.setBreakpoint(location, options);
return location;
}
@ -119,6 +119,16 @@ function waitForMessages(hud, text, selector = ".message") {
return waitUntilPredicate(() => findMessages(hud, text, selector));
}
async function waitForMessageCount(hud, text, length, selector = ".message") {
let messages;
await waitUntil(() => {
messages = findMessages(hud, text, selector);
return messages && messages.length == length;
});
ok(messages.length == length, "Found expected message count");
return messages;
}
async function warpToMessage(hud, threadClient, text) {
let messages = await waitForMessages(hud, text);
ok(messages.length == 1, "Found one message");