summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/tests/cts/checkout/src/webgpu/idl/exposed.html.ts
blob: 7aee998a9ffa2a9abcf3137e0eaac774268150b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// WPT-specific test checking that WebGPU is available iff isSecureContext.

import { assert } from '../../common/util/util.js';

const items = [
  globalThis.navigator.gpu,
  globalThis.GPU,
  globalThis.GPUAdapter,
  globalThis.GPUAdapterInfo,
  globalThis.GPUBindGroup,
  globalThis.GPUBindGroupLayout,
  globalThis.GPUBuffer,
  globalThis.GPUBufferUsage,
  globalThis.GPUCanvasContext,
  globalThis.GPUColorWrite,
  globalThis.GPUCommandBuffer,
  globalThis.GPUCommandEncoder,
  globalThis.GPUCompilationInfo,
  globalThis.GPUCompilationMessage,
  globalThis.GPUComputePassEncoder,
  globalThis.GPUComputePipeline,
  globalThis.GPUDevice,
  globalThis.GPUDeviceLostInfo,
  globalThis.GPUError,
  globalThis.GPUExternalTexture,
  globalThis.GPUMapMode,
  globalThis.GPUOutOfMemoryError,
  globalThis.GPUPipelineLayout,
  globalThis.GPUQuerySet,
  globalThis.GPUQueue,
  globalThis.GPURenderBundle,
  globalThis.GPURenderBundleEncoder,
  globalThis.GPURenderPassEncoder,
  globalThis.GPURenderPipeline,
  globalThis.GPUSampler,
  globalThis.GPUShaderModule,
  globalThis.GPUShaderStage,
  globalThis.GPUSupportedLimits,
  globalThis.GPUTexture,
  globalThis.GPUTextureUsage,
  globalThis.GPUTextureView,
  globalThis.GPUUncapturedErrorEvent,
  globalThis.GPUValidationError,
];

for (const item of items) {
  if (globalThis.isSecureContext) {
    assert(item !== undefined, 'Item/interface should be exposed on secure context');
  } else {
    assert(item === undefined, 'Item/interface should not be exposed on insecure context');
  }
}