| OLD | NEW |
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Audio element src attribute must match src list - negative test</titl
e> | 4 <title>Audio element src attribute must match src list - negative test</titl
e> |
| 5 <meta name=timeout content=long> | 5 <meta name=timeout content=long> |
| 6 <script src='/resources/testharness.js'></script> | 6 <script src='/resources/testharness.js'></script> |
| 7 <script src='/resources/testharnessreport.js'></script> | 7 <script src='/resources/testharnessreport.js'></script> |
| 8 </head> | 8 </head> |
| 9 <body> | 9 <body> |
| 10 <h1>Audio element src attribute must match src list - negative test</h1> | 10 <h1>Audio element src attribute must match src list - negative test</h1> |
| 11 <div id='log'></div> | 11 <div id='log'></div> |
| 12 | 12 |
| 13 <script> | 13 <script> |
| 14 var src_test = async_test("Disallaowed audio src"); | 14 var src_test = async_test("Disallaowed audio src"); |
| 15 var source_test = async_test("Disallowed audio source element"); | 15 var source_test = async_test("Disallowed audio source element"); |
| 16 | 16 |
| 17 // we assume tests are run from 'hostname' and 'www.hostname' or 'www2.hos
tname' is a valid alias | 17 // we assume tests are run from 'hostname' and 'www.hostname' or 'www2.hos
tname' is a valid alias |
| 18 var mediaURL = location.protocol + | 18 var mediaURL = location.protocol + "//{{domains[www2]}}:{{ports[http][0]}}
/media/sound_5.oga"; |
| 19 "//www2." + | |
| 20 location.hostname + | |
| 21 ":" + | |
| 22 location.port + | |
| 23 "/media/sound_5.mp3"; | |
| 24 | 19 |
| 25 function media_loaded(t) { | 20 function media_loaded(t) { |
| 26 t.step( function () { | 21 t.step( function () { |
| 27 assert_unreached("Media error handler should be triggered for non-allo
wed domain."); | 22 assert_unreached("Media error handler should be triggered for non-allo
wed domain."); |
| 28 }); | 23 }); |
| 29 t.done(); | 24 t.done(); |
| 30 } | 25 } |
| 31 | 26 |
| 32 function media_error_handler(t) { | 27 function media_error_handler(t) { |
| 33 t.done(); | 28 t.done(); |
| 34 } | 29 } |
| 35 </script> | 30 </script> |
| 36 | 31 |
| 37 <audio id="audioObject" width="320" height="240" controls | 32 <audio id="audioObject" width="320" height="240" controls |
| 38 onloadeddata="media_loaded(source_test)"> | 33 onloadeddata="media_loaded(source_test)"> |
| 39 <source id="audioSourceObject" | 34 <source id="audioSourceObject" |
| 40 type="audio/mpeg" | 35 type="audio/ogg" |
| 41 onerror="media_error_handler(source_test)"> | 36 onerror="media_error_handler(source_test)"> |
| 42 </audio> | 37 </audio> |
| 43 <audio id="audioObject2" width="320" height="240" controls | 38 <audio id="audioObject2" width="320" height="240" controls |
| 44 onerror="media_error_handler(src_test)" | 39 onerror="media_error_handler(src_test)" |
| 45 onloadeddata="media_loaded(src_test)"> | 40 onloadeddata="media_loaded(src_test)"> |
| 46 | 41 |
| 47 <script> | 42 <script> |
| 48 document.getElementById("audioSourceObject").src = mediaURL; | 43 document.getElementById("audioSourceObject").src = mediaURL; |
| 49 document.getElementById("audioObject2").src = mediaURL; | 44 document.getElementById("audioObject2").src = mediaURL; |
| 50 </script> | 45 </script> |
| 51 | 46 |
| 52 <script async defer src='../support/checkReport.sub.js?reportField=violated-
directive&reportValue=media-src%20%27self%27'></script> | 47 <script async defer src='../support/checkReport.sub.js?reportField=violated-
directive&reportValue=media-src%20%27self%27'></script> |
| 53 | 48 |
| 54 </body> | 49 </body> |
| 55 </html> | 50 </html> |
| OLD | NEW |