OLD | NEW |
(Empty) | |
| 1 if (self.importScripts) { |
| 2 importScripts('../resources/fetch-test-helpers.js'); |
| 3 importScripts('/serviceworker/resources/fetch-access-control-util.js'); |
| 4 } |
| 5 |
| 6 var TEST_TARGETS = [ |
| 7 // Auth check |
| 8 // Test that default mode is no-cors in serviceworker-proxied tests. |
| 9 onlyOnServiceWorkerProxiedTest( |
| 10 [BASE_URL + 'Auth', |
| 11 [fetchResolved, hasBody], [authCheck1]]), |
| 12 onlyOnServiceWorkerProxiedTest( |
| 13 [BASE_URL + 'Auth&credentials=omit', |
| 14 [fetchResolved, hasBody], [checkJsonpError]]), |
| 15 onlyOnServiceWorkerProxiedTest( |
| 16 [BASE_URL + 'Auth&credentials=include', |
| 17 [fetchResolved, hasBody], [authCheck1]]), |
| 18 onlyOnServiceWorkerProxiedTest( |
| 19 [BASE_URL + 'Auth&credentials=same-origin', |
| 20 [fetchResolved, hasBody], [authCheck1]]), |
| 21 |
| 22 // Tests for same-origin requests. |
| 23 [BASE_URL + 'Auth&mode=no-cors&credentials=omit', |
| 24 [fetchResolved, hasBody], [checkJsonpError]], |
| 25 [BASE_URL + 'Auth&mode=no-cors&credentials=include', |
| 26 [fetchResolved, hasBody], [authCheck1]], |
| 27 [BASE_URL + 'Auth&mode=no-cors&credentials=same-origin', |
| 28 [fetchResolved, hasBody], [authCheck1]], |
| 29 |
| 30 // Test that default mode is no-cors in serviceworker-proxied tests. |
| 31 onlyOnServiceWorkerProxiedTest( |
| 32 [OTHER_BASE_URL + 'Auth', |
| 33 [fetchResolved, noBody, typeOpaque], |
| 34 [authCheck2]]), |
| 35 onlyOnServiceWorkerProxiedTest( |
| 36 [OTHER_BASE_URL + 'Auth&credentials=omit', |
| 37 [fetchResolved, noBody, typeOpaque], |
| 38 [checkJsonpError]]), |
| 39 onlyOnServiceWorkerProxiedTest( |
| 40 [OTHER_BASE_URL + 'Auth&credentials=include', |
| 41 [fetchResolved, noBody, typeOpaque], |
| 42 [authCheck2]]), |
| 43 onlyOnServiceWorkerProxiedTest( |
| 44 [OTHER_BASE_URL + 'Auth&credentials=same-origin', |
| 45 [fetchResolved, noBody, typeOpaque], |
| 46 [authCheck2]]), |
| 47 |
| 48 // Tests for cross-origin requests. |
| 49 [OTHER_BASE_URL + 'Auth&mode=no-cors&credentials=omit', |
| 50 [fetchResolved, noBody, typeOpaque], |
| 51 onlyOnServiceWorkerProxiedTest([checkJsonpError])], |
| 52 [OTHER_BASE_URL + 'Auth&mode=no-cors&credentials=include', |
| 53 [fetchResolved, noBody, typeOpaque], |
| 54 onlyOnServiceWorkerProxiedTest([authCheck2])], |
| 55 [OTHER_BASE_URL + 'Auth&mode=no-cors&credentials=same-origin', |
| 56 [fetchResolved, noBody, typeOpaque], |
| 57 onlyOnServiceWorkerProxiedTest([authCheck2])], |
| 58 ]; |
| 59 |
| 60 if (self.importScripts) { |
| 61 executeTests(TEST_TARGETS); |
| 62 done(); |
| 63 } |
OLD | NEW |