Commit 4e7845d4 authored by Nicolas Pena's avatar Nicolas Pena Committed by Commit Bot

Fix flakiness in resource_timing_buffer_full_250

This CL uses document fragments to append scripts faster. Also, we do
not need to wait until onload of one script to begin appending the next.

Bug: 626703, 883837
Change-Id: I0bc010640793d6a7113d404f2838fd5cfe88ab25
Reviewed-on: https://chromium-review.googlesource.com/c/1265901Reviewed-by: default avatarTimothy Dresser <tdresser@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#598896}
parent fa9a09f8
......@@ -3089,7 +3089,6 @@ crbug.com/863355 [ Mac ] external/wpt/svg/shapes/reftests/pathlength-002.svg [ F
crbug.com/366559 external/wpt/svg/shapes/reftests/pathlength-003.svg [ Failure ]
crbug.com/366559 external/wpt/svg/text/reftests/textpath-side-001.svg [ Failure ]
crbug.com/366559 external/wpt/svg/text/reftests/textpath-shape-001.svg [ Failure ]
crbug.com/626703 [ Win7 ] external/wpt/resource-timing/resource_timing_buffer_full_eventually.html [ Timeout ]
crbug.com/626703 external/wpt/svg/rendering/order/z-index.svg [ Failure ]
crbug.com/626703 external/wpt/web-animations/timing-model/timelines/update-and-send-events.html [ Timeout ]
crbug.com/626703 external/wpt/console/console-timing-logging-manual.html [ Skip ]
......@@ -5293,7 +5292,6 @@ crbug.com/869492 virtual/video-surface-layer/external/wpt/feature-policy/experim
# Sheriff 2018-09-13
crbug.com/883591 [ Android ] fullscreen/full-screen-inline-split-crash.html [ Pass Crash ]
crbug.com/883837 [ Win7 ] http/tests/performance-timing/resource_timing_buffer_full_250.html [ Timeout Pass ]
# Sheriff 2018-09-18
crbug.com/884445 virtual/unified-autoplay/external/wpt/feature-policy/feature-policy-nested-header-policy-disallowed-for-all.https.sub.html [ Pass Timeout ]
......
......@@ -16,15 +16,23 @@
function() {
// Scripts appended in JS to ensure setResourceTimingBufferSize is called before.
let counter = performance.getEntriesByType("resource").length;
function appendScript() {
const src = "resources/empty.js?" + counter;
const script = document.createElement('script');
script.type = 'text/javascript';
script.onload = function() { ++counter; appendScript()};
script.src = src;
document.body.appendChild(script);
function appendScripts() {
const documentFragment = document.createDocumentFragment();
// Add 100 elements at a time to avoid page reflow every time.
let numScriptsAccumulated = 0;
while (numScriptsAccumulated < 100) {
const src = "resources/empty.js?" + counter;
const script = document.createElement('script');
script.type = 'text/javascript';
script.src = src;
documentFragment.appendChild(script);
++counter;
++numScriptsAccumulated;
}
document.body.appendChild(documentFragment);
t.step_timeout(appendScripts, 20);
}
appendScript();
appendScripts();
});
</script>
</body>
......
......@@ -18,21 +18,16 @@
function() {
// Scripts appended in JS to ensure setResourceTimingBufferSize is called before.
let counter = performance.getEntriesByType("resource").length;
function appendScript() {
if (counter > default_buffer_size) {
t.step_timeout(function() {
assert_unreached("Got no buffer full event at " + counter + " resources");
}, 100);
return;
}
const documentFragment = document.createDocumentFragment();
while (counter < default_buffer_size) {
const src = "../loading/resources/empty.js?" + counter;
const script = document.createElement('script');
script.type = 'text/javascript';
script.onload = function() { ++counter; appendScript()};
script.src = src;
document.body.appendChild(script);
documentFragment.appendChild(script);
++counter;
}
appendScript();
document.body.appendChild(documentFragment);
});
</script>
</body>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment