Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(626)

Side by Side Diff: LayoutTests/media/muted.html

Issue 205683003: Update <video muted=""> handling to match spec (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: update defaultMuted test Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/media/muted-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!doctype html>
2 <!-- original: https://github.com/w3c/web-platform-tests/blob/17e61b54afe98b7385 c8b7777e18f5f5b903a23c/html/semantics/embedded-content/media-elements/user-inter face/muted.html -->
3 <title>muted</title>
4 <script src="../resources/testharness.js"></script>
5 <script src="../resources/testharnessreport.js"></script>
6 <style>video { display: none; }</style>
7 <div id=log></div>
8
9 <script>
10 function test_setting(e, muted, hasAttribute)
11 {
12 assert_equals(e.muted, muted);
13 assert_equals(e.hasAttribute('muted'), hasAttribute);
14
15 e.muted = !e.muted;
16 assert_equals(e.muted, !muted);
17 assert_equals(e.hasAttribute('muted'), hasAttribute);
18
19 e.muted = !e.muted;
20 assert_equals(e.muted, muted);
21 assert_equals(e.hasAttribute('muted'), hasAttribute);
22 }
23 </script>
24
25 <!-- These tests are inside <audio>/<video> so that the steps for updating the
26 muted IDL attribute cannot be delayed until the end tag is parsed. -->
27
28 <audio id=a1>
29 <script>
30 var a1 = document.getElementById('a1');
31
32 test(function()
33 {
34 assert_false(a1.muted);
35 }, 'getting audio.muted (parser-created)');
36
37 test(function()
38 {
39 test_setting(a1, false, false);
40 }, 'setting audio.muted (parser-created)');
41 </script>
42 </audio>
43
44 <audio id=a2 muted>
45 <script>
46 var a2 = document.getElementById('a2');
47
48 test(function()
49 {
50 assert_true(a2.muted);
51 }, 'getting audio.muted with muted="" (parser-created)');
52
53 test(function()
54 {
55 test_setting(a2, true, true);
56 }, 'setting audio.muted with muted="" (parser-created)');
57 </script>
58 </audio>
59
60 <video id=v1>
61 <script>
62 var v1 = document.getElementById('v1');
63
64 test(function()
65 {
66 assert_false(v1.muted);
67 }, 'getting video.muted (parser-created)');
68
69 test(function()
70 {
71 test_setting(v1, false, false);
72 }, 'setting video.muted (parser-created)');
73 </script>
74 </video>
75
76 <video id=v2 muted>
77 <script>
78 var v2 = document.getElementById('v2');
79
80 test(function()
81 {
82 assert_true(v2.muted);
83 }, 'getting video.muted with muted="" (parser-created)');
84
85 test(function()
86 {
87 test_setting(v2, true, true);
88 }, 'setting video.muted with muted="" (parser-created)');
89 </script>
90 </video>
91
92 <!-- Negative test to ensure that the load algorithm does not update the
93 muted IDL attribute to match the content attribute. -->
94
95 <video id=v3 muted></video>
96 <script>
97 async_test(function(t)
98 {
99 var v = document.getElementById('v3');
100 assert_true(v.muted);
101 v.muted = false;
102 v.src = 'data:,'; // invokes load()
103 v.addEventListener('error', t.step_func(function()
104 {
105 assert_false(v.muted);
106 t.done();
107 }));
108 }, 'getting video.muted with muted="" after load (parser-created)');
109 </script>
110
111 <script>
112 ['audio', 'video'].forEach(function(tagName)
113 {
114 test(function()
115 {
116 var m = document.createElement(tagName);
117 assert_false(m.muted);
118 }, 'getting ' + tagName + '.muted (script-created)');
119
120 test(function()
121 {
122 var m = document.createElement(tagName);
123 test_setting(m, false, false);
124 }, 'setting ' + tagName + '.muted (script-created)');
125
126 test(function()
127 {
128 var m = document.createElement(tagName);
129 m.setAttribute('muted', '');
130 assert_false(m.muted);
131 }, 'getting ' + tagName + '.muted with muted="" (script-created)');
132
133 test(function()
134 {
135 var m = document.createElement(tagName);
136 m.setAttribute('muted', '');
137 test_setting(m, false, true);
138 }, 'setting ' + tagName + '.muted with muted="" (script-created)');
139
140 // Spec bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=25153
141 test(function()
142 {
143 var m = document.createElement(tagName);
144 m.setAttribute('muted', '');
145 m = m.cloneNode(false);
146 assert_true(m.hasAttribute('muted'));
147 assert_false(m.muted);
148 }, 'getting ' + tagName + '.muted with muted="" (cloneNode-created)');
149
150 test(function()
151 {
152 var div = document.createElement('div');
153 div.innerHTML = '<' + tagName + ' muted>';
154 m = div.firstChild;
155 assert_true(m.hasAttribute('muted'));
156 assert_true(m.muted);
157 }, 'getting ' + tagName + '.muted with muted="" (innerHTML-created)');
158
159 test(function()
160 {
161 var id = tagName;
162 assert_equals(document.getElementById(id), null);
163 document.write('<' + tagName + ' id=' + id + ' muted>');
164 m = document.getElementById(id);
165 assert_true(m.hasAttribute('muted'));
166 assert_true(m.muted);
167 }, 'getting ' + tagName + '.muted with muted="" (document.write-created)');
168 });
169 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/media/muted-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698