Commit 5ec7f215 authored by Kouhei Ueno's avatar Kouhei Ueno Committed by Commit Bot

SignedExchange: Add wpts to test interactions with appcache

We add two tests:
- SXG served by appcache should load (this doesn't yet pass in Chromium)
- SXG should take precedence when there's content in both appcache+sxg-inner-resp

Bug: 940797
Change-Id: Id1463b92f22ab04859ca3f075ca0340225f00694
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1516533
Commit-Queue: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: default avatarTsuyoshi Horo <horo@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#642423}
parent 7162f6b2
......@@ -6101,6 +6101,9 @@ crbug.com/938884 [ Win7 Mac ] virtual/binary-for-devtools/http/tests/devtools/el
crbug.com/931533 media/video-played-collapse.html [ Pass Failure ]
crbug.com/931533 virtual/video-surface-layer/media/video-played-collapse.html [ Pass Failure ]
crbug.com/940797 external/wpt/signed-exchange/appcache/sxg-served-from-appcache.tentative.https.html [ Pass Failure ]
crbug.com/940797 virtual/sxg-with-network-service/external/wpt/signed-exchange/appcache/sxg-served-from-appcache.tentative.https.html [ Pass Failure ]
# Flaky failures due to <object> resources not always appearing in the timeline.
crbug.com/941482 external/wpt/resource-timing/nested-context-navigations.html [ Pass Failure ]
......@@ -6135,4 +6138,3 @@ crbug.com/938592 virtual/gpu/fast/canvas/fillrect_gradient.html [ Pass Failure T
#
# Trooper 2019-03-19
crbug.com/836242 [ Mac ] external/wpt/shadow-dom/untriaged/html-elements-in-shadow-trees/html-forms/test-003.html [ Pass Failure ]
......@@ -804,4 +804,5 @@ CSS-COLLIDING-REF-NAME: css/vendor-imports/mozilla/mozilla-central-reftests/cont
# Signed Exchange files have hard-coded URLs in the certUrl field
WEB-PLATFORM.TEST:signed-exchange/resources/*.sxg
WEB-PLATFORM.TEST:signed-exchange/appcache/resources/*.sxg
WEB-PLATFORM.TEST:signed-exchange/resources/generate-test-sxgs.sh
CACHE MANIFEST
resources/appcached-url.html
resources/sxg/sxg-location.sxg
<!DOCTYPE html>
<title>Content of appcached URL</title>
<script>
window.addEventListener('message', (event) => {
event.data.port.postMessage({
location: document.location.href,
referrer: document.referrer,
appcacheContent: false});
}, false);
</script>
<!DOCTYPE html>
<title>Content of appcached URL</title>
<script>
window.addEventListener('message', (event) => {
event.data.port.postMessage({
location: document.location.href,
referrer: document.referrer,
appcacheContent: true});
}, false);
</script>
<!DOCTYPE html>
<title>Content of fallback URL</title>
<script>
window.addEventListener('message', (event) => {
event.data.port.postMessage({
location: document.location.href,
referrer: document.referrer,
is_fallback: true});
}, false);
</script>
Content-Type: application/signed-exchange;v=b3
X-Content-Type-Options: nosniff
<html manifest="appcache.manifest">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="../resources/sxg-util.js"></script>
<script>
const cache_ready = new Promise(resolve => {
['cached','noupdate'].forEach(event_name => {
window.applicationCache.addEventListener(event_name, resolve);
});
});
promise_test(async (t) => {
await cache_ready;
const sxgUrl = get_host_info().HTTPS_ORIGIN + '/signed-exchange/appcache/resources/sxg/sxg-appcached.sxg';
const message = await openSXGInIframeAndWaitForMessage(t, sxgUrl);
assert_equals(message.location, innerURLOrigin() + '/signed-exchange/appcache/resources/appcached-url.html');
assert_false(message.appcacheContent);
}, 'SignedHTTPExchange inner resp should take precedence to appcache.');
</script>
<html manifest="appcache.manifest">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="../resources/sxg-util.js"></script>
<script>
const cache_ready = new Promise(resolve => {
['cached','noupdate'].forEach(event_name => {
window.applicationCache.addEventListener(event_name, resolve);
});
});
promise_test(async (t) => {
await cache_ready;
const sxgUrl = get_host_info().HTTPS_ORIGIN + '/signed-exchange/appcache/resources/sxg/sxg-location.sxg';
const message = await openSXGInIframeAndWaitForMessage(t, sxgUrl);
assert_equals(message.location, innerURLOrigin() + '/signed-exchange/appcache/resources/inner-url.html');
assert_false(message.is_fallback);
}, 'SignedHTTPExchange cached in appcache should work.');
</script>
......@@ -43,6 +43,37 @@ gen-signedexchange \
-o sxg/sxg-location.sxg \
-miRecordSize 100
# A valid Signed Exchange for appcache test.
gen-signedexchange \
-version $sxg_version \
-uri $inner_url_origin/signed-exchange/appcache/resources/inner-url.html \
-status 200 \
-content sxg-location.html \
-certificate $certfile \
-certUrl $cert_url_origin/signed-exchange/resources/$certfile.cbor \
-validityUrl $inner_url_origin/signed-exchange/resources/resource.validity.msg \
-privateKey $keyfile \
-date 2018-04-01T00:00:00Z \
-expire 168h \
-o ../appcache/resources/sxg/sxg-location.sxg \
-miRecordSize 100
# A valid Signed Exchange for appcache test
# - appcache and the sxg inner resp both provide the content for the url
gen-signedexchange \
-version $sxg_version \
-uri $inner_url_origin/signed-exchange/appcache/resources/appcached-url.html \
-status 200 \
-content ../appcache/resources/appcached-url-in-sxg.html \
-certificate $certfile \
-certUrl $cert_url_origin/signed-exchange/resources/$certfile.cbor \
-validityUrl $inner_url_origin/signed-exchange/resources/resource.validity.msg \
-privateKey $keyfile \
-date 2018-04-01T00:00:00Z \
-expire 168h \
-o ../appcache/resources/sxg/sxg-appcached.sxg \
-miRecordSize 100
# A valid Signed Exchange. The origin of certUrl is the "alt" origin where NEL
# policy is installed in reporting tests.
gen-signedexchange \
......
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