OLD | NEW |
| (Empty) |
1 if (self.importScripts) { | |
2 importScripts('../resources/fetch-test-helpers.js'); | |
3 importScripts('../resources/fetch-access-control-util.js'); | |
4 } | |
5 | |
6 var TEST_TARGETS = [ | |
7 // Test that default mode is no-cors in serviceworker-proxied tests. | |
8 onlyOnServiceWorkerProxiedTest( | |
9 [BASE_URL + 'method=GET', | |
10 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | |
11 [methodIsGET, authCheck1]]), | |
12 onlyOnServiceWorkerProxiedTest( | |
13 [BASE_URL + 'method=GET&headers={}', | |
14 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | |
15 [methodIsGET]]), | |
16 onlyOnServiceWorkerProxiedTest( | |
17 [BASE_URL + 'method=GET&headers=CUSTOM', | |
18 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | |
19 [methodIsGET, noCustomHeader]]), | |
20 onlyOnServiceWorkerProxiedTest( | |
21 [BASE_URL + 'method=POST&headers=CUSTOM', | |
22 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | |
23 [methodIsPOST, noCustomHeader]]), | |
24 onlyOnServiceWorkerProxiedTest( | |
25 [BASE_URL + 'method=PUT', | |
26 [fetchError]]), | |
27 onlyOnServiceWorkerProxiedTest( | |
28 [BASE_URL + 'method=XXX', | |
29 [fetchError]]), | |
30 | |
31 onlyOnServiceWorkerProxiedTest( | |
32 [OTHER_BASE_URL + 'method=GET&headers=CUSTOM', | |
33 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque], | |
34 [methodIsGET, noCustomHeader, authCheck2]]), | |
35 onlyOnServiceWorkerProxiedTest( | |
36 [OTHER_BASE_URL + 'method=POST&headers=CUSTOM', | |
37 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque], | |
38 [methodIsPOST, noCustomHeader]]), | |
39 onlyOnServiceWorkerProxiedTest( | |
40 [OTHER_BASE_URL + 'method=PUT&headers=CUSTOM', | |
41 [fetchError]]), | |
42 onlyOnServiceWorkerProxiedTest( | |
43 [OTHER_BASE_URL + 'method=XXX&headers=CUSTOM', | |
44 [fetchError]]), | |
45 | |
46 // Test mode=no-cors. | |
47 [BASE_URL + 'mode=no-cors&method=GET', | |
48 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | |
49 [methodIsGET, authCheck1]], | |
50 [BASE_URL + 'mode=no-cors&method=GET&headers={}', | |
51 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | |
52 [methodIsGET]], | |
53 [BASE_URL + 'mode=no-cors&method=GET&headers=CUSTOM', | |
54 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | |
55 [methodIsGET, noCustomHeader]], | |
56 [BASE_URL + 'mode=no-cors&method=POST&headers=CUSTOM', | |
57 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | |
58 [methodIsPOST, noCustomHeader]], | |
59 [BASE_URL + 'mode=no-cors&method=PUT', | |
60 [fetchError]], | |
61 [BASE_URL + 'mode=no-cors&method=XXX', | |
62 [fetchError]], | |
63 | |
64 [OTHER_BASE_URL + 'mode=no-cors&method=GET&headers=CUSTOM', | |
65 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque], | |
66 onlyOnServiceWorkerProxiedTest([methodIsGET, noCustomHeader, authCheck2])], | |
67 [OTHER_BASE_URL + 'mode=no-cors&method=POST&headers=CUSTOM', | |
68 [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque], | |
69 onlyOnServiceWorkerProxiedTest([methodIsPOST, noCustomHeader])], | |
70 [OTHER_BASE_URL + 'mode=no-cors&method=PUT&headers=CUSTOM', | |
71 [fetchError]], | |
72 [OTHER_BASE_URL + 'mode=no-cors&method=XXX&headers=CUSTOM', | |
73 [fetchError]], | |
74 ]; | |
75 | |
76 if (self.importScripts) { | |
77 executeTests(TEST_TARGETS); | |
78 done(); | |
79 } | |
OLD | NEW |