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

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: Comment 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..97e2f46a42b251ffc0723a5e73529a238348f954
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/images/force-reload-image-document.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script>
+// This tests ImageLoader/ImageDocument implementation in Blink.
+var t = async_test("ForceReload should not crash 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];
+
+ img.onload = t.step_func_done(function() {
+ // TODO(hiroshige): Check that the image is actually reloaded.
+ // We need an URL that returns different non-SVG images for each reload.
kouhei (in TOK) 2017/05/11 16:50:52 fix todo?
hiroshige 2017/05/11 17:11:44 Hmm. One way to do this is to have .cgi page (or .
kouhei (in TOK) 2017/05/11 17:30:14 I see. I don't see a super clean way to do this. M
hiroshige 2017/05/11 18:12:15 This test is necessary to confirm there's no crash
+ });
+
+ 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="../resources/square100.png"></iframe>
+</body>

Powered by Google App Engine
This is Rietveld 408576698