| OLD | NEW |
| 1 # Referrer-Policy Web Platform Tests | 1 # Referrer-Policy Web Platform Tests |
| 2 | 2 |
| 3 The Referrer-Policy tests are designed for testing browser implementations and c
onformance to the [W3 Referrer-Policy Specification](http://w3c.github.io/webapp
sec/specs/referrer-policy/). | 3 The Referrer-Policy tests are designed for testing browser implementations and c
onformance to the [W3 Referrer-Policy Specification](http://w3c.github.io/webapp
sec/specs/referrer-policy/). |
| 4 | 4 |
| 5 ## Project structure | 5 ## Project structure |
| 6 | 6 |
| 7 The project contains tools, templates and a seed (```spec.src.json```) for gener
ating tests. The main assertion logic resides in JS files in the root of the ```
./generic/``` directory. | 7 The project contains tools, templates and a seed (```spec.src.json```) for gener
ating tests. The main assertion logic resides in JS files in the root of the ```
./generic/``` directory. |
| 8 | 8 |
| 9 This is the overview of the project structure: | 9 This is the overview of the project structure: |
| 10 | 10 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 ] | 207 ] |
| 208 } | 208 } |
| 209 ``` | 209 ``` |
| 210 | 210 |
| 211 **NOTE:** An expansion is always constructive (inclusive), there isn't a negatio
n operator for explicit exclusion. Be aware that using an empty list ```[]``` ma
tches (expands into) exactly nothing. Tests which are to be excluded should be d
efined in the ```excluded_tests``` section instead. | 211 **NOTE:** An expansion is always constructive (inclusive), there isn't a negatio
n operator for explicit exclusion. Be aware that using an empty list ```[]``` ma
tches (expands into) exactly nothing. Tests which are to be excluded should be d
efined in the ```excluded_tests``` section instead. |
| 212 | 212 |
| 213 A single test expansion pattern, be it a requirement or a suppressed pattern, ge
ts expanded into a list of **selections** as follows: | 213 A single test expansion pattern, be it a requirement or a suppressed pattern, ge
ts expanded into a list of **selections** as follows: |
| 214 | 214 |
| 215 * Expand each field's pattern (single, any of, or all) to list of allowed values
(defined by the ```test_expansion_schema```) | 215 * Expand each field's pattern (single, any of, or all) to list of allowed values
(defined by the ```test_expansion_schema```) |
| 216 | 216 |
| 217 * Permute - Recursively enumerate all **selections** accross all fields | 217 * Permute - Recursively enumerate all **selections** across all fields |
| 218 | 218 |
| 219 Be aware that if there is more than one pattern expanding into a same selection
(which also shares the same ```name``` field), the pattern appearing later in th
e spec JSON will overwrite a previously generated selection. To make sure this i
s not undetected when generating, set the value of the ```expansion``` field to
```default``` for an expansion appearing earlier and ```override``` for the one
appearing later. | 219 Be aware that if there is more than one pattern expanding into a same selection
(which also shares the same ```name``` field), the pattern appearing later in th
e spec JSON will overwrite a previously generated selection. To make sure this i
s not undetected when generating, set the value of the ```expansion``` field to
```default``` for an expansion appearing earlier and ```override``` for the one
appearing later. |
| 220 | 220 |
| 221 A **selection** is a single **test instance** (scenario) with explicit values, f
or example: | 221 A **selection** is a single **test instance** (scenario) with explicit values, f
or example: |
| 222 | 222 |
| 223 ```javascript | 223 ```javascript |
| 224 var scenario = { | 224 var scenario = { |
| 225 "referrer_policy": "origin-when-cross-origin", | 225 "referrer_policy": "origin-when-cross-origin", |
| 226 "delivery_method": "meta-referrer", | 226 "delivery_method": "meta-referrer", |
| 227 "redirection": "no-redirect", | 227 "redirection": "no-redirect", |
| 228 "origin": "cross-origin", | 228 "origin": "cross-origin", |
| 229 "source_protocol": "http", | 229 "source_protocol": "http", |
| 230 "target_protocol": "http", | 230 "target_protocol": "http", |
| 231 "subresource": "iframe-tag", | 231 "subresource": "iframe-tag", |
| 232 "subresource_path": "/referrer-policy/generic/subresource/document.py", | 232 "subresource_path": "/referrer-policy/generic/subresource/document.py", |
| 233 "referrer_url": "origin" | 233 "referrer_url": "origin" |
| 234 }; | 234 }; |
| 235 ``` | 235 ``` |
| 236 | 236 |
| 237 Essentially, this is what gets generated and defines a single test. The scenario
is then evaluated by the ```ReferrerPolicyTestCase``` in JS. For the rest of th
e arranging part, see the ```./generic/template/``` directory and examine ```./g
eneric/tools/generate.py``` to see how the values for the templates are produced
. | 237 Essentially, this is what gets generated and defines a single test. The scenario
is then evaluated by the ```ReferrerPolicyTestCase``` in JS. For the rest of th
e arranging part, see the ```./generic/template/``` directory and examine ```./g
eneric/tools/generate.py``` to see how the values for the templates are produced
. |
| 238 | 238 |
| 239 | 239 |
| 240 Taking the spec JSON, the generator follows this algorithm: | 240 Taking the spec JSON, the generator follows this algorithm: |
| 241 | 241 |
| 242 * Expand all ```excluded_tests``` to create a blacklist of selections | 242 * Expand all ```excluded_tests``` to create a blacklist of selections |
| 243 | 243 |
| 244 * For each specification requirement: Expand the ```test_expansion``` pattern in
to selections and check each against the blacklist, if not marked as suppresed,
generate the test resources for the selection | 244 * For each specification requirement: Expand the ```test_expansion``` pattern in
to selections and check each against the blacklist, if not marked as suppresed,
generate the test resources for the selection |
| 245 | 245 |
| OLD | NEW |