|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <head> |
|
4 <title>Media test: document-element-inserted</title> |
|
5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
7 </head> |
|
8 <body> |
|
9 <iframe id = 'media'> |
|
10 </iframe> |
|
11 <pre id="test"> |
|
12 <script class="testbody" type="text/javascript"> |
|
13 |
|
14 if (navigator.platform.startsWith("Win")) { |
|
15 SimpleTest.expectAssertions(0, 4); |
|
16 } |
|
17 |
|
18 SimpleTest.waitForExplicitFinish(); |
|
19 var loc; |
|
20 |
|
21 var observe = function(doc){ |
|
22 if (doc == media.contentDocument) { |
|
23 ok(media.contentDocument.location.toString().indexOf(loc) != -1, |
|
24 "The loaded media should be " + loc); |
|
25 next(); |
|
26 } |
|
27 } |
|
28 |
|
29 var media = document.getElementById('media'); |
|
30 var tests = [ |
|
31 "../../../media/test/short-video.ogv", |
|
32 "../../../media/test/sound.ogg", |
|
33 "../../content/test/image.png" |
|
34 ] |
|
35 |
|
36 function next() { |
|
37 if (tests.length > 0) { |
|
38 var t = tests.shift(); |
|
39 loc = t.substring(t.indexOf("test")); |
|
40 media.setAttribute("src",t); |
|
41 } |
|
42 else { |
|
43 SpecialPowers.removeObserver(observe, "document-element-inserted"); |
|
44 SimpleTest.finish(); |
|
45 } |
|
46 } |
|
47 |
|
48 SpecialPowers.addObserver(observe, "document-element-inserted", false) |
|
49 next(); |
|
50 |
|
51 </script> |
|
52 </pre> |
|
53 </body> |
|
54 </html> |