Commit 5579aad0 authored by Eriko Kurimoto's avatar Eriko Kurimoto Committed by Commit Bot

SharedWorker: Name shared workers identically in credentials mode WPT

This CL names shared workers identically for each test cases.
If not, all shared workers are attempting to connect to the same shared
worker whose type and credentials values are specified by the first call.

Bug: 1048966
Change-Id: I07f0b57e2fb513851ee35262a08c1f3ef42a9eab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2040856
Commit-Queue: Eriko Kurimoto <elkurin@google.com>
Reviewed-by: default avatarKenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#739286}
parent d877833c
This is a testharness.js-based test.
PASS Test initialization: setting up cross-origin cookie
PASS new SharedWorker() with type=module and default credentials option should behave as credentials=same-origin and send the credentials
FAIL new SharedWorker() with type=module and credentials=omit should not send the credentials assert_equals: expected "" but got "1"
PASS new SharedWorker() with type=module and credentials=same-origin should send the credentials
PASS new SharedWorker() with type=module and credentials=include should send the credentials
PASS new SharedWorker() with type=module and default credentials option should behave as credentials=same-origin and send the credentials for same-origin static imports
FAIL new SharedWorker() with type=module and credentials=omit should not send the credentials for same-origin static imports assert_equals: expected "" but got "1"
PASS new SharedWorker() with type=module and credentials=same-origin should send the credentials for same-origin static imports
PASS new SharedWorker() with type=module and credentials=include should send the credentials for same-origin static imports
PASS new SharedWorker() with type=module and default credentials option should behave as credentials=same-origin and not send the credentials for cross-origin static imports
PASS new SharedWorker() with type=module and credentials=omit should not send the credentials for cross-origin static imports
PASS new SharedWorker() with type=module and credentials=same-origin should not send the credentials for cross-origin static imports
FAIL new SharedWorker() with type=module and credentials=include should send the credentials for cross-origin static imports assert_equals: expected "1" but got ""
PASS new SharedWorker() with type=module and default credentials option should behave as credentials=same-origin and send the credentials for same-origin dynamic imports
FAIL new SharedWorker() with type=module and credentials=omit should not send the credentials for same-origin dynamic imports assert_equals: expected "" but got "1"
PASS new SharedWorker() with type=module and credentials=same-origin should send the credentials for same-origin dynamic imports
PASS new SharedWorker() with type=module and credentials=include should send the credentials for same-origin dynamic imports
PASS new SharedWorker() with type=module and default credentials option should behave as credentials=same-origin and not send the credentials for cross-origin dynamic imports
PASS new SharedWorker() with type=module and credentials=omit should not send the credentials for cross-origin dynamic imports
PASS new SharedWorker() with type=module and credentials=same-origin should not send the credentials for cross-origin dynamic imports
FAIL new SharedWorker() with type=module and credentials=include should send the credentials for cross-origin dynamic imports assert_equals: expected "1" but got ""
PASS new SharedWorker() with type=classic should always send the credentials regardless of the credentials option (default).
PASS new SharedWorker() with type=classic should always send the credentials regardless of the credentials option (omit).
PASS new SharedWorker() with type=classic should always send the credentials regardless of the credentials option (same-origin).
PASS new SharedWorker() with type=classic should always send the credentials regardless of the credentials option (include).
PASS new SharedWorker() with type=classic should always send the credentials for same-origin dynamic imports regardless of the credentials option (default).
PASS new SharedWorker() with type=classic should always send the credentials for same-origin dynamic imports regardless of the credentials option (omit).
PASS new SharedWorker() with type=classic should always send the credentials for same-origin dynamic imports regardless of the credentials option (same-origin).
PASS new SharedWorker() with type=classic should always send the credentials for same-origin dynamic imports regardless of the credentials option (include).
PASS new SharedWorker() with type=classic should never send the credentials for cross-origin dynamic imports regardless of the credentials option (default).
PASS new SharedWorker() with type=classic should never send the credentials for cross-origin dynamic imports regardless of the credentials option (omit).
PASS new SharedWorker() with type=classic should never send the credentials for cross-origin dynamic imports regardless of the credentials option (same-origin).
PASS new SharedWorker() with type=classic should never send the credentials for cross-origin dynamic imports regardless of the credentials option (include).
Harness: the test ran to completion.
...@@ -63,6 +63,10 @@ function credentials_test(options, config, description) { ...@@ -63,6 +63,10 @@ function credentials_test(options, config, description) {
assert_unreached('Invalid config.fetchType: ' + config.fetchType); assert_unreached('Invalid config.fetchType: ' + config.fetchType);
} }
// Name idetically for each test cases so that it connects to the shared
// worker with specified type and credentials.
options.name = `${options.type}_${options.credentials || 'default'}_${config.fetchType}_${config.origin}`;
const worker = new SharedWorker(workerURL, options); const worker = new SharedWorker(workerURL, options);
// Wait until the worker sends the actual cookie value. // Wait until the worker sends the actual cookie value.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment