mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-25 02:40:22 -10:00
Automatic update from web-platform-tests Update naming for vertex state Specification change: https://github.com/gpuweb/gpuweb/pull/469 Dawn roll: https://dawn.googlesource.com/dawn/+log/c3284fa40ec6b12731ed66c2f2a9256ae3fa692e..ae1f25fee85ebf2773b24a0a4f39c160839b1dbb CTS roll: https://github.com/gpuweb/cts/compare/3dc37c83a70667e9a92df773f34d154ec600d203...e114192747a54f34157eb65754e037701fbdf98b TBR: [email protected] Bug: dawn:22 Change-Id: Ib427760b9fba4b2cc4290de046c4a31d77e0b67a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1900807 Reviewed-by: Austin Eng <[email protected]> Reviewed-by: Yunchao He <[email protected]> Reviewed-by: Corentin Wallez <[email protected]> Commit-Queue: Kai Ninomiya <[email protected]> Cr-Commit-Position: refs/heads/master@{#713682} -- wpt-commits: 4831b37a33f002e67ecc5f9f5b41145721e0ab60 wpt-pr: 20186
122 lines
3.2 KiB
JavaScript
122 lines
3.2 KiB
JavaScript
/**
|
|
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
|
|
**/
|
|
|
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
|
|
export class SkipTestCase extends Error {} // A Fixture is a class used to instantiate each test case at run time.
|
|
// A new instance of the Fixture is created for every single test case
|
|
// (i.e. every time the test function is run).
|
|
|
|
export class Fixture {
|
|
constructor(rec, params) {
|
|
_defineProperty(this, "params", void 0);
|
|
|
|
_defineProperty(this, "rec", void 0);
|
|
|
|
_defineProperty(this, "eventualExpectations", []);
|
|
|
|
_defineProperty(this, "numOutstandingAsyncExpectations", 0);
|
|
|
|
this.rec = rec;
|
|
this.params = params;
|
|
} // This has to be a member function instead of an async `createFixture` function, because
|
|
// we need to be able to ergonomically override it in subclasses.
|
|
|
|
|
|
async init() {}
|
|
|
|
debug(msg) {
|
|
this.rec.debug(new Error(msg));
|
|
}
|
|
|
|
skip(msg) {
|
|
throw new SkipTestCase(msg);
|
|
}
|
|
|
|
async finalize() {
|
|
if (this.numOutstandingAsyncExpectations !== 0) {
|
|
throw new Error('there were outstanding asynchronous expectations (e.g. shouldReject) at the end of the test');
|
|
}
|
|
|
|
await Promise.all(this.eventualExpectations);
|
|
}
|
|
|
|
warn(msg) {
|
|
this.rec.warn(new Error(msg));
|
|
}
|
|
|
|
fail(msg) {
|
|
this.rec.fail(new Error(msg));
|
|
}
|
|
|
|
async immediateAsyncExpectation(fn) {
|
|
this.numOutstandingAsyncExpectations++;
|
|
const ret = await fn();
|
|
this.numOutstandingAsyncExpectations--;
|
|
return ret;
|
|
}
|
|
|
|
eventualAsyncExpectation(fn) {
|
|
const promise = fn(new Error());
|
|
this.eventualExpectations.push(promise);
|
|
return promise;
|
|
}
|
|
|
|
expectErrorValue(expectedName, ex, niceStack) {
|
|
if (!(ex instanceof Error)) {
|
|
niceStack.message = 'THREW non-error value, of type ' + typeof ex + niceStack.message;
|
|
this.rec.fail(niceStack);
|
|
return;
|
|
}
|
|
|
|
const actualName = ex.name;
|
|
|
|
if (actualName !== expectedName) {
|
|
niceStack.message = `THREW ${actualName}, instead of ${expectedName}` + niceStack.message;
|
|
this.rec.fail(niceStack);
|
|
} else {
|
|
niceStack.message = 'OK: threw ' + actualName + niceStack.message;
|
|
this.rec.debug(niceStack);
|
|
}
|
|
}
|
|
|
|
shouldReject(expectedName, p, msg) {
|
|
this.eventualAsyncExpectation(async niceStack => {
|
|
const m = msg ? ': ' + msg : '';
|
|
|
|
try {
|
|
await p;
|
|
niceStack.message = 'DID NOT THROW' + m;
|
|
this.rec.fail(niceStack);
|
|
} catch (ex) {
|
|
niceStack.message = m;
|
|
this.expectErrorValue(expectedName, ex, niceStack);
|
|
}
|
|
});
|
|
}
|
|
|
|
shouldThrow(expectedName, fn, msg) {
|
|
const m = msg ? ': ' + msg : '';
|
|
|
|
try {
|
|
fn();
|
|
this.rec.fail(new Error('DID NOT THROW' + m));
|
|
} catch (ex) {
|
|
this.expectErrorValue(expectedName, ex, new Error(m));
|
|
}
|
|
}
|
|
|
|
expect(cond, msg) {
|
|
if (cond) {
|
|
const m = msg ? ': ' + msg : '';
|
|
this.rec.debug(new Error('expect OK' + m));
|
|
} else {
|
|
this.rec.fail(new Error(msg));
|
|
}
|
|
|
|
return cond;
|
|
}
|
|
|
|
}
|
|
//# sourceMappingURL=fixture.js.map
|