Bug 1523562 [wpt PR 15117] - Fix flaky WPT test, a=testonly
authorAleks Totic <atotic@chromium.org>
Fri, 01 Feb 2019 13:41:09 +0000
changeset 458189 8e798a6a25cbf180a60e48615cdfe7c7f5ac2564
parent 458188 cb00507d73b65c7b7c86b53aac143e92476f84ab
child 458190 5dd641d1e2caf98da9efc757dc2122129929a628
push id35518
push useropoprus@mozilla.com
push dateFri, 08 Feb 2019 09:55:14 +0000
treeherdermozilla-central@3a3e393396f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1523562, 15117, 14888, 919297, 1440144, 626729
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1523562 [wpt PR 15117] - Fix flaky WPT test, a=testonly Automatic update from web-platform-tests Fix flaky WPT test Tests names differed depending on whether test was sync or async. https://github.com/web-platform-tests/wpt/pull/14888 Bug: 919297 Change-Id: I68579db478c68b2f603cc2d57f81bf02856961d8 Reviewed-on: https://chromium-review.googlesource.com/c/1440144 Reviewed-by: Robert Ma <robertma@chromium.org> Commit-Queue: Aleks Totic <atotic@chromium.org> Cr-Commit-Position: refs/heads/master@{#626729} -- wpt-commits: 24aaa7dd187f3603649ca5692ea639d67a166f88 wpt-pr: 15117
testing/web-platform/tests/css/css-position/position-absolute-replaced-minmax.html
--- a/testing/web-platform/tests/css/css-position/position-absolute-replaced-minmax.html
+++ b/testing/web-platform/tests/css/css-position/position-absolute-replaced-minmax.html
@@ -280,42 +280,49 @@
 
   // SVG with no intrinsic width/height
   let svgSrc="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' %3E%3Crect width='100%' height='100%' style='fill:rgb(0,255,0);'/%3E%3C/svg%3E ";
   images = document.querySelectorAll("img.svg");
   for (let i=0; i<images.length; ++i) {
     images[i].src = svgSrc;
   }
 
-  let testNameIndex = 1;
   function makeTest(el) {
     return function() {
       if (!el.getAttribute("data-expected-width")) {
+        // This code is used to generate reference data for the tests.
         let text = `data-expected-width="${el.offsetWidth}" data-expected-height="${el.offsetHeight}" data-offset-y="${el.offsetTop}" data-offset-x="${el.offsetLeft}"`;
         el.parentElement.innerText = text;
         return;
       }
       assert_equals(el.offsetWidth + "", el.getAttribute("data-expected-width"), "incorrect offsetWidth");
       assert_equals(el.offsetHeight + "", el.getAttribute("data-expected-height"), "incorrect offsetHeight");
       assert_equals(el.offsetTop + "", el.getAttribute("data-offset-y"), "incorrect offsetTop");
       assert_equals(el.offsetLeft + "", el.getAttribute("data-offset-x"), "incorrect offsetLeft");
     }
   };
 
+
+  let testNameIndex = 1;
+  function getTestName(el) {
+    let svg = el.classList.contains("svg") ? " svg" : "";
+    return "minmax replaced " + el.nodeName + svg + " " + testNameIndex++;
+  };
+
   function testAfterImageLoads(img, test) {
-    let asyncTest = async_test("minmax replaced async IMG " + testNameIndex++);
+    let asyncTest = async_test(getTestName(img));
     img.addEventListener("load", _ => {
       asyncTest.step(test);
       asyncTest.done();
     });
   };
 
   let testElements = document.querySelectorAll(".target");
 
   for (let i=0; i<testElements.length; ++i) {
     let myTest = makeTest(testElements[i]);
     if (testElements[i].nodeName == "IMG" && !testElements[i].complete) {
       testAfterImageLoads(testElements[i], myTest);
     } else {
-      test(myTest, "minmax replaced " + testElements[i].nodeName + " " + testNameIndex++);
+      test(myTest, getTestName(testElements[i]));
     }
   }
 </script>