| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src=video-test.js></script> | 4 <script src=video-test.js></script> |
| 5 <script src=media-file.js></script> | |
| 6 <script> | 5 <script> |
| 7 var index = 0; | 6 var index = 0; |
| 8 | 7 |
| 9 function testMuted(expectedMuted, expectedDefaultMuted) | 8 function testMuted(expectedMuted, expectedDefaultMuted) |
| 10 { | 9 { |
| 11 testExpected("video.muted", expectedMuted); | 10 testExpected("video.muted", expectedMuted); |
| 12 testExpected("video.defaultMuted", expectedDefaultMuted); | 11 testExpected("video.defaultMuted", expectedDefaultMuted); |
| 13 } | 12 } |
| 14 | 13 |
| 15 function test(defaultMuted) | 14 function test(defaultMuted) |
| 16 { | 15 { |
| 17 consoleWrite("<br><br><b>*** Test <em>" + (defaultMuted ? "with"
: "without") + "</em> 'muted' content attribute</b><br>"); | 16 consoleWrite("<br><br><b>*** Test <em>" + (defaultMuted ? "with"
: "without") + "</em> 'muted' content attribute</b><br>"); |
| 18 | 17 |
| 19 run("video = document.createElement('video')"); | 18 run("video = document.createElement('video')"); |
| 20 run("video.setAttribute('controls', 'controls')"); | 19 run("video.setAttribute('controls', 'controls')"); |
| 21 video.setAttribute('width', '300'); | 20 video.setAttribute('width', '300'); |
| 22 if (defaultMuted) | 21 if (defaultMuted) |
| 23 run("video.setAttribute('muted', 'muted')"); | 22 run("video.setAttribute('muted', 'muted')"); |
| 24 document.getElementById('parent').appendChild(video); | 23 document.getElementById('parent').appendChild(video); |
| 25 | 24 |
| 26 consoleWrite("<br>*** Test before setting src, IDL attribute sho
uld default to false"); | 25 consoleWrite("<br>*** Test before setting src, IDL attribute sho
uld default to false"); |
| 27 testMuted(false, defaultMuted); | 26 testMuted(false, defaultMuted); |
| 28 | 27 |
| 29 var loadedmetadata = function(evt) | 28 consoleWrite("<br>*** Change 'defaultMuted', IDL attribute shoul
d not change but content attribute should."); |
| 30 { | 29 var newDefaultMuted = !defaultMuted; |
| 31 consoleWrite("<br>EVENT(" + evt.type + ")"); | 30 run("video.defaultMuted = " + newDefaultMuted); |
| 31 testMuted(false, newDefaultMuted); |
| 32 testExpected("video.hasAttribute('muted')", newDefaultMuted); |
| 32 | 33 |
| 33 consoleWrite("<br>*** After setting url, content attribute s
hould have set IDL attribute"); | 34 consoleWrite("<br>*** Change 'muted' IDL attribute, content attr
ibute should not change"); |
| 34 testMuted(defaultMuted, defaultMuted); | 35 run("video.muted = false"); |
| 36 testMuted(false, newDefaultMuted); |
| 37 testExpected("video.hasAttribute('muted')", newDefaultMuted); |
| 35 | 38 |
| 36 consoleWrite("<br>*** Change 'defaultMuted', IDL attribute s
hould not change but content attribute should."); | 39 var action = defaultMuted ? "Remove" : "Add"; |
| 37 var newDefaultMuted = !defaultMuted; | 40 consoleWrite("<br>*** " + action + " 'muted' content attribute,
it should have no effect on IDL attribute"); |
| 38 run("video.defaultMuted = " + newDefaultMuted); | 41 if (defaultMuted) |
| 39 testMuted(defaultMuted, newDefaultMuted); | 42 run("video.removeAttribute('muted')"); |
| 40 testExpected("video.hasAttribute('muted')", newDefaultMuted)
; | 43 else |
| 41 | 44 run("video.setAttribute('muted', 'muted')"); |
| 42 consoleWrite("<br>*** Change 'muted' IDL attribute, content
attribute should not change"); | 45 testMuted(false, video.hasAttribute('muted')); |
| 43 run("video.muted = false"); | |
| 44 testMuted(false, newDefaultMuted); | |
| 45 testExpected("video.hasAttribute('muted')", newDefaultMuted)
; | |
| 46 | 46 |
| 47 var action = defaultMuted ? "Remove" : "Add"; | 47 runNextTest(); |
| 48 consoleWrite("<br>*** " + action + " 'muted' content attribu
te, it should have no effect on IDL attribute"); | |
| 49 if (defaultMuted) | |
| 50 run("video.removeAttribute('muted')"); | |
| 51 else | |
| 52 run("video.setAttribute('muted', 'muted')"); | |
| 53 testMuted(false, video.hasAttribute('muted')); | |
| 54 | |
| 55 runNextTest(); | |
| 56 } | |
| 57 video.addEventListener('loadedmetadata', loadedmetadata); | |
| 58 video.src = findMediaFile("audio", "content/test"); | |
| 59 } | 48 } |
| 60 | 49 |
| 61 function runNextTest() | 50 function runNextTest() |
| 62 { | 51 { |
| 63 if (video) { | 52 if (video) { |
| 64 video.parentNode.removeChild(video); | 53 video.parentNode.removeChild(video); |
| 65 video = null; | 54 video = null; |
| 66 } | 55 } |
| 67 | 56 |
| 68 switch (++index) | 57 switch (++index) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 81 } | 70 } |
| 82 | 71 |
| 83 </script> | 72 </script> |
| 84 </head> | 73 </head> |
| 85 | 74 |
| 86 <body onload="runNextTest()"> | 75 <body onload="runNextTest()"> |
| 87 <div id="parent"></div> | 76 <div id="parent"></div> |
| 88 <p>Test 'muted' content attribute<p> | 77 <p>Test 'muted' content attribute<p> |
| 89 </body> | 78 </body> |
| 90 </html> | 79 </html> |
| OLD | NEW |