blob: a2434cd88a4e04b686ebf4606a97837c3a902b0b [file] [log] [blame]
<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebGPUEnabled=true ] -->
<html>
<meta charset=utf-8>
<title>Test if WebGPU is enabled.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>
promise_test(async () => {
const canvas = document.createElement("canvas");
const context = canvas.getContext("gpu");
assert_true(context instanceof GPUCanvasContext, "Created GPUCanvasContext.");
assert_equals(window.gpu, undefined, "window.gpu should not be defined.")
assert_not_equals(navigator.gpu, undefined, "navigator.gpu is defined.");
const adapter = await navigator.gpu.requestAdapter();
assert_true(adapter instanceof GPUAdapter, "Created default GPUAdapter.");
const device = await adapter.requestDevice();
assert_true(device instanceof GPUDevice, "Created GPUDevice.");
}, "Web GPU is enabled.");
</script>
</html>