Bug 1503355 [wpt PR 13789] - Make Server-Timing tests more resilient, a=testonly

Automatic update from web-platform-testsMake Server-Timing tests more resilient (#13789)

--

wpt-commits: 5c95adc476aa7273b152d2468b5e71b42757f007
wpt-pr: 13789
This commit is contained in:
Charles Vazac 2018-11-09 17:25:37 +00:00 коммит произвёл moz-wptsync-bot
Родитель 0b61e937ad
Коммит 305fad09c9
7 изменённых файлов: 20 добавлений и 11 удалений

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

@ -42,3 +42,10 @@ function test_entries(actualEntries, expectedEntries) {
}
})
}
function delayedLoadListener(callback) {
window.addEventListener('load', function() {
// TODO(cvazac) Remove this setTimeout when spec enforces sync entries.
step_timeout(callback, 0)
})
}

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

@ -2,7 +2,7 @@
<head>
<meta charset='utf-8' />
<script src="/resources/testharness.js"></script>
<script src='/resources/testharnessreport.js'></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/performance-timeline-utils.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script>
@ -20,7 +20,7 @@
document.getElementsByTagName('script')[0].parentNode.appendChild(img)
})
window.addEventListener('load', function() {
delayedLoadListener(function() {
function assertServerTimingEntries(url, expectedEntryCount) {
test_equals(performance.getEntriesByName(url)[0].serverTiming.length,
expectedEntryCount,

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

@ -2,10 +2,11 @@
<head>
<meta charset='utf-8' />
<script src="/resources/testharness.js"></script>
<script src='/resources/testharnessreport.js'></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/performance-timeline-utils.js"></script>
<script>
setup({explicit_done: true})
window.addEventListener('load', function(){
delayedLoadListener(function(){
assert_not_equals(typeof performance.getEntriesByType('navigation')[0].serverTiming, 'undefined',
'An instance of `PerformanceNavigationTiming` should have a `serverTiming` attribute.')
done()

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

@ -2,10 +2,11 @@
<head>
<meta charset='utf-8' />
<script src="/resources/testharness.js"></script>
<script src='/resources/testharnessreport.js'></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/performance-timeline-utils.js"></script>
<script>
setup({explicit_done: true})
window.addEventListener('load', function(){
delayedLoadListener(function(){
assert_not_equals(typeof performance.getEntriesByType('resource')[0].serverTiming, 'undefined',
'An instance of `PerformanceResourceTiming` should have a `serverTiming` attribute.')
done()

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

@ -7,7 +7,7 @@ tests generated by:
<head>
<meta charset='utf-8' />
<script src="/resources/testharness.js"></script>
<script src='/resources/testharnessreport.js'></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/performance-timeline-utils.js"></script>
<script>
setup({explicit_done: true})
@ -49,6 +49,6 @@ tests generated by:
document.getElementsByTagName('head')[0].appendChild(script)
urlToIndex[script.src] = i
}
window.addEventListener('load', runTests)
delayedLoadListener(runTests)
</script>
</head>

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

@ -2,7 +2,7 @@
<head>
<meta charset='utf-8' />
<script src="/resources/testharness.js"></script>
<script src='/resources/testharnessreport.js'></script>
<script src="/resources/testharnessreport.js"></script>
<script>
(async () => {
const scope = 'does/not/exist'

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

@ -2,12 +2,12 @@
<head>
<meta charset='utf-8' />
<script src="/resources/testharness.js"></script>
<script src='/resources/testharnessreport.js'></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/performance-timeline-utils.js"></script>
<script>
setup({explicit_done: true})
window.addEventListener('load', function() {
delayedLoadListener(function() {
// there should be exactly three server-timing entries, 2 for document, 1 for img#one
test_entries(performance.getEntriesByType('navigation')[0].serverTiming, [{
duration: 1.1,