tree: 2f9ee7ad923027ec41f42030aa8baa379d309722 [path history] [tgz]
  1. resources/
  2. tools/
  3. a-element-origin-xhtml.xhtml
  4. a-element-origin.html
  5. a-element-xhtml.xhtml
  6. a-element.html
  7. a-element_include=javascript-expected.txt
  8. a-element_include=mailto-expected.txt
  9. data-uri-fragment.html
  10. DIR_METADATA
  11. failure.html
  12. historical.any.js
  13. idlharness.any.js
  14. IdnaTestV2-removed.window-expected.txt
  15. IdnaTestV2-removed.window.js
  16. IdnaTestV2.window-expected.txt
  17. IdnaTestV2.window.js
  18. javascript-urls.window.js
  19. META.yml
  20. percent-encoding.window.js
  21. README.md
  22. toascii.window-expected.txt
  23. toascii.window.js
  24. url-constructor.any.js
  25. url-origin.any.js
  26. url-searchparams.any.js
  27. url-setters-a-area.window.js
  28. url-setters-a-area.window_include=file-expected.txt
  29. url-setters-a-area.window_include=mailto-expected.txt
  30. url-setters-stripping.any-expected.txt
  31. url-setters-stripping.any.js
  32. url-setters-stripping.any.worker-expected.txt
  33. url-setters.any.js
  34. url-setters.any.worker_include=file-expected.txt
  35. url-setters.any.worker_include=mailto-expected.txt
  36. url-setters.any_include=file-expected.txt
  37. url-setters.any_include=mailto-expected.txt
  38. url-statics-canparse.any.js
  39. url-statics-parse.any.js
  40. url-tojson.any.js
  41. urlencoded-parser.any.js
  42. urlsearchparams-append.any.js
  43. urlsearchparams-constructor.any.js
  44. urlsearchparams-delete.any-expected.txt
  45. urlsearchparams-delete.any.js
  46. urlsearchparams-delete.any.worker-expected.txt
  47. urlsearchparams-foreach.any.js
  48. urlsearchparams-get.any.js
  49. urlsearchparams-getall.any.js
  50. urlsearchparams-has.any.js
  51. urlsearchparams-set.any.js
  52. urlsearchparams-size.any.js
  53. urlsearchparams-sort.any.js
  54. urlsearchparams-stringifier.any.js
  55. WEB_FEATURES.yml
third_party/blink/web_tests/external/wpt/url/README.md

urltestdata.json / urltestdata-javascript-only.json

resources/urltestdata.json contains URL parsing tests suitable for any URL parser implementation. resources/urltestdata-javascript-only.json contains URL parsing tests specifically meant for JavaScript's URL() class as well as other languages accepting non-scalar-value strings.

These files are used as a source of tests by a-element.html, failure.html, url-constructor.any.js, and other test files in this directory.

Both files share the same format. They consist of a JSON array of comments as strings and test cases as objects. The keys for each test case are:

  • input: a string to be parsed as URL.

  • base: null or a serialized URL (i.e., does not fail parsing).

  • Then either

    • failure whose value is true, indicating that parsing input relative to base returns failure
    • relativeTo whose value is “non-opaque-path-base” (input does parse against a non-null base URL without an opaque path) or “any-base” (input parses against any non-null base URL), or is omitted in its entirety (input never parses successfully)

    or href, origin, protocol, username, password, host, hostname, port, pathname, search, and hash with string values; indicating that parsing input should return an URL record and that the getters of each corresponding attribute in that URL’s API should return the corresponding value.

    The origin key may be missing. In that case, the API’s origin attribute is not tested.

setters_tests.json

resources/setters_tests.json is self-documented.

toascii.json

resources/toascii.json is a JSON resource containing an array where each item is an object consisting of an optional comment field and mandatory input and output fields. input is the domain to be parsed according to the rules of UTS #46 (as stipulated by the URL Standard). output gives the expected output of the parser after serialization. An output of null means parsing is expected to fail.

URL parser's encoding argument

Tests in /encoding and /html/infrastructure/urls/resolving-urls/query-encoding/ cover the encoding argument to the URL parser.

There's also limited coverage in resources/percent-encoding.json for percent-encode after encoding with percentEncodeSet set to special-query percent-encode set and spaceAsPlus set to false. (Improvements to expand coverage here are welcome.)

Specification

The tests in this directory assert conformance with the URL Standard.