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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-request-resources.html

Issue 1853333005: Add layout tests to check Accept request header values observed by Service Worker Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/http/tests/serviceworker/fetch-request-resources.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-request-resources.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-request-resources.html
index 7b7947a0652930a572764aa609b46e85dca2985b..1ba4fe331a3495001fb66584de5fd1f487159d86 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-request-resources.html
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-request-resources.html
@@ -8,6 +8,11 @@
var url_count = 0;
var expected_results = {};
+// The `Accept` header value for images should be
+// 'image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5' according to the spec
+// https://fetch.spec.whatwg.org/#fetching.
+var accept_image = 'image/webp,image/*,*/*;q=0.8';
nhiroki 2016/04/11 08:33:29 If there is a bug about lack of the "q=0.5" part,
+
function image_test(frame, url, cross_origin,
expected_mode, expected_credentials) {
var actual_url = url + (++url_count);
@@ -15,6 +20,7 @@ function image_test(frame, url, cross_origin,
mode: expected_mode,
credentials: expected_credentials,
redirect: 'follow',
+ accept: accept_image,
message: 'Image load (url:' +
actual_url + ' cross_origin:' + cross_origin + ')'
};
@@ -28,6 +34,7 @@ function script_test(frame, url, cross_origin,
mode: expected_mode,
credentials: expected_credentials,
redirect: 'follow',
+ accept: '*/*',
message: 'Script load (url:' +
actual_url + ' cross_origin:' + cross_origin + ')'
};
@@ -41,6 +48,7 @@ function css_test(frame, url, cross_origin,
mode: expected_mode,
credentials: expected_credentials,
redirect: 'follow',
+ accept: 'text/css,*/*;q=0.1',
message: 'CSS load (url:' +
actual_url + ' cross_origin:' + cross_origin + ')'
};
@@ -55,6 +63,7 @@ function font_face_test(frame, url, expected_mode,
mode: expected_mode,
credentials: expected_credentials,
redirect: 'follow',
+ accept: '*/*',
message: 'FontFace load (url:' + actual_url + ')'
};
return frame.contentWindow.load_font(actual_url);
@@ -68,6 +77,7 @@ function css_image_test(frame, url, type,
mode: expected_mode,
credentials: expected_credentials,
redirect: 'follow',
+ accept: accept_image,
message: 'CSSImage load (url:' + actual_url + ' type:' + type + ')'
};
return frame.contentWindow.load_css_image(actual_url, type);
@@ -81,6 +91,7 @@ function css_image_set_test(frame, url, type,
mode: expected_mode,
credentials: expected_credentials,
redirect: 'follow',
+ accept: accept_image,
message: 'CSSImageSet load (url:' + actual_url + ' type:' + type + ')'
};
return frame.contentWindow.load_css_image_set(actual_url, type);
@@ -93,6 +104,7 @@ function fetch_test(frame, url, mode, credentials,
mode: expected_mode,
credentials: expected_credentials,
redirect: 'follow',
+ accept: '*/*',
message: 'fetch (url:' + actual_url + ' mode:' + mode + ' credentials:' +
credentials + ')'
};
@@ -107,6 +119,7 @@ function audio_test(frame, url, cross_origin,
mode: expected_mode,
credentials: expected_credentials,
redirect: 'follow',
+ accept: '*/*',
message: 'Audio load (url:' + actual_url + ' cross_origin:' +
cross_origin + ')'
};
@@ -153,6 +166,10 @@ async_test(function(t) {
result.redirect, expected.redirect,
'redirect mode of ' + expected.message + ' must be ' +
expected.redirect + '.');
+ assert_equals(
+ result.accept, expected.accept,
+ '`Accept` header value of ' + expected.message + ' must be ' +
nhiroki 2016/04/11 08:33:29 Can you wrap this line at 80th column?
+ expected.accept + '.');
--url_count;
delete expected_results[result.url];
if (url_count == 0) {

Powered by Google App Engine
This is Rietveld 408576698