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

Side by Side Diff: LayoutTests/http/tests/fetch/script-tests/fetch-access-control.js

Issue 921673003: [Fetch] Split layout tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
OLDNEW
1 // OPTIONS: ,-base-https-other-https 1 // OPTIONS: ,-base-https-other-https
2 if (self.importScripts) { 2 if (self.importScripts) {
3 importScripts('../resources/fetch-test-helpers.js'); 3 importScripts('../resources/fetch-test-helpers.js');
4 importScripts('/serviceworker/resources/fetch-access-control-util.js'); 4 importScripts('/serviceworker/resources/fetch-access-control-util.js');
5 } 5 }
6 6
7 var referer; 7 var referer;
8 8
9 if (self.importScripts) { 9 if (self.importScripts) {
10 // fetch/workers or fetch/serviceworker 10 // fetch/workers or fetch/serviceworker
11 referer = BASE_ORIGIN + 11 referer = BASE_ORIGIN +
12 '/fetch/script-tests/fetch-access-control.js?' + TEST_OPTIONS; 12 '/fetch/script-tests/fetch-access-control.js?' + TEST_OPTIONS;
13 } else if(location.pathname.startsWith( 13 } else if(location.pathname.startsWith(
14 '/fetch/serviceworker-proxied/fetch-access-control')) { 14 '/fetch/serviceworker-proxied/fetch-access-control')) {
15 // fetch/serviceworker-proxied 15 // fetch/serviceworker-proxied
16 referer = WORKER_URL; 16 referer = WORKER_URL;
17 } else { 17 } else {
18 // fetch/window 18 // fetch/window
19 referer = BASE_ORIGIN + 19 referer = BASE_ORIGIN +
20 '/fetch/window/fetch-access-control' + TEST_OPTIONS + '.html'; 20 '/fetch/window/fetch-access-control' + TEST_OPTIONS + '.html';
21 } 21 }
22 22
23 var TEST_TARGETS = [ 23 var TEST_TARGETS = [
24 [BASE_URL + 'method=GET', 24 // Test mode=same-origin.
25 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
26 [methodIsGET, authCheck1]],
27 [BASE_URL + 'method=GET&headers={}',
28 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
29 [methodIsGET]],
30 [BASE_URL + 'method=GET&headers=CUSTOM',
31 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
32 [methodIsGET, noCustomHeader]],
33 [BASE_URL + 'method=POST&headers=CUSTOM',
34 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
35 [methodIsPOST, noCustomHeader]],
36 [BASE_URL + 'method=PUT',
37 [fetchError]],
38 [BASE_URL + 'method=XXX',
39 [fetchError]],
40
41 [BASE_URL + 'mode=same-origin&method=GET', 25 [BASE_URL + 'mode=same-origin&method=GET',
42 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], 26 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
43 [methodIsGET, authCheck1]], 27 [methodIsGET, authCheck1]],
44 [BASE_URL + 'mode=same-origin&method=GET&headers={}', 28 [BASE_URL + 'mode=same-origin&method=GET&headers={}',
45 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], 29 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
46 [methodIsGET]], 30 [methodIsGET]],
47 [BASE_URL + 'mode=same-origin&method=GET&headers=CUSTOM', 31 [BASE_URL + 'mode=same-origin&method=GET&headers=CUSTOM',
48 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], 32 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
49 [methodIsGET, hasCustomHeader]], 33 [methodIsGET, hasCustomHeader]],
50 [BASE_URL + 'mode=same-origin&method=POST&headers=CUSTOM', 34 [BASE_URL + 'mode=same-origin&method=POST&headers=CUSTOM',
51 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], 35 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
52 [methodIsPOST, hasCustomHeader]], 36 [methodIsPOST, hasCustomHeader]],
53 [BASE_URL + 'mode=same-origin&method=PUT&headers=CUSTOM', 37 [BASE_URL + 'mode=same-origin&method=PUT&headers=CUSTOM',
54 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], 38 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
55 [methodIsPUT, hasCustomHeader]], 39 [methodIsPUT, hasCustomHeader]],
56 [BASE_URL + 'mode=same-origin&method=XXX&headers=CUSTOM', 40 [BASE_URL + 'mode=same-origin&method=XXX&headers=CUSTOM',
57 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], 41 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
58 [methodIsXXX, hasCustomHeader]], 42 [methodIsXXX, hasCustomHeader]],
59 43
60 [BASE_URL + 'mode=no-cors&method=GET', 44 // Test mode=cors.
61 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
62 [methodIsGET, authCheck1]],
63 [BASE_URL + 'mode=no-cors&method=GET&headers={}',
64 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
65 [methodIsGET]],
66 [BASE_URL + 'mode=no-cors&method=GET&headers=CUSTOM',
67 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
68 [methodIsGET, noCustomHeader]],
69 [BASE_URL + 'mode=no-cors&method=POST&headers=CUSTOM',
70 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
71 [methodIsPOST, noCustomHeader]],
72 [BASE_URL + 'mode=no-cors&method=PUT',
73 [fetchError]],
74 [BASE_URL + 'mode=no-cors&method=XXX',
75 [fetchError]],
76
77 [BASE_URL + 'mode=cors&method=GET', 45 [BASE_URL + 'mode=cors&method=GET',
78 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], 46 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
79 [methodIsGET, authCheck1]], 47 [methodIsGET, authCheck1]],
80 [BASE_URL + 'mode=cors&method=GET&headers={}', 48 [BASE_URL + 'mode=cors&method=GET&headers={}',
81 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], 49 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
82 [methodIsGET]], 50 [methodIsGET]],
83 [BASE_URL + 'mode=cors&method=GET&headers=CUSTOM', 51 [BASE_URL + 'mode=cors&method=GET&headers=CUSTOM',
84 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], 52 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
85 [methodIsGET, hasCustomHeader]], 53 [methodIsGET, hasCustomHeader]],
86 [BASE_URL + 'mode=cors&method=POST&headers=CUSTOM', 54 [BASE_URL + 'mode=cors&method=POST&headers=CUSTOM',
87 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], 55 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
88 [methodIsPOST, hasCustomHeader]], 56 [methodIsPOST, hasCustomHeader]],
89 [BASE_URL + 'mode=cors&method=PUT&headers=CUSTOM', 57 [BASE_URL + 'mode=cors&method=PUT&headers=CUSTOM',
90 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], 58 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
91 [methodIsPUT, hasCustomHeader]], 59 [methodIsPUT, hasCustomHeader]],
92 [BASE_URL + 'mode=cors&method=XXX&headers=CUSTOM', 60 [BASE_URL + 'mode=cors&method=XXX&headers=CUSTOM',
93 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], 61 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic],
94 [methodIsXXX, hasCustomHeader]], 62 [methodIsXXX, hasCustomHeader]],
95 63
96 // Referer check 64 // Referer check
97 [BASE_URL, 65 [BASE_URL + 'mode=same-origin',
98 [fetchResolved], 66 [fetchResolved],
99 [checkJsonpHeader.bind(this, 'Referer', referer)]], 67 [checkJsonpHeader.bind(this, 'Referer', referer)]],
100 ]; 68 ];
101 69
102 if (self.importScripts) { 70 if (self.importScripts) {
103 executeTests(TEST_TARGETS); 71 executeTests(TEST_TARGETS);
104 done(); 72 done();
105 } 73 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698