Title: [198888] trunk/LayoutTests
Revision
198888
Author
[email protected]
Date
2016-03-31 01:26:29 -0700 (Thu, 31 Mar 2016)

Log Message

[Fetch API] Update web-platform-test fetch API tests
https://bugs.webkit.org/show_bug.cgi?id=155969

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Resyncing tests and updated expectations.
New test web-platform-tests/fetch/api/request/request-cache.html is timing out.

* web-platform-tests/fetch/api/basic/scheme-blob-expected.txt:
* web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt:
* web-platform-tests/fetch/api/basic/scheme-blob.js:
(checkFetchResponse):
* web-platform-tests/fetch/api/headers/headers-basic.html:
* web-platform-tests/fetch/api/request/request-cache-expected.txt: Added.
* web-platform-tests/fetch/api/request/request-cache.html: Added.
* web-platform-tests/fetch/api/request/request-consume-empty.html:
* web-platform-tests/fetch/api/request/request-consume.html:
* web-platform-tests/fetch/api/request/request-idl-expected.txt:
* web-platform-tests/fetch/api/request/request-idl.html:
* web-platform-tests/fetch/api/request/request-init-002-expected.txt:
* web-platform-tests/fetch/api/request/request-init-002.html:
* web-platform-tests/fetch/api/request/resources/cache.py: Added.
(main):
* web-platform-tests/fetch/api/resources/utils.js:
(stringToArray):
(validateBufferFromString):
(validateStreamFromString):
* web-platform-tests/fetch/api/response/response-clone.html:
* web-platform-tests/fetch/api/response/response-consume-empty.html:
* web-platform-tests/fetch/api/response/response-consume.html:
* web-platform-tests/fetch/api/response/response-init-002.html:

LayoutTests:

* TestExpectations: Marking imported/w3c/web-platform-tests/fetch/api/request/request-cache.html as timing out.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (198887 => 198888)


--- trunk/LayoutTests/ChangeLog	2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/ChangeLog	2016-03-31 08:26:29 UTC (rev 198888)
@@ -1,3 +1,12 @@
+2016-03-31  Youenn Fablet  <[email protected]>
+
+        [Fetch API] Update web-platform-test fetch API tests
+        https://bugs.webkit.org/show_bug.cgi?id=155969
+
+        Reviewed by Darin Adler.
+
+        * TestExpectations: Marking imported/w3c/web-platform-tests/fetch/api/request/request-cache.html as timing out.
+
 2016-03-30  Konstantin Tokarev  <[email protected]>
 
         Fixed typo in fast/css/viewport-vmin-border test.

Modified: trunk/LayoutTests/TestExpectations (198887 => 198888)


--- trunk/LayoutTests/TestExpectations	2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/TestExpectations	2016-03-31 08:26:29 UTC (rev 198888)
@@ -317,6 +317,8 @@
 imported/w3c/web-platform-tests/XMLHttpRequest/send-redirect-to-cors.htm [ Skip ]
 imported/w3c/web-platform-tests/XMLHttpRequest/send-redirect-to-non-cors.htm [ Skip ]
 
+imported/w3c/web-platform-tests/fetch/api/request/request-cache.html [ Timeout ]
+
 # New W3C ref tests that are failing.
 webkit.org/b/148856 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video_initially_paused.html [ ImageOnlyFailure ]
 

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (198887 => 198888)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-03-31 08:26:29 UTC (rev 198888)
@@ -1,3 +1,37 @@
+2016-03-31  Youenn Fablet  <[email protected]>
+
+        [Fetch API] Update web-platform-test fetch API tests
+        https://bugs.webkit.org/show_bug.cgi?id=155969
+
+        Reviewed by Darin Adler.
+
+        Resyncing tests and updated expectations.
+        New test web-platform-tests/fetch/api/request/request-cache.html is timing out.
+
+        * web-platform-tests/fetch/api/basic/scheme-blob-expected.txt:
+        * web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt:
+        * web-platform-tests/fetch/api/basic/scheme-blob.js:
+        (checkFetchResponse):
+        * web-platform-tests/fetch/api/headers/headers-basic.html:
+        * web-platform-tests/fetch/api/request/request-cache-expected.txt: Added.
+        * web-platform-tests/fetch/api/request/request-cache.html: Added.
+        * web-platform-tests/fetch/api/request/request-consume-empty.html:
+        * web-platform-tests/fetch/api/request/request-consume.html:
+        * web-platform-tests/fetch/api/request/request-idl-expected.txt:
+        * web-platform-tests/fetch/api/request/request-idl.html:
+        * web-platform-tests/fetch/api/request/request-init-002-expected.txt:
+        * web-platform-tests/fetch/api/request/request-init-002.html:
+        * web-platform-tests/fetch/api/request/resources/cache.py: Added.
+        (main):
+        * web-platform-tests/fetch/api/resources/utils.js:
+        (stringToArray):
+        (validateBufferFromString):
+        (validateStreamFromString):
+        * web-platform-tests/fetch/api/response/response-clone.html:
+        * web-platform-tests/fetch/api/response/response-consume-empty.html:
+        * web-platform-tests/fetch/api/response/response-consume.html:
+        * web-platform-tests/fetch/api/response/response-init-002.html:
+
 2016-03-25  Youenn Fablet  <[email protected]>
 
         [Fetch API] Add basic loading of resources

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-expected.txt (198887 => 198888)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-expected.txt	2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-expected.txt	2016-03-31 08:26:29 UTC (rev 198888)
@@ -1,5 +1,5 @@
 
-PASS Regular Blob loading 
-PASS Loading an erroneous blob scheme URL 
-FAIL Loading a blob URL using POST assert_unreached: Should have rejected. Reached unreachable code
+PASS Fetching [GET] URL.createObjectURL(blob) is OK 
+PASS Fetching [GET] blob:http://www.localhost:8800/ is KO 
+FAIL Fetching [POST] URL.createObjectURL(blob) is KO assert_unreached: Should have rejected. Reached unreachable code
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt (198887 => 198888)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt	2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt	2016-03-31 08:26:29 UTC (rev 198888)
@@ -1,5 +1,5 @@
 
-FAIL Regular Blob loading promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Loading an erroneous blob scheme URL assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Loading a blob URL using POST assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching [GET] URL.createObjectURL(blob) is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetching [GET] blob:http://www.localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching [POST] URL.createObjectURL(blob) is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.js (198887 => 198888)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.js	2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.js	2016-03-31 08:26:29 UTC (rev 198888)
@@ -14,12 +14,13 @@
       return resp.text();
     }).then(function(bodyAsText) {
       assert_equals(bodyAsText, data, "Response's body is " + data);
-    })
+    });
   }, desc);
 }
 
 var blob = new Blob(["Blob's data"], { "type" : "text/plain" });
-checkFetchResponse(URL.createObjectURL(blob), "Blob's data", "text/plain",  blob.size, "Regular Blob loading");
+checkFetchResponse(URL.createObjectURL(blob), "Blob's data", "text/plain",  blob.size,
+                  "Fetching [GET] URL.createObjectURL(blob) is OK");
 
 function checkKoUrl(url, method, desc) {
   promise_test(function(test) {
@@ -29,7 +30,9 @@
 }
 
 var blob2 = new Blob(["Blob's data"], { "type" : "text/plain" });
-checkKoUrl("blob:http://{{domains[www]}}:{{ports[http][0]}}/", "GET", "Loading an erroneous blob scheme URL");
-checkKoUrl(URL.createObjectURL(blob2), "POST", "Loading a blob URL using POST");
+checkKoUrl("blob:http://{{domains[www]}}:{{ports[http][0]}}/", "GET",
+          "Fetching [GET] blob:http://{{domains[www]}}:{{ports[http][0]}}/ is KO");
+checkKoUrl(URL.createObjectURL(blob2), "POST",
+           "Fetching [POST] URL.createObjectURL(blob) is KO");
 
 done();

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic.html (198887 => 198888)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic.html	2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic.html	2016-03-31 08:26:29 UTC (rev 198888)
@@ -25,7 +25,7 @@
       var parameters = [null, 1];
       parameters.forEach(function(parameter) {
         test(function() {
-          assert_throws(new TypeError(), () => new Headers(parameter));
+          assert_throws(new TypeError(), function() { new Headers(parameter) });
         }, "Create headers with " + parameter + " should throw");
       });
 

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-expected.txt (0 => 198888)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-expected.txt	2016-03-31 08:26:29 UTC (rev 198888)
@@ -0,0 +1,2 @@
+FAIL: Timed out waiting for notifyDone to be called
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache.html (0 => 198888)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache.html	2016-03-31 08:26:29 UTC (rev 198888)
@@ -0,0 +1,498 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Request cache</title>
+    <meta name="help" href=""
+    <meta name="timeout" content="long">
+    <script src=""
+    <script src=""
+    <script src=""
+  </head>
+  <body>
+    <script>
+    var now = new Date();
+    var tests = [
+      {
+        name: 'RequestCache "default" mode checks the cache for previously cached content and goes to the network for stale responses',
+        state: "stale",
+        request_cache: ["default", "default"],
+        expected_validation_headers: [false, true],
+        expected_no_cache_headers: [false, false],
+      },
+      {
+        name: 'RequestCache "default" mode checks the cache for previously cached content and avoids going to the network if a fresh response exists',
+        state: "fresh",
+        request_cache: ["default", "default"],
+        expected_validation_headers: [false],
+        expected_no_cache_headers: [false],
+      },
+      {
+        name: 'RequestCache "no-cache" mode revalidates stale responses found in the cache',
+        state: "stale",
+        request_cache: ["default", "no-cache"],
+        expected_validation_headers: [false, true],
+        expected_no_cache_headers: [false, false],
+        expected_max_age_headers: [false, true],
+      },
+      {
+        name: 'RequestCache "no-cache" mode revalidates fresh responses found in the cache',
+        state: "fresh",
+        request_cache: ["default", "no-cache"],
+        expected_validation_headers: [false, true],
+        expected_no_cache_headers: [false, false],
+        expected_max_age_headers: [false, true],
+      },
+      {
+        name: 'RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for stale responses',
+        state: "stale",
+        request_cache: ["default", "force-cache"],
+        expected_validation_headers: [false],
+        expected_no_cache_headers: [false],
+      },
+      {
+        name: 'RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for fresh responses',
+        state: "fresh",
+        request_cache: ["default", "force-cache"],
+        expected_validation_headers: [false],
+        expected_no_cache_headers: [false],
+      },
+      {
+        name: 'RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response is not found',
+        state: "stale",
+        request_cache: ["force-cache"],
+        expected_validation_headers: [false],
+        expected_no_cache_headers: [false],
+      },
+      {
+        name: 'RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response is not found',
+        state: "fresh",
+        request_cache: ["force-cache"],
+        expected_validation_headers: [false],
+        expected_no_cache_headers: [false],
+      },
+      {
+        name: 'RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response would vary',
+        state: "stale",
+        vary: "*",
+        request_cache: ["default", "force-cache"],
+        expected_validation_headers: [false, true],
+        expected_no_cache_headers: [false, false],
+      },
+      {
+        name: 'RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response would vary',
+        state: "fresh",
+        vary: "*",
+        request_cache: ["default", "force-cache"],
+        expected_validation_headers: [false, true],
+        expected_no_cache_headers: [false, false],
+      },
+      {
+        name: 'RequestCache "force-cache" stores the response in the cache if it goes to the network',
+        state: "stale",
+        request_cache: ["force-cache", "default"],
+        expected_validation_headers: [false, true],
+        expected_no_cache_headers: [false, false],
+      },
+      {
+        name: 'RequestCache "force-cache" stores the response in the cache if it goes to the network',
+        state: "fresh",
+        request_cache: ["force-cache", "default"],
+        expected_validation_headers: [false],
+        expected_no_cache_headers: [false],
+      },
+      {
+        name: 'RequestCache "no-store" mode does not check the cache for previously cached content and goes to the network regardless',
+        state: "stale",
+        request_cache: ["default", "no-store"],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache "no-store" mode does not check the cache for previously cached content and goes to the network regardless',
+        state: "fresh",
+        request_cache: ["default", "no-store"],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache "no-store" mode does not store the response in the cache',
+        state: "stale",
+        request_cache: ["no-store", "default"],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache "no-store" mode does not store the response in the cache',
+        state: "fresh",
+        request_cache: ["no-store", "default"],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store"',
+        state: "stale",
+        request_cache: ["default", "default"],
+        request_headers: [{}, {"If-Modified-Since": now.toGMTString()}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store"',
+        state: "fresh",
+        request_cache: ["default", "default"],
+        request_headers: [{}, {"If-Modified-Since": now.toGMTString()}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store"',
+        state: "stale",
+        request_cache: ["default", "default"],
+        request_headers: [{"If-Modified-Since": now.toGMTString()}, {}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store"',
+        state: "fresh",
+        request_cache: ["default", "default"],
+        request_headers: [{"If-Modified-Since": now.toGMTString()}, {}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store"',
+        state: "stale",
+        request_cache: ["default", "default"],
+        request_headers: [{}, {"If-None-Match": '"foo"'}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store"',
+        state: "fresh",
+        request_cache: ["default", "default"],
+        request_headers: [{}, {"If-None-Match": '"foo"'}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store"',
+        state: "stale",
+        request_cache: ["default", "default"],
+        request_headers: [{"If-None-Match": '"foo"'}, {}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store"',
+        state: "fresh",
+        request_cache: ["default", "default"],
+        request_headers: [{"If-None-Match": '"foo"'}, {}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store"',
+        state: "stale",
+        request_cache: ["default", "default"],
+        request_headers: [{}, {"If-Unmodified-Since": now.toGMTString()}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store"',
+        state: "fresh",
+        request_cache: ["default", "default"],
+        request_headers: [{}, {"If-Unmodified-Since": now.toGMTString()}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store"',
+        state: "stale",
+        request_cache: ["default", "default"],
+        request_headers: [{"If-Unmodified-Since": now.toGMTString()}, {}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store"',
+        state: "fresh",
+        request_cache: ["default", "default"],
+        request_headers: [{"If-Unmodified-Since": now.toGMTString()}, {}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache "default" mode with an If-Match header is treated similarly to "no-store"',
+        state: "stale",
+        request_cache: ["default", "default"],
+        request_headers: [{}, {"If-Match": '"foo"'}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache "default" mode with an If-Match header is treated similarly to "no-store"',
+        state: "fresh",
+        request_cache: ["default", "default"],
+        request_headers: [{}, {"If-Match": '"foo"'}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache "default" mode with an If-Match header is treated similarly to "no-store"',
+        state: "stale",
+        request_cache: ["default", "default"],
+        request_headers: [{"If-Match": '"foo"'}, {}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache "default" mode with an If-Match header is treated similarly to "no-store"',
+        state: "fresh",
+        request_cache: ["default", "default"],
+        request_headers: [{"If-Match": '"foo"'}, {}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache "default" mode with an If-Range header is treated similarly to "no-store"',
+        state: "stale",
+        request_cache: ["default", "default"],
+        request_headers: [{}, {"If-Range": '"foo"'}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache "default" mode with an If-Range header is treated similarly to "no-store"',
+        state: "fresh",
+        request_cache: ["default", "default"],
+        request_headers: [{}, {"If-Range": '"foo"'}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache "default" mode with an If-Range header is treated similarly to "no-store"',
+        state: "stale",
+        request_cache: ["default", "default"],
+        request_headers: [{"If-Range": '"foo"'}, {}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache "default" mode with an If-Range header is treated similarly to "no-store"',
+        state: "fresh",
+        request_cache: ["default", "default"],
+        request_headers: [{"If-Range": '"foo"'}, {}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'Responses with the "Cache-Control: no-store" header are not stored in the cache',
+        state: "stale",
+        cache_control: "no-store",
+        request_cache: ["default", "default"],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, false],
+      },
+      {
+        name: 'Responses with the "Cache-Control: no-store" header are not stored in the cache',
+        state: "fresh",
+        cache_control: "no-store",
+        request_cache: ["default", "default"],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, false],
+      },
+      {
+        name: 'RequestCache "reload" mode does not check the cache for previously cached content and goes to the network regardless',
+        state: "stale",
+        request_cache: ["default", "reload"],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache "reload" mode does not check the cache for previously cached content and goes to the network regardless',
+        state: "fresh",
+        request_cache: ["default", "reload"],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache "reload" mode does store the response in the cache',
+        state: "stale",
+        request_cache: ["reload", "default"],
+        expected_validation_headers: [false, true],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache "reload" mode does store the response in the cache',
+        state: "fresh",
+        request_cache: ["reload", "default"],
+        expected_validation_headers: [false],
+        expected_no_cache_headers: [true],
+      },
+      {
+        name: 'RequestCache "reload" mode does store the response in the cache even if a previous response is already stored',
+        state: "stale",
+        request_cache: ["default", "reload", "default"],
+        expected_validation_headers: [false, false, true],
+        expected_no_cache_headers: [false, true, false],
+      },
+      {
+        name: 'RequestCache "reload" mode does store the response in the cache even if a previous response is already stored',
+        state: "fresh",
+        request_cache: ["default", "reload", "default"],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+    ];
+    function make_url(uuid, id, value, content, info) {
+      var dates = {
+        fresh: new Date(now.getFullYear() + 1, now.getMonth(), now.getDay()).toGMTString(),
+        stale: new Date(now.getFullYear() - 1, now.getMonth(), now.getDay()).toGMTString(),
+      };
+      var vary = "";
+      if ("vary" in info) {
+        vary = "&vary=" + info.vary;
+      }
+      var cache_control = "";
+      if ("cache_control" in info) {
+        cache_control = "&cache_control=" + info.cache_control;
+      }
+      var ignore_request_headers = "";
+      if ("request_headers" in info) {
+        // Ignore the request headers that we send since they may be synthesized by the test.
+        ignore_request_headers = "&ignore";
+      }
+      return "resources/cache.py?token=" + uuid +
+             "&content=" + content +
+             "&" + id + "=" + value +
+             "&expires=" + dates[info.state] +
+             vary + cache_control + ignore_request_headers;
+    }
+    function expected_status(type, identifier, init) {
+      if (type == "date" &&
+          init.headers &&
+          init.headers["If-Modified-Since"] == identifier) {
+        // The server will respond with a 304 in this case.
+        return [304, "Not Modified"];
+      }
+      return [200, "OK"];
+    }
+    function expected_response_text(type, identifier, init, content) {
+      if (type == "date" &&
+          init.headers &&
+          init.headers["If-Modified-Since"] == identifier) {
+        // The server will respond with a 304 in this case.
+        return "";
+      }
+      return content;
+    }
+    function server_state(uuid) {
+      return fetch("resources/cache.py?querystate&token=" + uuid)
+        .then(function(response) {
+          return response.text();
+        }).then(function(text) {
+          return JSON.parse(text);
+        });
+    }
+    function populate_cache(url, content, info, type, identifier) {
+      var init = {cache: info.request_cache[0]};
+      if ("request_headers" in info) {
+        init.headers = info.request_headers[0];
+      }
+      return fetch(url, init)
+        .then(function(response) {
+          assert_array_equals([response.status, response.statusText],
+                              expected_status(type, identifier, init));
+          return response.text();
+        }).then(function(text) {
+          assert_equals(text, expected_response_text(type, identifier, init, content));
+        });
+    }
+    function make_test(type, info) {
+      return function(test) {
+        var uuid = token();
+        var identifier = (type == "tag" ? Math.random() : now.toGMTString());
+        var content = Math.random().toString();
+        var url = "" type, identifier, content, info);
+        var fetch_functions = [function() {
+          return populate_cache(url, content, info, type, identifier);
+        }];
+        for (var i = 1; i < info.request_cache.length; ++i) {
+          fetch_functions.push(function(idx) {
+            var init = {cache: info.request_cache[idx]};
+            if ("request_headers" in info) {
+              init.headers = info.request_headers[idx];
+            }
+            return fetch(url, init)
+              .then(function(response) {
+                assert_array_equals([response.status, response.statusText],
+                                    expected_status(type, identifier, init));
+                return response.text();
+              }).then(function(text) {
+                assert_equals(text, expected_response_text(type, identifier, init, content));
+              });
+          });
+        }
+        var i = 0;
+        function run_next_step() {
+          if (fetch_functions.length) {
+            return fetch_functions.shift()(i++)
+              .then(run_next_step);
+          } else {
+            return Promise.resolve();
+          }
+        }
+        return run_next_step()
+          .then(function() {
+            // Now, query the server state
+            return server_state(uuid);
+          }).then(function(state) {
+            var expectedState = [];
+            info.expected_validation_headers.forEach(function (validate) {
+              if (validate) {
+                if (type == "tag") {
+                  expectedState.push({"If-None-Match": '"' + identifier + '"'});
+                } else {
+                  expectedState.push({"If-Modified-Since": identifier});
+                }
+              } else {
+                expectedState.push({});
+              }
+            });
+            for (var i = 0; i < info.expected_no_cache_headers.length; ++i) {
+              if (info.expected_no_cache_headers[i]) {
+                expectedState[i]["Pragma"] = "no-cache";
+                expectedState[i]["Cache-Control"] = "no-cache";
+              }
+            }
+            if ("expected_max_age_headers" in info) {
+              for (var i = 0; i < info.expected_max_age_headers.length; ++i) {
+                if (info.expected_max_age_headers[i]) {
+                  expectedState[i]["Cache-Control"] = "max-age=0";
+                }
+              }
+            }
+            assert_equals(state.length, expectedState.length);
+            for (var i = 0; i < state.length; ++i) {
+              for (var header in state[i]) {
+                assert_equals(state[i][header], expectedState[i][header]);
+                delete expectedState[i][header];
+              }
+              for (var header in expectedState[i]) {
+                assert_false(header in state[i]);
+              }
+            }
+          });
+      };
+    }
+    tests.forEach(function(info) {
+      promise_test(make_test("tag", info), info.name + " with Etag and " + info.state + " response");
+      promise_test(make_test("date", info), info.name + " with date and " + info.state + " response");
+    });
+    </script>
+  </body>
+</html>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty.html (198887 => 198888)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty.html	2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty.html	2016-03-31 08:26:29 UTC (rev 198888)
@@ -12,7 +12,7 @@
   <body>
     <script>
     function checkBodyText(request) {
-      return request.text().then( function(bodyAsText) {
+      return request.text().then(function(bodyAsText) {
         assert_equals(bodyAsText, "", "Resolved value should be empty");
         assert_false(request.bodyUsed);
       });
@@ -20,7 +20,7 @@
 
     function checkBodyBlob(request) {
       return request.blob().then(function(bodyAsBlob) {
-        var promise = new Promise(function (resolve, reject) {
+        var promise = new Promise(function(resolve, reject) {
           var reader = new FileReader();
           reader._onload_ = function(evt) {
             resolve(reader.result)
@@ -38,7 +38,7 @@
     }
 
     function checkBodyArrayBuffer(request) {
-      return request.arrayBuffer().then( function(bodyAsArrayBuffer) {
+      return request.arrayBuffer().then(function(bodyAsArrayBuffer) {
         assert_equals(bodyAsArrayBuffer.byteLength, 0, "Resolved value should be empty");
         assert_false(request.bodyUsed);
       });
@@ -46,10 +46,10 @@
 
     function checkBodyJSON(request) {
       return request.json().then(
-        (bodyAsJSON) => {
+        function(bodyAsJSON) {
           assert_unreached("JSON parsing should fail");
         },
-        () => {
+        function() {
           assert_false(request.bodyUsed);
         });
     }
@@ -78,7 +78,7 @@
 
     function checkRequestWithEmptyBody(bodyType, body, asText) {
       promise_test(function(test) {
-        var request = new Request("", {"method": "POST", "body" : body});
+        var request = new Request("", {"method": "POST", "body": body});
         assert_false(request.bodyUsed, "bodyUsed is false at init");
         if (asText) {
           return request.text().then(function(bodyAsString) {

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume.html (198887 => 198888)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume.html	2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume.html	2016-03-31 08:26:29 UTC (rev 198888)
@@ -8,6 +8,7 @@
     <meta name="author" title="Canon Research France" href=""
     <script src=""
     <script src=""
+    <script src=""
   </head>
   <body>
     <script>
@@ -37,19 +38,9 @@
       });
     }
 
-    <!-- Taken from https://developers.google.com -->
-    function str2ab(str) {
-      var buf = new ArrayBuffer(str.length*2); // 2 bytes for each char
-      var bufView = new Uint16Array(buf);
-      for (var i=0, strLen=str.length; i < strLen; i++) {
-        bufView[i] = str.charCodeAt(i);
-      }
-      return buf;
-    }
-
     function checkBodyArrayBuffer(request, expectedBody) {
-      return request.arrayBuffer().then( function(bodyAsArrayBuffer) {
-        assert_array_equals(bodyAsArrayBuffer, str2ab(expectedBody), "Retrieve and verify request's body");
+      return request.arrayBuffer().then(function(bodyAsArrayBuffer) {
+        validateBufferFromString(bodyAsArrayBuffer, expectedBody, "Retrieve and verify request's body");
         assert_true(request.bodyUsed, "body as arrayBuffer: bodyUsed turned true");
       });
     }
@@ -85,7 +76,7 @@
     checkRequestBody(textData, "text", checkBodyText);
     checkRequestBody(textData, "blob", checkBodyBlob);
     checkRequestBody(textData, "arrayBuffer", checkBodyArrayBuffer);
-    checkRequestBody(JSON.stringify(textData), "json", checkBodyJSON);
+    checkRequestBody(textData, "json", checkBodyJSON);
     checkRequestBody(formData, "formData", checkBodyFormData);
 
     function checkBlobResponseBody(blobBody, blobData, bodyType, checkFunction) {

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl-expected.txt (198887 => 198888)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl-expected.txt	2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl-expected.txt	2016-03-31 08:26:29 UTC (rev 198888)
@@ -31,7 +31,7 @@
 PASS Request interface: new Request("") must inherit property "type" with the proper type (3) 
 PASS Request interface: new Request("") must inherit property "destination" with the proper type (4) 
 PASS Request interface: new Request("") must inherit property "referrer" with the proper type (5) 
-FAIL Request interface: new Request("") must inherit property "referrerPolicy" with the proper type (6) Unrecognized type ReferrerPolicy
+PASS Request interface: new Request("") must inherit property "referrerPolicy" with the proper type (6) 
 PASS Request interface: new Request("") must inherit property "mode" with the proper type (7) 
 PASS Request interface: new Request("") must inherit property "credentials" with the proper type (8) 
 PASS Request interface: new Request("") must inherit property "cache" with the proper type (9) 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl.html (198887 => 198888)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl.html	2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl.html	2016-03-31 08:26:29 UTC (rev 198888)
@@ -70,6 +70,7 @@
       enum RequestCredentials { "omit", "same-origin", "include" };
       enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" };
       enum RequestRedirect { "follow", "error", "manual" };
+      enum ReferrerPolicy { "", "no-referrer", "no-referrer-when-downgrade", "origin-only", "origin-when-cross-origin", "unsafe-url" };
     </script>
     <script>
       var idlsArray = new IdlArray();

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002-expected.txt (198887 => 198888)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002-expected.txt	2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002-expected.txt	2016-03-31 08:26:29 UTC (rev 198888)
@@ -1,5 +1,7 @@
 
 PASS Initialize Request with headers values 
+PASS Initialize Request's body with undefined 
+PASS Initialize Request's body with null 
 PASS Initialize Request's body with application/octet-binary 
 FAIL Initialize Request's body with multipart/form-data promise_test: Unhandled rejection with value: undefined
 PASS Initialize Request's body with text/plain;charset=UTF-8 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002.html (198887 => 198888)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002.html	2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002.html	2016-03-31 08:26:29 UTC (rev 198888)
@@ -23,18 +23,23 @@
         }
       }, "Initialize Request with headers values");
 
+      function makeRequestInit(body, method) {
+        return {"method": method, "body": body};
+      }
+
       function checkRequestInit(body, bodyType, expectedTextBody) {
         promise_test(function(test) {
-          var request = new Request("", {"method": "POST", "body": body});
-          assert_throws(new TypeError(),
-                        function() { new Request("", {"method": "GET", "body": body}); }
-          );
-          assert_throws(new TypeError(),
-                        function() { new Request("", {"method": "HEAD", "body": body}); }
-          );
+          var request = new Request("", makeRequestInit(body, "POST"));
+          if (body) {
+            assert_throws(new TypeError(),
+                          function() { new Request("", makeRequestInit(body, "GET")); }
+            );
+          } else {
+            new Request("", makeRequestInit(body, "GET")); // should not throw
+          }
           var reqHeaders = request.headers;
           var mime = reqHeaders.get("Content-Type");
-          assert_true(mime && mime.search(bodyType) > -1, "Content-Type header should be \"" + bodyType + "\", not \"" + mime + "\"");
+          assert_true(!body || (mime && mime.search(bodyType) > -1), "Content-Type header should be \"" + bodyType + "\", not \"" + mime + "\"");
           return request.text().then(function(bodyAsText) {
             //not equals: cannot guess formData exact value
             assert_true( bodyAsText.search(expectedTextBody) > -1, "Retrieve and verify request body");
@@ -47,6 +52,8 @@
       formaData.append("name", "value");
       var usvString = "This is a USVString"
 
+      checkRequestInit(undefined, undefined, "");
+      checkRequestInit(null, null, "");
       checkRequestInit(blob, "application/octet-binary", "This is a blob");
       checkRequestInit(formaData, "multipart/form-data", "name=\"name\"\r\n\r\nvalue");
       checkRequestInit(usvString, "text/plain;charset=UTF-8", "This is a USVString");

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/cache.py (0 => 198888)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/cache.py	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/cache.py	2016-03-31 08:26:29 UTC (rev 198888)
@@ -0,0 +1,53 @@
+def main(request, response):
+    token = request.GET.first("token", None)
+    if "querystate" in request.GET:
+        from json import JSONEncoder
+        response.headers.set("Content-Type", "text/plain")
+        return JSONEncoder().encode(request.server.stash.take(token))
+    content = request.GET.first("content", None)
+    tag = request.GET.first("tag", None)
+    date = request.GET.first("date", None)
+    expires = request.GET.first("expires", None)
+    vary = request.GET.first("vary", None)
+    cc = request.GET.first("cache_control", None)
+    inm = request.headers.get("If-None-Match", None)
+    ims = request.headers.get("If-Modified-Since", None)
+    pragma = request.headers.get("Pragma", None)
+    cache_control = request.headers.get("Cache-Control", None)
+    ignore = "ignore" in request.GET
+
+    server_state = request.server.stash.take(token)
+    if not server_state:
+        server_state = []
+    state = dict()
+    if not ignore:
+        if inm:
+            state["If-None-Match"] = inm
+        if ims:
+            state["If-Modified-Since"] = ims
+        if pragma:
+            state["Pragma"] = pragma
+        if cache_control:
+            state["Cache-Control"] = cache_control
+    server_state.append(state)
+    request.server.stash.put(token, server_state)
+
+    if tag:
+        response.headers.set("ETag", '"%s"' % tag)
+    elif date:
+        response.headers.set("Last-Modified", date)
+    if expires:
+        response.headers.set("Expires", expires)
+    if vary:
+        response.headers.set("Vary", vary)
+    if cc:
+        response.headers.set("Cache-Control", cc)
+
+    if ((inm is not None and inm == tag) or
+        (ims is not None and ims == date)):
+        response.status = (304, "Not Modified")
+        return ""
+    else:
+        response.status = (200, "OK")
+        response.headers.set("Content-Type", "text/plain")
+        return content

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/utils.js (198887 => 198888)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/utils.js	2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/utils.js	2016-03-31 08:26:29 UTC (rev 198888)
@@ -44,25 +44,31 @@
   }
 }
 
-//check reader's text content in an asyncronous test
-function readTextStream(reader, asyncTest, expectedValue, retrievedText) {
-  if (!retrievedText)
-    retrievedText = "";
-  reader.read().then(function(data) {
+function stringToArray(str) {
+  var array = new Uint8Array(str.length);
+  for (var i=0, strLen = str.length; i < strLen; i++)
+    array[i] = str.charCodeAt(i);
+  return array;
+}
+
+function validateBufferFromString(buffer, expectedValue, message)
+{
+  return assert_array_equals(new Uint8Array(buffer), stringToArray(expectedValue), message);
+}
+
+function validateStreamFromString(reader, expectedValue, retrievedArrayBuffer) {
+  return reader.read().then(function(data) {
     if (!data.done) {
-      var decoder = new TextDecoder();
-      retrievedText += decoder.decode(data.value);
-      readTextStream(reader, asyncTest, expectedValue, retrievedText);
-      return;
+      var newBuffer;
+      if (retrievedArrayBuffer) {
+        newBuffer =  new ArrayBuffer(data.value.length + retrievedArrayBuffer.length);
+        newBuffer.set(retrievedArrayBuffer, 0);
+        newBuffer.set(data.value, retrievedArrayBuffer.length);
+      } else {
+        newBuffer = data.value;
+      }
+      return validateStreamFromString(reader, expectedValue, newBuffer);
     }
-    asyncTest.step(function() {
-      assert_equals(retrievedText, expectedValue, "Retrieve and verify stream");
-      asyncTest.done();
-    });
-  }).catch(function(e) {
-    asyncTest.step(function() {
-      assert_unreached("Cannot read stream " + e);
-      asyncTest.done();
-    });
+    validateBufferFromString(retrievedArrayBuffer, expectedValue, "Retrieve and verify stream");
   });
 }

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone.html (198887 => 198888)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone.html	2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone.html	2016-03-31 08:26:29 UTC (rev 198888)
@@ -45,12 +45,12 @@
           "Expect response.headers has name:value header");
       }, "Check Response's clone has the expected attribute values");
 
-      async_test(function(test) {
-        readTextStream(response.body.getReader(), test, body);
+      promise_test(function(test) {
+        return validateStreamFromString(response.body.getReader(), body);
       }, "Check orginal response's body after cloning");
 
-      async_test(function(test) {
-        readTextStream(clonedResponse.body.getReader(), test, body);
+      promise_test(function(test) {
+        return validateStreamFromString(clonedResponse.body.getReader(), body);
       }, "Check cloned response's body");
 
       promise_test(function(test) {
@@ -63,4 +63,4 @@
       }, "Cannot clone a disturbed response");
     </script>
   </body>
-</html>
\ No newline at end of file
+</html>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-empty.html (198887 => 198888)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-empty.html	2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-empty.html	2016-03-31 08:26:29 UTC (rev 198888)
@@ -12,7 +12,7 @@
   <body>
     <script>
     function checkBodyText(response) {
-      return response.text().then( function(bodyAsText) {
+      return response.text().then(function(bodyAsText) {
         assert_equals(bodyAsText, "", "Resolved value should be empty");
         assert_false(response.bodyUsed);
       });
@@ -20,7 +20,7 @@
 
     function checkBodyBlob(response) {
       return response.blob().then(function(bodyAsBlob) {
-        var promise = new Promise(function (resolve, reject) {
+        var promise = new Promise(function(resolve, reject) {
           var reader = new FileReader();
           reader._onload_ = function(evt) {
             resolve(reader.result)
@@ -38,7 +38,7 @@
     }
 
     function checkBodyArrayBuffer(response) {
-      return response.arrayBuffer().then( function(bodyAsArrayBuffer) {
+      return response.arrayBuffer().then(function(bodyAsArrayBuffer) {
         assert_equals(bodyAsArrayBuffer.byteLength, 0, "Resolved value should be empty");
         assert_false(response.bodyUsed);
       });
@@ -46,10 +46,10 @@
 
     function checkBodyJSON(response) {
       return response.json().then(
-        (bodyAsJSON) => {
+        function(bodyAsJSON) {
           assert_unreached("JSON parsing should fail");
         },
-        () => {
+        function() {
           assert_false(response.bodyUsed);
         });
     }
@@ -78,7 +78,7 @@
 
     function checkResponseWithEmptyBody(bodyType, body, asText) {
       promise_test(function(test) {
-        var response = new Response("", {"method": "POST", "body" : body});
+        var response = new Response(body);
         assert_false(response.bodyUsed, "bodyUsed is false at init");
         if (asText) {
           return response.text().then(function(bodyAsString) {

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume.html (198887 => 198888)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume.html	2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume.html	2016-03-31 08:26:29 UTC (rev 198888)
@@ -8,6 +8,7 @@
     <meta name="author" title="Canon Research France" href=""
     <script src=""
     <script src=""
+    <script src=""
   </head>
   <body>
     <script>
@@ -37,19 +38,9 @@
       });
     }
 
-    <!-- Taken from https://developers.google.com -->
-    function str2ab(str) {
-      var buf = new ArrayBuffer(str.length*2); // 2 bytes for each char
-      var bufView = new Uint16Array(buf);
-      for (var i=0, strLen=str.length; i < strLen; i++) {
-        bufView[i] = str.charCodeAt(i);
-      }
-      return buf;
-    }
-
     function checkBodyArrayBuffer(response, expectedBody) {
       return response.arrayBuffer().then( function(bodyAsArrayBuffer) {
-        assert_array_equals(bodyAsArrayBuffer, str2ab(expectedBody), "Retrieve and verify response's body");
+        validateBufferFromString(bodyAsArrayBuffer, expectedBody, "Retrieve and verify response's body");
         assert_true(response.bodyUsed, "body as arrayBuffer: bodyUsed turned true");
       });
     }
@@ -85,9 +76,7 @@
     checkResponseBody(textData, "text", checkBodyText);
     checkResponseBody(textData, "blob", checkBodyBlob);
     checkResponseBody(textData, "arrayBuffer", checkBodyArrayBuffer);
-
-    checkResponseBody(JSON.stringify("This is response's body"), "json", checkBodyJSON);
-
+    checkResponseBody(textData, "json", checkBodyJSON);
     checkResponseBody(formData, "formData", checkBodyFormData);
 
     function checkBlobResponseBody(blobBody, blobData, bodyType, checkFunction) {

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-init-002.html (198887 => 198888)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-init-002.html	2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-init-002.html	2016-03-31 08:26:29 UTC (rev 198888)
@@ -52,10 +52,10 @@
       checkResponseInit(urlSearchParams, "application/x-www-form-urlencoded;charset=UTF-8", "name=value");
       checkResponseInit(usvString, "text/plain;charset=UTF-8", "This is a USVString");
 
-      async_test(function(test) {
+      promise_test(function(test) {
         var body = "This is response body";
         var response = new Response(body);
-        readTextStream(response.body.getReader(), test, body);
+        return validateStreamFromString(response.body.getReader(), body);
       }, "Read Response's body as readableStream");
     </script>
   </body>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to