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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/images/force-reload.html

Issue 2874073003: Add layout tests for ImageLoader::UpdateFromElement(kUpdateForcedReload) (Closed)
Patch Set: fix Created 3 years, 7 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
Index: third_party/WebKit/LayoutTests/http/tests/images/force-reload.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/images/force-reload.html b/third_party/WebKit/LayoutTests/http/tests/images/force-reload.html
new file mode 100644
index 0000000000000000000000000000000000000000..ce495d326cc05c6b820aae1cff0ef127d529fa8a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/images/force-reload.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script>
+var t = async_test("ForceReload should get a new image for an <img> element");
+function triggerReload() {
+ var img = document.getElementById('img');
+ var originalWidth = img.width;
+ var originalHeight = img.height;
+
+ img.onload = t.step_func_done(function() {
+ assert_not_equals(originalWidth, img.width, "Should be reloaded: width");
+ assert_not_equals(originalHeight, img.height, "Should be reloaded: height");
+ });
+
yhirano 2017/05/12 10:30:43 +img.onerror
hiroshige 2017/05/12 17:14:51 Done.
+ if (window.internals) {
+ internals.forceImageReload(img);
+ }
+}
+</script>
+
+<!-- We call triggerReload() strictly after document load event,
+because reloading is not enforced until document load event is finished. -->
+<body onload="setTimeout(t.step_func(triggerReload), 0)">
+<img id="img" src="../cache/resources/random-cached-image.php?id=1">
yhirano 2017/05/12 10:30:43 [optional] I think using the test name as id is sa
hiroshige 2017/05/12 17:14:51 Done.
+</body>

Powered by Google App Engine
This is Rietveld 408576698