Skip to content

Commit

Permalink
Split html/.../query-encoding/ tests
Browse files Browse the repository at this point in the history
These tests cover 5 encodings (UTF-8, UTF-16LE/BE, Windows-1251/1252)
and exercise many features (HTML, CSS, SVG, Workers, ...). They're
currently all skipped in Chrome (and other browser CI systems), since
something in that huge matrix fails or times out for everyone.

#4934 suggests
splitting these into separate files. As a stopgap, split them out
using the WPT "variant" mechanism and provide expected failure files
for subsets, which should make fixing the tests and/or browsers more
actionable, and let us catch new regressions.

Bug: 930297
Change-Id: I4813281f547216b2b5f377118a58a419f62cfbc7
  • Loading branch information
inexorabletash authored and chromium-wpt-export-bot committed Feb 19, 2020
1 parent 25f5eba commit 5d81dbd
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ onload = function() {

// loading html (or actually svg to support <embed>)
function test_load_nested_browsing_context(tag, attr, spec_url) {
async_test(function() {
subsetTestByKey('nested-browsing', async_test, function() {
var id = 'test_load_nested_browsing_context_'+tag;
var elm = document.createElement(tag);
elm.setAttribute(attr, input_url_svg);
Expand Down Expand Up @@ -81,7 +81,7 @@ onload = function() {
});

// loading css with <link>
async_test(function() {
subsetTestByKey('loading', async_test, function() {
var elm = document.createElement('link');
elm.href = input_url_css;
elm.rel = 'stylesheet';
Expand All @@ -99,7 +99,7 @@ onload = function() {
'https://html.spec.whatwg.org/multipage/#styling']});

// loading js
async_test(function() {
subsetTestByKey('loading-css', async_test, function() {
var elm = document.createElement('script');
elm.src = input_url_js + '&var=test_load_js_got';
document.head.appendChild(elm); // no cleanup
Expand All @@ -111,7 +111,7 @@ onload = function() {

// loading image
function test_load_image(tag, attr, spec_url) {
async_test(function() {
subsetTestByKey('loading', async_test, function() {
var elm = document.createElement(tag);
if (tag == 'input') {
elm.type = 'image';
Expand Down Expand Up @@ -173,7 +173,7 @@ onload = function() {

// loading video
function test_load_video(tag, use_source_element) {
async_test(function() {
subsetTestByKey('loading', async_test, function() {
var elm = document.createElement(tag);
var video_ext = '';
if (elm.canPlayType('video/ogg; codecs="theora,flac"')) {
Expand Down Expand Up @@ -229,7 +229,7 @@ onload = function() {
});

// loading webvtt
async_test(function() {
subsetTestByKey('loading', async_test, function() {
var video = document.createElement('video');
var track = document.createElement('track');
video.appendChild(track);
Expand All @@ -248,7 +248,7 @@ onload = function() {

// submit forms
function test_submit_form(tag, attr) {
async_test(function(){
subsetTestByKey('submit', async_test, function(){
var elm = document.createElement(tag);
elm.setAttribute(attr, input_url_html);
var form;
Expand Down Expand Up @@ -291,7 +291,7 @@ onload = function() {
});

// <base href>
async_test(function() {
subsetTestByKey('base-href', async_test, function() {
var iframe = document.createElement('iframe');
iframe.src = blank;
document.body.appendChild(iframe);
Expand All @@ -315,7 +315,7 @@ onload = function() {
// XXX drag and drop (<a href> or <img src>) seems hard to automate

// Worker()
async_test(function() {
subsetTestByKey('workers', async_test, function() {
var worker = new Worker(input_url_worker);
worker.onmessage = this.step_func_done(function(e) {
assert_equals(e.data, expected_current);
Expand All @@ -324,7 +324,7 @@ onload = function() {
{help:'https://html.spec.whatwg.org/multipage/#dom-worker'});

// SharedWorker()
async_test(function() {
subsetTestByKey('workers', async_test, function() {
var worker = new SharedWorker(input_url_sharedworker);
worker.port.onmessage = this.step_func_done(function(e) {
assert_equals(e.data, expected_current);
Expand All @@ -333,7 +333,7 @@ onload = function() {
{help:'https://html.spec.whatwg.org/multipage/#dom-sharedworker'});

// EventSource()
async_test(function() {
subsetTestByKey('eventsource', async_test, function() {
var source = new EventSource(input_url_eventstream);
this.add_cleanup(function() {
source.close();
Expand All @@ -345,7 +345,7 @@ onload = function() {
{help:'https://html.spec.whatwg.org/multipage/#dom-eventsource'});

// EventSource#url
test(function() {
subsetTestByKey('eventsource', test, function() {
var source = new EventSource(input_url_eventstream);
source.close();
var got = source.url;
Expand All @@ -354,7 +354,7 @@ onload = function() {
{help:'https://html.spec.whatwg.org/multipage/#dom-eventsource'});

// XMLDocument#load()
async_test(function() {
subsetTestByKey('xmldocument', async_test, function() {
var doc = document.implementation.createDocument(null, "x");
doc.load(input_url_svg);
doc.onload = this.step_func_done(function() {
Expand All @@ -364,7 +364,7 @@ onload = function() {
{help:'https://html.spec.whatwg.org/multipage/#dom-xmldocument-load'});

// window.open
async_test(function() {
subsetTestByKey('window-open', async_test, function() {
var id = 'test_window_open';
var iframe = document.createElement('iframe');
iframe.name = id;
Expand All @@ -385,7 +385,7 @@ onload = function() {

// a.search, area.search
function test_hyperlink_search(tag) {
test(function() {
subsetTestByKey('hyperlink-search', test, function() {
var elm = document.createElement(tag);
var input_arr = input_url_html.split('?');
elm.href = input_arr[0];
Expand All @@ -405,7 +405,7 @@ onload = function() {
// history.pushState
// history.replaceState
function test_history(prop) {
async_test(function() {
subsetTestByKey('history', async_test, function() {
var iframe = document.createElement('iframe');
iframe.src = blank;
document.body.appendChild(iframe);
Expand All @@ -429,7 +429,7 @@ onload = function() {
// SVG
var ns = {svg:'http://www.w3.org/2000/svg', xlink:'http://www.w3.org/1999/xlink'};
// a
async_test(function() {
subsetTestByKey('svg', async_test, function() {
SVGAElement; // check support
var iframe = document.createElement('iframe');
var id = 'test_svg_a';
Expand Down Expand Up @@ -458,7 +458,7 @@ onload = function() {

// feImage, image, use
function test_svg(func, tag) {
async_test(function() {
subsetTestByKey('svg', async_test, function() {
var uuid = token();
var id = 'test_svg_'+tag;
var svg = document.createElementNS(ns.svg, 'svg');
Expand Down Expand Up @@ -492,7 +492,7 @@ onload = function() {

// UTF-8:
// XHR
async_test(function() {
subsetTestByKey('xhr', async_test, function() {
var xhr = new XMLHttpRequest();
xhr.open('GET', input_url_html);
xhr.onload = this.step_func_done(function() {
Expand All @@ -503,7 +503,7 @@ onload = function() {
{help:'https://xhr.spec.whatwg.org/#the-open()-method'});

// in a worker
async_test(function() {
subsetTestByKey('workers', async_test, function() {
var worker = new Worker(input_url_worker_importScripts);
worker.onmessage = this.step_func_done(function(e) {
assert_equals(e.data, expected_utf8);
Expand All @@ -512,7 +512,7 @@ onload = function() {
{help:['https://html.spec.whatwg.org/multipage/#set-up-a-worker-script-settings-object',
'https://html.spec.whatwg.org/multipage/#dom-workerglobalscope-importscripts']});

async_test(function() {
subsetTestByKey('workers', async_test, function() {
var worker = new Worker(input_url_worker_worker);
worker.onmessage = this.step_func_done(function(e) {
assert_equals(e.data, expected_utf8);
Expand All @@ -521,7 +521,7 @@ onload = function() {
{help:['https://html.spec.whatwg.org/multipage/#set-up-a-worker-script-settings-object',
'https://html.spec.whatwg.org/multipage/#dom-worker']});

async_test(function() {
subsetTestByKey('workers', async_test, function() {
var worker = new Worker(input_url_worker_sharedworker);
worker.onmessage = this.step_func_done(function(e) {
assert_equals(e.data, expected_utf8);
Expand All @@ -530,7 +530,7 @@ onload = function() {
{help:['https://html.spec.whatwg.org/multipage/#set-up-a-worker-script-settings-object',
'https://html.spec.whatwg.org/multipage/#dom-sharedworker']});

async_test(function() {
subsetTestByKey('workers', async_test, function() {
var worker = new SharedWorker(input_url_sharedworker_importScripts);
worker.port.onmessage = this.step_func_done(function(e) {
assert_equals(e.data, expected_utf8);
Expand All @@ -539,7 +539,7 @@ onload = function() {
{help:['https://html.spec.whatwg.org/multipage/#set-up-a-worker-script-settings-object',
'https://html.spec.whatwg.org/multipage/#dom-workerglobalscope-importscripts']});

async_test(function() {
subsetTestByKey('workers', async_test, function() {
var worker = new SharedWorker(input_url_sharedworker_worker);
worker.port.onmessage = this.step_func_done(function(e) {
assert_equals(e.data, expected_utf8);
Expand All @@ -548,7 +548,7 @@ onload = function() {
{help:['https://html.spec.whatwg.org/multipage/#set-up-a-worker-script-settings-object',
'https://html.spec.whatwg.org/multipage/#dom-worker']});

async_test(function() {
subsetTestByKey('workers', async_test, function() {
var worker = new SharedWorker(input_url_sharedworker_sharedworker);
worker.port.onmessage = this.step_func_done(function(e) {
assert_equals(e.data, expected_utf8);
Expand All @@ -558,7 +558,7 @@ onload = function() {
'https://html.spec.whatwg.org/multipage/#dom-sharedworker']});

// WebSocket()
async_test(function(){
subsetTestByKey('websocket', async_test, function() {
var ws = new WebSocket('ws://{{host}}:{{ports[ws][0]}}/echo-query?\u00E5');
this.add_cleanup(function() {
ws.close();
Expand All @@ -570,7 +570,7 @@ onload = function() {
{help:'https://html.spec.whatwg.org/multipage/#parse-a-websocket-url\'s-components'});

// WebSocket#url
test(function(){
subsetTestByKey('websocket', test, function() {
var ws = new WebSocket('ws://{{host}}:{{ports[ws][0]}}/echo-query?\u00E5');
ws.close();
var got = ws.url;
Expand All @@ -580,7 +580,7 @@ onload = function() {

// Parsing cache manifest
function test_cache_manifest(mode) {
async_test(function() {
subsetTestByKey('appcache', async_test, function() {
var iframe = document.createElement('iframe');
var uuid = token();
iframe.src = 'resources/page-using-manifest.py?id='+uuid+'&encoding='+encoding+'&mode='+mode;
Expand All @@ -600,7 +600,7 @@ onload = function() {
// CSS
function test_css(tmpl, expected_cssom, encoding, use_style_element) {
var desc = ['CSS', (use_style_element ? '<style>' : '<link> (' + encoding + ')'), tmpl].join(' ');
async_test(function(){
subsetTestByKey('css', async_test, function(){
css_is_supported(tmpl, expected_cssom, this);
var uuid = token();
var id = 'test_css_' + uuid;
Expand Down Expand Up @@ -672,7 +672,7 @@ onload = function() {
// image() (not implemented?)

// <?xml-stylesheet?>
async_test(function() {
subsetTestByKey('xml', async_test, function() {
var iframe = document.createElement('iframe');
iframe.src = input_url_xmlstylesheet_css;
document.body.appendChild(iframe);
Expand All @@ -686,15 +686,15 @@ onload = function() {
{help:'http://dev.w3.org/csswg/cssom/#requirements-on-user-agents-implementing-the-xml-stylesheet-processing-instruction'});

// new URL()
test(function() {
subsetTestByKey('url', test, function() {
var url = new URL('http://example.org/'+input_url);
var expected = expected_utf8;
assert_true(url.href.indexOf(expected) > -1, 'url.href '+msg(expected, url.href));
assert_true(url.search.indexOf(expected) > -1, 'url.search '+msg(expected, url.search));
}, 'URL constructor, url',
{help:'http://url.spec.whatwg.org/#dom-url'});

test(function() {
subsetTestByKey('url', test, function() {
var url = new URL('', 'http://example.org/'+input_url);
var expected = expected_utf8;
assert_true(url.href.indexOf(expected) > -1, 'url.href '+msg(expected, url.href));
Expand All @@ -704,7 +704,7 @@ onload = function() {

// Test different schemes
function test_scheme(url, utf8) {
test(function() {
subsetTestByKey('scheme', test, function() {
var a = document.createElement('a');
a.setAttribute('href', url);
var got = a.href;
Expand Down
Binary file not shown.
Binary file not shown.
19 changes: 19 additions & 0 deletions html/infrastructure/urls/resolving-urls/query-encoding/utf-8.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,27 @@
<meta charset=utf-8>
<title>Resolving URLs, URL character encoding, utf-8</title>
<meta name="timeout" content="long">
<meta name="variant" content="?include=nested-browsing">
<meta name="variant" content="?include=loading">
<meta name="variant" content="?include=submit">
<meta name="variant" content="?include=base-href">
<meta name="variant" content="?include=workers">
<meta name="variant" content="?include=eventsource">
<meta name="variant" content="?include=xmldocument">
<meta name="variant" content="?include=window-open">
<meta name="variant" content="?include=hyperlink-search">
<meta name="variant" content="?include=history">
<meta name="variant" content="?include=svg">
<meta name="variant" content="?include=xhr">
<meta name="variant" content="?include=websocket">
<meta name="variant" content="?include=appcache">
<meta name="variant" content="?include=css">
<meta name="variant" content="?include=xml">
<meta name="variant" content="?include=url">
<meta name="variant" content="?include=scheme">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/subset-tests-by-key.js"></script>
<script src="/common/utils.js"></script>
<div id=log></div>
<script src="resources/resolve-url.js?encoding=utf-8&pipe=sub"></script>
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,27 @@
<meta charset=windows-1251>
<title>Resolving URLs, URL character encoding, windows-1251</title>
<meta name="timeout" content="long">
<meta name="variant" content="?include=nested-browsing">
<meta name="variant" content="?include=loading">
<meta name="variant" content="?include=submit">
<meta name="variant" content="?include=base-href">
<meta name="variant" content="?include=workers">
<meta name="variant" content="?include=eventsource">
<meta name="variant" content="?include=xmldocument">
<meta name="variant" content="?include=window-open">
<meta name="variant" content="?include=hyperlink-search">
<meta name="variant" content="?include=history">
<meta name="variant" content="?include=svg">
<meta name="variant" content="?include=xhr">
<meta name="variant" content="?include=websocket">
<meta name="variant" content="?include=appcache">
<meta name="variant" content="?include=css">
<meta name="variant" content="?include=xml">
<meta name="variant" content="?include=url">
<meta name="variant" content="?include=scheme">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/subset-tests-by-key.js"></script>
<script src="/common/utils.js"></script>
<div id=log></div>
<script src="resources/resolve-url.js?encoding=windows-1251&pipe=sub"></script>
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,27 @@
<meta charset=windows-1252>
<title>Resolving URLs, URL character encoding, windows-1252</title>
<meta name="timeout" content="long">
<meta name="variant" content="?include=nested-browsing">
<meta name="variant" content="?include=loading">
<meta name="variant" content="?include=submit">
<meta name="variant" content="?include=base-href">
<meta name="variant" content="?include=workers">
<meta name="variant" content="?include=eventsource">
<meta name="variant" content="?include=xmldocument">
<meta name="variant" content="?include=window-open">
<meta name="variant" content="?include=hyperlink-search">
<meta name="variant" content="?include=history">
<meta name="variant" content="?include=svg">
<meta name="variant" content="?include=xhr">
<meta name="variant" content="?include=websocket">
<meta name="variant" content="?include=appcache">
<meta name="variant" content="?include=css">
<meta name="variant" content="?include=xml">
<meta name="variant" content="?include=url">
<meta name="variant" content="?include=scheme">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/subset-tests-by-key.js"></script>
<script src="/common/utils.js"></script>
<div id=log></div>
<script src="resources/resolve-url.js?encoding=windows-1252&pipe=sub"></script>

0 comments on commit 5d81dbd

Please sign in to comment.