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

Side by Side Diff: LayoutTests/http/tests/cachestorage/script-tests/cache-add.js

Issue 1049983003: [Fetch] Body consume function should not set bodyUsed flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@stream-clone
Patch Set: Created 5 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/cachestorage/script-tests/cache-put.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 if (self.importScripts) { 1 if (self.importScripts) {
2 importScripts('/resources/testharness.js'); 2 importScripts('/resources/testharness.js');
3 importScripts('/resources/testharness-helpers.js'); 3 importScripts('/resources/testharness-helpers.js');
4 importScripts('../resources/test-helpers.js'); 4 importScripts('../resources/test-helpers.js');
5 } 5 }
6 6
7 cache_test(function(cache) { 7 cache_test(function(cache) {
8 return assert_promise_rejects( 8 return assert_promise_rejects(
9 cache.add(), 9 cache.add(),
10 new TypeError(), 10 new TypeError(),
(...skipping 21 matching lines...) Expand all
32 .then(function(result) { 32 .then(function(result) {
33 assert_equals(result, undefined, 33 assert_equals(result, undefined,
34 'Cache.add should resolve with undefined on success.'); 34 'Cache.add should resolve with undefined on success.');
35 }); 35 });
36 }, 'Cache.add called with Request object'); 36 }, 'Cache.add called with Request object');
37 37
38 cache_test(function(cache) { 38 cache_test(function(cache) {
39 var request = new Request('../resources/simple.txt', {method: 'POST', body: 'Hello'}); 39 var request = new Request('../resources/simple.txt', {method: 'POST', body: 'Hello'});
40 return request.text() 40 return request.text()
41 .then(function() { 41 .then(function() {
42 assert_true(request.bodyUsed); 42 assert_false(request.bodyUsed);
43 }) 43 })
44 .then(function() { 44 .then(function() {
45 return assert_promise_rejects( 45 return cache.add(request);
46 cache.add(request),
47 new TypeError(),
48 'Cache.add with a Request object with a used body should reject ' +
49 'with a TypeError.');
50 }); 46 });
51 }, 'Cache.add called with Request object with a used body'); 47 }, 'Cache.add called with Request object with a used body');
52 48
53 cache_test(function(cache) { 49 cache_test(function(cache) {
54 var request = new Request('../resources/simple.txt', {method: 'POST', body: 'Hello'}); 50 var request = new Request('../resources/simple.txt', {method: 'POST', body: 'Hello'});
55 return cache.add(request) 51 return cache.add(request)
56 .then(function(result) { 52 .then(function(result) {
57 assert_equals(result, undefined, 53 assert_equals(result, undefined,
58 'Cache.add should resolve with undefined on success.'); 54 'Cache.add should resolve with undefined on success.');
59 }) 55 })
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 cache_test(function(cache) { 136 cache_test(function(cache) {
141 var request = new Request('../resources/simple.txt'); 137 var request = new Request('../resources/simple.txt');
142 return assert_promise_rejects( 138 return assert_promise_rejects(
143 cache.addAll([request, request]), 139 cache.addAll([request, request]),
144 new TypeError(), 140 new TypeError(),
145 'Cache.addAll should throw TypeError if the same request is added ' + 141 'Cache.addAll should throw TypeError if the same request is added ' +
146 'twice.'); 142 'twice.');
147 }, 'Cache.addAll called with the same Request object specified twice'); 143 }, 'Cache.addAll called with the same Request object specified twice');
148 144
149 done(); 145 done();
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/cachestorage/script-tests/cache-put.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698