From 15209380ae509cb6b5a0cffe90e42d727b9c3aa5 Mon Sep 17 00:00:00 2001 From: Han Gao Date: Wed, 23 Nov 2022 10:53:36 -0800 Subject: [PATCH] Add browser test to verify Cumulative Layout Shift hadRecentInput Add cumulative_layout_shift_browsertest to add coverage on CLS hadRecentInput. In the simple-block-movement.html file, we perform the first layout shift with 160px movement, and we pause the program for one second, and we perform one click then perform another layout shift with 340px movement. In CLS Normalization, we should only consider the first layout shift since the second layout shift happened in 500ms after the click which will reset the hadRecentInput timer. Bug: 1370548 Change-Id: I7378acf445a133c12d21f4591dd83deba3f7e61a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4044285 Reviewed-by: Annie Sullivan Commit-Queue: Han Gao Cr-Commit-Position: refs/heads/main@{#1075246} --- layout-instability/resources/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout-instability/resources/util.js b/layout-instability/resources/util.js index 1b3c82d7d68da9b..597e2d7d849bf55 100644 --- a/layout-instability/resources/util.js +++ b/layout-instability/resources/util.js @@ -64,7 +64,7 @@ ScoreWatcher = function() { list.getEntries().forEach(entry => { this.lastEntry = entry; this.score += entry.value; - watcher_entry_record.push({startTime: entry.startTime, score: entry.value}); + watcher_entry_record.push({startTime: entry.startTime, score: entry.value, hadRecentInput : entry.hadRecentInput}); if (!entry.hadRecentInput) this.scoreWithInputExclusion += entry.value; this.resolve();