Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/webgpu/mochitest/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 2 kB image not shown  

Quelle  test_device_lost.html   Sprache: HTML

 
 products/Sources/formale Sprachen/C/Firefox/dom/webgpu/mochitest/test_device_lost.html


<!doctype html>
<html>
  <head>
    <meta charset="utf-8" />
    <script src="/tests/SimpleTest/SimpleTest.js"></script>
    <link rel="stylesheet" href="/tests/SimpleTest/test.css" />
  </head>
  <body>
    <script>
      ok(
        SpecialPowers.getBoolPref("dom.webgpu.enabled"),
        "Pref should be enabled."
      );

      const destroy_causes_lost = async function () {
        const adapter = await navigator.gpu.requestAdapter();
        ok(adapter !== undefined, "adapter !== undefined");
        const device = await adapter.requestDevice();
        ok(device !== undefined, "device !== undefined");

        const lostPromise = device.lost;
        device.destroy();
        const deviceLostReason = await lostPromise;

        is(
          deviceLostReason.reason,
          "destroyed",
          "Destroy reason should correspond to GPUDeviceLostReason.destroyed"
        );
        is(deviceLostReason.message, """Destroy message should be blank");
      };

      const drop_causes_lost_is_unobservable = async function () {
        const adapter = await navigator.gpu.requestAdapter();
        ok(adapter !== undefined, "adapter !== undefined");

        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.");
      };

      SimpleTest.waitForExplicitFinish();

      destroy_causes_lost()
        .then(() => drop_causes_lost_is_unobservable())
        .catch(e => ok(false, `Unhandled exception ${e}`))
        .finally(() => SimpleTest.finish());
    </script>
  </body>
</html>

Messung V0.5
C=90 H=98 G=94

¤ Dauer der Verarbeitung: 0.16 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.