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

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/image-decodes/image-decode-path-changes.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-path-changes.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/image-decodes/image-decode-path-changes.html b/third_party/WebKit/LayoutTests/external/wpt/image-decodes/image-decode-path-changes.html
new file mode 100644
index 0000000000000000000000000000000000000000..6082c4b148e0022faca593ff4c5fefba55407456
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/image-decodes/image-decode-path-changes.html
@@ -0,0 +1,112 @@
+<!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>
+
+<script>
+"use strict";
+
+// src tests
+// -------------------
+promise_test(function(t) {
+ var img = new Image();
+ img.src = "/images/green.png";
+ var promise = img.decode();
+ img.src = "/images/green.svg";
+ return promise_rejects(t, "EncodingError", promise);
+}, "(src) Path changes fail decode.");
+
+promise_test(function(t) {
+ var img = new Image();
+ img.src = "/images/green.png";
+ var first_promise = img.decode();
+ img.src = "/images/green.svg";
+ var second_promise = img.decode();
+ assert_true(first_promise !== second_promise);
+ return Promise.all([
+ promise_rejects(t, "EncodingError", first_promise),
+ second_promise
+ ]);
+}, "(src) Path changes fail decode; following good decode succeeds.");
+
+promise_test(function(t) {
+ var img = new Image();
+ img.src = "/images/green.png";
+ var first_promise = img.decode();
+ img.src = "/non/existent/path.png";
+ var second_promise = img.decode();
+ assert_true(first_promise !== second_promise);
+ return Promise.all([
+ promise_rejects(t, "EncodingError", first_promise),
+ promise_rejects(t, "EncodingError", second_promise)
+ ]);
+}, "(src) Path changes fail decode; following bad decode fails.");
+
+promise_test(function() {
+ var img = new Image();
+ img.src = "/images/green.png";
+ var first_promise = img.decode();
+ img.src = "/images/green.png";
+ var second_promise = img.decode();
+ assert_true(first_promise !== second_promise);
+ return Promise.all([
+ first_promise,
+ second_promise
+ ]);
+}, "(src) Path changes to the same path succeed.");
+
+// srcset tests
+// -------------------
+promise_test(function(t) {
+ var img = new Image();
+ img.srcset = "/images/green.png 100w";
+ var promise = img.decode();
+ img.srcset = "/images/green.svg 100w";
+ return promise_rejects(t, "EncodingError", promise);
+}, "(srcset) Path changes fail decode.");
+
+promise_test(function(t) {
+ var img = new Image();
+ img.srcset = "/images/green.png 100w";
+ var first_promise = img.decode();
+ img.srcset = "/images/green.svg 100w";
+ var second_promise = img.decode();
+ assert_true(first_promise !== second_promise);
+ return Promise.all([
+ promise_rejects(t, "EncodingError", first_promise),
+ second_promise
+ ]);
+}, "(srcset) Path changes fail decode; following good decode succeeds.");
+
+promise_test(function(t) {
+ var img = new Image();
+ img.srcset = "/images/green.png 100w";
+ var first_promise = img.decode();
+ img.srcset = "/non/existent/path.png 100w";
+ var second_promise = img.decode();
+ assert_true(first_promise !== second_promise);
+ return Promise.all([
+ promise_rejects(t, "EncodingError", first_promise),
+ promise_rejects(t, "EncodingError", second_promise)
+ ]);
+}, "(srcset) Path changes fail decode; following bad decode fails.");
+
+promise_test(function() {
+ var img = new Image();
+ img.srcset = "/images/green.png 100w";
+ var first_promise = img.decode();
+ img.srcset = "/images/green.png 100w";
+ var second_promise = img.decode();
+ assert_true(first_promise !== second_promise);
+ return Promise.all([
+ first_promise,
+ second_promise
+ ]);
+}, "(srcset) Path changes to the same path succeed.");
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698