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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-keys.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-keys.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-keys.js b/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-keys.js
index 65dbca9d891eac03e2bd6722df6ccfa6778f87e0..fad0150715223c0e9913a4459c13b11f15f7f46c 100644
--- a/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-keys.js
+++ b/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-keys.js
@@ -3,6 +3,15 @@ if (self.importScripts) {
importScripts('../resources/test-helpers.js');
}
+cache_test(cache => {
+ return cache.keys()
+ .then(requests => {
+ assert_equals(
+ requests.length, 0,
+ 'Cache.keys should resolve to an empty array for an empty cache');
+ });
+ }, 'Cache.keys() called on an empty cache');
+
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.keys('not-present-in-the-cache')
.then(function(result) {
@@ -123,4 +132,14 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
});
}, 'Cache.keys without parameters');
+prepopulated_cache_test(simple_entries, function(cache, entries) {
+ return cache.keys(new Request(entries.cat.request.url, {method: 'HEAD'}))
+ .then(function(result) {
+ assert_request_array_equals(
+ result, [],
+ 'Cache.keys should not match HEAD request unless ignoreMethod ' +
+ 'option is set.');
+ });
+ }, 'Cache.keys with a HEAD Request');
+
done();

Powered by Google App Engine
This is Rietveld 408576698