From cddf5bc5cb8666baf4f8f3e6f2b956763350961f Mon Sep 17 00:00:00 2001 From: Karl Tomlinson Date: Mon, 28 Oct 2019 09:33:55 +0000 Subject: [PATCH] Bug 1583496 create a subtest name on success to match the subtest for unhandled exception r=jgraham This is part of an attempt to make subtest names independent of the performance of the test. Depends on D47024 Differential Revision: https://phabricator.services.mozilla.com/D47025 --HG-- extra : moz-landing-system : lando --- .../web-platform/tests/webaudio/resources/audit.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/testing/web-platform/tests/webaudio/resources/audit.js b/testing/web-platform/tests/webaudio/resources/audit.js index 2aac1fffb492..fe6fc45b1400 100644 --- a/testing/web-platform/tests/webaudio/resources/audit.js +++ b/testing/web-platform/tests/webaudio/resources/audit.js @@ -51,6 +51,12 @@ window.Audit = (function() { }, message); } + function _logException(message, exception) { + test(function() { + throw exception; + }, message); + } + function _throwException(message) { throw new Error(message); } @@ -1191,11 +1197,12 @@ window.Audit = (function() { // that wheel, but since it's been reinvented... At least make sure that // an exception while running a task doesn't preclude us running all the // _other_ tasks for the test. + let testName = `Executing "${this.label}"`; try { this._taskFunction(this, this.should.bind(this)); + _logPassed(testName); } catch (e) { - // Log the failure. - test(() => { throw e; }, `Executing "${this.label}"`); + _logException(testName, e); if (this.state != TaskState.FINISHED) { // We threw before calling done(), so do that manually to run our // other tasks.