| Index: third_party/WebKit/LayoutTests/http/tests/loading/onload/resources/onload-test.js
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/onload/resources/onload-test.js b/third_party/WebKit/LayoutTests/http/tests/loading/onload/resources/onload-test.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0d2438c01b9c7f7b725aca9c3eb610b7f2ee9d03
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/loading/onload/resources/onload-test.js
|
| @@ -0,0 +1,50 @@
|
| +jsTestIsAsync = true;
|
| +
|
| +var imgOnLoadCalled = false;
|
| +var img2OnLoadCalled = false;
|
| +var bodyOnLoadCalled = false;
|
| +
|
| +var img = document.createElement('img');
|
| +var img2 = document.createElement('img');
|
| +
|
| +img.onload = imgOnLoad;
|
| +img.src = url;
|
| +document.body.appendChild(img);
|
| +shouldBeFalse("bodyOnLoadCalled");
|
| +shouldBeFalse("imgOnLoadCalled");
|
| +shouldBeFalse("img.complete");
|
| +
|
| +function imgOnLoad() {
|
| + imgOnLoadCalled = true;
|
| + debug("img's onload");
|
| +
|
| + shouldBeFalse("bodyOnLoadCalled");
|
| + shouldBeTrue("imgOnLoadCalled");
|
| + shouldBeTrue("img.complete");
|
| +
|
| + img2.onload = img2OnLoad;
|
| + img2.src = url;
|
| + document.body.appendChild(img2);
|
| + shouldBeFalse("bodyOnLoadCalled");
|
| + shouldBeFalse("img2OnLoadCalled");
|
| + shouldBeFalse("img2.complete");
|
| +}
|
| +
|
| +function img2OnLoad() {
|
| + img2OnLoadCalled = true;
|
| + debug("img2's onload");
|
| +
|
| + shouldBeFalse("bodyOnLoadCalled");
|
| + shouldBeTrue("img2OnLoadCalled");
|
| + shouldBeTrue("img2.complete");
|
| +}
|
| +
|
| +function bodyOnLoad() {
|
| + bodyOnLoadCalled = true;
|
| + debug("body's onload");
|
| + shouldBeTrue("imgOnLoadCalled");
|
| + shouldBeTrue("img.complete");
|
| + shouldBeTrue("img2OnLoadCalled");
|
| + shouldBeTrue("img2.complete");
|
| + finishJSTest();
|
| +}
|
|
|