зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1693354 [wpt PR 27662] - ResourceTiming: Cleanup resource_hash.htm, a=testonly
Automatic update from web-platform-tests ResourceTiming: Cleanup resource_hash.htm This change rewrites a ResourceTiming WPT to use the updated style and file naming conventions in wpt/resource-timing/CodingConventions.md Bug: 1171767 Change-Id: I00d44affaaa702598c39bbdadf5f14f5a5392b93 GithubIssue: https://github.com/w3c/resource-timing/issues/254 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2698854 Reviewed-by: Yoav Weiss <yoavweiss@chromium.org> Commit-Queue: Tom McKee <tommckee@chromium.org> Cr-Commit-Position: refs/heads/master@{#855731} -- wpt-commits: 29134beee3c9ca5f49f492ff2f90baa879496950 wpt-pr: 27662
This commit is contained in:
Родитель
1c35629602
Коммит
0358affa5e
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Resource Timing: PerformanceResourceTiming attributes</title>
|
||||
<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#sec-performanceresourcetiming"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
|
||||
// Returns a promise that settles once the given path has been fetched.
|
||||
function load_image(path) {
|
||||
return new Promise(resolve => {
|
||||
const img = new Image();
|
||||
img.onload = img.onerror = resolve;
|
||||
img.src = path;
|
||||
});
|
||||
}
|
||||
|
||||
promise_test(async () => {
|
||||
// Clean up entries from scripts includes.
|
||||
performance.clearResourceTimings();
|
||||
await load_image("resources/fake_responses.py#hash=1");
|
||||
const entry_list = performance.getEntriesByType("resource");
|
||||
if (entry_list.length != 1) {
|
||||
throw new Error("There should be one entry for one resource");
|
||||
}
|
||||
assert_true(entry_list[0].name.includes('#hash=1'),
|
||||
"There should be a hash in the resource name");
|
||||
}, "URL fragments should be present in the 'name' attribute");
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates that PerformanceResourceTiming entries' attributes are
|
||||
populated with the correct values.</p>
|
||||
</body>
|
||||
</html>
|
|
@ -1,44 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Resource Timing: image with a hash</title>
|
||||
<link rel="help" href="http://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});
|
||||
|
||||
// explicitly test the namespace before we start testing
|
||||
test_namespace("getEntriesByType");
|
||||
|
||||
function onload_test() {
|
||||
if (window.performance.getEntriesByType === undefined) {
|
||||
done();
|
||||
return;
|
||||
}
|
||||
|
||||
const url = "resources/fake_responses.py?tag=" + Math.random() + '#hash=1';
|
||||
const image = new Image();
|
||||
image.onload = image.onerror = () => {
|
||||
const entries = window.performance.getEntriesByType('resource').filter(r => r.initiatorType === 'img');
|
||||
test_equals(entries.length, 1, "There should be one entry");
|
||||
if (entries.length === 1) {
|
||||
test_true(entries[0].name.indexOf('#hash=1') > -1, "There should be a hash in the resource name");
|
||||
}
|
||||
done();
|
||||
|
||||
}
|
||||
image.src = url;
|
||||
}
|
||||
window.onload = onload_test;
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates that a hash in an image URL is preserved in resource timing API results.</p>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче