[WebGPU] Move 'gpu' API entry point from DOMWindow to Navigator
[WebKit-https.git] / LayoutTests / webgpu / adapter-options.html
1 <!DOCTYPE html><!-- webkit-test-runner [ experimental:WebGPUEnabled=true ] -->
2 <meta charset=utf-8>
3 <title>Create GPUDevices from various options.</title>
4 <body>
5 <script src="../resources/testharness.js"></script>
6 <script src="../resources/testharnessreport.js"></script>
7 <script>
8 promise_test(async () => {
9     const defaultAdapter = await navigator.gpu.requestAdapter();
10     const device = await defaultAdapter.requestDevice();
11
12     assert_true(device instanceof WebGPUDevice, "Default device successfully created.");
13 }, "Create the default device.");
14
15 promise_test(async () => {
16     const lowPowerAdapter = await navigator.gpu.requestAdapter({ powerPreference: "low-power" });
17     const device = await lowPowerAdapter.requestDevice();
18
19     assert_true(device instanceof WebGPUDevice, "Device successfully created using low-power option.");
20 }, "Create a device with a low-power option.");
21
22 promise_test(async () => {
23     const highPerfAdapter = await navigator.gpu.requestAdapter({ powerPreference: "high-performance" });
24     const device = await highPerfAdapter.requestDevice();
25
26     assert_true(device instanceof WebGPUDevice, "Device successfully created using high-performance option.");
27 }, "Create a device with a high-performance option.");
28 </script>
29 </body>