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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-stream-disturbed-1.html

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 <!doctype html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>Consuming Response body after getting a ReadableStream</title>
6 <meta name="help" href="https://fetch.spec.whatwg.org/#response">
7 <meta name="help" href="https://fetch.spec.whatwg.org/#body-mixin">
8 <meta name="author" title="Canon Research France" href="https://www.crf.cano n.fr">
9 <script src="/resources/testharness.js"></script>
10 <script src="/resources/testharnessreport.js"></script>
11 </head>
12 <body>
13 <script>
14
15 function createResponseWithReadableStream(callback) {
16 return fetch("../resources/data.json").then(function(response) {
17 var reader = response.body.getReader();
18 reader.releaseLock();
19 return callback(response);
20 });
21 }
22
23 promise_test(function() {
24 return createResponseWithReadableStream(function(response) {
25 return response.blob().then(function(blob) {
26 assert_true(blob instanceof Blob);
27 });
28 });
29 }, "Getting blob after getting the Response body - not disturbed, not locked");
30
31 promise_test(function() {
32 return createResponseWithReadableStream(function(response) {
33 return response.text().then(function(text) {
34 assert_true(text.length > 0);
35 });
36 });
37 }, "Getting text after getting the Response body - not disturbed, not locked");
38
39 promise_test(function() {
40 return createResponseWithReadableStream(function(response) {
41 return response.json().then(function(json) {
42 assert_true(typeof json === "object");
43 });
44 });
45 }, "Getting json after getting the Response body - not disturbed, not locked");
46
47 promise_test(function() {
48 return createResponseWithReadableStream(function(response) {
49 return response.arrayBuffer().then(function(arrayBuffer) {
50 assert_true(arrayBuffer.byteLength > 0);
51 });
52 });
53 }, "Getting arrayBuffer after getting the Response body - not disturbed, not loc ked");
54
55 </script>
56 </body>
57 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698