summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/mediacapture-fromelement/idlharness.window.js
blob: 970f3cd5c623261f0d5acc4e5fb14dfa2f732883 (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
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js

// https://w3c.github.io/mediacapture-fromelement/

'use strict';

idl_test(
  ['mediacapture-fromelement'],
  ['mediacapture-streams', 'html', 'dom'],
  idl_array => {
    // Ignored errors will be surfaced when the elements are undefined below.
    try {
      self.video = document.createElement('video');
      video.width = video.height = 10;
      document.body.appendChild(video);
    } catch (e) { }

    try {
      self.audio = document.createElement('audio');
      document.body.appendChild(audio);
    } catch (e) { }

    try {
      self.canvas = document.createElement('canvas');
      document.body.appendChild(canvas);
      canvas.width = canvas.height = 10;
      self.track = canvas.captureStream().getTracks()[0];
    } catch (e) { }

    idl_array.add_objects({
      HTMLVideoElement: ['video'],
      HTMLAudioElement: ['audio'],
      HTMLCanvasElement: ['canvas'],
      CanvasCaptureMediaStreamTrack: ['track'],
    });
  }
);