OLD | NEW |
---|---|
(Empty) | |
1 if (self.importScripts) { | |
2 importScripts('/resources/testharness.js'); | |
3 importScripts('../resources/test-helpers.js'); | |
4 } | |
5 | |
6 prepopulated_cache_test(simple_entries, function(cache, entries) { | |
7 return cache.keys('not-present-in-the-cache') | |
8 .then(function(result) { | |
9 assert_request_array_equivalent( | |
10 result, [], | |
11 'Cache.keys should resolve with an empty array on failure.'); | |
12 }); | |
13 }, 'Cache.keys with no matching entries'); | |
14 | |
15 prepopulated_cache_test(simple_entries, function(cache, entries) { | |
16 return cache.keys(entries.a.request.url) | |
17 .then(function(result) { | |
18 assert_request_array_equals(result, [entries.a.request], | |
19 'Cache.keys should match by URL.'); | |
20 }); | |
21 }, 'Cache.keys with URL'); | |
22 | |
23 prepopulated_cache_test(simple_entries, function(cache, entries) { | |
24 return cache.keys(entries.a.request) | |
25 .then(function(result) { | |
26 assert_request_array_equals( | |
27 result, [entries.a.request], | |
28 'Cache.keys should match by Request.'); | |
29 }); | |
30 }, 'Cache.keys with Request'); | |
31 | |
32 prepopulated_cache_test(simple_entries, function(cache, entries) { | |
33 return cache.keys(new Request(entries.a.request.url)) | |
34 .then(function(result) { | |
35 assert_request_array_equals( | |
36 result, [entries.a.request], | |
37 'Cache.keys should match by Request.'); | |
38 }); | |
39 }, 'Cache.keys with new Request'); | |
40 | |
41 prepopulated_cache_test(simple_entries, function(cache, entries) { | |
42 return cache.keys(entries.a.request, | |
43 {ignoreSearch: true}) | |
nhiroki
2016/08/08 12:40:54
Args don't need 4-spaces indent.
zino
2016/08/08 16:36:03
Done.
| |
44 .then(function(result) { | |
45 assert_request_array_equivalent( | |
46 result, | |
47 [ | |
48 entries.a.request, | |
49 entries.a_with_query.request | |
50 ], | |
51 'Cache.keys with ignoreSearch should ignore the ' + | |
52 'search parameters of cached request.'); | |
53 }); | |
54 }, | |
55 'Cache.keys with ignoreSearch option (request with no search ' + | |
56 'parameters)'); | |
57 | |
58 prepopulated_cache_test(simple_entries, function(cache, entries) { | |
59 return cache.keys(entries.a_with_query.request, | |
60 {ignoreSearch: true}) | |
61 .then(function(result) { | |
62 assert_request_array_equivalent( | |
63 result, | |
64 [ | |
65 entries.a.request, | |
66 entries.a_with_query.request | |
67 ], | |
68 'Cache.keys with ignoreSearch should ignore the ' + | |
69 'search parameters of request.'); | |
70 }); | |
71 }, | |
72 'Cache.keys with ignoreSearch option (request with search parameters)'); | |
73 | |
74 prepopulated_cache_test(simple_entries, function(cache, entries) { | |
75 return cache.keys(entries.cat.request.url + '#mouse') | |
76 .then(function(result) { | |
77 assert_request_array_equivalent( | |
78 result, | |
79 [ | |
80 entries.cat.request, | |
81 ], | |
82 'Cache.keys should ignore URL fragment.'); | |
83 }); | |
84 }, 'Cache.keys with URL containing fragment'); | |
85 | |
86 prepopulated_cache_test(simple_entries, function(cache, entries) { | |
87 return cache.keys('http') | |
88 .then(function(result) { | |
89 assert_request_array_equivalent( | |
90 result, [], | |
91 'Cache.keys should treat query as a URL and not ' + | |
92 'just a string fragment.'); | |
93 }); | |
94 }, 'Cache.keys with string fragment "http" as query'); | |
95 | |
96 prepopulated_cache_test(simple_entries, function(cache, entries) { | |
97 return cache.keys() | |
98 .then(function(result) { | |
99 assert_request_array_equivalent( | |
jkarlin
2016/08/02 12:06:20
Add a TODO to remove the "equivalent" part and del
zino
2016/08/08 16:36:03
Done.
| |
100 result, | |
101 [ | |
102 entries.a.request, | |
103 entries.b.request, | |
104 entries.a_with_query.request, | |
105 entries.A.request, | |
106 entries.a_https.request, | |
107 entries.a_org.request, | |
108 entries.cat.request, | |
109 entries.catmandu.request, | |
110 entries.cat_num_lives.request, | |
111 entries.cat_in_the_hat.request, | |
112 entries.non_2xx_response.request, | |
113 entries.error_response.request | |
114 ], | |
115 'Cache.keys without parameters should match all entries.'); | |
116 }); | |
117 }, 'Cache.keys without parameters'); | |
118 | |
119 done(); | |
OLD | NEW |