is(
deviceLostReason.reason, "destroyed", "Destroy reason should correspond to GPUDeviceLostReason.destroyed"
);
is(deviceLostReason.message, "", "Destroy message should be blank");
};
let lostPromise;
// Create a scope with a device that will go out of scope
// and then be dropped.
{
const device = await adapter.requestDevice();
ok(device !== undefined, "device !== undefined");
lostPromise = device.lost;
}
SimpleTest.requestFlakyTimeout( "Racing against promise that should never resolve."
);
const TIMEOUT_MS = 5000;
let timeoutPromise = new Promise(resolve => {
let timeoutValue = { reason: "timeout", message: "" };
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
setTimeout(() => resolve(timeoutValue), TIMEOUT_MS);
});
const firstPromise = await Promise.race([lostPromise, timeoutPromise]);
is(
firstPromise.reason, "timeout", "timeoutPromise should return before lostPromise."
);
// Check the message so we output some indication of what incorrectly
// resolved the lost promise.
is(firstPromise.message, "", "the message should be blank.");
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.