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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/images/force-reload-image-document.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-image-document.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/images/force-reload-image-document.html b/third_party/WebKit/LayoutTests/http/tests/images/force-reload-image-document.html
new file mode 100644
index 0000000000000000000000000000000000000000..37ee2748f911ec471bef4ec653e8f669472fe71c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/images/force-reload-image-document.html
@@ -0,0 +1,29 @@
+<!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 image document");
+
+function triggerReload() {
+ // This depends on how image documents are implemented by Blink.
+ var iframe = document.getElementById('iframe');
+ var img = iframe.contentDocument.body.getElementsByTagName('img')[0];
+ 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)">
+<iframe id="iframe" src="../cache/resources/random-cached-image.php?id=2"></iframe>
+</body>

Powered by Google App Engine
This is Rietveld 408576698