Bug 1633114 [wpt PR 23250] - LazyLoad: Fix feature-policy tests, a=testonly
authorrajendrant <rajendrant@chromium.org>
Tue, 28 Apr 2020 11:48:33 +0000
changeset 527719 d6496be5a74c43f09938d8cc5c6e6f7e273f813b
parent 527718 923491beee00f8bd5d055b9621de0ccbf556ed32
child 527720 d5413d356b1e4aa1c8af46d79bd177eee92867ee
push id114723
push userarchaeopteryx@coole-files.de
push dateFri, 01 May 2020 14:54:07 +0000
treeherderautoland@8f743729a39b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1633114, 23250, 1074608, 2166638, 763010
milestone77.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 1633114 [wpt PR 23250] - LazyLoad: Fix feature-policy tests, a=testonly Automatic update from web-platform-tests LazyLoad: Fix feature-policy tests This updates the lazyload attribute as 'loading' with values of auto, eager and lazy for the feature policy tests. TBR=hiroshige@chromium.org Fixed: 1074608 Change-Id: If8ba1d09bce518ac36b70bd2a7b01687ffec87c1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2166638 Commit-Queue: rajendrant <rajendrant@chromium.org> Reviewed-by: Scott Little <sclittle@chromium.org> Cr-Commit-Position: refs/heads/master@{#763010} -- wpt-commits: ddad50b245ec811f4cbce8c84639122e9a7732a9 wpt-pr: 23250
testing/web-platform/tests/feature-policy/experimental-features/lazyload/lazyload-disabled-image-tentative.sub.html
testing/web-platform/tests/feature-policy/experimental-features/lazyload/lazyload-disabled-tentative.sub.html
testing/web-platform/tests/feature-policy/experimental-features/lazyload/lazyload-enabled-image-tentative.sub.html
testing/web-platform/tests/feature-policy/experimental-features/lazyload/lazyload-enabled-tentative.sub.html
testing/web-platform/tests/feature-policy/experimental-features/lazyload/lazyload-image-attribute-on-sanity-check-tentative.sub.html
testing/web-platform/tests/feature-policy/experimental-features/lazyload/loading-frame-default-eager-disabled-tentative.sub.html
--- a/testing/web-platform/tests/feature-policy/experimental-features/lazyload/lazyload-disabled-image-tentative.sub.html
+++ b/testing/web-platform/tests/feature-policy/experimental-features/lazyload/lazyload-disabled-image-tentative.sub.html
@@ -1,11 +1,11 @@
 <!doctype html>
 <meta charset=utf-8>
-<title>Verify behavior of 'lazyload' attribute state 'OFF' when the feature policy 'lazyload' is
+<title>Verify behavior of 'loading' attribute state 'eager' when the feature policy 'lazyload' is
        disabled.
 </title>
 <link rel="stylesheet" href="/feature-policy/experimental-features/resources/lazyload-image.css">
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script src="/feature-policy/experimental-features/resources/common.js"></script>
 <style>
 body {
@@ -22,40 +22,36 @@ img {
 #image-container {
   position: absolute;
   top: 10000px;
 }
 </style>
 <body>
   <p>Image inserted further below.</p>
   <div id="image-container">
-    <img id="off" lazyload="off" src="http://{{hosts[alt][www1]}}:{{ports[http][0]}}/feature-policy/experimental-features/resources/lazyload.png"></img>
+    <img id="eager" loading="eager" src="http://{{hosts[alt][www1]}}:{{ports[http][0]}}/feature-policy/experimental-features/resources/lazyload.png"></img>
     <img id="auto" lazyload="auto" src="http://{{hosts[alt][www2]}}:{{ports[http][0]}}/feature-policy/experimental-features/resources/lazyload.png"></img>
   </div>
   <script>
-    var img_off = document.getElementById("off");
+    var img_eager = document.getElementById("eager");
     var img_auto = document.getElementById("auto");
-    [window, img_off, img_auto].forEach((target) => {
+    [window, img_eager, img_auto].forEach((target) => {
       target.load_complete = wait_for_load(target).then(() => target.did_load = true );
     });
 
-    function images_loaded() {
-      return img_off.did_load && img_auto.did_load;
+    function same_load_state() {
+      return img_eager.did_load === img_auto.did_load;
     }
 
-    function same_load_state() {
-      return img_off.did_load === img_auto.did_load;
-    }
-
-    // Verifies that "off" and "auto" behave the same for out-of-view images.
+    // Verifies that "eager" and "auto" behave the same for out-of-view images.
     promise_test(async(t) => {
       await window.load_complete;
       assert_true(same_load_state(), "Expected same loading state for both images.");
-    }, "When the 'lazyload' feature is disabled, lazyload=OFF and lazyload=AUTO behave the same.");
+    }, "When the 'lazyload' feature is disabled, lazyload=EAGER and lazyload=AUTO behave the same.");
 
-    // Verifies that images with attributes "off" and "auto" load after the images get into view.
+    // Verifies that images with attributes "eager" and "auto" load after the images get into view.
     promise_test(async(t) => {
       document.getElementById("image-container").scrollIntoView();
-      await img_off.load_complete;
+      await img_eager.load_complete;
       await img_auto.load_complete;
     },  "Sanity-check: Verify that all images load after they are scrolled into view.");
   </script>
 </body>
--- a/testing/web-platform/tests/feature-policy/experimental-features/lazyload/lazyload-disabled-tentative.sub.html
+++ b/testing/web-platform/tests/feature-policy/experimental-features/lazyload/lazyload-disabled-tentative.sub.html
@@ -25,69 +25,69 @@ iframe {
       "http://{{hosts[alt][www]}}:{{ports[http][0]}}/" +
       "feature-policy/experimental-features/resources/lazyload-contents.html";
 
   let load_timeout = 600; // ms
   let expected_timeout_msg = false;
 
   window.scrollTo(0, 0);
 
-  // Sanity-check: Make sure lazyload='on' works as intended.
+  // Sanity-check: Make sure loading='lazy' works as intended.
   promise_test(async(t) => {
-    // Add a frame with lazyload="on".
-    let frame_on = createIframe(document.body, {
-        id: "ON",
-        lazyload: "on",
-        src: `${cross_origin_url}?id=ON`
+    // Add a frame with loading="lazy".
+    let frame_lazy = createIframe(document.body, {
+        id: "LAZY",
+        loading: "lazy",
+        src: `${cross_origin_url}?id=LAZY`
       });
     // Sanity-check: The frame is not visible.
     assert_greater_than(
-        frame_on.getBoundingClientRect().top,
+        frame_lazy.getBoundingClientRect().top,
         window.innerHeight * 2,
-        "Unexpected position for <iframe> with ID 'ON'.");
-    let msg_or_timeout_attr_on =
-        await waitForMessageOrTimeout(t, "ON", load_timeout);
-    assert_equals(msg_or_timeout_attr_on,
+        "Unexpected position for <iframe> with ID 'LAZY'.");
+    let msg_or_timeout_attr_lazy =
+        await waitForMessageOrTimeout(t, "LAZY", load_timeout);
+    assert_equals(msg_or_timeout_attr_lazy,
                   expected_timeout_msg,
-                  "With lazyload='on', the frame should not load.");
+                  "With loading='lazy', the frame should not load.");
   }, "Sanity-check: Contents do not load immediately (no eager-loading) " +
-     "when the lazyload attribute is 'on' and frame is in viewport.");
+     "when the loading attribute is 'lazy' and frame is in viewport.");
 
 
-  // Verify that when 'lazyload' policy is disabled,  lazyload='off' and
-  // lazyload='auto' behave the same.
+  // Verify that when 'lazyload' policy is disabled,  loading='eager' and
+  // loading='auto' behave the same.
   promise_test(async(t) => {
-    // Add a frame with lazyload="off".
-    let frame_on = createIframe(document.body, {
-        id: "OFF",
-        lazyload: "off",
-        src: `${cross_origin_url}?id=OFF`
+    // Add a frame with loading="eager".
+    let frame_lazy = createIframe(document.body, {
+        id: "EAGER",
+        loading: "eager",
+        src: `${cross_origin_url}?id=EAGER`
       });
     // Sanity-check: The frame is not visible.
     assert_greater_than(
-        frame_on.getBoundingClientRect().top,
+        frame_lazy.getBoundingClientRect().top,
         window.innerHeight * 2,
-        "Unexpected position for <iframe> with ID 'OFF'.");
-    let msg_or_timeout_attr_off =
-        await waitForMessageOrTimeout(t, "OFF", load_timeout);
+        "Unexpected position for <iframe> with ID 'EAGER'.");
+    let msg_or_timeout_attr_eager =
+        await waitForMessageOrTimeout(t, "EAGER", load_timeout);
 
-    // Now do the same for lazyload='auto'.
+    // Now do the same for loading='auto'.
     let frame_auto = createIframe(document.body, {
         id: "AUTO",
-        lazyload: "auto",
+        loading: "auto",
         src: `${cross_origin_url}?id=AUTO`
     });
     // Sanity-check: The frame is not visible.
     assert_greater_than(
-        frame_on.getBoundingClientRect().top,
+        frame_lazy.getBoundingClientRect().top,
         window.innerHeight * 2,
         "Unexpected position for <iframe> with ID 'AUTO'.");
     let msg_or_timeout_attr_auto =
         await waitForMessageOrTimeout(t, "AUTO", load_timeout);
 
     // The result should be the same.
     assert_equals(
-          msg_or_timeout_attr_off,
+          msg_or_timeout_attr_eager,
           msg_or_timeout_attr_auto,
-          "lazyload='off' not treated as 'auto'.");
+          "loading='eager' not treated as 'auto'.");
   }, "When 'lazyload' feature is disabled, a frame cannot avoid lazyloading " +
-     "by setting 'lazyload' attribute to 'off'");
+     "by setting 'loading' attribute to 'eager'");
 </script>
--- a/testing/web-platform/tests/feature-policy/experimental-features/lazyload/lazyload-enabled-image-tentative.sub.html
+++ b/testing/web-platform/tests/feature-policy/experimental-features/lazyload/lazyload-enabled-image-tentative.sub.html
@@ -1,11 +1,11 @@
 <!doctype html>
 <meta charset=utf-8>
-<title>Verify behavior of 'lazyload' attribute state 'OFF' when the feature policy 'lazyload' is
+<title>Verify behavior of 'lazyload' attribute state 'eager' when the feature policy 'lazyload' is
        enabled.
 </title>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script src="/feature-policy/experimental-features/resources/common.js"></script>
 <style>
 body {
   width: 100%;
@@ -21,17 +21,17 @@ img {
 #image-container {
   position: absolute;
   top: 10000px;
 }
 </style>
 <body>
   <p>Image inserted further below.</p>
   <div id="image-container">
-    <img id="off" loading="eager" src="http://{{hosts[alt][www1]}}:{{ports[http][0]}}/feature-policy/experimental-features/resources/lazyload.png"></img>
+    <img loading="eager" src="http://{{hosts[alt][www1]}}:{{ports[http][0]}}/feature-policy/experimental-features/resources/lazyload.png"></img>
   </div>
   <script>
     var img = document.querySelector("img");
 
     [img, window].forEach((target) => {
       target.load_complete = wait_for_load(target).then(() => target.did_load = true );
     });
 
--- a/testing/web-platform/tests/feature-policy/experimental-features/lazyload/lazyload-enabled-tentative.sub.html
+++ b/testing/web-platform/tests/feature-policy/experimental-features/lazyload/lazyload-enabled-tentative.sub.html
@@ -48,17 +48,17 @@ iframe {
         await waitForMessageOrTimeout(t, "ON", load_timeout);
     assert_equals(msg_or_timeout_attr_on,
                   expected_timeout_msg,
                   "With loading='lazy', the frame should not load.");
   }, "Sanity-check: Contents do not load immediately (no eager-loading) " +
      "when the loading attribute is 'lazy' and frame is in viewport.");
 
   // When feature is enabled, a frame can turn off lazy loading by setting the
-  // attribute to 'off'.
+  // attribute to 'eager'.
   promise_test(async(t) => {
     // Add a frame with loading="eager".
     let frame_off = createIframe(document.body, {
         id: "OFF",
         loading: "eager",
         src: `${cross_origin_url}?id=OFF`
       });
     // Sanity-check: The frame is not visible.
deleted file mode 100644
--- a/testing/web-platform/tests/feature-policy/experimental-features/lazyload/lazyload-image-attribute-on-sanity-check-tentative.sub.html
+++ /dev/null
@@ -1,48 +0,0 @@
-<!doctype html>
-<meta charset=utf-8>
-<title>Verify behavior of 'lazyload' attribute state 'ON' (sanity-check for lazyload policy tests).
-</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="/feature-policy/experimental-features/resources/common.js"></script>
-<style>
-body {
-  width: 100%;
-  height: 100%;
-}
-
-img {
-  width: 200px;
-  height: 200px;
-  border: solid 1px black;
-}
-
-#image-container {
-  position: absolute;
-  top: 10000px;
-}
-</style>
-<body>
-  <p>Image inserted further below.</p>
-  <div id="image-container">
-    <img lazyload="on" src="http://{{hosts[alt][www1]}}:{{ports[http][0]}}/feature-policy/experimental-features/resources/lazyload.png"/>
-  </div>
-  <script>
-    var img = document.querySelector("img");
-
-    [img, window].forEach((target) => {
-      target.did_load = false;
-      target.load_complete = wait_for_load(target).then(() => target.did_load = true );
-    });
-
-    // Sanity-check: Verify that when feature-policy 'lazyload' is enabled, the lazyload attribute
-    // value 'OFF' works as expected (images load immediately).
-    promise_test( async(t) => {
-      await window.load_complete;
-      assert_false(img.did_load, "Out-of-viewport image should not have loaded.");
-      img.scrollIntoView();
-      await img.load_complete;
-    }, "Verify 'lazyload' attribute state 'on' works as expected: image loads only when in " +
-       "viewport.");
- </script>
-</body>
--- a/testing/web-platform/tests/feature-policy/experimental-features/lazyload/loading-frame-default-eager-disabled-tentative.sub.html
+++ b/testing/web-platform/tests/feature-policy/experimental-features/lazyload/loading-frame-default-eager-disabled-tentative.sub.html
@@ -28,17 +28,16 @@ iframe {
       "http://{{hosts[alt][www]}}:{{ports[http][0]}}/" +
       "feature-policy/experimental-features/resources/lazyload-contents.html";
 
   window.scrollTo(0, 0);
 
   // Verify that when 'loading-frame-default-eager' policy is disabled, the
   // loading attribute "auto" leads to lazy loading.
   promise_test(async(t) => {
-    // Add a frame with load="off".
     let frame_loading_auto = createIframe(document.body, {
         id: "auto",
         // Sets the "loading" attribute to "auto".
         loading: "auto",
         src: `${cross_origin_url}?id=auto`
       });
     // Sanity-check: The frame is not visible.
     assert_greater_than(