-
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 1689388 [wpt PR 27367] - Updates for TAO-null-opaque-origin.sub.h…
…tml, a=testonly Automatic update from web-platform-tests Updates for TAO-null-opaque-origin.sub.html We want to normalize and update our WPT tests for ResourceTiming. This change uses - 'promise_test' instead of 'async_test' - 'fetch_tests_from_window' instead of hand-rolled 'PostMessage' calls as well as some other small cleanups. Bug: 1171767 Change-Id: Id71c0eef898ffb4982785f01edd2a4df9b1bfbba GitHubIssue: w3c/resource-timing#254 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2656419 Commit-Queue: Tom McKee <[email protected]> Reviewed-by: Yoav Weiss <[email protected]> Cr-Commit-Position: refs/heads/master@{#848574} -- wpt-commits: 1f6bc471fb537e733703cce3283fbb4d7f47547b wpt-pr: 27367
- Loading branch information
1 parent
5c87e53
commit 31ad885
Showing
3 changed files
with
56 additions
and
43 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
testing/web-platform/tests/resource-timing/TAO-null-opaque-origin.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,55 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Resource Timing TAO - "null" and opaque origin</title> | ||
<link rel="author" title="Google" href="http://www.google.com/" /> | ||
<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#timing-allow-origin"/> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/common/get-host-info.sub.js"></script> | ||
</head> | ||
<body> | ||
<h1>Description</h1> | ||
<p>This test validates that, for a cross origin resource, the timing allow | ||
check algorithm will succeed when the value of Timing-Allow-Origin is null and | ||
the origin is an opaque origin.</p> | ||
<div id="log"></div> | ||
<iframe id="frameContext"></iframe> | ||
<script> | ||
const origin = get_host_info()["ORIGIN"]; | ||
const frame_content = `data:text/html;utf8,<body> | ||
<script src="${origin}/resources/testharness.js"></` + `script> | ||
<script> | ||
const url = "${origin}/resource-timing/resources/TAOResponse.py?tao=null"; | ||
promise_test(() => { return new Promise((resolve, reject) => { | ||
const run_test = entryList => { | ||
const entry = entryList.getEntries()[0]; | ||
const sum = entry.redirectStart + entry.redirectEnd + | ||
entry.domainLookupStart + entry.domainLookupEnd + | ||
entry.connectStart + entry.connectEnd + | ||
entry.secureConnectionStart + entry.requestStart + | ||
entry.responseStart + entry.transferSize + | ||
entry.encodedBodySize + entry.decodedBodySize; | ||
assert_not_equals(sum, 0, "Timings must be non-zero"); | ||
}; | ||
const observer = new PerformanceObserver(list => { | ||
try { | ||
run_test(list); | ||
resolve(); | ||
} catch(e) { | ||
reject(e); | ||
} | ||
}); | ||
observer.observe({ entryTypes: ["resource"] }); | ||
fetch(url); | ||
})}, "An opaque origin should be authorized to see resource timings when" + | ||
" the TAO header is the string 'null'"); | ||
</` + `script></body>`; | ||
|
||
frameContext.style = "display:none" | ||
frameContext.src = frame_content; | ||
fetch_tests_from_window(frameContext.contentWindow); | ||
</script> | ||
</body> | ||
</html> |
42 changes: 0 additions & 42 deletions
42
testing/web-platform/tests/resource-timing/TAO-null-opaque-origin.sub.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