summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLMediaElement.html
blob: 58e002c52ca2fe03e2a209ef611f52ab66f8e847 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!DOCTYPE html>
<title>Custom Elements: CEReactions on HTMLMediaElement interface</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<meta name="assert" content="src, crossOrigin, preload, autoplay, loop,
  controls, defaultMuted of HTMLMediaElement interface must have CEReactions">
<meta name="help" content="https://html.spec.whatwg.org/#media-elements">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../resources/custom-elements-helpers.js"></script>
<script src="../resources/reactions.js"></script>

<body>
<script>

function getParentElement() {
  return document.body;
}

function setAttributes(instance, value) {
  instance.setAttribute('src', value);
}

testReflectAttribute(
  'src', 'src', '/media/sound_0.mp3',
  '/media/sound_5.mp3', 'src on HTMLMediaElement in audio', 'audio',
  HTMLAudioElement
);
testReflectAttributeWithDependentAttributes(
  'crossOrigin', 'crossorigin', 'use-credentials',
  'anonymous', 'crossOrigin on HTMLMediaElement in audio', 'audio',
  getParentElement, instance => setAttributes(instance, '/media/sound_5.mp3'),
  HTMLAudioElement
);
testReflectAttributeWithDependentAttributes(
  'preload', 'preload', 'auto',
  'none', 'preload on HTMLMediaElement in audio', 'audio',
  getParentElement, instance => setAttributes(instance, '/media/sound_5.mp3'),
  HTMLAudioElement
);
testReflectBooleanAttributeWithDependentAttributes(
  'autoplay', 'autoplay', 'autoplay on HTMLMediaElement in audio',
  'audio', getParentElement,
  instance => setAttributes(instance, '/media/sound_5.mp3'),
  HTMLAudioElement
);
testReflectBooleanAttributeWithDependentAttributes(
  'loop', 'loop', 'loop on HTMLMediaElement in audio',
  'audio', getParentElement,
  instance => setAttributes(instance, '/media/sound_5.mp3'), HTMLAudioElement
);
testReflectBooleanAttributeWithDependentAttributes(
  'controls', 'controls', 'controls on HTMLMediaElement in audio',
  'audio', getParentElement,
  instance => setAttributes(instance, '/media/sound_5.mp3'),
  HTMLAudioElement
);
testReflectBooleanAttributeWithDependentAttributes(
  'defaultMuted', 'muted', 'defaultMuted on HTMLMediaElement in audio',
  'audio', getParentElement,
  instance => setAttributes(instance, '/media/sound_5.mp3'),
  HTMLAudioElement
);

testReflectAttribute(
  'src', 'src', '/media/video.ogv',
  '/media/movie_5.mp4', 'src on HTMLMediaElement in video', 'video',
  HTMLVideoElement
);
testReflectAttributeWithDependentAttributes(
  'crossOrigin', 'crossorigin', 'use-credentials',
  'anonymous', 'crossOrigin on HTMLMediaElement in video', 'video',
  getParentElement, instance => setAttributes(instance, '/media/movie_5.mp4'),
  HTMLVideoElement
);
testReflectAttributeWithDependentAttributes(
  'preload', 'preload', 'auto',
  'none', 'preload on HTMLMediaElement in video', 'video',
  getParentElement, instance => setAttributes(instance, '/media/movie_5.mp4'),
  HTMLVideoElement
);
testReflectBooleanAttributeWithDependentAttributes(
  'autoplay', 'autoplay', 'autoplay on HTMLMediaElement in video',
  'video', getParentElement,
  instance => setAttributes(instance, '/media/movie_5.mp4'),
  HTMLVideoElement
);
testReflectBooleanAttributeWithDependentAttributes(
  'loop', 'loop', 'loop on HTMLMediaElement in video',
  'video', getParentElement,
  instance => setAttributes(instance, '/media/movie_5.mp4'),
  HTMLVideoElement
);
testReflectBooleanAttributeWithDependentAttributes(
  'controls', 'controls', 'controls on HTMLMediaElement in video',
  'video', getParentElement,
  instance => setAttributes(instance, '/media/movie_5.mp4'),
  HTMLVideoElement
);
testReflectBooleanAttributeWithDependentAttributes(
  'defaultMuted', 'muted', 'defaultMuted on HTMLMediaElement in video',
  'video', getParentElement,
  instance => setAttributes(instance, '/media/movie_5.mp4'),
  HTMLVideoElement
);

</script>
</body>