Bug 1316629 - Migrate dom/html/test/test_img_complete.html to web-platform-test. r=jgraham, a=test-only
authorJoel Maher <jmaher@mozilla.com>
Wed, 16 Nov 2016 09:43:53 -0500
changeset 353496 8f8be75d4cc580e418a4ca50ad0afe75c65f78f3
parent 353495 44bd0aff9b6974277cc78299e3d4b86527bd3a5c
child 353497 be00bf1f7afa8bc7ca262ecda3fcc25f9d71ec98
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgraham, test-only
bugs1316629
milestone52.0a2
Bug 1316629 - Migrate dom/html/test/test_img_complete.html to web-platform-test. r=jgraham, a=test-only MozReview-Commit-ID: 7tyxMzVQ1g2
dom/html/test/mochitest.ini
dom/html/test/test_img_complete.html
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/html/semantics/embedded-content/the-img-element/image.png
testing/web-platform/tests/html/semantics/embedded-content/the-img-element/update-src-complete.html
--- a/dom/html/test/mochitest.ini
+++ b/dom/html/test/mochitest.ini
@@ -577,17 +577,16 @@ support-files = file_cookiemanager.js
 [test_bug765780.html]
 [test_bug871161.html]
 support-files = file_bug871161-1.html file_bug871161-2.html
 [test_bug1013316.html]
 [test_hash_encoded.html]
 [test_bug1081037.html]
 [test_window_open_close.html]
 tags = openwindow
-[test_img_complete.html]
 [test_viewport_resize.html]
 [test_image_clone_load.html]
 [test_bug1203668.html]
 [test_bug1166138.html]
 [test_bug1230665.html]
 [test_filepicker_default_directory.html]
 skip-if = toolkit == 'android'
 [test_bug1233598.html]
deleted file mode 100644
--- a/dom/html/test/test_img_complete.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=608261
--->
-<head>
-  <meta charset="utf-8">
-  <title>Test for Bug 608261</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="application/javascript">
-  /** Test for Bug 608261 **/
-  SimpleTest.waitForExplicitFinish();
-  </script>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=608261">Mozilla Bug 608261</a>
-<p id="display"><img src="image.png"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-  <script type="application/javascript">
-    addLoadEvent(function() {
-      var img = document.querySelector("img");
-      ok(img.complete, "By onload, image should have loaded");
-      img.src = "image.png?cachebust";
-      ok(!img.complete, "Now that we're loading we should no longer be complete");
-      img.onload = function() {
-        ok(img.complete, "The new thing should have loaded.");
-        SimpleTest.finish();
-      }
-    });
-  </script>
-</pre>
-</body>
-</html>
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -20715,16 +20715,20 @@
         "path": "html/semantics/embedded-content/the-img-element/srcset/select-an-image-source.html",
         "url": "/html/semantics/embedded-content/the-img-element/srcset/select-an-image-source.html"
       },
       {
         "path": "html/semantics/embedded-content/the-img-element/update-media.html",
         "url": "/html/semantics/embedded-content/the-img-element/update-media.html"
       },
       {
+        "path": "html/semantics/embedded-content/the-img-element/update-src-complete.html",
+        "url": "/html/semantics/embedded-content/the-img-element/update-src-complete.html"
+      },
+      {
         "path": "html/semantics/embedded-content/the-img-element/update-the-image-data/fail-to-resolve.html",
         "url": "/html/semantics/embedded-content/the-img-element/update-the-image-data/fail-to-resolve.html"
       },
       {
         "path": "html/semantics/embedded-content/the-img-element/update-the-source-set.html",
         "url": "/html/semantics/embedded-content/the-img-element/update-the-source-set.html"
       },
       {
copy from dom/html/test/image.png
copy to testing/web-platform/tests/html/semantics/embedded-content/the-img-element/image.png
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/update-src-complete.html
@@ -0,0 +1,23 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>Changing the img src should retain the 'complete' property</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<p id="display"><img src="image.png"></p>
+<script>
+    function check() {
+        var img = document.querySelector("img");
+        assert_true(img.complete, "By onload, image should have loaded");
+        img.src = `image.png?${Math.random()}`;
+        assert_false(img.complete, "Now that we're loading we should no longer be complete");
+        img.onload = function () {
+            assert_true(img.complete, "The new thing should have loaded.");
+            done();
+        }
+    }
+
+    onload = function () {
+        check();
+    };
+
+</script>