Automatic update from web-platform-tests [wpt] Convert console manual tests to Bidi-based automation. Convert several manual WPT console tests to automated testharness.js tests using WebDriver BiDi log.entryAdded via testdriver.js?feature=bidi. Changes: - Remove manual tests: console-count-logging-manual.html console-countReset-logging-manual.html console-number-format-specifiers-symbol-manual.html console-timing-logging-manual.html - Add automated tests: console-count-logging.html console-countReset-logging.html console-number-format-specifiers-symbol.html console-timing-logging.html console-timing-missing-label-warnings.tentative.html - Update NeverFixTests accordingly. Bug: 489738791 Change-Id: Iba1718b4e423391cc8a186664a3889002e87c4fd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7657323 Commit-Queue: Minju Kim <mkim@igalia.com> Reviewed-by: Alex N. Jose <alexnj@chromium.org> Reviewed-by: Philip Jägenstedt <foolip@chromium.org> Cr-Commit-Position: refs/heads/main@{#1607021} -- wpt-commits: be3f3ee1b16088d9d593119061578df45070a0fd wpt-pr: 58820
27 lines
592 B
JavaScript
27 lines
592 B
JavaScript
function waitForConsoleEntries(t, {count, accept}) {
|
|
return new Promise(resolve => {
|
|
const entries = [];
|
|
let done = false;
|
|
|
|
const removeListener = test_driver.bidi.log.entry_added.on(entry => {
|
|
if (done) return;
|
|
if (entry.type !== "console") return;
|
|
if (accept && !accept(entry)) return;
|
|
|
|
entries.push(entry);
|
|
if (entries.length === count) {
|
|
done = true;
|
|
removeListener();
|
|
resolve(entries);
|
|
}
|
|
});
|
|
|
|
t.add_cleanup(() => {
|
|
if (!done) {
|
|
done = true;
|
|
removeListener();
|
|
}
|
|
});
|
|
});
|
|
}
|