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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-storage-match.js

Issue 2204683002: Cache API should not match() HEAD requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: HEAD -> Head Created 4 years, 4 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/http/tests/cachestorage/script-tests/cache-storage-match.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-storage-match.js b/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-storage-match.js
index 2102d78f079a03052f17d639a7bd1262c005eab0..21517b1eccddcae9bca4349c282e3d942bdf9a8b 100644
--- a/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-storage-match.js
+++ b/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-storage-match.js
@@ -60,7 +60,7 @@ promise_test(function(test) {
return Promise.all(test_cache_list.map(function(key) {
return self.caches.open(key);
}))
- .then(function() { return caches.open('x'); })
+ .then(function() { return self.caches.open('x'); })
.then(function(cache) {
return cache.put(transaction.request.clone(),
transaction.response.clone());
@@ -93,13 +93,26 @@ cache_test(function(cache) {
});
}, 'CacheStorageMatch a string request');
+cache_test(function(cache) {
+ var transaction = create_unique_transaction();
+ return cache.put(transaction.request.clone(), transaction.response.clone())
+ .then(function() {
+ return self.caches.match(new Request(transaction.request.url,
+ {method: 'HEAD'}));
+ })
+ .then(function(response) {
+ assert_equals(response, undefined,
+ 'A HEAD request should not be matched');
+ });
+}, 'CacheStorageMatch a HEAD request');
+
promise_test(function(test) {
var transaction = create_unique_transaction();
return self.caches.match(transaction.request)
.then(function(response) {
assert_equals(response, undefined,
'The response should not be found.');
- })
+ });
}, 'CacheStorageMatch with no cached entry');
promise_test(function(test) {
@@ -117,7 +130,7 @@ promise_test(function(test) {
})
.then(function(has_foo) {
assert_false(has_foo, "The cache should still not exist.");
- })
+ });
}, 'CacheStorageMatch with no caches available but name provided');
done();

Powered by Google App Engine
This is Rietveld 408576698