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

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-init-001.html

Issue 2778753002: Import //fetch from Web Platform Tests. (Closed)
Patch Set: Baselines. Created 3 years, 9 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/external/wpt/fetch/api/response/response-init-001.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-init-001.html b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-init-001.html
new file mode 100644
index 0000000000000000000000000000000000000000..4a8a7bd80cceafabf2a6b29f3912edb9c5ad2853
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-init-001.html
@@ -0,0 +1,63 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Response init: simple cases</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#response">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#concept-response">
+ <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script>
+ var defaultValues = { "type" : "default",
+ "url" : "",
+ "ok" : true,
+ "status" : 200,
+ "statusText" : "OK",
+ "body" : null
+ };
+
+ var statusCodes = { "givenValues" : [200, 300, 400, 500, 599],
+ "expectedValues" : [200, 300, 400, 500, 599]
+ };
+ var statusTexts = { "givenValues" : ["OK", "with space", String.fromCharCode(0x80)],
+ "expectedValues" : ["OK", "with space", String.fromCharCode(0x80)]
+ };
+ var initValuesDict = { "status" : statusCodes,
+ "statusText" : statusTexts
+ };
+
+ function isOkStatus(status) {
+ return 200 <= status && 299 >= status;
+ }
+
+ var response = new Response();
+ for (var attributeName in defaultValues) {
+ test(function() {
+ var expectedValue = defaultValues[attributeName];
+ assert_equals(response[attributeName], expectedValue,
+ "Expect default response." + attributeName + " is " + expectedValue);
+ }, "Check default value for " + attributeName + " attribute");
+ }
+
+ for (var attributeName in initValuesDict)
+ test(function() {
+ var valuesToTest = initValuesDict[attributeName];
+ for (var valueIdx in valuesToTest["givenValues"]) {
+ var givenValue = valuesToTest["givenValues"][valueIdx];
+ var expectedValue = valuesToTest["expectedValues"][valueIdx];
+ var responseInit = {};
+ responseInit[attributeName] = givenValue;
+ var response = new Response("", responseInit);
+ assert_equals(response[attributeName], expectedValue,
+ "Expect response." + attributeName + " is " + expectedValue +
+ " when initialized with " + givenValue);
+ assert_equals(response.ok, isOkStatus(response.status),
+ "Expect response.ok is " + isOkStatus(response.status));
+ }
+ }, "Check " + attributeName + " init values and associated getter");
+ </script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698