зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1557377 [wpt PR 16855] - Update LayoutShift entryType and rename "fraction" to "value"., a=testonly
Automatic update from web-platform-tests Update LayoutShift entryType and rename "fraction" to "value". Bug: 963474 Change-Id: I29cdf63d82105644ba9f4fddbf38c17ae81aabdb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1613887 Commit-Queue: Steve Kobes <skobes@chromium.org> Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> Cr-Commit-Position: refs/heads/master@{#660234} -- wp5At-commits: 17fdc108517774279ea71f0de4fe8d68618249d3 wpt-pr: 16855 --HG-- rename : testing/web-platform/tests/layout-stability/resources/slow-image.py => testing/web-platform/tests/layout-instability/resources/slow-image.py
This commit is contained in:
Родитель
beb5e724da
Коммит
9dd02752fd
|
@ -1,6 +1,6 @@
|
||||||
<!DOCTYPE HTML>
|
<!DOCTYPE HTML>
|
||||||
<meta charset=utf-8>
|
<meta charset=utf-8>
|
||||||
<title>Layout Jank: query jank via the performance timeline</title>
|
<title>Layout Instability: query layout shift value via the performance timeline</title>
|
||||||
<body>
|
<body>
|
||||||
<style>
|
<style>
|
||||||
#myDiv { position: relative; width: 300px; height: 100px; }
|
#myDiv { position: relative; width: 300px; height: 100px; }
|
||||||
|
@ -16,27 +16,27 @@
|
||||||
// Modify the position of the div.
|
// Modify the position of the div.
|
||||||
document.getElementById('myDiv').style = "top: 60px";
|
document.getElementById('myDiv').style = "top: 60px";
|
||||||
function testBufferedEntry() {
|
function testBufferedEntry() {
|
||||||
if (performance.getEntriesByType('layoutJank').length === 0) {
|
if (performance.getEntriesByType('layoutShift').length === 0) {
|
||||||
t.step_timeout(testBufferedEntry, 0);
|
t.step_timeout(testBufferedEntry, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const endTime = performance.now();
|
const endTime = performance.now();
|
||||||
assert_equals(performance.getEntriesByType('layoutJank').length, 1);
|
assert_equals(performance.getEntriesByType('layoutShift').length, 1);
|
||||||
assert_equals(performance.getEntries().filter(
|
assert_equals(performance.getEntries().filter(
|
||||||
entry => entry.entryType === 'layoutJank').length, 1);
|
entry => entry.entryType === 'layoutShift').length, 1);
|
||||||
const entry = performance.getEntriesByType('layoutJank')[0];
|
const entry = performance.getEntriesByType('layoutShift')[0];
|
||||||
assert_equals(entry.entryType, "layoutJank");
|
assert_equals(entry.entryType, "layoutShift");
|
||||||
assert_equals(entry.name, "");
|
assert_equals(entry.name, "");
|
||||||
assert_greater_than_equal(entry.startTime, startTime)
|
assert_greater_than_equal(entry.startTime, startTime)
|
||||||
assert_less_than_equal(entry.startTime, endTime)
|
assert_less_than_equal(entry.startTime, endTime)
|
||||||
assert_equals(entry.duration, 0.0);
|
assert_equals(entry.duration, 0.0);
|
||||||
// The layout jank fraction should be: 300 * (100 + 60) / viewport size.
|
// The layout shift value should be: 300 * (100 + 60) / viewport size.
|
||||||
assert_equals(entry.fraction, 300 * (100 + 60) /
|
assert_equals(entry.value, 300 * (100 + 60) /
|
||||||
(document.documentElement.clientWidth * document.documentElement.clientHeight));
|
(document.documentElement.clientWidth * document.documentElement.clientHeight));
|
||||||
t.done();
|
t.done();
|
||||||
}
|
}
|
||||||
t.step(testBufferedEntry);
|
t.step(testBufferedEntry);
|
||||||
}, 'LayoutJank before onload is buffered into the performance timeline.');
|
}, 'Layout shift before onload is buffered into the performance timeline.');
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
|
@ -1,6 +1,6 @@
|
||||||
<!DOCTYPE HTML>
|
<!DOCTYPE HTML>
|
||||||
<meta charset=utf-8>
|
<meta charset=utf-8>
|
||||||
<title>Layout Jank: observe jank fraction via PerformanceObserver</title>
|
<title>Layout Instability: observe layout shift value via PerformanceObserver</title>
|
||||||
<body>
|
<body>
|
||||||
<style>
|
<style>
|
||||||
#myDiv { position: relative; width: 300px; height: 100px; }
|
#myDiv { position: relative; width: 300px; height: 100px; }
|
||||||
|
@ -16,22 +16,22 @@
|
||||||
const endTime = performance.now();
|
const endTime = performance.now();
|
||||||
assert_equals(entryList.getEntries().length, 1);
|
assert_equals(entryList.getEntries().length, 1);
|
||||||
const entry = entryList.getEntries()[0];
|
const entry = entryList.getEntries()[0];
|
||||||
assert_equals(entry.entryType, "layoutJank");
|
assert_equals(entry.entryType, "layoutShift");
|
||||||
assert_equals(entry.name, "");
|
assert_equals(entry.name, "");
|
||||||
assert_greater_than_equal(entry.startTime, startTime)
|
assert_greater_than_equal(entry.startTime, startTime)
|
||||||
assert_less_than_equal(entry.startTime, endTime)
|
assert_less_than_equal(entry.startTime, endTime)
|
||||||
assert_equals(entry.duration, 0.0);
|
assert_equals(entry.duration, 0.0);
|
||||||
// The layout jank fraction should be: 300 * (100 + 60) / viewport size.
|
// The layout shift value should be: 300 * (100 + 60) / viewport size.
|
||||||
assert_equals(entry.fraction, 300 * (100 + 60) /
|
assert_equals(entry.value, 300 * (100 + 60) /
|
||||||
(document.documentElement.clientWidth * document.documentElement.clientHeight));
|
(document.documentElement.clientWidth * document.documentElement.clientHeight));
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
observer.observe({entryTypes: ['layoutJank']});
|
observer.observe({entryTypes: ['layoutShift']});
|
||||||
window.onload = () => {
|
window.onload = () => {
|
||||||
// Modify the position of the div.
|
// Modify the position of the div.
|
||||||
document.getElementById('myDiv').style = "top: 60px";
|
document.getElementById('myDiv').style = "top: 60px";
|
||||||
};
|
};
|
||||||
}, 'LayoutJank is observable via PerformanceObserver.');
|
}, 'Layout shift is observable via PerformanceObserver.');
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
|
@ -1,6 +1,6 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<head>
|
<head>
|
||||||
<title>PerformanceObserver.supportedEntryTypes contains "layoutJank"</title>
|
<title>PerformanceObserver.supportedEntryTypes contains "layoutShift"</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script src="/resources/testharness.js"></script>
|
<script src="/resources/testharness.js"></script>
|
||||||
|
@ -9,9 +9,9 @@
|
||||||
test(() => {
|
test(() => {
|
||||||
if (typeof PerformanceObserver.supportedEntryTypes === "undefined")
|
if (typeof PerformanceObserver.supportedEntryTypes === "undefined")
|
||||||
assert_unreached("supportedEntryTypes is not supported.");
|
assert_unreached("supportedEntryTypes is not supported.");
|
||||||
assert_greater_than(PerformanceObserver.supportedEntryTypes.indexOf("layoutJank"), -1,
|
assert_greater_than(PerformanceObserver.supportedEntryTypes.indexOf("layoutShift"), -1,
|
||||||
"There should be an entry 'layoutJank' in PerformanceObserver.supportedEntryTypes");
|
"There should be an entry 'layoutShift' in PerformanceObserver.supportedEntryTypes");
|
||||||
}, "supportedEntryTypes contains 'layoutJank'.");
|
}, "supportedEntryTypes contains 'layoutShift'.");
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Загрузка…
Ссылка в новой задаче