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

Side by Side 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE html>
2 <html> 2 <title>Test that when images are moved to a new document, a new load fires.</tit le>
3 <head> 3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/testharnessreport.js"></script>
5 </head>
6 <body> 5 <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.
7 <script src="script-tests/move-image-to-new-document.js"></script> 6 <iframe></iframe>
8 </body> 7 <script type="text/javascript">
9 </html> 8 async_test(function(t) {
9 if (window.testRunner)
10 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.
11 var subframe = document.querySelector("iframe");
12 var subdocument = subframe.contentDocument;
13 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.
14 var i = 0;
15 var element;
16 function testNextType() {
17 if (i >= types.length) {
18 document.body.removeChild(subframe);
19 t.done();
20 return;
21 }
22 var type = types[i++];
23 element = document.createElement(type);
24 if (type == "input")
25 element.type = "image";
26 element.data = "resources/test-load.jpg";
27 element.src = "resources/test-load.jpg";
28 document.body.appendChild(element);
29 element.onload = t.step_func(function() {
30 document.body.removeChild(element);
31 subdocument.body.appendChild(element);
32 element.onload = t.step_func(function() {
33 subdocument.body.removeChild(element);
34 testNextType();
35 });
36 });
37 }
38 testNextType();
39 });
40 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698