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

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/image-decodes/image-decode-iframe.html

Issue 2769823002: Add decode() functionality to image elements. (Closed)
Patch Set: rebase 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/external/wpt/image-decodes/image-decode-iframe.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/image-decodes/image-decode-iframe.html b/third_party/WebKit/LayoutTests/external/wpt/image-decodes/image-decode-iframe.html
new file mode 100644
index 0000000000000000000000000000000000000000..e64ea98afeb70b181c9d8993902ee2c72dac5570
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/image-decodes/image-decode-iframe.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>img.decode()</title>
+<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
+<link rel=help href="">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+
+<iframe id="frame_loaded" srcdoc="iframe"></iframe>
+<iframe id="frame_notloaded" srcdoc="iframe"></iframe>
+<iframe id="frame_notloaded2" srcdoc="iframe"></iframe>
+
+<script>
+"use strict";
+
+promise_test(function() {
+ return new Promise(function(resolve, reject) {
+ var frame = document.getElementById("frame_loaded");
+ var img = frame.contentDocument.createElement("img");
+ img.src = "/images/green.png";
+ img.onload = function() {
+ // At this point the frame which created the img is removed, so decode() should fail.
+ frame.parentNode.removeChild(frame);
+ img.decode().then(function() {
+ assert_false(true, "Unexpected success");
+ }, function() {
+ resolve();
+ });
+ };
+ });
+}, "(misc) Decode from removed iframe fails (loaded img)");
+
+promise_test(function(t) {
+ var frame = document.getElementById("frame_notloaded");
+ var img = frame.contentDocument.createElement("img");
+ img.src = "/images/green.png";
+ frame.parentNode.removeChild(frame);
+ var promise = img.decode();
+ return promise_rejects(t, "EncodingError", promise);
+}, "(misc) Decode from removed iframe fails (img not loaded)");
+
+promise_test(function(t) {
+ var frame = document.getElementById("frame_notloaded2");
+ var img = frame.contentDocument.createElement("img");
+ img.src = "/images/green.png";
+ // First request a promise, then remove the iframe.
+ var promise = img.decode();
+ frame.parentNode.removeChild(frame);
+ return promise_rejects(t, "EncodingError", promise);
+}, "(misc) Decode from iframe, later removed, fails (img not loaded)");
+
+</script>
+

Powered by Google App Engine
This is Rietveld 408576698