-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1728673 [wpt PR 30292] - [ResourceTiming]: Update resource_cached…
….html to follow the new style, a=testonly Automatic update from web-platform-tests [ResourceTiming]: Update resource_cached.html to follow the new style This change updates the named test to conform to the new style described in wpt/resource-timing/CodingConventions.md. GithubIssue: w3c/resource-timing#254 Bug: 1171767 Change-Id: Iba63250828c33df477852aeddd1b1e1cf49f88c2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3138593 Reviewed-by: Yoav Weiss <yoavweiss@chromium.org> Commit-Queue: Tom McKee <tommckee@chromium.org> Cr-Commit-Position: refs/heads/main@{#917665} -- wpt-commits: 9888b4153005f30dc493eddcb50fa800a24c3d7f wpt-pr: 30292
- Loading branch information
1 parent
98d4dac
commit f38f0a3
Showing
3 changed files
with
59 additions
and
53 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
testing/web-platform/tests/resource-timing/304-response-recorded.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Resource Timing - cached resources generate performance entries</title> | ||
<link rel="author" title="Google" href="http://www.google.com/" /> | ||
<link rel="help" | ||
href="https://www.w3.org/TR/resource-timing-2/#resources-included-in-the-performanceresourcetiming-interface"/> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="resources/entry-invariants.js"></script> | ||
<script src="resources/resource-loaders.js"></script> | ||
</head> | ||
<body> | ||
<h1>Description</h1> | ||
<p>This test validates that a 304 Not Modified resource appears in the | ||
Performance Timeline.</p> | ||
<script> | ||
// Need to fetch the same resource twice; the first will get a 200 response but | ||
// the second request should be cached and get a 304. | ||
promise_test(async () => { | ||
performance.clearResourceTimings(); | ||
|
||
const unique = Math.random(); | ||
const path = `resources/fake_responses.py?tag=${unique}`; | ||
|
||
await load.xhr_sync(path); | ||
await load.xhr_sync(path, {"If-None-Match": `${unique}`}); | ||
const entries = await new Promise(resolve => { | ||
const accumulator = []; | ||
new PerformanceObserver(entry_list => { | ||
entry_list.getEntries().forEach(entry => { | ||
accumulator.push(entry); | ||
}); | ||
if (accumulator.length >= 2) { | ||
resolve(accumulator); | ||
} | ||
}).observe({'type': 'resource', 'buffered': true}); | ||
}); | ||
|
||
|
||
if (entries.length != 2) { | ||
throw new Error(`Expecting 2 but got ${entries.length} entries`); | ||
} | ||
|
||
assert_equals(entries[0].name, entries[1].name, | ||
"Both entries should have the same name"); | ||
invariants.assert_tao_pass_no_redirect_http(entries[0]); | ||
invariants.assert_tao_pass_304_not_modified_http(entries[1]); | ||
}, "304 responses should still show up in the PerformanceTimeline"); | ||
</script> | ||
</body> | ||
</html> |
52 changes: 0 additions & 52 deletions
52
testing/web-platform/tests/resource-timing/resource_cached.html
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters