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>
<html>
<body onload="on_load('document')">
<body>
<script>
function on_load(msg) {
console.log("LAZY_LOAD CONSOLE", msg, "ON_LOAD FOR TEST");
}
loaded_ids = new Array();
</script>
In the viewport image <br>
<img src="images/fruit1.jpg?auto"
onload="on_load('in-viewport img')">
<img src="images/fruit1.jpg?lazy" loading="lazy"
onload="on_load('in-viewport loading=lazy img')">
<img src="images/fruit1.jpg?eager" loading="eager"
onload="on_load('in-viewport loading=eager img')">
In the viewport images <br>
<img id="atf_auto" src="images/fruit1.jpg?auto"
onload="loaded_ids.push(this.id); console.log(this.id);">
<img id="atf_lazy" src="images/fruit1.jpg?lazy" loading="lazy"
onload="loaded_ids.push(this.id); console.log(this.id);">
<img id="atf_eager" src="images/fruit1.jpg?eager" loading="eager"
onload="loaded_ids.push(this.id); console.log(this.id);">
<div style="height:11000px;"></div>
Below the viewport images <br>
<img src="images/fruit2.jpg?auto"
onload="on_load('below-viewport img')">
<img src="images/fruit2.jpg?lazy" loading="lazy"
onload="on_load('below-viewport loading=lazy img')">
<img src="images/fruit2.jpg?eager" loading="eager"
onload="on_load('below-viewport loading=eager img')">
<img id="btf_auto" src="images/fruit2.jpg?auto"
onload="loaded_ids.push(this.id); console.log(this.id);">
<img id="btf_lazy" src="images/fruit2.jpg?lazy" loading="lazy"
onload="loaded_ids.push(this.id); console.log(this.id);">
<img id="btf_eager" src="images/fruit2.jpg?eager" loading="eager"
onload="loaded_ids.push(this.id); console.log(this.id);">
</body>
</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