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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/loading/onload/resources/onload-test.js

Issue 1833303002: [Not committed] Make image load completion async and remove EventSender from ImageLoader (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Loader_asyncImageLoadEvent_1
Patch Set: Rebase. Created 4 years, 8 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
(Empty)
1 jsTestIsAsync = true;
2
3 var imgOnLoadCalled = false;
4 var img2OnLoadCalled = false;
5 var bodyOnLoadCalled = false;
6
7 var img = document.createElement('img');
8 var img2 = document.createElement('img');
9
10 img.onload = imgOnLoad;
11 img.src = url;
12 document.body.appendChild(img);
13 shouldBeFalse("bodyOnLoadCalled");
14 shouldBeFalse("imgOnLoadCalled");
15 shouldBeFalse("img.complete");
16
17 function imgOnLoad() {
18 imgOnLoadCalled = true;
19 debug("img's onload");
20
21 shouldBeFalse("bodyOnLoadCalled");
22 shouldBeTrue("imgOnLoadCalled");
23 shouldBeTrue("img.complete");
24
25 img2.onload = img2OnLoad;
26 img2.src = url;
27 document.body.appendChild(img2);
28 shouldBeFalse("bodyOnLoadCalled");
29 shouldBeFalse("img2OnLoadCalled");
30 shouldBeFalse("img2.complete");
31 }
32
33 function img2OnLoad() {
34 img2OnLoadCalled = true;
35 debug("img2's onload");
36
37 shouldBeFalse("bodyOnLoadCalled");
38 shouldBeTrue("img2OnLoadCalled");
39 shouldBeTrue("img2.complete");
40 }
41
42 function bodyOnLoad() {
43 bodyOnLoadCalled = true;
44 debug("body's onload");
45 shouldBeTrue("imgOnLoadCalled");
46 shouldBeTrue("img.complete");
47 shouldBeTrue("img2OnLoadCalled");
48 shouldBeTrue("img2.complete");
49 finishJSTest();
50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698