Commit c326228d authored by Scott Little's avatar Scott Little Committed by Commit Bot

Rewrite LazyLoad BrowserTests to reduce flakiness.

Previously, these tests would occasionally flake while waiting for the
scroll offset to update. This CL rewrites these tests to remove this
dependency on RenderFrameSubmissionObserver::WaitForScrollOffset.

This CL also changes these tests to use JavaScript promises to
communicate with the page instead of polling the console output in order
to improve readability of the tests.

Fixed: 1035057
Change-Id: I845d0f821bdc4ee604a9432a90f5e4a100187c97
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2166633
Commit-Queue: Scott Little <sclittle@chromium.org>
Reviewed-by: default avatarrajendrant <rajendrant@chromium.org>
Cr-Commit-Position: refs/heads/master@{#762789}
parent 52f3b67e
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<body onload="on_load('document')"> <body>
<script> <script>
function on_load(msg) { loaded_ids = new Array();
console.log("LAZY_LOAD CONSOLE", msg, "ON_LOAD FOR TEST");
}
</script> </script>
In the viewport image <br> In the viewport images <br>
<img src="images/fruit1.jpg?auto" <img id="atf_auto" src="images/fruit1.jpg?auto"
onload="on_load('in-viewport img')"> onload="loaded_ids.push(this.id); console.log(this.id);">
<img src="images/fruit1.jpg?lazy" loading="lazy" <img id="atf_lazy" src="images/fruit1.jpg?lazy" loading="lazy"
onload="on_load('in-viewport loading=lazy img')"> onload="loaded_ids.push(this.id); console.log(this.id);">
<img src="images/fruit1.jpg?eager" loading="eager" <img id="atf_eager" src="images/fruit1.jpg?eager" loading="eager"
onload="on_load('in-viewport loading=eager img')"> onload="loaded_ids.push(this.id); console.log(this.id);">
<div style="height:11000px;"></div> <div style="height:11000px;"></div>
Below the viewport images <br> Below the viewport images <br>
<img src="images/fruit2.jpg?auto" <img id="btf_auto" src="images/fruit2.jpg?auto"
onload="on_load('below-viewport img')"> onload="loaded_ids.push(this.id); console.log(this.id);">
<img src="images/fruit2.jpg?lazy" loading="lazy" <img id="btf_lazy" src="images/fruit2.jpg?lazy" loading="lazy"
onload="on_load('below-viewport loading=lazy img')"> onload="loaded_ids.push(this.id); console.log(this.id);">
<img src="images/fruit2.jpg?eager" loading="eager" <img id="btf_eager" src="images/fruit2.jpg?eager" loading="eager"
onload="on_load('below-viewport loading=eager img')"> onload="loaded_ids.push(this.id); console.log(this.id);">
</body> </body>
</html> </html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment