Commit 8f1fa724 authored by Hiroshige Hayashizaki's avatar Hiroshige Hayashizaki Committed by Commit Bot

[WPT/referrer-policy] Rename referrer_policy to delivery_value

To use common structures and names in referrer-policy and
mixed-content tests, this CL

- Renames `referrer_policy` to `delivery_value`, and
- Moves it under `test_expansion`, because in mixed-content
  tests `delivery_value` can be different among multiple
  `test_expansion` entries under a single `specification` entry.

Accordingly, `referrer_policy_schema` is moved to
`test_expansion_schema`'s `delivery_value`, and
related checks in spec_validator are removed.

Generated files will be updated after some more changes, not now.

Bug: 906850
Change-Id: I28beb09ab2eb4c69ec598de415d81cd1c8f77765
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1717592Reviewed-by: default avatarKenichi Ishibashi <bashi@chromium.org>
Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681076}
parent a9f47113
......@@ -58,11 +58,6 @@ def dump_test_parameters(selection):
def generate_selection(config, selection, spec, test_html_template_basename):
# TODO: Refactor out this referrer-policy-specific part.
if 'referrer_policy' in spec:
# Oddball: it can be None, so in JS it's null.
selection['referrer_policy'] = spec['referrer_policy']
test_parameters = dump_test_parameters(selection)
# Adjust the template for the test invoking JS. Indent it to look nice.
indent = "\n" + " " * 8
......
......@@ -44,7 +44,7 @@ the target request is %(origin)s.'''
def handleDelivery(self, selection, spec):
delivery_type = selection['delivery_type']
delivery_value = spec['referrer_policy']
delivery_value = selection['delivery_value']
meta = ''
headers = []
......
......@@ -36,7 +36,8 @@ def assert_value_from(obj, field, items):
def assert_atom_or_list_items_from(obj, field, items):
if isinstance(obj[field], basestring) or isinstance(obj[field], int):
if isinstance(obj[field], basestring) or isinstance(
obj[field], int) or obj[field] is None:
assert_value_from(obj, field, items)
return
......@@ -77,16 +78,14 @@ def validate(spec_json, details):
details['object'] = spec_json
assert_contains_only_fields(spec_json, [
"specification", "referrer_policy_schema", "delivery_key",
"test_expansion_schema", "excluded_tests"
"specification", "delivery_key", "test_expansion_schema",
"excluded_tests"
])
assert_non_empty_list(spec_json, "specification")
assert_non_empty_list(spec_json, "referrer_policy_schema")
assert_non_empty_dict(spec_json, "test_expansion_schema")
assert_non_empty_list(spec_json, "excluded_tests")
specification = spec_json['specification']
referrer_policy_schema = spec_json['referrer_policy_schema']
test_expansion_schema = spec_json['test_expansion_schema']
excluded_tests = spec_json['excluded_tests']
......@@ -98,14 +97,13 @@ def validate(spec_json, details):
# Validate required fields for a single spec.
assert_contains_only_fields(spec, [
'name', 'title', 'description', 'referrer_policy',
'specification_url', 'test_expansion'
'name', 'title', 'description', 'specification_url',
'test_expansion'
])
assert_non_empty_string(spec, 'name')
assert_non_empty_string(spec, 'title')
assert_non_empty_string(spec, 'description')
assert_non_empty_string(spec, 'specification_url')
assert_value_from(spec, 'referrer_policy', referrer_policy_schema)
assert_non_empty_list(spec, 'test_expansion')
# Validate spec's test expansion.
......@@ -128,8 +126,9 @@ def validate(spec_json, details):
# Validate the test_expansion schema members.
details['object'] = test_expansion_schema
assert_contains_only_fields(test_expansion_schema, [
'expansion', 'delivery_type', 'redirection', 'origin',
'source_protocol', 'target_protocol', 'subresource', 'expectation'
'expansion', 'delivery_type', 'delivery_value', 'redirection',
'origin', 'source_protocol', 'target_protocol', 'subresource',
'expectation'
])
# Validate excluded tests.
details['object'] = excluded_tests
......
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