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

Unified Diff: LayoutTests/http/tests/serviceworker/resources/fetch-body-stream-worker.js

Issue 555443002: [Fetch API] Put body members directly on Response/Request (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: incorporated yhirano's comment Created 6 years, 3 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: LayoutTests/http/tests/serviceworker/resources/fetch-body-stream-worker.js
diff --git a/LayoutTests/http/tests/serviceworker/resources/fetch-body-stream-worker.js b/LayoutTests/http/tests/serviceworker/resources/fetch-body-stream-worker.js
deleted file mode 100644
index f3f47f9cf305dfef135da96456efc603ddaf5841..0000000000000000000000000000000000000000
--- a/LayoutTests/http/tests/serviceworker/resources/fetch-body-stream-worker.js
+++ /dev/null
@@ -1,94 +0,0 @@
-self.onmessage = function(e) {
- var message = e.data;
- if ('port' in message) {
- port = message.port;
- doTextTest(port);
- }
-};
-
-function quit(port) {
- port.postMessage('quit');
-}
-
-function doFetchTwiceTest(port) {
- var p1Out = p2Out = null;
-
- fetch('doctype.html')
- .then(function(response) {
- var p1 = response.body.asText();
- var p2 = response.body.asText();
-
- p1.then(function(obj) {
- p1Out = obj;
- if (p2Out) {
- complete();
- }
- });
- p2.catch(function(e) {
- p2Out = e;
- if (p1Out) {
- complete();
- }
- });
- });
-
- function complete() {
- port.postMessage(p1Out + ' : ' + p2Out.name);
- quit(port);
- }
-}
-
-function doArrayBufferTest(port) {
- fetch('doctype.html')
- .then(function(response) {
- response.body.asArrayBuffer()
- .then(function(b) {
- port.postMessage('ArrayBuffer: ' + b.byteLength);
- doFetchTwiceTest(port);
- });
- });
-}
-
-function doBlobTest(port) {
- fetch('doctype.html')
- .then(function(response) {
- response.body.asBlob()
- .then(function(blob) {
- port.postMessage('Blob: ' + blob.size + " : " + blob.type);
- doArrayBufferTest(port);
- });
- });
-}
-
-function doJSONFailedTest(port) {
- fetch('doctype.html')
- .then(function(response) {
- response.body.asJSON()
- .catch(function(e) {
- port.postMessage('JSON: ' + e.name);
- doBlobTest(port);
- });
- });
-}
-
-function doJSONTest(port) {
- fetch('simple.json')
- .then(function(response) {
- response.body.asJSON()
- .then(function(json) {
- port.postMessage('JSON: ' + json['a'] + ' ' + json['b']);
- doJSONFailedTest(port);
- });
- });
-}
-
-function doTextTest(port) {
- fetch('doctype.html')
- .then(function(response) {
- response.body.asText()
- .then(function(txt) {
- port.postMessage('Text: ' + txt);
- doJSONTest(port);
- });
- });
-}

Powered by Google App Engine
This is Rietveld 408576698