| OLD | NEW |
| 1 <html> | 1 <!DOCTYPE html> |
| 2 <head> | 2 <title>Cancel loading a video file and access its properties afterwards.</title> |
| 3 <title>Cancel loading a video file and access its properties afterwards.</titl
e> | 3 <script src="../../media-resources/media-file.js"></script> |
| 4 </head> | 4 <video></video> |
| 5 <body> | |
| 6 Access a video element with resource loading canceled. | |
| 7 If this test is successful it will terminate with a blank page. | |
| 8 This test should finish without crashing. | |
| 9 | 5 |
| 10 <script src=../../media-resources/media-file.js></script> | 6 <textarea style="display: none;"> |
| 11 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 7 <!-- Begin child content --> |
| 12 (Please avoid writing new tests using video-test.js) --> | 8 <!-- The following section contains the content in the document of child window.
--> |
| 13 <script src=../../media-resources/video-test.js></script> | 9 <script> |
| 14 <video controls id="video"></video> | 10 var video = window.opener.video; |
| 11 window.setTimeout(function() { |
| 12 var d = video.duration; |
| 13 testRunner.notifyDone(); |
| 14 }, 50); |
| 15 window.opener.blank(); |
| 16 </script> |
| 17 <!-- End child content --> |
| 18 </textarea> |
| 15 | 19 |
| 16 <textarea id="child_content" style="display: none;"> | 20 <script> |
| 17 <!-- Begin child content --> | 21 // Access a video element with resource loading canceled. |
| 18 <!-- The following section contains the content in the document of child windo
w. --> | 22 // If this test is successful it will terminate with a blank page. |
| 19 <script> | 23 // This test should finish without crashing. |
| 20 var video = window.opener.video; | 24 testRunner.setCanOpenWindows(); |
| 21 window.setTimeout(function () { | 25 testRunner.dumpAsText(); |
| 22 var d = video.duration; | |
| 23 if (window.testRunner) | |
| 24 testRunner.notifyDone(); | |
| 25 }, 50); | |
| 26 window.opener.blank(); | |
| 27 </script> | |
| 28 <!-- End child content --> | |
| 29 </textarea> | |
| 30 | 26 |
| 31 <script> | 27 var video = document.querySelector("video"); |
| 32 if (window.testRunner) { | |
| 33 testRunner.setCanOpenWindows(); | |
| 34 } | |
| 35 | 28 |
| 36 var video = document.getElementById("video"); | 29 // Opens a window and writes the child content into the document. |
| 37 var file = findMediaFile("video", "../resources/test"); | 30 video.onloadedmetadata = function() { |
| 31 var win = window.open("", "child"); |
| 32 var doc = win.document; |
| 33 doc.open(); |
| 34 doc.write(document.querySelector("textarea").value); |
| 35 doc.close(); |
| 36 }; |
| 38 | 37 |
| 39 // Opens a window and writes the child content into the document. | 38 var file = findMediaFile("video", "../resources/test"); |
| 40 video.addEventListener("loadedmetadata", function main() | 39 video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?throttle=40&na
me=" + file; |
| 41 { | |
| 42 var win = window.open("", "child"); | |
| 43 var doc = win.document; | |
| 44 doc.open(); | |
| 45 doc.write(document.getElementById("child_content").value); | |
| 46 doc.close(); | |
| 47 }); | |
| 48 video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?throttle=40&
name=" + file; | |
| 49 | 40 |
| 50 // Change URL of the current page to a blank page. | 41 // Change URL of the current page to a blank page. |
| 51 function blank() | 42 function blank() { |
| 52 { | 43 location.href = "about:blank"; |
| 53 location.href = "about:blank"; | 44 } |
| 54 } | 45 </script> |
| 55 </script> | |
| 56 </body> | |
| 57 </html> | |
| OLD | NEW |