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

Side by Side Diff: LayoutTests/http/tests/serviceworker/resources/cache-put-worker.js

Issue 675783004: Service Worker: Remove redundant assertions from Cache.put() test case (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/http/tests/serviceworker/cache-put-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 importScripts('worker-testharness.js'); 1 importScripts('worker-testharness.js');
2 importScripts('/resources/testharness-helpers.js'); 2 importScripts('/resources/testharness-helpers.js');
3 3
4 var test_url = 'https://example.com/foo'; 4 var test_url = 'https://example.com/foo';
5 5
6 // Construct a generic Request object. The URL is |test_url|. All other fields 6 // Construct a generic Request object. The URL is |test_url|. All other fields
7 // are defaults. 7 // are defaults.
8 function new_test_request() { 8 function new_test_request() {
9 return new Request(test_url); 9 return new Request(test_url);
10 } 10 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 var request = new_test_request(); 95 var request = new_test_request();
96 var response = new Response('', { 96 var response = new Response('', {
97 status: 200, 97 status: 200,
98 headers: [['Content-Type', 'text/plain']] 98 headers: [['Content-Type', 'text/plain']]
99 }); 99 });
100 return cache.put(request, response) 100 return cache.put(request, response)
101 .then(function() { 101 .then(function() {
102 return cache.match(test_url); 102 return cache.match(test_url);
103 }) 103 })
104 .then(function(result) { 104 .then(function(result) {
105 assert_object_equals(result, response, 105 assert_equals(result.status, 200, 'Cache.put should store status.');
106 'Cache.put should update the cache with ' + 106 assert_equals(result.headers.get('Content-Type'), 'text/plain',
107 'new request and response.'); 107 'Cache.put should store headers.');
108 return result.text(); 108 return result.text();
109 }) 109 })
110 .then(function(body) { 110 .then(function(body) {
111 assert_equals(body, '', 111 assert_equals(body, '',
112 'Cache.put should store response body.'); 112 'Cache.put should store response body.');
113 }); 113 });
114 }, 'Cache.put with an empty response body'); 114 }, 'Cache.put with an empty response body');
115 115
116 cache_test(function(cache) { 116 cache_test(function(cache) {
117 var test_url = new URL('fetch-status.php?status=500', location.href).href; 117 var test_url = new URL('fetch-status.php?status=500', location.href).href;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 new TypeError(), 202 new TypeError(),
203 'Cache.put should throw a TypeError for non-GET requests.'); 203 'Cache.put should throw a TypeError for non-GET requests.');
204 }, 'Cache.put with a non-GET request'); 204 }, 'Cache.put with a non-GET request');
205 205
206 cache_test(function(cache) { 206 cache_test(function(cache) {
207 return assert_promise_rejects( 207 return assert_promise_rejects(
208 cache.put(new_test_request(), null), 208 cache.put(new_test_request(), null),
209 new TypeError(), 209 new TypeError(),
210 'Cache.put should throw a TypeError for an empty response.'); 210 'Cache.put should throw a TypeError for an empty response.');
211 }, 'Cache.put with an empty response'); 211 }, 'Cache.put with an empty response');
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/serviceworker/cache-put-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698