Bug 1566462 [wpt PR 17852] - Rename render timestamp in ElementTiming and LargestContentfulPaint, a=testonly

Automatic update from web-platform-tests
Rename render timestamp in ElementTiming and LargestContentfulPaint

Currently, the rendering timestamp is exposed in startTime. This may not
be ideal because analytics providers may be using certain default
filters which could sort by startTime, but the timestamp is 0 for cross
origin images. Also, 'renderTime' is more indicative of the timestamp
being exposed.

Bug: 879270, 942033, 965505
Change-Id: Iee283426173facd1e67343fd376e344517540423
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1703480
Reviewed-by: Yoav Weiss <yoavweiss@chromium.org>
Reviewed-by: Timothy Dresser <tdresser@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#677814}

--

wpt-commits: 47df9efd6ad1b9bf18345b3ace6790a5d41f6334
wpt-pr: 17852
This commit is contained in:
Nicolás Peña Moreno 2019-07-22 11:08:32 +00:00 коммит произвёл James Graham
Родитель 96a47a5d83
Коммит 116871312e
6 изменённых файлов: 19 добавлений и 15 удалений

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

@ -1,6 +1,6 @@
<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Element Timing: observe cross-origin images but without startTime</title>
<title>Element Timing: observe cross-origin images but without renderTime</title>
<body>
<style>
body {
@ -23,8 +23,8 @@ body {
assert_equals(entryList.getEntries().length, 1);
const entry = entryList.getEntries()[0];
checkElement(entry, pathname, 'my_image', 'the_id', 0, img);
assert_equals(entry.startTime, 0,
'The startTime of a cross-origin image should be 0.');
assert_equals(entry.renderTime, 0,
'The renderTime of a cross-origin image should be 0.');
checkRect(entry, [0, 100, 0, 100]);
checkNaturalSize(entry, 100, 100);
})

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

@ -39,7 +39,7 @@
if (valid_tao.includes(tao)) {
checkElement(entry, remote_img + tao, tao, 'id_' + tao, beforeRender, img);
} else if (invalid_tao.includes(tao)) {
assert_equals(entry.startTime, 0, 'Entry with tao=' + tao + ' must have a startTime of 0');
assert_equals(entry.renderTime, 0, 'Entry with tao=' + tao + ' must have a renderTime of 0');
checkElement(entry, remote_img + tao, tao, 'id_' + tao, 0, img);
}
else {
@ -51,6 +51,6 @@
});
})
).observe({type: 'element', buffered: true});
}, 'Cross-origin elements with valid TAO have correct startTime, with invalid TAO have startTime set to 0.');
}, 'Cross-origin elements with valid TAO have correct renderTime, with invalid TAO have renderTime set to 0.');
</script>
</body>

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

@ -4,16 +4,17 @@ function checkElementInternal(entry, expectedUrl, expectedIdentifier, expectedID
assert_equals(entry.entryType, 'element');
assert_equals(entry.url, expectedUrl);
assert_equals(entry.identifier, expectedIdentifier);
assert_equals(entry.startTime, 0);
assert_equals(entry.duration, 0);
assert_equals(entry.id, expectedID);
assert_greater_than_equal(entry.startTime, beforeRender);
assert_greater_than_equal(performance.now(), entry.startTime);
assert_greater_than_equal(entry.renderTime, beforeRender);
assert_greater_than_equal(performance.now(), entry.renderTime);
if (expectedElement !== null)
assert_equals(entry.element, expectedElement);
}
// Checks that this is an ElementTiming entry with url |expectedUrl|. It also
// does a very basic check on |startTime|: after |beforeRender| and before now().
// does a very basic check on |renderTime|: after |beforeRender| and before now().
function checkElement(entry, expectedUrl, expectedIdentifier, expectedID, beforeRender,
expectedElement) {
checkElementInternal(entry, expectedUrl, expectedIdentifier, expectedID, beforeRender,

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

@ -1,6 +1,6 @@
<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Largest Contentful Paint: observe cross-origin images but without startTime.</title>
<title>Largest Contentful Paint: observe cross-origin images but without renderTime.</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
@ -14,7 +14,8 @@
assert_equals(entryList.getEntries().length, 1);
const entry = entryList.getEntries()[0];
assert_equals(entry.entryType, 'largest-contentful-paint');
assert_equals(entry.startTime, 0, 'The startTime value should be 0 for a cross origin image.');
assert_equals(entry.renderTime, 0, 'The renderTime value should be 0 for a cross origin image.');
assert_equals(entry.startTime, 0);
assert_equals(entry.duration, 0);
// blue.png is 133 x 106.
assert_equals(entry.size, 14098);
@ -27,7 +28,7 @@
})
);
observer.observe({type: 'largest-contentful-paint', buffered: true});
}, 'Cross-origin image is observable, with startTime equal to 0.');
}, 'Cross-origin image is observable, with renderTime equal to 0.');
</script>
<img src='http://{{domains[www]}}:{{ports[http][1]}}/images/blue.png' id='image_id'/>

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

@ -15,10 +15,11 @@
assert_equals(entryList.getEntries().length, 1);
const entry = entryList.getEntries()[0];
assert_equals(entry.entryType, 'largest-contentful-paint');
assert_greater_than_equal(entry.startTime, beforeRender,
assert_greater_than_equal(entry.renderTime, beforeRender,
'The rendering timestamp should occur after script starts running.');
assert_greater_than_equal(performance.now(), entry.startTime,
assert_greater_than_equal(performance.now(), entry.renderTime,
'The rendering timestamp should occur before the entry is dispatched to the observer.');
assert_equals(entry.startTime, 0);
assert_equals(entry.duration, 0);
// blue.png is 133 x 106.
assert_equals(entry.size, 14098);

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

@ -20,8 +20,9 @@ p {
assert_equals(entryList.getEntries().length, 1);
const entry = entryList.getEntries()[0];
assert_equals(entry.entryType, 'largest-contentful-paint');
assert_greater_than_equal(entry.startTime, beforeRender);
assert_greater_than_equal(performance.now(), entry.startTime);
assert_greater_than_equal(entry.renderTime, beforeRender);
assert_greater_than_equal(performance.now(), entry.renderTime);
assert_equals(entry.startTime, 0);
assert_equals(entry.duration, 0);
// Some lower bound: height of at least 12 px.
// Width of at least 100 px.