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

Unified Diff: third_party/WebKit/LayoutTests/fast/images/onload-event-when-reloading-image-after-interrupted-null-src-load.html

Issue 2251413002: Use testharness.js in image load tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comments. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/images/onload-event-when-reloading-image-after-interrupted-null-src-load-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/images/onload-event-when-reloading-image-after-interrupted-null-src-load.html
diff --git a/third_party/WebKit/LayoutTests/fast/images/onload-event-when-reloading-image-after-interrupted-null-src-load.html b/third_party/WebKit/LayoutTests/fast/images/onload-event-when-reloading-image-after-interrupted-null-src-load.html
index 9b8b9f89b1b50211ff0a1df313a76d7ed08a323b..3a78a3b3d0e1138a04ee5db6bd59c75da7838f8a 100644
--- a/third_party/WebKit/LayoutTests/fast/images/onload-event-when-reloading-image-after-interrupted-null-src-load.html
+++ b/third_party/WebKit/LayoutTests/fast/images/onload-event-when-reloading-image-after-interrupted-null-src-load.html
@@ -1,39 +1,20 @@
<!DOCTYPE html>
-<script src="../../resources/js-test.js"></script>
+<title>crbug.com/469678: We should fire an image load event even if the image is the last one we loaded successfully.</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
<script>
- if (window.testRunner) {
- testRunner.waitUntilDone();
- testRunner.dumpAsText();
- }
- img = new Image();
- var onloadCounter = 0;
+async_test(function(t) {
+ var img = new Image();
var testImage = 'resources/green.jpg';
var resetImage = '';
- img.onload = function(){
- onloadCounter++;
- debug("Image onload event fired for " + img.src.substring(img.src.lastIndexOf('/') + 1));
- if (onloadCounter == 2) {
- document.getElementById('result').textContent = "PASS";
- if (window.testRunner)
- testRunner.notifyDone();
- return;
- }
- if (onloadCounter == 1) {
- setTimeout(function() {
- img.src= resetImage;
- img.src = testImage;
- }, 0);
- return;
- }
- document.getElementById('result').textContent = "FAIL";
- };
- setTimeout(function() {
- img.src= resetImage;
+ // In this test we load an image. Then we make a null request (img.src='')
+ // which should clear down the image before we attempt to load the same image again.
+ img.onload = t.step_func(function() {
+ img.src = resetImage;
img.src = testImage;
- }, 0);
+ img.onload = t.step_func_done();
+ });
+ img.src = resetImage;
+ img.src = testImage;
+});
</script>
-<div id="console">
-crbug.com/469678: We should fire an image load event even if the image is the last one we loaded successfully.<br>
-In this test we load an image. Then we make a null request (img.src='') which should clear down the image before we attempt to load the same image again.<br>
-</div>
-<div id="result">FAIL</div>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/images/onload-event-when-reloading-image-after-interrupted-null-src-load-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698