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:
Steve Kobes 2019-06-13 10:23:46 +00:00 коммит произвёл James Graham
Родитель beb5e724da
Коммит 9dd02752fd
4 изменённых файлов: 19 добавлений и 19 удалений

Просмотреть файл

@ -1,6 +1,6 @@
<!DOCTYPE HTML>
<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>
<style>
#myDiv { position: relative; width: 300px; height: 100px; }
@ -16,27 +16,27 @@
// Modify the position of the div.
document.getElementById('myDiv').style = "top: 60px";
function testBufferedEntry() {
if (performance.getEntriesByType('layoutJank').length === 0) {
if (performance.getEntriesByType('layoutShift').length === 0) {
t.step_timeout(testBufferedEntry, 0);
return;
}
const endTime = performance.now();
assert_equals(performance.getEntriesByType('layoutJank').length, 1);
assert_equals(performance.getEntriesByType('layoutShift').length, 1);
assert_equals(performance.getEntries().filter(
entry => entry.entryType === 'layoutJank').length, 1);
const entry = performance.getEntriesByType('layoutJank')[0];
assert_equals(entry.entryType, "layoutJank");
entry => entry.entryType === 'layoutShift').length, 1);
const entry = performance.getEntriesByType('layoutShift')[0];
assert_equals(entry.entryType, "layoutShift");
assert_equals(entry.name, "");
assert_greater_than_equal(entry.startTime, startTime)
assert_less_than_equal(entry.startTime, endTime)
assert_equals(entry.duration, 0.0);
// The layout jank fraction should be: 300 * (100 + 60) / viewport size.
assert_equals(entry.fraction, 300 * (100 + 60) /
// The layout shift value should be: 300 * (100 + 60) / viewport size.
assert_equals(entry.value, 300 * (100 + 60) /
(document.documentElement.clientWidth * document.documentElement.clientHeight));
t.done();
}
t.step(testBufferedEntry);
}, 'LayoutJank before onload is buffered into the performance timeline.');
}, 'Layout shift before onload is buffered into the performance timeline.');
</script>
</body>

Просмотреть файл

@ -1,6 +1,6 @@
<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Layout Jank: observe jank fraction via PerformanceObserver</title>
<title>Layout Instability: observe layout shift value via PerformanceObserver</title>
<body>
<style>
#myDiv { position: relative; width: 300px; height: 100px; }
@ -16,22 +16,22 @@
const endTime = performance.now();
assert_equals(entryList.getEntries().length, 1);
const entry = entryList.getEntries()[0];
assert_equals(entry.entryType, "layoutJank");
assert_equals(entry.entryType, "layoutShift");
assert_equals(entry.name, "");
assert_greater_than_equal(entry.startTime, startTime)
assert_less_than_equal(entry.startTime, endTime)
assert_equals(entry.duration, 0.0);
// The layout jank fraction should be: 300 * (100 + 60) / viewport size.
assert_equals(entry.fraction, 300 * (100 + 60) /
// The layout shift value should be: 300 * (100 + 60) / viewport size.
assert_equals(entry.value, 300 * (100 + 60) /
(document.documentElement.clientWidth * document.documentElement.clientHeight));
})
);
observer.observe({entryTypes: ['layoutJank']});
observer.observe({entryTypes: ['layoutShift']});
window.onload = () => {
// Modify the position of the div.
document.getElementById('myDiv').style = "top: 60px";
};
}, 'LayoutJank is observable via PerformanceObserver.');
}, 'Layout shift is observable via PerformanceObserver.');
</script>
</body>

Просмотреть файл

@ -1,6 +1,6 @@
<!DOCTYPE html>
<head>
<title>PerformanceObserver.supportedEntryTypes contains "layoutJank"</title>
<title>PerformanceObserver.supportedEntryTypes contains "layoutShift"</title>
</head>
<body>
<script src="/resources/testharness.js"></script>
@ -9,9 +9,9 @@
test(() => {
if (typeof PerformanceObserver.supportedEntryTypes === "undefined")
assert_unreached("supportedEntryTypes is not supported.");
assert_greater_than(PerformanceObserver.supportedEntryTypes.indexOf("layoutJank"), -1,
"There should be an entry 'layoutJank' in PerformanceObserver.supportedEntryTypes");
}, "supportedEntryTypes contains 'layoutJank'.");
assert_greater_than(PerformanceObserver.supportedEntryTypes.indexOf("layoutShift"), -1,
"There should be an entry 'layoutShift' in PerformanceObserver.supportedEntryTypes");
}, "supportedEntryTypes contains 'layoutShift'.");
</script>
</body>
</html>