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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/images/script-tests/move-image-to-new-document.js

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: Corrected indentation. 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/images/script-tests/TEMPLATE.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 description("Test that when images are moved to a new document, a new load fires .");
2
3 if (window.testRunner)
4 testRunner.setPluginsEnabled(false);
5
6 jsTestIsAsync = true;
7
8 var subframe = document.createElement("iframe");
9 document.body.appendChild(subframe);
10 var subdocument = subframe.contentDocument;
11
12 var types = [ "img", "input", "object", "embed" ];
13 var i = 0;
14 var element;
15
16 function imageLoadedInSecondDocument()
17 {
18 element.removeEventListener("load", imageLoadedInSecondDocument, false);
19 testPassed("Load event fired for " + element.tagName + " in both documents." );
20 subdocument.body.removeChild(element);
21 testNextType();
22 }
23
24 function imageLoadedInFirstDocument()
25 {
26 element.removeEventListener("load", imageLoadedInFirstDocument, false);
27 document.body.removeChild(element);
28 subdocument.body.appendChild(element);
29 element.addEventListener("load", imageLoadedInSecondDocument, false);
30 }
31
32 function testNextType()
33 {
34 if (i >= types.length) {
35 document.body.removeChild(subframe);
36 finishJSTest();
37 return;
38 }
39 var type = types[i++];
40 element = document.createElement(type);
41 if (type == "input")
42 element.type = "image";
43 element.data = "resources/test-load.jpg";
44 element.src = "resources/test-load.jpg";
45 document.body.appendChild(element);
46 element.addEventListener("load", imageLoadedInFirstDocument, false);
47 }
48
49 testNextType();
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/images/script-tests/TEMPLATE.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698