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

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

Issue 2415873002: Import w3c tests for the service workers (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/script-tests/cache-matchAll.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-matchAll.js b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/script-tests/cache-matchAll.js
similarity index 57%
copy from third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-matchAll.js
copy to third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/script-tests/cache-matchAll.js
index b7c7bd63785c3b757c325ffab20daa5c848f4a39..2bc661a5c905dfbf10d3eb727ba2a63b0a741800 100644
--- a/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-matchAll.js
+++ b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/script-tests/cache-matchAll.js
@@ -1,12 +1,13 @@
if (self.importScripts) {
importScripts('/resources/testharness.js');
+ importScripts('../resources/testharness-helpers.js');
importScripts('../resources/test-helpers.js');
}
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll('not-present-in-the-cache')
.then(function(result) {
- assert_response_array_equals(
+ assert_response_array_equivalent(
result, [],
'Cache.matchAll should resolve with an empty array on failure.');
});
@@ -39,20 +40,10 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
}, 'Cache.matchAll with new Request');
prepopulated_cache_test(simple_entries, function(cache, entries) {
- return cache.matchAll(new Request(entries.a.request.url, {method: 'HEAD'}),
- {ignoreSearch: true})
- .then(function(result) {
- assert_response_array_equals(
- result, [],
- 'Cache.matchAll should not match HEAD Request.');
- });
- }, 'Cache.matchAll with HEAD');
-
-prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.a.request,
{ignoreSearch: true})
.then(function(result) {
- assert_response_array_equals(
+ assert_response_array_equivalent(
result,
[
entries.a.response,
@@ -69,7 +60,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.a_with_query.request,
{ignoreSearch: true})
.then(function(result) {
- assert_response_array_equals(
+ assert_response_array_equivalent(
result,
[
entries.a.response,
@@ -79,62 +70,12 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
'search parameters of request.');
});
},
- 'Cache.matchAll with ignoreSearch option (request with search parameters)');
-
-cache_test(function(cache) {
- var request = new Request('http://example.com/');
- var head_request = new Request('http://example.com/', {method: 'HEAD'});
- var response = new Response('foo');
- return cache.put(request.clone(), response.clone())
- .then(function() {
- return cache.matchAll(head_request.clone());
- })
- .then(function(result) {
- assert_response_array_equals(
- result, [],
- 'Cache.matchAll should resolve with empty array for a ' +
- 'mismatched method.');
- return cache.matchAll(head_request.clone(),
- {ignoreMethod: true});
- })
- .then(function(result) {
- assert_response_array_equals(
- result, [response],
- 'Cache.matchAll with ignoreMethod should ignore the ' +
- 'method of request.');
- });
- }, 'Cache.matchAll supports ignoreMethod');
-
-cache_test(function(cache) {
- var vary_request = new Request('http://example.com/c',
- {headers: {'Cookies': 'is-for-cookie'}});
- var vary_response = new Response('', {headers: {'Vary': 'Cookies'}});
- var mismatched_vary_request = new Request('http://example.com/c');
-
- return cache.put(vary_request.clone(), vary_response.clone())
- .then(function() {
- return cache.matchAll(mismatched_vary_request.clone());
- })
- .then(function(result) {
- assert_response_array_equals(
- result, [],
- 'Cache.matchAll should resolve as undefined with a ' +
- 'mismatched vary.');
- return cache.matchAll(mismatched_vary_request.clone(),
- {ignoreVary: true});
- })
- .then(function(result) {
- assert_response_array_equals(
- result, [vary_response],
- 'Cache.matchAll with ignoreVary should ignore the ' +
- 'vary of request.');
- });
- }, 'Cache.matchAll supports ignoreVary');
+ 'Cache.matchAll with ignoreSearch option (request with search parameter)');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.cat.request.url + '#mouse')
.then(function(result) {
- assert_response_array_equals(
+ assert_response_array_equivalent(
result,
[
entries.cat.response,
@@ -146,40 +87,17 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll('http')
.then(function(result) {
- assert_response_array_equals(
+ assert_response_array_equivalent(
result, [],
'Cache.matchAll should treat query as a URL and not ' +
'just a string fragment.');
});
}, 'Cache.matchAll with string fragment "http" as query');
-prepopulated_cache_test(simple_entries, function(cache, entries) {
- return cache.matchAll()
- .then(function(result) {
- assert_response_array_equals(
- result,
- [
- entries.a.response,
- entries.b.response,
- entries.a_with_query.response,
- entries.A.response,
- entries.a_https.response,
- entries.a_org.response,
- entries.cat.response,
- entries.catmandu.response,
- entries.cat_num_lives.response,
- entries.cat_in_the_hat.response,
- entries.non_2xx_response.response,
- entries.error_response.response
- ],
- 'Cache.matchAll without parameters should match all entries.');
- });
- }, 'Cache.matchAll without parameters');
-
prepopulated_cache_test(vary_entries, function(cache, entries) {
return cache.matchAll('http://example.com/c')
.then(function(result) {
- assert_response_array_equals(
+ assert_response_array_equivalent(
result,
[
entries.vary_cookie_absent.response
@@ -195,7 +113,7 @@ prepopulated_cache_test(vary_entries, function(cache, entries) {
{headers: {'Cookies': 'none-of-the-above'}}));
})
.then(function(result) {
- assert_response_array_equals(
+ assert_response_array_equivalent(
result,
[
],
@@ -210,7 +128,7 @@ prepopulated_cache_test(vary_entries, function(cache, entries) {
{headers: {'Cookies': 'is-for-cookie'}}));
})
.then(function(result) {
- assert_response_array_equals(
+ assert_response_array_equivalent(
result,
[entries.vary_cookie_is_cookie.response],
'Cache.matchAll should match the entire header if a vary header ' +
@@ -222,16 +140,15 @@ prepopulated_cache_test(vary_entries, function(cache, entries) {
return cache.matchAll('http://example.com/c',
{ignoreVary: true})
.then(function(result) {
- assert_response_array_equals(
+ assert_response_array_equivalent(
result,
[
entries.vary_cookie_is_cookie.response,
entries.vary_cookie_is_good.response,
entries.vary_cookie_absent.response
],
- 'Cache.matchAll should support multiple vary request/response ' +
- 'pairs.');
+ 'Cache.matchAll should honor "ignoreVary" parameter.');
});
- }, 'Cache.matchAll with multiple vary pairs');
+ }, 'Cache.matchAll with "ignoreVary" parameter');
done();

Powered by Google App Engine
This is Rietveld 408576698