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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/fetch/api/basic/accept-header.js

Issue 2778753002: Import //fetch from Web Platform Tests. (Closed)
Patch Set: Baselines. Created 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 if (this.document === undefined) {
2 importScripts("/resources/testharness.js");
3 importScripts("../resources/utils.js");
4 }
5
6 promise_test(function() {
7 return fetch(RESOURCES_DIR + "inspect-headers.py?headers=Accept").then(functio n(response) {
8 assert_equals(response.status, 200, "HTTP status is 200");
9 assert_equals(response.type , "basic", "Response's type is basic");
10 assert_equals(response.headers.get("x-request-accept"), "*/*", "Request has accept header with value '*/*'");
11 });
12 }, "Request through fetch should have 'accept' header with value '*/*'");
13
14 promise_test(function() {
15 return fetch(RESOURCES_DIR + "inspect-headers.py?headers=Accept", {"headers": [["Accept", "custom/*"]]}).then(function(response) {
16 assert_equals(response.status, 200, "HTTP status is 200");
17 assert_equals(response.type , "basic", "Response's type is basic");
18 assert_equals(response.headers.get("x-request-accept"), "custom/*", "Request has accept header with value 'custom/*'");
19 });
20 }, "Request through fetch should have 'accept' header with value 'custom/*'");
21
22 promise_test(function() {
23 return fetch(RESOURCES_DIR + "inspect-headers.py?headers=Accept-Language").the n(function(response) {
24 assert_equals(response.status, 200, "HTTP status is 200");
25 assert_equals(response.type , "basic", "Response's type is basic");
26 assert_true(response.headers.has("x-request-accept-language"));
27 });
28 }, "Request through fetch should have a 'accept-language' header");
29
30 promise_test(function() {
31 return fetch(RESOURCES_DIR + "inspect-headers.py?headers=Accept-Language", {"h eaders": [["Accept-Language", "bzh"]]}).then(function(response) {
32 assert_equals(response.status, 200, "HTTP status is 200");
33 assert_equals(response.type , "basic", "Response's type is basic");
34 assert_equals(response.headers.get("x-request-accept-language"), "bzh", "Req uest has accept header with value 'bzh'");
35 });
36 }, "Request through fetch should have 'accept-language' header with value 'bzh'" );
37
38 done();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698