-
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 1523562 [wpt PR 15047] - Reland add tentative WPT tests for stale…
… while revalidate handling., a=testonly Automatic update from web-platform-tests Reland add tentative WPT tests for stale while revalidate handling. Add test to ensure that handling the fetch doesn't trigger stale while revalidate loading. Add test to ensure that scripts and css loaded trigger a stale while revalidate cache hit. The PR for the spec changes is here: whatwg/fetch#853 This reland removes the resource timing and moves to css (instead of images) which were both unreliable. BUG=348877 Change-Id: Ibabd8d3fd0295bedc8259594fc926da6ab5cfc43 Reviewed-on: https://chromium-review.googlesource.com/c/1434776 Commit-Queue: Dave Tapuska <dtapuskachromium.org> Reviewed-by: Ben Kelly <wanderviewchromium.org> Cr-Commit-Position: refs/heads/master{#626264} -- wpt-commits: f8a34bc8fa3a9451717c974108d677e319243ded wpt-pr: 15047 UltraBlame original commit: 53cc2cd5c20c298cc1d7b855d0053fe58856bc10
- Loading branch information
Showing
7 changed files
with
2,170 additions
and
0 deletions.
There are no files selected for viewing
171 changes: 171 additions & 0 deletions
171
testing/web-platform/tests/fetch/stale-while-revalidate/fetch.tentative.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,171 @@ | ||
< | ||
! | ||
DOCTYPE | ||
html | ||
> | ||
< | ||
! | ||
- | ||
- | ||
- | ||
Tentative | ||
test | ||
against | ||
: | ||
https | ||
: | ||
/ | ||
/ | ||
github | ||
. | ||
com | ||
/ | ||
whatwg | ||
/ | ||
fetch | ||
/ | ||
pull | ||
/ | ||
853 | ||
- | ||
- | ||
> | ||
< | ||
meta | ||
charset | ||
= | ||
" | ||
utf | ||
- | ||
8 | ||
" | ||
> | ||
< | ||
title | ||
> | ||
Tests | ||
Stale | ||
While | ||
Revalidate | ||
is | ||
not | ||
executed | ||
for | ||
fetch | ||
API | ||
< | ||
/ | ||
title | ||
> | ||
< | ||
script | ||
src | ||
= | ||
" | ||
/ | ||
resources | ||
/ | ||
testharness | ||
. | ||
js | ||
" | ||
> | ||
< | ||
/ | ||
script | ||
> | ||
< | ||
script | ||
src | ||
= | ||
" | ||
/ | ||
resources | ||
/ | ||
testharnessreport | ||
. | ||
js | ||
" | ||
> | ||
< | ||
/ | ||
script | ||
> | ||
< | ||
script | ||
> | ||
promise_test | ||
( | ||
async | ||
( | ||
test | ||
) | ||
= | ||
> | ||
{ | ||
const | ||
response | ||
= | ||
await | ||
fetch | ||
( | ||
stale | ||
- | ||
script | ||
. | ||
py | ||
) | ||
; | ||
const | ||
response2 | ||
= | ||
await | ||
fetch | ||
( | ||
stale | ||
- | ||
script | ||
. | ||
py | ||
) | ||
; | ||
assert_not_equals | ||
( | ||
response | ||
. | ||
headers | ||
. | ||
get | ||
( | ||
' | ||
Token | ||
' | ||
) | ||
response2 | ||
. | ||
headers | ||
. | ||
get | ||
( | ||
' | ||
Token | ||
' | ||
) | ||
) | ||
; | ||
} | ||
' | ||
Second | ||
fetch | ||
does | ||
not | ||
return | ||
same | ||
response | ||
' | ||
) | ||
; | ||
< | ||
/ | ||
script | ||
> |
192 changes: 192 additions & 0 deletions
192
testing/web-platform/tests/fetch/stale-while-revalidate/stale-css.py
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,192 @@ | ||
def | ||
main | ||
( | ||
request | ||
response | ||
) | ||
: | ||
|
||
cookie | ||
= | ||
request | ||
. | ||
cookies | ||
. | ||
first | ||
( | ||
" | ||
Count | ||
" | ||
None | ||
) | ||
|
||
count | ||
= | ||
0 | ||
|
||
if | ||
cookie | ||
! | ||
= | ||
None | ||
: | ||
|
||
count | ||
= | ||
int | ||
( | ||
cookie | ||
. | ||
value | ||
) | ||
|
||
if | ||
request | ||
. | ||
GET | ||
. | ||
first | ||
( | ||
" | ||
query | ||
" | ||
None | ||
) | ||
! | ||
= | ||
None | ||
: | ||
|
||
headers | ||
= | ||
[ | ||
( | ||
" | ||
Count | ||
" | ||
count | ||
) | ||
] | ||
|
||
content | ||
= | ||
" | ||
" | ||
|
||
return | ||
200 | ||
headers | ||
content | ||
|
||
else | ||
: | ||
|
||
count | ||
= | ||
count | ||
+ | ||
1 | ||
|
||
content | ||
= | ||
" | ||
body | ||
{ | ||
background | ||
: | ||
rgb | ||
( | ||
0 | ||
128 | ||
0 | ||
) | ||
; | ||
} | ||
" | ||
|
||
if | ||
count | ||
> | ||
1 | ||
: | ||
|
||
content | ||
= | ||
" | ||
body | ||
{ | ||
background | ||
: | ||
rgb | ||
( | ||
255 | ||
0 | ||
0 | ||
) | ||
; | ||
} | ||
" | ||
|
||
headers | ||
= | ||
[ | ||
( | ||
" | ||
Content | ||
- | ||
Type | ||
" | ||
" | ||
text | ||
/ | ||
css | ||
" | ||
) | ||
|
||
( | ||
" | ||
Set | ||
- | ||
Cookie | ||
" | ||
" | ||
Count | ||
= | ||
{ | ||
} | ||
" | ||
. | ||
format | ||
( | ||
count | ||
) | ||
) | ||
|
||
( | ||
" | ||
Cache | ||
- | ||
Control | ||
" | ||
" | ||
private | ||
max | ||
- | ||
age | ||
= | ||
0 | ||
stale | ||
- | ||
while | ||
- | ||
revalidate | ||
= | ||
10 | ||
" | ||
) | ||
] | ||
|
||
return | ||
200 | ||
headers | ||
content |
Oops, something went wrong.