Chrome Release Bot (LUCI) 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
..
chromium 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
referrer 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
resources 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
script-tests 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
serviceworker 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
serviceworker-proxied 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
window 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
workers 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
README 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
generate.py 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago

README

Fetch API LayoutTests README

This directory contains Fetch API layout tests.
Tests should conform to Service Worker Testing style[1].

1: http://www.chromium.org/blink/serviceworker/testing

# generator.py

The files under
- /fetch/window/
- /fetch/workers/
- /fetch/serviceworker/
- /fetch/serviceworker-proxied/
are generated by the generator.
Run
$ python generate.py
at this (/LayoutTests/http/tests/fetch/) directory to generate these files
from templates script-tests/TEMPLATE*.html.

There are two kinds of tests. One is regular tests placed on script-tests
directory and another is "thorough" tests placed on script-tests/thorough
directory. Each has its own template files and default option settings.
Note: thorough tests were called as "fetch-access-control" tests. auth.js
was called as fetch-access-control-auth.js, for example.

# Running on window, workers, serviceworker, serviceworker-proxied

As it is exposed to Window and Worker, most (if not all) of tests are expected
to run on Window, DedicatedWorker and ServiceWorker.
For each test (say X), we have
- a script X.js in /fetch/script-tests,
- /fetch/window/X.html Window test file,
- /fetch/workers/X.html Worker test file, and
- /fetch/serviceworker/X.html ServiceWorker test file.

Some tests that require a serviceworker to test CORS requests are executed in
- /fetch/serviceworker-proxied/X.html.

# BASE_ORIGIN, OTHER_ORIGIN, and HTTP/HTTPS OPTIONS

BASE_ORIGIN is the origin of HTML/JS files where tests are executed.
OTHER_ORIGIN is used to test cross-origin requests.
To control whether BASE_ORIGIN/OTHER_ORIGIN is HTTP or HTTPS, OPTIONS string
is used.

----------------------------- ----------------------- ----------- ------------
Filename OPTIONS BASE_ORIGIN OTHER_ORIGIN
----------------------------- ----------------------- ----------- ------------
X.html (empty) HTTP HTTP
X-other-https.html -other-https HTTP HTTPS
X-base-https.html -base-https HTTPS HTTP
X-base-https-other-https.html -base-https-other-https HTTPS HTTPS
----------------------------- ----------------------- ----------- ------------

X.js is common to all options.
The test switches by location.href at runtime.

The options to be generated is listed in a line in X.js like:
// OPTIONS: ,-other-https,-base-https-other-https
(Three files for OPTIONS = (empty), -other-https, -base-https-other-https are
generated)
Default:
For thorough tests: ,-other-https,-base-https-other-https
For others: ,-base-https-other-https

# File structure

Helper JS files and server side scripts are located on
/fetch/resources and /serviceworker/resources:
- /serviceworker/resources/test-helpers.js
Utility functions for all tests.
Include this before X.js and from HTML files.
- /fetch/resources/fetch-test-options.js
Process test options for X.js. BASE_ORIGIN/OTHER_ORIGIN are defined here.
Include this before X.js and thorough-util.js.
- /fetch/resources/fetch-test-helpers.js
Variables/functions commonly used from X.js.
Include this before X.js.
- /fetch/resources/thorough-util.js
Utility functions for thorough tests.
Include this before X.js in thorough tests.
- /fetch/resources/init.js
Initialization script executed on window.
Include this from HTML files.

Files needed from HTML/X.js files for each tests:
----------------------------------------------------- ------------ ------------
HTML X.js
Files wi wo sw swp wi wo sw swp
----------------------------------------------------- -- -- -- --- -- -- -- ---
/serviceworker/resources/test-helpers.js Y Y Y Y . . . .
/fetch/resources/fetch-test-options.js Y - - Y . . . .
/fetch/resources/fetch-test-helpers.js Y - - Y . Y Y .
/fetch/resources/thorough-util.js Y* - - Y* . Y* Y* .
/fetch/script-tests/X.js Y - - Y
/fetch/resources/init.js Y Y Y Y - - - -
----------------------------------------------------- ------------ ------------
wi/wo/sw/swp: window/workers/serviceworker/serviceworker-proxied.
Y: to be included.
-: not to be included.
.: included indirectly via HTML or fetch-test-helpers.js.
Y*: thorough tests only.