Index: LayoutTests/http/tests/fetch/script-tests/fetch-access-control-nocors.js |
diff --git a/LayoutTests/http/tests/fetch/script-tests/fetch-access-control-nocors.js b/LayoutTests/http/tests/fetch/script-tests/fetch-access-control-nocors.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1590e8c9a093c3b9ee57a16e6b778735ee8b1e2a |
--- /dev/null |
+++ b/LayoutTests/http/tests/fetch/script-tests/fetch-access-control-nocors.js |
@@ -0,0 +1,79 @@ |
+if (self.importScripts) { |
+ importScripts('../resources/fetch-test-helpers.js'); |
+ importScripts('/serviceworker/resources/fetch-access-control-util.js'); |
+} |
+ |
+var TEST_TARGETS = [ |
+ // Test that default mode is no-cors in serviceworker-proxied tests. |
+ onlyOnServiceWorkerProxiedTest( |
+ [BASE_URL + 'method=GET', |
+ [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], |
+ [methodIsGET, authCheck1]]), |
+ onlyOnServiceWorkerProxiedTest( |
+ [BASE_URL + 'method=GET&headers={}', |
+ [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], |
+ [methodIsGET]]), |
+ onlyOnServiceWorkerProxiedTest( |
+ [BASE_URL + 'method=GET&headers=CUSTOM', |
+ [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], |
+ [methodIsGET, noCustomHeader]]), |
+ onlyOnServiceWorkerProxiedTest( |
+ [BASE_URL + 'method=POST&headers=CUSTOM', |
+ [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], |
+ [methodIsPOST, noCustomHeader]]), |
+ onlyOnServiceWorkerProxiedTest( |
+ [BASE_URL + 'method=PUT', |
+ [fetchError]]), |
+ onlyOnServiceWorkerProxiedTest( |
+ [BASE_URL + 'method=XXX', |
+ [fetchError]]), |
+ |
+ onlyOnServiceWorkerProxiedTest( |
+ [OTHER_BASE_URL + 'method=GET&headers=CUSTOM', |
+ [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque], |
+ [methodIsGET, noCustomHeader, authCheck2]]), |
+ onlyOnServiceWorkerProxiedTest( |
+ [OTHER_BASE_URL + 'method=POST&headers=CUSTOM', |
+ [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque], |
+ [methodIsPOST, noCustomHeader]]), |
+ onlyOnServiceWorkerProxiedTest( |
+ [OTHER_BASE_URL + 'method=PUT&headers=CUSTOM', |
+ [fetchError]]), |
+ onlyOnServiceWorkerProxiedTest( |
+ [OTHER_BASE_URL + 'method=XXX&headers=CUSTOM', |
+ [fetchError]]), |
+ |
+ // Test mode=no-cors. |
+ [BASE_URL + 'mode=no-cors&method=GET', |
+ [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], |
+ [methodIsGET, authCheck1]], |
+ [BASE_URL + 'mode=no-cors&method=GET&headers={}', |
+ [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], |
+ [methodIsGET]], |
+ [BASE_URL + 'mode=no-cors&method=GET&headers=CUSTOM', |
+ [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], |
+ [methodIsGET, noCustomHeader]], |
+ [BASE_URL + 'mode=no-cors&method=POST&headers=CUSTOM', |
+ [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], |
+ [methodIsPOST, noCustomHeader]], |
+ [BASE_URL + 'mode=no-cors&method=PUT', |
+ [fetchError]], |
+ [BASE_URL + 'mode=no-cors&method=XXX', |
+ [fetchError]], |
+ |
+ [OTHER_BASE_URL + 'mode=no-cors&method=GET&headers=CUSTOM', |
+ [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque], |
+ onlyOnServiceWorkerProxiedTest([methodIsGET, noCustomHeader, authCheck2])], |
+ [OTHER_BASE_URL + 'mode=no-cors&method=POST&headers=CUSTOM', |
+ [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque], |
+ onlyOnServiceWorkerProxiedTest([methodIsPOST, noCustomHeader])], |
+ [OTHER_BASE_URL + 'mode=no-cors&method=PUT&headers=CUSTOM', |
+ [fetchError]], |
+ [OTHER_BASE_URL + 'mode=no-cors&method=XXX&headers=CUSTOM', |
+ [fetchError]], |
+]; |
+ |
+if (self.importScripts) { |
+ executeTests(TEST_TARGETS); |
+ done(); |
+} |