Ignore layout shifts from a SliderThumbElement.
Bug: 1088311
Change-Id: I9e93f3193de6d75bfb2d5c384a0455619340f961
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2233310
Commit-Queue: Steve Kobes <skobes@chromium.org>
Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#777876}
diff --git a/layout-instability/resources/util.js b/layout-instability/resources/util.js
index 8a06d72..d6f54bc 100644
--- a/layout-instability/resources/util.js
+++ b/layout-instability/resources/util.js
@@ -70,7 +70,7 @@
};
ScoreWatcher.prototype.checkExpectation = function(expectation) {
- if (expectation.score)
+ if (expectation.score != undefined)
assert_equals(this.score, expectation.score);
if (expectation.sources)
check_sources(expectation.sources, this.lastEntry.sources);
diff --git a/layout-instability/video.html b/layout-instability/video.html
new file mode 100644
index 0000000..d699ba0
--- /dev/null
+++ b/layout-instability/video.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<title>Layout Instability: no shifts from advancing video track</title>
+<link rel="help" href="https://wicg.github.io/layout-instability/" />
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/test-adapter.js"></script>
+<script src="resources/util.js"></script>
+<video controls>
+ <source src="/media/white.webm" type="video/webm">
+</video>
+<script>
+
+promise_test(async () => {
+ const watcher = new ScoreWatcher;
+ var video = document.querySelector("video");
+
+ await new Promise(resolve => { video.oncanplay = resolve; });
+ await waitForAnimationFrames(2);
+
+ // TODO(crbug.com/1088311): There are still some shifts from creating the
+ // <video>, so the score is already > 0 here. For now, just verify that
+ // advancing the track does not increase it further.
+ var currentScore = watcher.score;
+
+ video.currentTime = 5;
+
+ await waitForAnimationFrames(3);
+ cls_expect(watcher, {score: currentScore});
+
+}, "No shifts from advancing video track.");
+
+</script>