Skip to content

Commit

Permalink
Split sxg-referrer.tentative.https.html
Browse files Browse the repository at this point in the history
This test is too big. So sometimes timeouts on bots.
https://test-results.appspot.com/dashboards/flakiness_dashboard.html#testType=webkit_layout_tests&tests=sxg-referrer.tentative.https.html

Bug: 924752
Change-Id: I3c1df411fadef9f9d67aa41bdf7231aed11f1497
Reviewed-on: https://chromium-review.googlesource.com/c/1433257
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Tsuyoshi Horo <horo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#625552}
  • Loading branch information
horo-t authored and Commit Bot committed Jan 24, 2019
1 parent 50f6ce8 commit fe2a6a4
Show file tree
Hide file tree
Showing 8 changed files with 350 additions and 288 deletions.
4 changes: 0 additions & 4 deletions third_party/blink/web_tests/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -5972,7 +5972,3 @@ crbug.com/v8/8319 external/wpt/wasm/jsapi/memory/grow.any.worker.html [ Pass Fai
# Sheriff 2019-01-22
# Likely needs a rebaseline
crbug.com/921242 [ Mac ] fast/overflow/clip-rects-fixed-ancestor.html [ Failure ]

# Sheriff 2019-01-24
crbug.com/924752 external/wpt/signed-exchange/sxg-referrer.tentative.https.html [ Timeout Pass ]
crbug.com/924752 virtual/sxg-with-network-service/external/wpt/signed-exchange/sxg-referrer.tentative.https.html [ Timeout Pass ]
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,27 @@ function loadScript(url) {
function innerURLOrigin() {
return 'https://127.0.0.1:8444';
}

function runReferrerTests(test_cases) {
for (const i in test_cases) {
const test_case = test_cases[i];
promise_test(async (t) => {
const sxgUrl = test_case.origin + '/signed-exchange/resources/sxg/' +
test_case.sxg;
const message =
await openSXGInIframeAndWaitForMessage(
t, sxgUrl, test_case.referrerPolicy);
assert_false(message.is_fallback);
assert_equals(message.referrer, test_case.expectedReferrer);

const invalidSxgUrl =
test_case.origin + '/signed-exchange/resources/sxg/invalid-' +
test_case.sxg;
const fallbackMessage =
await openSXGInIframeAndWaitForMessage(
t, invalidSxgUrl, test_case.referrerPolicy);
assert_true(fallbackMessage.is_fallback);
assert_equals(fallbackMessage.referrer, test_case.expectedReferrer);
}, 'Referrer of SignedHTTPExchange test : ' + JSON.stringify(test_case));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<!DOCTYPE html>
<title>Referrer-Policy header in outer SXG response</title>
<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>
<body>
<script>
(() => {
const SAME_ORIGIN = get_host_info().HTTPS_ORIGIN;
const SAME_ORIGIN_SXG = 'sxg-referrer-same-origin.sxg';
const TEST_CASES = [
// Referrer-Policy header in outer SXG response.
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG + '?pipe=header(Referrer-Policy,no-referrer)',
referrerPolicy: undefined,
expectedReferrer: ''
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG +
'?pipe=header(Referrer-Policy,no-referrer-when-downgrade)',
referrerPolicy: undefined,
expectedReferrer: document.location.href
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG + '?pipe=header(Referrer-Policy,origin)',
referrerPolicy: undefined,
expectedReferrer: document.location.origin + '/'
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG + '?pipe=header(Referrer-Policy,same-origin)',
referrerPolicy: undefined,
expectedReferrer: document.location.href
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG + '?pipe=header(Referrer-Policy,strict-origin)',
referrerPolicy: undefined,
expectedReferrer: document.location.origin + '/'
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG +
'?pipe=header(Referrer-Policy,strict-origin-when-cross-origin)',
referrerPolicy: undefined,
expectedReferrer: document.location.href
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG + '?pipe=header(Referrer-Policy,unsafe-url)',
referrerPolicy: undefined,
expectedReferrer: document.location.href
},
];
runReferrerTests(TEST_CASES);
})();
</script>
</body>
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!DOCTYPE html>
<title>Referrer of SignedHTTPExchange(physical:remote origin, logical:remote origin)</title>
<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>
<body>
<script>
(() => {
const REMOTE_ORIGIN = get_host_info().HTTPS_REMOTE_ORIGIN;
const REMOTE_ORIGIN_SXG = 'sxg-referrer-remote-origin.sxg';
const TEST_CASES = [
// Physical origin = remote origin. Logical origin = remote origin.
{
origin: REMOTE_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: undefined,
expectedReferrer: document.location.href
},
{
origin: REMOTE_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'no-referrer',
expectedReferrer: ''
},
{
origin: REMOTE_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'no-referrer-when-downgrade',
expectedReferrer: document.location.href
},
{
origin: REMOTE_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'origin',
expectedReferrer: document.location.origin + '/'
},
{
origin: REMOTE_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'same-origin',
expectedReferrer: ''
},
{
origin: REMOTE_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'strict-origin',
expectedReferrer: document.location.origin + '/'
},
{
origin: REMOTE_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'strict-origin-when-cross-origin',
expectedReferrer: document.location.origin + '/'
},
{
origin: REMOTE_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'unsafe-url',
expectedReferrer: document.location.href
},
];
runReferrerTests(TEST_CASES);
})();
</script>
</body>
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!DOCTYPE html>
<title>Referrer of SignedHTTPExchange(physical:remote origin, logical:same origin)</title>
<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>
<body>
<script>
(() => {
const REMOTE_ORIGIN = get_host_info().HTTPS_REMOTE_ORIGIN;
const SAME_ORIGIN_SXG = 'sxg-referrer-same-origin.sxg';
const TEST_CASES = [
// Physical origin = remote origin. Logical origin = same origin.
{
origin: REMOTE_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: undefined,
expectedReferrer: document.location.href
},
{
origin: REMOTE_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'no-referrer',
expectedReferrer: ''
},
{
origin: REMOTE_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'no-referrer-when-downgrade',
expectedReferrer: document.location.href
},
{
origin: REMOTE_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'origin',
expectedReferrer: document.location.origin + '/'
},
{
origin: REMOTE_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'same-origin',
expectedReferrer: ''
},
{
origin: REMOTE_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'strict-origin',
expectedReferrer: document.location.origin + '/'
},
{
origin: REMOTE_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'strict-origin-when-cross-origin',
expectedReferrer: document.location.origin + '/'
},
{
origin: REMOTE_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'unsafe-url',
expectedReferrer: document.location.href
},
];
runReferrerTests(TEST_CASES);
})();
</script>
</body>
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!DOCTYPE html>
<title>Referrer of SignedHTTPExchange(physical:same origin, logical:remote origin)</title>
<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>
<body>
<script>
(() => {
const SAME_ORIGIN = get_host_info().HTTPS_ORIGIN;
const REMOTE_ORIGIN_SXG = 'sxg-referrer-remote-origin.sxg';
const TEST_CASES = [
// Physical origin = same origin. Logical origin = remote origin.
{
origin: SAME_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: undefined,
expectedReferrer: document.location.href
},
{
origin: SAME_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'no-referrer',
expectedReferrer: ''
},
{
origin: SAME_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'no-referrer-when-downgrade',
expectedReferrer: document.location.href
},
{
origin: SAME_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'origin',
expectedReferrer: document.location.origin + '/'
},
{
origin: SAME_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'same-origin',
expectedReferrer: ''
},
{
origin: SAME_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'strict-origin',
expectedReferrer: document.location.origin + '/'
},
{
origin: SAME_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'strict-origin-when-cross-origin',
expectedReferrer: document.location.origin + '/'
},
{
origin: SAME_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'unsafe-url',
expectedReferrer: document.location.href
},
];
runReferrerTests(TEST_CASES);
})();
</script>
</body>
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!DOCTYPE html>
<title>Referrer of SignedHTTPExchange(physical:same origin, logical:same origin)</title>
<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>
<body>
<script>
(() => {
const SAME_ORIGIN = get_host_info().HTTPS_ORIGIN;
const SAME_ORIGIN_SXG = 'sxg-referrer-same-origin.sxg';
const TEST_CASES = [
// Physical origin = same origin. Logical origin = same origin.
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: undefined,
expectedReferrer: document.location.href
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'no-referrer',
expectedReferrer: ''
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'no-referrer-when-downgrade',
expectedReferrer: document.location.href
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'origin',
expectedReferrer: document.location.origin + '/'
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'same-origin',
expectedReferrer: document.location.href
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'strict-origin',
expectedReferrer: document.location.origin + '/'
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'strict-origin-when-cross-origin',
expectedReferrer: document.location.href
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'unsafe-url',
expectedReferrer: document.location.href
},
];
runReferrerTests(TEST_CASES);
})();
</script>
</body>
Loading

0 comments on commit fe2a6a4

Please sign in to comment.