Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Unified Diff: third_party/WebKit/LayoutTests/fast/images/move-image-to-new-document.html

Issue 2255213002: Use testharness.js to test move image to new document. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unnecessary append. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/images/move-image-to-new-document.html
diff --git a/third_party/WebKit/LayoutTests/fast/images/move-image-to-new-document.html b/third_party/WebKit/LayoutTests/fast/images/move-image-to-new-document.html
index 2ea24e5098fe1eb3b3fd0377619906c253f1927d..f1f092632690bc6b79f94cf8840c26408b540467 100644
--- a/third_party/WebKit/LayoutTests/fast/images/move-image-to-new-document.html
+++ b/third_party/WebKit/LayoutTests/fast/images/move-image-to-new-document.html
@@ -1,9 +1,40 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src="../../resources/js-test.js"></script>
-</head>
+<!DOCTYPE html>
+<title>Test that when images are moved to a new document, a new load fires.</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
<body>
fs 2016/08/18 14:31:46 Don't need this (should be created by <iframe> I t
sivag 2016/08/19 07:26:05 Done.
-<script src="script-tests/move-image-to-new-document.js"></script>
-</body>
-</html>
+<iframe></iframe>
+<script type="text/javascript">
+async_test(function(t) {
+ if (window.testRunner)
+ testRunner.setPluginsEnabled(false);
fs 2016/08/18 14:31:46 Move this out of the test body.
sivag 2016/08/19 07:26:05 Done.
+ var subframe = document.querySelector("iframe");
+ var subdocument = subframe.contentDocument;
+ var types = [ "img", "input", "object", "embed" ];
fs 2016/08/18 14:31:46 It'd probably be easier to have one test per type,
sivag 2016/08/19 07:26:05 Done.
+ var i = 0;
+ var element;
+ function testNextType() {
+ if (i >= types.length) {
+ document.body.removeChild(subframe);
+ t.done();
+ return;
+ }
+ var type = types[i++];
+ element = document.createElement(type);
+ if (type == "input")
+ element.type = "image";
+ element.data = "resources/test-load.jpg";
+ element.src = "resources/test-load.jpg";
+ document.body.appendChild(element);
+ element.onload = t.step_func(function() {
+ document.body.removeChild(element);
+ subdocument.body.appendChild(element);
+ element.onload = t.step_func(function() {
+ subdocument.body.removeChild(element);
+ testNextType();
+ });
+ });
+ }
+ testNextType();
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698