Commit 875e732f authored by Findit's avatar Findit

Revert "Add tentative WPT tests for stale while revalidate handling."

This reverts commit 05cdb4d1.

Reason for revert:

Findit (https://goo.gl/kROfz5) identified CL at revision 625228 as the
culprit for flakes in the build cycles as shown on:
https://findit-for-me.appspot.com/waterfall/flake/flake-culprit?key=ag9zfmZpbmRpdC1mb3ItbWVyQwsSDEZsYWtlQ3VscHJpdCIxY2hyb21pdW0vMDVjZGI0ZDFkOWNkYWEyZGYzZDkxY2Q5ZGMxNTBlZGE5MDNmZTM1Ygw

Sample Failed Build: https://ci.chromium.org/buildbot/chromium.linux/Linux%20Tests%20%28dbg%29%281%29/77482

Sample Failed Step: webkit_layout_tests

Sample Flaky Test: virtual/outofblink-cors-ns/external/wpt/fetch/stale-while-revalidate/stale-script.tentative.html

Original change's description:
> 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 loaded trigger a stale while revalidate
> cache hit and resource timing entries are correct.
> 
> The PR for the spec changes is here:
> https://github.com/whatwg/fetch/pull/853
> 
> BUG=348877
> 
> Change-Id: Ib07b98d0d2595b6b99857161f830343bf7516518
> Reviewed-on: https://chromium-review.googlesource.com/c/1383297
> Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
> Reviewed-by: Ben Kelly <wanderview@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#625228}

No-Presubmit: true
No-Tree-Checks: true
No-Try: true
BUG=348877

Change-Id: Ie11ef55a64fcf3e39781666b65a47bbd157f04a2
Reviewed-on: https://chromium-review.googlesource.com/c/1432937
Cr-Commit-Position: refs/heads/master@{#625497}
parent 529eb6e9
<!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>
import os.path
def main(request, response):
filename = "green-16x16.png"
for cookie in request.cookies.get_list('a'):
filename = "green-256x256.png"
path = os.path.join(os.path.dirname(__file__), "../../images", filename)
body = open(path, "rb").read()
response.add_required_headers = False
response.writer.write_status(200)
response.writer.write_header("content-length", len(body))
response.writer.write_header("Cache-Control", "private, max-age=0, stale-while-revalidate=10")
response.writer.write_header("content-type", "image/png")
response.writer.write_header("Set-Cookie", "a=b")
response.writer.end_headers()
response.writer.write(body)
<!DOCTYPE html>
<!---
Tentative test against:
https://github.com/whatwg/fetch/pull/853
-->
<meta charset="utf-8">
<title>Tests Stale While Revalidate works for images</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
async_test(t => {
window.onload = t.step_func(() => {
step_timeout(() => {
assert_equals(document.getElementById("firstimage").width, 16, "Width is 16");
var img2 = document.createElement("img");
img2.onload = t.step_func(() => {
var resources = performance.getEntriesByType("resource");
var count = 0;
for (var i=0; i < resources.length; i++) {
if (resources[i].name.indexOf('stale-image.py') != -1) {
count++;
}
}
// We shouldn't have the stale while revalidate resource load yet
// as it should be issued during an idle period.
assert_greater_than_equal(count, 1, "performance entries");
assert_equals(img.width, 16, "image dimension");
// Ensure that we get a performance resource entry for the stale
// while revalidate load.
var checkResult = () => {
var resources = performance.getEntriesByType("resource");
var count = 0;
for (var i=0; i < resources.length; i++) {
if (resources[i].name.indexOf('stale-image.py') != -1) {
count++;
}
}
if (count < 2) {
t.step_timeout(checkResult, 25);
return;
}
assert_equals(count, 2, "Performance count");
t.done();
};
t.step_timeout(checkResult, 25);
});
img2.src = "stale-image.py";
document.body.appendChild(img2);
}, 0);
});
}, 'Cache returns stale resource');
var img = document.createElement("img");
img.src = "stale-image.py";
img.id = "firstimage";
document.body.appendChild(img);
</script>
</body>
import random, string
def token():
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(20))
def main(request, response):
unique_id = token()
headers = [("Content-Type", "text/javascript"),
("Cache-Control", "private, max-age=0, stale-while-revalidate=10"),
("Token", unique_id)]
content = "report('{}')".format(unique_id)
return 200, headers, content
<!DOCTYPE html>
<!---
Tentative test against:
https://github.com/whatwg/fetch/pull/853
-->
<meta charset="utf-8">
<title>Tests Stale While Revalidate works for scripts</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
var last_modified;
var last_modified_count = 0;
// The script will call report via a uniquely generated ID on the subresource.
// If it is a cache hit the ID will be the same and the test will pass.
function report(mod) {
if (!last_modified) {
last_modified = mod;
last_modified_count = 1;
} else if (last_modified == mod) {
last_modified_count++;
}
}
async_test(t => {
window.onload = t.step_func(() => {
step_timeout(() => {
var script = document.createElement("script");
script.src = "stale-script.py";
document.body.appendChild(script);
script.onload = t.step_func(() => {
var resources = performance.getEntriesByType("resource");
var count = 0;
for (var i=0; i < resources.length; i++) {
if (resources[i].name.indexOf('stale-script.py') != -1) {
count++;
}
}
assert_greater_than_equal(count, 1, "performance entries");
assert_equals(last_modified_count, 2, "last modified");
// Ensure that we get a performance resource entry for the stale
// while revalidate load.
var checkResult = () => {
var resources = performance.getEntriesByType("resource");
var count = 0;
for (var i=0; i < resources.length; i++) {
if (resources[i].name.indexOf('stale-script.py') != -1) {
count++;
}
}
if (count < 2) {
t.step_timeout(checkResult, 25);
return;
}
assert_equals(count, 2, "Performance count");
t.done();
};
t.step_timeout(checkResult, 25);
});
}, 0);
});
}, 'Cache returns stale resource');
var script = document.createElement("script");
script.src = "stale-script.py";
document.body.appendChild(script);
</script>
</body>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment