Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(735)

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/fetch-event.https.html

Issue 2610243002: Import wpt@5e1a3b80cea8d36774d2afd78b29a74792e9f15a (Closed)
Patch Set: Rebased Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/fetch-event.https.html
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/fetch-event.https.html b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/fetch-event.https.html
index a9b0d6ca286e2e435cdee601809e88146e745b30..6f8618bad7ecaadec57863d0e60e831c906bc0c3 100644
--- a/third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/fetch-event.https.html
+++ b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/fetch-event.https.html
@@ -88,7 +88,7 @@ function run_referrer_policy_tests(frame, referrer, href, origin) {
.then(function(response_text) {
assert_equals(
response_text,
- 'Referrer: about:client\n' +
+ 'Referrer: \n' +
'ReferrerPolicy: no-referrer-when-downgrade',
'Service Worker should respond to fetch with no referrer when a member of RequestInit is present with an HTTP request');
return frame.contentWindow.fetch('resources/simple.html?referrerFull',
@@ -110,7 +110,7 @@ function run_referrer_policy_tests(frame, referrer, href, origin) {
.then(function(response_text) {
assert_equals(
response_text,
- 'Referrer: about:client\n' +
+ 'Referrer: \n' +
'ReferrerPolicy: no-referrer-when-downgrade',
'Service Worker should respond to fetch with no referrer with ""');
return frame.contentWindow.fetch('resources/simple.html?referrerFull',
@@ -176,7 +176,7 @@ function run_referrer_policy_tests(frame, referrer, href, origin) {
.then(function(response_text) {
assert_equals(
response_text,
- 'Referrer: about:client\n' +
+ 'Referrer: \n' +
'ReferrerPolicy: no-referrer-when-downgrade',
'Service Worker should respond to fetch with no referrer with "no-referrer-when-downgrade" and an HTTP request');
var http_url = get_host_info()['HTTP_ORIGIN'] + base_path() +
@@ -197,9 +197,99 @@ function run_referrer_policy_tests(frame, referrer, href, origin) {
.then(function(response_text) {
assert_equals(
response_text,
- 'Referrer: about:client\n' +
+ 'Referrer: \n' +
'ReferrerPolicy: no-referrer',
'Service Worker should respond to fetch with no referrer URL with "no-referrer"');
+ return frame.contentWindow.fetch('resources/simple.html?referrerFull',
+ {referrerPolicy: "same-origin", referrer: referrer});
+ })
+ .then(function(response) { return response.text(); })
+ .then(function(response_text) {
+ assert_equals(
+ response_text,
+ 'Referrer: ' + href + '\n' +
+ 'ReferrerPolicy: same-origin',
+ 'Service Worker should respond to fetch with referrer URL with "same-origin" and a same origin request');
+ var http_url = get_host_info()['HTTPS_REMOTE_ORIGIN'] + base_path() +
+ '/resources/simple.html?referrerFull';
+ return frame.contentWindow.fetch(http_url,
+ {referrerPolicy: "same-origin", referrer: referrer});
+ })
+ .then(function(response) { return response.text(); })
+ .then(function(response_text) {
+ assert_equals(
+ response_text,
+ 'Referrer: \n' +
+ 'ReferrerPolicy: same-origin',
+ 'Service Worker should respond to fetch with no referrer with "same-origin" and cross origin request');
+ var http_url = get_host_info()['HTTPS_REMOTE_ORIGIN'] + base_path() +
+ '/resources/simple.html?referrerFull';
+ return frame.contentWindow.fetch(http_url,
+ {referrerPolicy: "strict-origin", referrer: referrer});
+ })
+ .then(function(response) { return response.text(); })
+ .then(function(response_text) {
+ assert_equals(
+ response_text,
+ 'Referrer: ' + origin + '/' + '\n' +
+ 'ReferrerPolicy: strict-origin',
+ 'Service Worker should respond to fetch with the referrer origin with "strict-origin" and a HTTPS cross origin request');
+ return frame.contentWindow.fetch('resources/simple.html?referrerFull',
+ {referrerPolicy: "strict-origin", referrer: referrer});
+ })
+ .then(function(response) { return response.text(); })
+ .then(function(response_text) {
+ assert_equals(
+ response_text,
+ 'Referrer: ' + origin + '/' + '\n' +
+ 'ReferrerPolicy: strict-origin',
+ 'Service Worker should respond to fetch with the referrer origin with "strict-origin" and a same origin request');
+ var http_url = get_host_info()['HTTP_ORIGIN'] + base_path() +
+ '/resources/simple.html?referrerFull';
+ return frame.contentWindow.fetch(http_url,
+ {referrerPolicy: "strict-origin", referrer: referrer});
+ })
+ .then(function(response) { return response.text(); })
+ .then(function(response_text) {
+ assert_equals(
+ response_text,
+ 'Referrer: \n' +
+ 'ReferrerPolicy: strict-origin',
+ 'Service Worker should respond to fetch with no referrer with "strict-origin" and a HTTP request');
+ return frame.contentWindow.fetch('resources/simple.html?referrerFull',
+ {referrerPolicy: "strict-origin-when-cross-origin", referrer: referrer});
+ })
+ .then(function(response) { return response.text(); })
+ .then(function(response_text) {
+ assert_equals(
+ response_text,
+ 'Referrer: ' + href + '\n' +
+ 'ReferrerPolicy: strict-origin-when-cross-origin',
+ 'Service Worker should respond to fetch with the referrer URL with "strict-origin-when-cross-origin" and a same origin request');
+ var http_url = get_host_info()['HTTPS_REMOTE_ORIGIN'] + base_path() +
+ '/resources/simple.html?referrerFull';
+ return frame.contentWindow.fetch(http_url,
+ {referrerPolicy: "strict-origin-when-cross-origin", referrer: referrer});
+ })
+ .then(function(response) { return response.text(); })
+ .then(function(response_text) {
+ assert_equals(
+ response_text,
+ 'Referrer: ' + origin + '/' + '\n' +
+ 'ReferrerPolicy: strict-origin-when-cross-origin',
+ 'Service Worker should respond to fetch with the referrer origin with "strict-origin-when-cross-origin" and a HTTPS cross origin request');
+ var http_url = get_host_info()['HTTP_ORIGIN'] + base_path() +
+ '/resources/simple.html?referrerFull';
+ return frame.contentWindow.fetch(http_url,
+ {referrerPolicy: "strict-origin-when-cross-origin", referrer: referrer});
+ })
+ .then(function(response) { return response.text(); })
+ .then(function(response_text) {
+ assert_equals(
+ response_text,
+ 'Referrer: \n' +
+ 'ReferrerPolicy: strict-origin-when-cross-origin',
+ 'Service Worker should respond to fetch with no referrer with "strict-origin-when-cross-origin" and a HTTP request');
});
}
@@ -419,14 +509,13 @@ async_test(function(t) {
.then(function(frame) {
assert_equals(
frame.contentDocument.body.textContent,
- 'Fragment Not Found',
- 'Service worker should not expose URL fragments.');
+ 'Fragment Found :' + fragment,
+ 'Service worker should expose URL fragments in request.');
frame.remove();
return service_worker_unregister_and_done(t, scope);
})
.catch(unreached_rejection(t));
}, 'Service Worker must not expose FetchEvent URL fragments.');
-
async_test(function(t) {
var scope = 'resources/simple.html?cache';
var frame;

Powered by Google App Engine
This is Rietveld 408576698