mirror of
https://github.com/servo/servo.git
synced 2025-09-10 15:08:21 +01:00
Update web-platform-tests to revision 2d42384cf21efd71843295d319c1bab85b3acf4a
This commit is contained in:
parent
f2b224d610
commit
e851ef0cd2
1014 changed files with 5653 additions and 1590 deletions
|
@ -3,9 +3,23 @@
|
|||
<title>Make sure that resources fetched by cross origin CSS are not in the timeline.</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
<body>
|
||||
<!-- The stylesheet is fetched from http://www1.web–platform.test:64941/resource-timing/resources/nested.css -->
|
||||
<link rel=stylesheet id=cross_origin_style href="//{{domains[www1]}}:{{ports[http][1]}}{{location[path]}}/../resources/nested.css">
|
||||
<script>
|
||||
const host = get_host_info();
|
||||
|
||||
const link = document.createElement("LINK");
|
||||
link.rel = "stylesheet";
|
||||
link.id = "cross_origin_style";
|
||||
|
||||
/*
|
||||
This stylesheet is fetched from one of:
|
||||
//www1.web–platform.test:64941/resource-timing/resources/nested.css
|
||||
//127.0.0.1:64941/resource-timing/resources/nested.css
|
||||
*/
|
||||
link.href = "//" + host.REMOTE_HOST + ":{{ports[http][1]}}{{location[path]}}/../resources/nested.css"
|
||||
document.currentScript.parentNode.insertBefore(link, document.currentScript);
|
||||
</script>
|
||||
<script>
|
||||
const t = async_test("Make sure that resources fetched by cross origin CSS are not in the timeline.");
|
||||
window.addEventListener("load", function() {
|
||||
|
@ -17,7 +31,7 @@
|
|||
assert_equals(performance.getEntriesByName(prefix + "/fonts/Ahem.ttf?id=n1").length, 0, "Font should not be in timeline");
|
||||
assert_equals(performance.getEntriesByName(prefix + "/resource-timing/resources/blue.png?id=n1").length, 0, "Image should not be in timeline");
|
||||
t.done();
|
||||
},100);
|
||||
}, 200);
|
||||
});
|
||||
</script>
|
||||
<ol>Some content</ol>
|
||||
|
|
|
@ -21,7 +21,6 @@ test_namespace('getEntriesByType');
|
|||
function setup_iframe() {
|
||||
iframe = document.getElementById('frameContext');
|
||||
d = iframe.contentWindow.document;
|
||||
iframeBody = d.body;
|
||||
iframe.addEventListener('load', onload_test, false);
|
||||
}
|
||||
|
||||
|
@ -41,10 +40,11 @@ function onload_test() {
|
|||
const entry = entries[1];
|
||||
test_equals(entry.fetchStart, entry.connectStart, 'connectStart and fetchStart should be the same');
|
||||
test_equals(entry.fetchStart, entry.connectEnd, 'connectEnd and fetchStart should be the same');
|
||||
test_equals(entry.fetchStart, entry.secureConnectionStart, 'secureConnectStart and fetchStart should be the same');
|
||||
if(!window.isSecureConnection) {
|
||||
test_equals(entry.secureConnectionStart, 0, 'secureConnectStart should be zero');
|
||||
}
|
||||
test_equals(entry.fetchStart, entry.domainLookupStart, 'domainLookupStart and fetchStart should be the same')
|
||||
test_equals(entry.fetchStart, entry.domainLookupEnd, 'domainLookupEnd and fetchStart should be the same')
|
||||
|
||||
}
|
||||
|
||||
done();
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Resource Timing connection reuse</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="https://www.w3.org/TR/resource-timing/#dom-performanceresourcetiming-initiatortype"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/webperftestharness.js"></script>
|
||||
<script src="resources/webperftestharnessextension.js"></script>
|
||||
<script>
|
||||
setup({explicit_done: true});
|
||||
let iframe;
|
||||
let d;
|
||||
let body;
|
||||
|
||||
// Explicitly test the namespace before we start testing.
|
||||
test_namespace('getEntriesByType');
|
||||
|
||||
function setup_iframe() {
|
||||
iframe = document.getElementById('frameContext');
|
||||
d = iframe.contentWindow.document;
|
||||
iframe.addEventListener('load', onload_test, false);
|
||||
}
|
||||
|
||||
function onload_test() {
|
||||
if (window.performance.getEntriesByType === undefined) {
|
||||
done();
|
||||
return;
|
||||
}
|
||||
const context = new PerformanceContext(iframe.contentWindow.performance);
|
||||
const entries = context.getEntriesByType('resource');
|
||||
|
||||
// When a persistent connection is used, follow-on resources should be included as PerformanceResourceTiming objects.
|
||||
test_equals(entries.length, 2, 'There should be 2 PerformanceEntries');
|
||||
|
||||
if (entries.length >= 2) {
|
||||
// When a persistent connection is used, for the resource that reuses the socket, connectStart and connectEnd should have the same value as fetchStart.
|
||||
const entry = entries[1];
|
||||
test_equals(entry.fetchStart, entry.connectStart, 'connectStart and fetchStart should be the same');
|
||||
test_equals(entry.fetchStart, entry.connectEnd, 'connectEnd and fetchStart should be the same');
|
||||
test_equals(entry.fetchStart, entry.secureConnectionStart, 'secureConnectStart and fetchStart should be the same');
|
||||
test_equals(entry.fetchStart, entry.domainLookupStart, 'domainLookupStart and fetchStart should be the same')
|
||||
test_equals(entry.fetchStart, entry.domainLookupEnd, 'domainLookupEnd and fetchStart should be the same')
|
||||
}
|
||||
|
||||
done();
|
||||
}
|
||||
|
||||
window.setup_iframe = setup_iframe;
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates that connectStart and connectEnd are the same when a connection is reused (e.g. when a persistent connection is used).</p>
|
||||
<div id="log"></div>
|
||||
<iframe id="frameContext" src="resources/fake_responses.html"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -9,24 +9,26 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/webperftestharness.js"></script>
|
||||
<script src="resources/webperftestharnessextension.js"></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
<script>
|
||||
setup({explicit_done: true});
|
||||
let d;
|
||||
let iframe;
|
||||
let iframeBody;
|
||||
let count = 0;
|
||||
const host = get_host_info();
|
||||
function onload_prep() {
|
||||
iframe = document.getElementById('frameContext');
|
||||
d = iframe.contentWindow.document;
|
||||
iframeBody = d.body;
|
||||
|
||||
const image = d.createElement('img');
|
||||
const image = d.createElement('IMG');
|
||||
image.addEventListener('load', function() {
|
||||
step_timeout(onload_test, 0); });
|
||||
image.src = 'blue.png?id=cached';
|
||||
iframeBody.appendChild(image);
|
||||
|
||||
const image2 = d.createElement('img');
|
||||
const image2 = d.createElement('IMG');
|
||||
image2.addEventListener('load', function() {
|
||||
step_timeout(onload_test, 0); });
|
||||
image2.src = 'blue.png?id=cached';
|
||||
|
@ -55,16 +57,16 @@ function onload_test() {
|
|||
start_crossorigin_test();
|
||||
}
|
||||
function start_crossorigin_test() {
|
||||
const image3 = d.createElement('img');
|
||||
const image3 = d.createElement('IMG');
|
||||
image3.addEventListener("load", function() { step_timeout(finish_crossorigin_test, 0); });
|
||||
image3.src = 'http://{{domains[www1]}}:{{ports[http][1]}}{{location[path]}}/../resources/blue.png?id=cached';
|
||||
image3.src = 'http://' + host.REMOTE_HOST + ':{{ports[http][1]}}{{location[path]}}/../resources/blue.png?id=cached';
|
||||
iframeBody.appendChild(image3);
|
||||
}
|
||||
function finish_crossorigin_test() {
|
||||
const context = new PerformanceContext(iframe.contentWindow.performance);
|
||||
const entries = context.getEntriesByType('resource');
|
||||
test_equals(entries.length, 1, 'There should be one entry in second test');
|
||||
test_true(entries[0].name.startsWith('http://{{domains[www1]}}:{{ports[http][1]}}'), 'Entry name should start with cross-origin domain');
|
||||
test_true(entries[0].name.startsWith('http://' + host.REMOTE_HOST + ':{{ports[http][1]}}'), 'Entry name should start with cross-origin domain');
|
||||
test_true(entries[0].name.endsWith('/resources/blue.png?id=cached'), 'Entry name should end with file name');
|
||||
test_equals(entries[0].requestStart, 0, 'requestStart should be 0 on the cross-origin request');
|
||||
done();
|
||||
|
@ -79,6 +81,10 @@ window.addEventListener('load', onload_prep);
|
|||
<div id="log"></div>
|
||||
<iframe id="frameContext" src="resources/inject_resource_test.html"></iframe>
|
||||
<img src="resources/blue.png?id=cached"></img>
|
||||
<img src="http://{{domains[www1]}}:{{ports[http][1]}}{{location[path]}}/../resources/blue.png?id=cached"></img>
|
||||
<script>
|
||||
const img = document.createElement('IMG');
|
||||
img.src = "http://" + host.REMOTE_HOST + ":{{ports[http][1]}}{{location[path]}}/../resources/blue.png?id=cached";
|
||||
document.currentScript.parentNode.insertBefore(img, document.currentScript);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue