Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / images / image-currentsrc-load.html
blobb5742db2c7d9268736edc87b33ffe54a676f715d
1 <!DOCTYPE html>
2 <script src="/js-test-resources/js-test.js"></script>
3 <body>
4 <script>
5 document.body.innerHTML += '<img id="load" src="http://127.0.0.1:8000/resources/slow-image-dimensions.php?name=square100.png&mimeType=image/png&sleep=100">';
6 jsTestIsAsync = true;
7 var img = window.document.getElementById("load");
8 shouldBe('img.currentSrc', '""');
9 shouldBe('img.width', '0');
10 var interval = setInterval(function() {
11 if (img.width != 0) {
12 shouldBe('img.currentSrc', '"http://127.0.0.1:8000/resources/slow-image-dimensions.php?name=square100.png&mimeType=image/png&sleep=100"');
13 shouldBe('img.width', '100');
14 clearInterval(interval);
15 img.src = "http://127.0.0.1:8000/resources/slow-image-dimensions.php?name=square200.png&mimeType=image/png&sleep=100";
16 shouldBe('img.currentSrc', '"http://127.0.0.1:8000/resources/slow-image-dimensions.php?name=square100.png&mimeType=image/png&sleep=100"');
17 shouldBe('img.width', '100');
18 var interval2 = setInterval(function() {
19 if (img.width != 100) {
20 shouldBe('img.currentSrc', '"http://127.0.0.1:8000/resources/slow-image-dimensions.php?name=square200.png&mimeType=image/png&sleep=100"');
21 shouldBe('img.width', '200');
22 clearInterval(interval2);
23 setTimeout(finishJSTest, 100);
25 }, 10);
27 }, 10);
28 </script>
29 </body>