mirror of
https://github.com/servo/servo.git
synced 2025-10-04 02:29:12 +01:00
Update web-platform-tests to revision 10168e9a5d44efbc6e7d416d1d454eb9c9f1396c
This commit is contained in:
parent
c88dc51d03
commit
0e1caebaf4
791 changed files with 23381 additions and 5501 deletions
|
@ -17,6 +17,7 @@ let page_loaded = false;
|
|||
let ol_font_loaded = false;
|
||||
let ul_font_loaded = false;
|
||||
let xhr_loaded = false;
|
||||
let tests_run = false;
|
||||
|
||||
function check_finished() {
|
||||
if (!ul_font_loaded) {
|
||||
|
@ -64,6 +65,10 @@ function onload_test() {
|
|||
}
|
||||
|
||||
function perform_test() {
|
||||
if (tests_run) {
|
||||
return;
|
||||
}
|
||||
tests_run = true;
|
||||
const context = new PerformanceContext(document.getElementById('frameContext').contentWindow.performance);
|
||||
const entries = context.getEntriesByType('resource');
|
||||
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
importScripts("/resources/testharness.js");
|
||||
|
||||
function check(initiatorType, protocol) {
|
||||
let entries = performance.getEntries();
|
||||
assert_equals(entries.length, 1);
|
||||
|
||||
assert_true(entries[0] instanceof PerformanceEntry);
|
||||
assert_equals(entries[0].entryType, "resource");
|
||||
assert_true(entries[0].startTime > 0);
|
||||
assert_true(entries[0].duration > 0);
|
||||
|
||||
assert_true(entries[0] instanceof PerformanceResourceTiming);
|
||||
assert_equals(entries[0].initiatorType, initiatorType);
|
||||
assert_equals(entries[0].nextHopProtocol, protocol);
|
||||
}
|
||||
|
||||
async_test(t => {
|
||||
performance.clearResourceTimings();
|
||||
|
||||
// Fetch
|
||||
fetch("resources/empty.js")
|
||||
.then(r => r.blob())
|
||||
.then(blob => {
|
||||
check("fetch", "http/1.1");
|
||||
})
|
||||
|
||||
// XMLHttpRequest
|
||||
.then(() => {
|
||||
return new Promise(resolve => {
|
||||
performance.clearResourceTimings();
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.onload = () => {
|
||||
check("xmlhttprequest", "http/1.1");
|
||||
resolve();
|
||||
};
|
||||
xhr.open("GET", "resources/empty.js");
|
||||
xhr.send();
|
||||
});
|
||||
})
|
||||
|
||||
// Sync XMLHttpREquest
|
||||
.then(() => {
|
||||
performance.clearResourceTimings();
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "resources/empty.js", false);
|
||||
xhr.send();
|
||||
|
||||
check("xmlhttprequest", "http/1.1");
|
||||
})
|
||||
|
||||
// ImportScripts
|
||||
.then(() => {
|
||||
performance.clearResourceTimings();
|
||||
importScripts(["resources/empty.js"]);
|
||||
check("other", "http/1.1");
|
||||
})
|
||||
|
||||
// All done.
|
||||
.then(() => {
|
||||
t.done();
|
||||
});
|
||||
}, "Performance Resouce Entries in workers");
|
||||
|
||||
done();
|
|
@ -0,0 +1 @@
|
|||
/* Nothing here */
|
Loading…
Add table
Add a link
Reference in a new issue