Index: third_party/WebKit/LayoutTests/http/tests/media/video-in-iframe-crash.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-in-iframe-crash.html b/third_party/WebKit/LayoutTests/http/tests/media/video-in-iframe-crash.html |
index bd53d42e4afac26abc81d46278b5a1bd419760e8..fd852b1120ae2cfddc7fb33040cf7eb3ed2afa33 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/media/video-in-iframe-crash.html |
+++ b/third_party/WebKit/LayoutTests/http/tests/media/video-in-iframe-crash.html |
@@ -1,64 +1,43 @@ |
-<!doctype html> |
-<html> |
- <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 |
- (Please avoid writing new tests using video-test.js) --> |
- <script src="../../media-resources/video-test.js"></script> |
- <script> |
- function getNextURL() |
- { |
- var url = location.href; |
- var queryIndex = url.indexOf("?"); |
- var loadCount = 1; |
- if (queryIndex >= 0) { |
- loadCount = parseInt(url.substring(queryIndex + 1)); |
- |
- // Enforce an arbitrary reload limit that is high enough to trigger previosly observed crashes. |
- if (loadCount >= 10) |
- return ""; |
- |
- url = url.substring(0, queryIndex); |
- } |
- |
- return url + "?" + (loadCount + 1); |
- } |
- |
- function reloadPage() |
- { |
- var url = getNextURL(); |
- if (url.length == 0) { |
- endTest(); |
+<!DOCTYPE html> |
+<title>Tests that moving a "video" in and out of an "iframe" does not trigger a crash.</title> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+<body> |
+<div></div> |
+<video></video> |
+<script> |
+async_test(function(t) { |
+ var iframe = document.createElement("iframe"); |
+ iframe.src = "../../media-resources/resources/frame_size_change.webm"; |
+ document.querySelector("div").appendChild(iframe); |
+ |
+ setTimeout(t.step_func(function() { |
Srirama
2016/07/26 13:29:30
Thought of using iframe.onload but then looking at
|
+ var iframeContentDocument = iframe.contentDocument; |
+ var iframeDocumentElement = iframeContentDocument.documentElement; |
+ |
+ iframeContentDocument.onreadystatechange = function() { |
+ // Attempts to move the document body back into the iframe document. |
+ iframeContentDocument.appendChild(iframeDocumentElement); |
+ }; |
+ |
+ // Moves the iframe body into the current document. |
+ document.body.appendChild(iframeContentDocument.firstChild); |
+ // Reload page. |
+ var url = location.href; |
+ var loadCount = 1; |
+ var queryIndex = url.indexOf("?"); |
+ if (queryIndex >= 0) { |
+ loadCount = parseInt(url.substring(queryIndex + 1)); |
+ // Enforce an arbitrary reload limit that is high enough to trigger previosly observed crashes. |
+ if (loadCount >= 10) { |
+ t.done(); |
return; |
} |
- location.href = url; |
- } |
- |
- function start() |
- { |
- iframe = document.createElement("iframe"); |
- iframe.src = "../../media-resources/resources/frame_size_change.webm"; |
- document.getElementById("store_div").appendChild(iframe); |
- window.setTimeout(moveIframeBodyIntoDocumentBody, 20); |
- } |
- |
- function moveIframeBodyIntoDocumentBody() |
- { |
- var iframeContentDocument = iframe.contentDocument; |
- var iframeDocumentElement = iframeContentDocument.documentElement; |
- |
- iframeContentDocument.onreadystatechange = function(e) |
- { |
- // Attempts to move the document body back into the iframe document. |
- iframeContentDocument.appendChild(iframeDocumentElement); |
- } |
- // Moves the iframe body into the current document. |
- document.body.appendChild(iframeContentDocument.firstChild); |
- reloadPage(); |
+ url = url.substring(0, queryIndex); |
} |
- </script> |
- <body onload="start()"> |
- <p>Tests that moving a <video> in and out of an iframe does not trigger a crash.</p> |
- <div id="store_div"></div> |
- </body> |
-</html> |
+ location.href = url + "?" + (loadCount + 1); |
+ }), 20); |
+}); |
+</script> |