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

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/script-tests/cache-put.js

Issue 2610243002: Import wpt@5e1a3b80cea8d36774d2afd78b29a74792e9f15a (Closed)
Patch Set: Rebased Created 3 years, 11 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: third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/script-tests/cache-put.js
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/script-tests/cache-put.js b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/script-tests/cache-put.js
index 71a0e4d9c89f236b93138fbd1ea03c9b66cdc1d4..9e9fd67a3fe917f9291f0157eba0ba6c49893283 100644
--- a/third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/script-tests/cache-put.js
+++ b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/script-tests/cache-put.js
@@ -103,6 +103,19 @@ cache_test(function(cache) {
}, 'Cache.put with an empty response body');
cache_test(function(cache) {
+ var request = new Request(test_url);
+ var response = new Response('', {
+ status: 206,
+ headers: [['Content-Type', 'text/plain']]
+ });
+
+ return assert_promise_rejects(
+ cache.put(request, response),
+ new TypeError(),
+ 'Cache.put should reject 206 Responses with a TypeError.');
+ }, 'Cache.put with 206 response');
+
+cache_test(function(cache) {
var test_url = new URL('../resources/fetch-status.py?status=500', location.href).href;
var request = new Request(test_url);
var response;
@@ -290,4 +303,22 @@ cache_test(function(cache, test) {
'TypeError.');
}, 'Cache.put with an embedded VARY:* Response');
+cache_test(function(cache) {
+ var url = 'foo.html';
+ var redirectURL = 'http://example.com/foo-bar.html';
+ var redirectResponse = Response.redirect(redirectURL);
+ assert_equals(redirectResponse.headers.get('Location'), redirectURL,
+ 'Response.redirect() should set Location header.');
+ return cache.put(url, redirectResponse.clone())
+ .then(function() {
+ return cache.match(url);
+ })
+ .then(function(response) {
+ assert_response_equals(response, redirectResponse,
+ 'Redirect response is reproduced by the Cache API');
+ assert_equals(response.headers.get('Location'), redirectURL,
+ 'Location header is preserved by Cache API.');
+ });
+ }, 'Cache.put should store Response.redirect() correctly');
+
done();

Powered by Google App Engine
This is Rietveld 408576698