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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/images/onload-event-when-reloading-image-after-interrupted-broken-image-load.html

Issue 2246303003: Use testharness.js instead of js-test.js in fast/images. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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> 1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script> 2 <title>crbug.com/469678: We should fire an image load event even if the image is the last one we loaded successfully. In this test we load an image. Then we mak e a request for a broken image which doesn't get the chance to complete before w e attempt to load the same image again.</title>
fs 2016/08/16 10:54:59 I'd suggest trying to make <title> contain a summa
sivag 2016/08/16 13:44:03 Done.
3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script>
3 <script> 5 <script>
4 if (window.testRunner) { 6 async_test(function(t) {
5 testRunner.waitUntilDone(); 7 var img = new Image();
6 testRunner.dumpAsText();
7 }
8 img = new Image();
9 var onloadCounter = 0; 8 var onloadCounter = 0;
fs 2016/08/16 10:54:59 We could probably get rid of this and instead rese
sivag 2016/08/16 13:44:03 Done.
10 var testImage = 'resources/green.jpg'; 9 var testImage = 'resources/green.jpg';
11 var resetImage = 'resources/bad-png.png'; 10 var resetImage = 'resources/bad-png.png';
12 img.onload = function(){ 11 img.src= resetImage;
fs 2016/08/16 10:54:59 Nit: Space before =
sivag 2016/08/16 13:44:02 Done.
12 img.src = testImage;
13 img.onload = t.step_func(function() {
13 onloadCounter++; 14 onloadCounter++;
14 debug("Image onload event fired for " + img.src.substring(img.src.lastIn dexOf('/') + 1));
15 if (onloadCounter == 2) { 15 if (onloadCounter == 2) {
16 document.getElementById('result').textContent = "PASS"; 16 t.done();
17 if (window.testRunner)
18 testRunner.notifyDone();
19 return; 17 return;
20 } 18 }
21 if (onloadCounter == 1) { 19 if (onloadCounter == 1) {
22 setTimeout(function() { 20 img.src= resetImage;
fs 2016/08/16 10:54:59 Nit: Space before =
sivag 2016/08/16 13:44:03 Done.
23 img.src= resetImage; 21 img.src = testImage;
24 img.src = testImage;
25 }, 0);
26 return; 22 return;
27 } 23 }
28 document.getElementById('result').textContent = "FAIL"; 24 });
29 }; 25 });
30 setTimeout(function() {
31 img.src= resetImage;
32 img.src = testImage;
33 }, 0);
34 </script> 26 </script>
35 <div id="console"> 27
fs 2016/08/16 10:54:59 Nit: Drop blank line
sivag 2016/08/16 13:44:03 Done.
36 crbug.com/469678: We should fire an image load event even if the image is the la st one we loaded successfully.<br>
37 In this test we load an image. Then we make a request for a broken image which d oesn't get the chance to complete before we attempt to load the same image again .<br>
38 </div>
39 <div id="result">FAIL</div>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698