Skip to content

Commit

Permalink
[ResourceTiming]: Add WPT for same-origin redirect
Browse files Browse the repository at this point in the history
The spec requires that attributes of the PerformanceResourceTiming
entries take on certain values when the underlying resource was fetched
through an HTTP redirect.

This change adds tests to validate
  - startTime
  - redirectStart
  - redirectEnd
  - fetchStart
  - domainLookupStart
  - domainLookupEnd
  - connectStart

Bug: 1171767
Change-Id: Ia422c25aa9c6da55b318c7e21a1839359d104d82
GithubIssue: w3c/resource-timing#254
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2736074
Commit-Queue: Tom McKee <[email protected]>
Reviewed-by: Yoav Weiss <[email protected]>
Cr-Commit-Position: refs/heads/master@{#861551}
GitOrigin-RevId: af288bf3c15b2d3d01a0bef1672ade6146ffff55
  • Loading branch information
tommckee1 authored and copybara-github committed Mar 10, 2021
1 parent 44d6548 commit 6f88ed6
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions blink/web_tests/external/wpt/resource-timing/entry-attributes.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,24 @@
]);
}

function assert_same_origin_redirected_resource(entry) {
assert_positive(entry, [
"redirectStart",
]);

assert_equals(entry.redirectStart, entry.startTime,
"redirectStart should be equal to startTime");

assert_ordered(entry, [
"redirectStart",
"redirectEnd",
"fetchStart",
"domainLookupStart",
"domainLookupEnd",
"connectStart",
]);
}

// Given a resource-loader and a PerformanceResourceTiming validator, loads a
// resource and validates the resulting entry.
function attribute_test(load_resource, validate, test_label) {
Expand Down Expand Up @@ -126,6 +144,10 @@
assert_http_resource,
"Font resources should generate conformant entries");

attribute_test(
() => load_image("/common/redirect.py?location=resources/fake_responses.py"),
assert_same_origin_redirected_resource,
"Same-origin redirects should populate redirectStart/redirectEnd");
</script>
</head>
<body>
Expand Down

0 comments on commit 6f88ed6

Please sign in to comment.