OLD | NEW |
1 if (self.importScripts) { | 1 if (self.importScripts) { |
2 importScripts('../resources/fetch-test-helpers.js'); | 2 importScripts('../resources/fetch-test-helpers.js'); |
3 importScripts('/serviceworker/resources/fetch-access-control-util.js'); | 3 importScripts('/serviceworker/resources/fetch-access-control-util.js'); |
4 } | 4 } |
5 | 5 |
6 var TEST_TARGETS = [ | 6 var TEST_TARGETS = [ |
7 // Auth check | 7 // Auth check |
8 [BASE_URL + 'Auth', | |
9 [fetchResolved, hasBody], [authCheck1]], | |
10 [BASE_URL + 'Auth&credentials=omit', | |
11 [fetchResolved, hasBody], [checkJsonpError]], | |
12 [BASE_URL + 'Auth&credentials=include', | |
13 [fetchResolved, hasBody], [authCheck1]], | |
14 [BASE_URL + 'Auth&credentials=same-origin', | |
15 [fetchResolved, hasBody], [authCheck1]], | |
16 | |
17 [BASE_URL + 'Auth&mode=no-cors&credentials=omit', | |
18 [fetchResolved, hasBody], [checkJsonpError]], | |
19 [BASE_URL + 'Auth&mode=no-cors&credentials=include', | |
20 [fetchResolved, hasBody], [authCheck1]], | |
21 [BASE_URL + 'Auth&mode=no-cors&credentials=same-origin', | |
22 [fetchResolved, hasBody], [authCheck1]], | |
23 | |
24 [BASE_URL + 'Auth&mode=same-origin&credentials=omit', | 8 [BASE_URL + 'Auth&mode=same-origin&credentials=omit', |
25 [fetchResolved, hasBody], [checkJsonpError]], | 9 [fetchResolved, hasBody], [checkJsonpError]], |
26 [BASE_URL + 'Auth&mode=same-origin&credentials=include', | 10 [BASE_URL + 'Auth&mode=same-origin&credentials=include', |
27 [fetchResolved, hasBody], [authCheck1]], | 11 [fetchResolved, hasBody], [authCheck1]], |
28 [BASE_URL + 'Auth&mode=same-origin&credentials=same-origin', | 12 [BASE_URL + 'Auth&mode=same-origin&credentials=same-origin', |
29 [fetchResolved, hasBody], [authCheck1]], | 13 [fetchResolved, hasBody], [authCheck1]], |
30 | 14 |
31 [BASE_URL + 'Auth&mode=cors&credentials=omit', | 15 [BASE_URL + 'Auth&mode=cors&credentials=omit', |
32 [fetchResolved, hasBody], [checkJsonpError]], | 16 [fetchResolved, hasBody], [checkJsonpError]], |
33 [BASE_URL + 'Auth&mode=cors&credentials=include', | 17 [BASE_URL + 'Auth&mode=cors&credentials=include', |
34 [fetchResolved, hasBody], [authCheck1]], | 18 [fetchResolved, hasBody], [authCheck1]], |
35 [BASE_URL + 'Auth&mode=cors&credentials=same-origin', | 19 [BASE_URL + 'Auth&mode=cors&credentials=same-origin', |
36 [fetchResolved, hasBody], [authCheck1]], | 20 [fetchResolved, hasBody], [authCheck1]], |
37 | 21 |
38 [OTHER_BASE_URL + 'Auth', | |
39 [fetchResolved, noBody, typeOpaque], | |
40 onlyOnServiceWorkerProxiedTest([authCheck2])], | |
41 [OTHER_BASE_URL + 'Auth&credentials=omit', | |
42 [fetchResolved, noBody, typeOpaque], | |
43 onlyOnServiceWorkerProxiedTest([checkJsonpError])], | |
44 [OTHER_BASE_URL + 'Auth&credentials=include', | |
45 [fetchResolved, noBody, typeOpaque], | |
46 onlyOnServiceWorkerProxiedTest([authCheck2])], | |
47 [OTHER_BASE_URL + 'Auth&credentials=same-origin', | |
48 [fetchResolved, noBody, typeOpaque], | |
49 onlyOnServiceWorkerProxiedTest([authCheck2])], | |
50 | |
51 [OTHER_BASE_URL + 'Auth&mode=no-cors&credentials=omit', | |
52 [fetchResolved, noBody, typeOpaque], | |
53 onlyOnServiceWorkerProxiedTest([checkJsonpError])], | |
54 [OTHER_BASE_URL + 'Auth&mode=no-cors&credentials=include', | |
55 [fetchResolved, noBody, typeOpaque], | |
56 onlyOnServiceWorkerProxiedTest([authCheck2])], | |
57 [OTHER_BASE_URL + 'Auth&mode=no-cors&credentials=same-origin', | |
58 [fetchResolved, noBody, typeOpaque], | |
59 onlyOnServiceWorkerProxiedTest([authCheck2])], | |
60 | |
61 [OTHER_BASE_URL + 'Auth&mode=same-origin&credentials=omit', | 22 [OTHER_BASE_URL + 'Auth&mode=same-origin&credentials=omit', |
62 [fetchRejected]], | 23 [fetchRejected]], |
63 [OTHER_BASE_URL + 'Auth&mode=same-origin&credentials=include', | 24 [OTHER_BASE_URL + 'Auth&mode=same-origin&credentials=include', |
64 [fetchRejected]], | 25 [fetchRejected]], |
65 [OTHER_BASE_URL + 'Auth&mode=same-origin&credentials=same-origin', | 26 [OTHER_BASE_URL + 'Auth&mode=same-origin&credentials=same-origin', |
66 [fetchRejected]], | 27 [fetchRejected]], |
67 | 28 |
68 // CORS check tests | 29 // CORS check tests |
69 // Spec: https://fetch.spec.whatwg.org/#concept-cors-check | 30 // Spec: https://fetch.spec.whatwg.org/#concept-cors-check |
70 | 31 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 [OTHER_BASE_URL + 'Auth&mode=cors&credentials=include&ACAOrigin=' + | 127 [OTHER_BASE_URL + 'Auth&mode=cors&credentials=include&ACAOrigin=' + |
167 BASE_ORIGIN + '&PACAOrigin=' + BASE_ORIGIN + | 128 BASE_ORIGIN + '&PACAOrigin=' + BASE_ORIGIN + |
168 '&PACACredentials=true&method=PUT&PACAMethods=PUT&PreflightTest=200', | 129 '&PACACredentials=true&method=PUT&PACAMethods=PUT&PreflightTest=200', |
169 [fetchRejected]], | 130 [fetchRejected]], |
170 ]; | 131 ]; |
171 | 132 |
172 if (self.importScripts) { | 133 if (self.importScripts) { |
173 executeTests(TEST_TARGETS); | 134 executeTests(TEST_TARGETS); |
174 done(); | 135 done(); |
175 } | 136 } |
OLD | NEW |