summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules')
-rw-r--r--testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/buildtests.py67
-rw-r--r--testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/common.js189
-rw-r--r--testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/entities.dat114
-rw-r--r--testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/tags.dat56
-rw-r--r--testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/timestamps.dat58
-rw-r--r--testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/tree-building.dat171
-rw-r--r--testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/entities.html32
-rw-r--r--testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/tags.html23
-rw-r--r--testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/timestamps.html22
-rw-r--r--testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/tree-building.html33
10 files changed, 765 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/buildtests.py b/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/buildtests.py
new file mode 100644
index 000000000..5ad788bc0
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/buildtests.py
@@ -0,0 +1,67 @@
+#!/usr/bin/python
+
+import os
+import urllib
+import hashlib
+
+doctmpl = """<!doctype html>
+<title>WebVTT cue data parser test %s</title>
+<style>video { display:none }</style>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=/html/syntax/parsing/template.js></script>
+<script src=/html/syntax/parsing/common.js></script>
+<script src=../common.js></script>
+<div id=log></div>
+<script>
+runTests([
+%s
+]);
+</script>"""
+
+testobj = "{name:'%s', input:'%s', expected:'%s'}"
+
+def appendtest(tests, input, expected):
+ tests.append(testobj % (hashlib.sha1(input).hexdigest(), urllib.quote(input[:-1]), urllib.quote(expected[:-1])))
+
+files = os.listdir('dat/')
+for file in files:
+ if os.path.isdir('dat/'+file) or file[0] == ".":
+ continue
+ tests = []
+ input = ""
+ expected = ""
+ state = ""
+ f = open('dat/'+file, "r")
+ while 1:
+ line = f.readline()
+ if not line:
+ if state != "":
+ appendtest(tests, input, expected)
+ input = ""
+ expected = ""
+ state = ""
+ break
+ if line[0] == "#":
+ state = line
+ if line == "#document-fragment\n":
+ expected = expected + line
+ elif state == "#data\n":
+ input = input + line
+ elif state == "#errors\n":
+ pass
+ elif state == "#document-fragment\n":
+ if line == "\n":
+ appendtest(tests, input, expected)
+ input = ""
+ expected = ""
+ state = ""
+ else:
+ expected = expected + line
+ else:
+ raise Exception("failed to parse file "+file+" line:"+line+" (state: "+state+")")
+ f.close()
+ barename = file.replace(".dat", "")
+ out = open('tests/'+barename+".html", "w")
+ out.write(doctmpl % (barename, ",\n".join(tests)))
+ out.close()
diff --git a/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/common.js b/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/common.js
new file mode 100644
index 000000000..543fe4655
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/common.js
@@ -0,0 +1,189 @@
+var namespaces = {
+ "html":"http://www.w3.org/1999/xhtml",
+ "mathml":"http://www.w3.org/1998/Math/MathML",
+ "svg":"http://www.w3.org/2000/svg",
+ "xlink":"http://www.w3.org/1999/xlink",
+ "xml":"http://www.w3.org/XML/1998/namespace",
+ "xmlns":"http://www.w3.org/2000/xmlns/"
+};
+
+var prefixes = {};
+for (var prefix in namespaces) {
+ if (namespaces.hasOwnProperty(prefix)) {
+ prefixes[namespaces[prefix]] = prefix;
+ }
+}
+prefixes[namespaces["mathml"]] = "math";
+
+function format(format_string) {
+ var insertions = Array.prototype.slice.call(arguments, 1);
+ var regexp = /%s/g;
+ var match_count = 0;
+ var rv = format_string.replace(regexp, function(match) {
+ var rv = insertions[match_count];
+ match_count++;
+ return rv;
+ });
+ return rv;
+}
+
+function test_serializer(element) {
+ //element.normalize();
+ var lines = [];
+ function serialize_element(element, indent) {
+ var indent_spaces = (new Array(indent)).join(" ");
+ switch(element.nodeType) {
+ case Node.DOCUMENT_TYPE_NODE:
+ if (element.name) {
+ if (element.publicId || element.systemId) {
+ var publicId = element.publicId ? element.publicId : "";
+ var systemId = element.systemId ? element.systemId : "";
+ lines.push(format("|%s<!DOCTYPE %s \"%s\" \"%s\">", indent_spaces,
+ element.name, publicId, systemId));
+ } else {
+ lines.push(format("|%s<!DOCTYPE %s>", indent_spaces,
+ element.name));
+ }
+ } else {
+ lines.push(format("|%s<!DOCTYPE >", indent_spaces));
+ }
+ break;
+ case Node.DOCUMENT_NODE:
+ lines.push("#document");
+ break;
+ case Node.DOCUMENT_FRAGMENT_NODE:
+ lines.push("#document-fragment");
+ break;
+ case Node.PROCESSING_INSTRUCTION_NODE:
+ lines.push(format("|%s<?%s %s>", indent_spaces, element.target, element.data));
+ break;
+ case Node.COMMENT_NODE:
+ lines.push(format("|%s<!-- %s -->", indent_spaces, element.nodeValue));
+ break;
+ case Node.TEXT_NODE:
+ lines.push(format("|%s\"%s\"", indent_spaces, element.nodeValue));
+ break;
+ case Node.ELEMENT_NODE:
+ if (element.getAttribute("data-skip") !== null) {
+ return;
+ }
+ if (element.namespaceURI !== null && element.namespaceURI !== namespaces.html) {
+ var name = format("%s %s", prefixes[element.namespaceURI],
+ element.localName);
+ } else {
+ var name = element.localName;
+ }
+ lines.push(format("|%s<%s>", indent_spaces, name));
+
+ var attributes = Array.prototype.map.call(
+ element.attributes,
+ function(attr) {
+ var name = (attr.namespaceURI ? prefixes[attr.namespaceURI] + " " : "") +
+ attr.localName;
+ return [name, attr.value];
+ });
+ attributes.sort(function (a, b) {
+ var x = a[0];
+ var y = b[0];
+ if (x === y) {
+ return 0;
+ }
+ return x > y ? 1 : -1;
+ });
+
+ attributes.forEach(
+ function(attr) {
+ var indent_spaces = (new Array(indent + 2)).join(" ");
+ lines.push(format("|%s%s=\"%s\"", indent_spaces, attr[0], attr[1]));
+ }
+ );
+ break;
+ }
+ indent += 2;
+ Array.prototype.forEach.call(element.childNodes,
+ function(node) {
+ serialize_element(node, indent);
+ });
+ }
+ serialize_element(element, 0);
+ return lines.join("\n");
+}
+
+function print_diffs(test_id, uri_encoded_input, expected, actual, container) {
+ container = container ? container : null;
+ if (actual) {
+ var diffs = mark_diffs(expected, actual);
+ var expected_text = diffs[0];
+ var actual_text = diffs[1];
+ } else {
+ var expected_text = expected;
+ var actual_text = "";
+ }
+
+ var tmpl = ["div", {"id":"${test_id}"},
+ ["h2", {}, "${test_id}"],
+ function(vars) {
+ if (vars.container !== null) {
+ return ["div", {"class":"container"},
+ ["h3", {}, "innerHTML Container"],
+ ["pre", {}, vars.container]];
+ } else {
+ return null;
+ }
+ },
+ ["div", {"id":"input_${test_id}"}, ["h3", {}, "Input"], ["pre", {},
+ ["code", {}, decodeURIComponent(uri_encoded_input)]]],
+ ["div", {"id":"expected_${test_id}"}, ["h3", {}, "Expected"],
+ ["pre", {}, ["code", {}, expected_text]]],
+ ["div", {"id":"actual_${test_id}"}, ["h3", {}, "Actual"],
+ ["pre", {}, ["code", {}, actual_text]]]
+ ];
+
+ var diff_dom = template.render(tmpl, {test_id:test_id, container:container});
+ document.body.appendChild(diff_dom);
+}
+
+function runTests(tests) {
+ tests.forEach(function(test){
+ var expected = decodeURIComponent(test.expected);
+ var t = async_test(document.title + ' - ' + test.name);
+ t.step(function(){
+ var video = document.createElement('video');
+ var track = document.createElement('track');
+ assert_true('src' in track, 'track not supported');
+ t.test_id = test.name;
+ t.url_encoded_input = test.input;
+ t.expected = expected;
+ track.src = 'data:text/vtt,'+encodeURIComponent('WEBVTT\n\n00:00.000 --> 00:01.000\n')+test.input;
+ track['default'] = true;
+ track.kind = 'subtitles';
+ track.onload = t.step_func(trackLoaded);
+ track.onerror = t.step_func(trackError);
+ video.appendChild(track);
+ document.body.appendChild(video);
+ });
+ });
+}
+
+function trackLoaded(e) {
+ var track = e.target;
+ setTimeout(removeElm, 0, track.parentNode);
+ var cue = track.track.cues[0];
+ var frag = cue.getCueAsHTML();
+ var got = test_serializer(frag);
+ if (got !== this.expected) {
+ print_diffs(this.test_id, this.url_encoded_input, this.expected, got);
+ }
+ assert_equals(got, this.expected);
+ this.done();
+}
+
+function trackError(e) {
+ setTimeout(removeElm, 0, e.target.parentNode);
+ assert_unreached('got error event');
+ this.done();
+}
+
+function removeElm(elm) {
+ document.body.removeChild(elm);
+}
diff --git a/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/entities.dat b/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/entities.dat
new file mode 100644
index 000000000..cddcb27ff
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/entities.dat
@@ -0,0 +1,114 @@
+#data
+&
+#errors
+#document-fragment
+| "&"
+
+#data
+&amp
+#errors
+#document-fragment
+| "&amp"
+
+#data
+&amp;
+#errors
+#document-fragment
+| "&"
+
+#data
+&AMP;
+#errors
+#document-fragment
+| "&AMP;"
+
+#data
+&lt;
+#errors
+#document-fragment
+| "<"
+
+#data
+&gt;
+#errors
+#document-fragment
+| ">"
+
+#data
+a&lrm;b
+#errors
+#document-fragment
+| "a‎b"
+
+#data
+a&rlm;b
+#errors
+#document-fragment
+| "a‏b"
+
+#data
+&quot;
+#errors
+#document-fragment
+| "&quot;"
+
+#data
+&nbsp;
+#errors
+#document-fragment
+| " "
+
+#data
+&copy;
+#errors
+#document-fragment
+| "&copy;"
+
+#data
+&&
+#errors
+#document-fragment
+| "&&"
+
+#data
+&1
+#errors
+#document-fragment
+| "&1"
+
+#data
+&1;
+#errors
+#document-fragment
+| "&1;"
+
+#data
+&<
+#errors
+#document-fragment
+| "&"
+
+#data
+&<c
+#errors
+#document-fragment
+| "&"
+| <span>
+
+#data
+&#32;
+#errors
+#document-fragment
+| "&#32;"
+
+#data
+&#x20;
+#errors
+#document-fragment
+| "&#x20;"
+
+#data
+&;
+#errors
+#document-fragment
+| "&;"
diff --git a/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/tags.dat b/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/tags.dat
new file mode 100644
index 000000000..425af32e2
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/tags.dat
@@ -0,0 +1,56 @@
+#data
+<
+#errors
+#document-fragment
+
+#data
+<<
+#errors
+#document-fragment
+
+#data
+<
+#errors
+#document-fragment
+
+#data
+<
+
+#errors
+#document-fragment
+
+#data
+<
+#errors
+#document-fragment
+
+#data
+<.
+#errors
+#document-fragment
+
+#data
+<c.
+#errors
+#document-fragment
+| <span>
+
+#data
+</
+#errors
+#document-fragment
+
+#data
+<c></>x
+#errors
+#document-fragment
+| <span>
+| "x"
+
+#data
+<c></
+c>x
+#errors
+#document-fragment
+| <span>
+| "x"
diff --git a/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/timestamps.dat b/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/timestamps.dat
new file mode 100644
index 000000000..ba0f686ae
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/timestamps.dat
@@ -0,0 +1,58 @@
+#data
+<0
+#errors
+#document-fragment
+
+#data
+<0.500
+#errors
+#document-fragment
+
+#data
+<0:00.500
+#errors
+#document-fragment
+
+#data
+<00:00.500
+#errors
+#document-fragment
+| <?timestamp 00:00:00.500>
+
+#data
+<00:00:00.500
+#errors
+#document-fragment
+| <?timestamp 00:00:00.500>
+
+#data
+test<00:00:00.500>test
+#errors
+#document-fragment
+| "test"
+| <?timestamp 00:00:00.500>
+| "test"
+
+#data
+test<01:00:00.000>test
+#errors
+#document-fragment
+| "test"
+| <?timestamp 01:00:00.000>
+| "test"
+
+#data
+test<10:00:00.000>test
+#errors
+#document-fragment
+| "test"
+| <?timestamp 10:00:00.000>
+| "test"
+
+#data
+test<100:00:00.000>test
+#errors
+#document-fragment
+| "test"
+| <?timestamp 100:00:00.000>
+| "test"
diff --git a/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/tree-building.dat b/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/tree-building.dat
new file mode 100644
index 000000000..08410d1ff
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/tree-building.dat
@@ -0,0 +1,171 @@
+#data
+test
+#errors
+#document-fragment
+| "test"
+
+#data
+<c>test
+#errors
+#document-fragment
+| <span>
+| "test"
+
+#data
+<i>test
+#errors
+#document-fragment
+| <i>
+| "test"
+
+#data
+<b>test
+#errors
+#document-fragment
+| <b>
+| "test"
+
+#data
+<u>test
+#errors
+#document-fragment
+| <u>
+| "test"
+
+#data
+<ruby>test
+#errors
+#document-fragment
+| <ruby>
+| "test"
+
+#data
+<rt>test
+#errors
+#document-fragment
+| "test"
+
+#data
+<ruby>test<rt>test
+#errors
+#document-fragment
+| <ruby>
+| "test"
+| <rt>
+| "test"
+
+#data
+<ruby>test<rt>test</rt>test
+#errors
+#document-fragment
+| <ruby>
+| "test"
+| <rt>
+| "test"
+| "test"
+
+#data
+<ruby>test<rt>test</rt></ruby>test
+#errors
+#document-fragment
+| <ruby>
+| "test"
+| <rt>
+| "test"
+| "test"
+
+#data
+<ruby>test<rt>test</ruby>test
+#errors
+#document-fragment
+| <ruby>
+| "test"
+| <rt>
+| "test"
+| "test"
+
+#data
+<ruby>test<rt><b>test</rt></ruby>test
+#errors
+#document-fragment
+| <ruby>
+| "test"
+| <rt>
+| <b>
+| "test"
+| "test"
+
+#data
+<ruby>test<rt><b>test</ruby>test
+#errors
+#document-fragment
+| <ruby>
+| "test"
+| <rt>
+| <b>
+| "test"
+| "test"
+
+#data
+<ruby>test<rt><b>test</rt></ruby></b>test
+#errors
+#document-fragment
+| <ruby>
+| "test"
+| <rt>
+| <b>
+| "test"
+| "test"
+
+#data
+<ruby>test<rt><b>test</rt></b></ruby>test
+#errors
+#document-fragment
+| <ruby>
+| "test"
+| <rt>
+| <b>
+| "test"
+| "test"
+
+#data
+<v>test
+#errors
+#document-fragment
+| <span>
+| title=""
+| "test"
+
+#data
+<v a>test
+#errors
+#document-fragment
+| <span>
+| title="a"
+| "test"
+
+#data
+<v a b>test
+#errors
+#document-fragment
+| <span>
+| title="a b"
+| "test"
+
+#data
+<v.a>test
+#errors
+#document-fragment
+| <span>
+| class="a"
+| title=""
+| "test"
+
+#data
+<v.a.b>test
+#errors
+#document-fragment
+| <span>
+| class="a b"
+| title=""
+| "test"
diff --git a/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/entities.html b/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/entities.html
new file mode 100644
index 000000000..2568258a2
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/entities.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<title>WebVTT cue data parser test entities</title>
+<style>video { display:none }</style>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=/html/syntax/parsing/template.js></script>
+<script src=/html/syntax/parsing/common.js></script>
+<script src=../common.js></script>
+<div id=log></div>
+<script>
+runTests([
+{name:'3686fc0cdc60dc536e75df054b0bd372273db2cc', input:'%26', expected:'%23document-fragment%0A%7C%20%22%26%22'},
+{name:'f1869f6e2853635eec81cc3afa3e2b8148ccbdc0', input:'%26amp', expected:'%23document-fragment%0A%7C%20%22%26amp%22'},
+{name:'92d76530d723b6b4e4ef8280c01cf1c80f9bebdb', input:'%26amp%3B', expected:'%23document-fragment%0A%7C%20%22%26%22'},
+{name:'261cd4e9df4a12535b66a0c39e9635aab2bb19aa', input:'%26AMP%3B', expected:'%23document-fragment%0A%7C%20%22%26AMP%3B%22'},
+{name:'1a2269cdb73bf97ec6a99b0edabfe646c471b67e', input:'%26lt%3B', expected:'%23document-fragment%0A%7C%20%22%3C%22'},
+{name:'44ceb90884cceeeccb4f7024e3598f7dc5ceebfa', input:'%26gt%3B', expected:'%23document-fragment%0A%7C%20%22%3E%22'},
+{name:'05def72af03fc2b1617da950d871b9fd0ba20e5a', input:'a%26lrm%3Bb', expected:'%23document-fragment%0A%7C%20%22a%E2%80%8Eb%22'},
+{name:'da999a55445eca43aa41e039ec439c1a812db297', input:'a%26rlm%3Bb', expected:'%23document-fragment%0A%7C%20%22a%E2%80%8Fb%22'},
+{name:'0fd9e3823b62c028c1d50e35b1f3ee3df02a62eb', input:'%26quot%3B', expected:'%23document-fragment%0A%7C%20%22%26quot%3B%22'},
+{name:'e7387003fbacb22b706796c98b781eb4ebf5ff85', input:'%26nbsp%3B', expected:'%23document-fragment%0A%7C%20%22%C2%A0%22'},
+{name:'216cd0e914b9f2ccd04eff6d02a0b1ce24441d95', input:'%26copy%3B', expected:'%23document-fragment%0A%7C%20%22%26copy%3B%22'},
+{name:'2cdf20980d17a5d077299215e6a7e97f3c6b07e2', input:'%26%26', expected:'%23document-fragment%0A%7C%20%22%26%26%22'},
+{name:'83f4500c0bd8598480713997a041d8f70fd3f11e', input:'%261', expected:'%23document-fragment%0A%7C%20%22%261%22'},
+{name:'2c6b2ba38a08eca45370f28a5b7df2aa463fb3dc', input:'%261%3B', expected:'%23document-fragment%0A%7C%20%22%261%3B%22'},
+{name:'f4bb977c0a06851bdd19260c035a766c5c8ea093', input:'%26%3C', expected:'%23document-fragment%0A%7C%20%22%26%22'},
+{name:'b1fff1ac42688d16e00f6c758d84e5152e39702d', input:'%26%3Cc', expected:'%23document-fragment%0A%7C%20%22%26%22%0A%7C%20%3Cspan%3E'},
+{name:'bd68f6beda2c2264e61dff7359c1ad48bc0a9934', input:'%26%2332%3B', expected:'%23document-fragment%0A%7C%20%22%26%2332%3B%22'},
+{name:'5b77a0be23453dfe6eea59d43bb0708f89e1df82', input:'%26%23x20%3B', expected:'%23document-fragment%0A%7C%20%22%26%23x20%3B%22'},
+{name:'87986551b0e6180cb279f2aa4cdddf77daa90c11', input:'%26%3B', expected:'%23document-fragment%0A%7C%20%22%26%3B%22'}
+]);
+</script>
diff --git a/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/tags.html b/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/tags.html
new file mode 100644
index 000000000..d42478dc9
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/tags.html
@@ -0,0 +1,23 @@
+<!doctype html>
+<title>WebVTT cue data parser test tags</title>
+<style>video { display:none }</style>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=/html/syntax/parsing/template.js></script>
+<script src=/html/syntax/parsing/common.js></script>
+<script src=../common.js></script>
+<div id=log></div>
+<script>
+runTests([
+{name:'d49e42f7582c6f00b2569f2d14629611c0c6b0e6', input:'%3C', expected:'%23document-fragment'},
+{name:'9dd187edd10c907e6b92148fd82940e401dbe79f', input:'%3C%3C', expected:'%23document-fragment'},
+{name:'2d2c4333983e23a4962083e8120e5d42c839f77b', input:'%3C%09', expected:'%23document-fragment'},
+{name:'94f898df44b470e2d05d74c6816fd908e55c9fdf', input:'%3C%0A', expected:'%23document-fragment'},
+{name:'2fdc1b84ba41ec98833851e80781df1fbe72182f', input:'%3C%20', expected:'%23document-fragment'},
+{name:'487690a6f5da4666f9caaf3a3ecc10992aca1414', input:'%3C.', expected:'%23document-fragment'},
+{name:'0d7df935b172f2a1b357b94596d68f2443f30f8b', input:'%3Cc.', expected:'%23document-fragment%0A%7C%20%3Cspan%3E'},
+{name:'cd1d6dd274e03ae8fc56bc4ef163998d9ff24496', input:'%3C/', expected:'%23document-fragment'},
+{name:'fca1a11d42b735453117f42456360e88082a3fd7', input:'%3Cc%3E%3C/%3Ex', expected:'%23document-fragment%0A%7C%20%3Cspan%3E%0A%7C%20%20%20%22x%22'},
+{name:'fe3b6277edf5c2f84e7a6779eddd0cac30552bca', input:'%3Cc%3E%3C/%0Ac%3Ex', expected:'%23document-fragment%0A%7C%20%3Cspan%3E%0A%7C%20%20%20%22x%22'}
+]);
+</script>
diff --git a/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/timestamps.html b/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/timestamps.html
new file mode 100644
index 000000000..bc19e2d8e
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/timestamps.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<title>WebVTT cue data parser test timestamps</title>
+<style>video { display:none }</style>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=/html/syntax/parsing/template.js></script>
+<script src=/html/syntax/parsing/common.js></script>
+<script src=../common.js></script>
+<div id=log></div>
+<script>
+runTests([
+{name:'54c245f3fbe7a3e25398b13971d44f2bb3a5f947', input:'%3C0', expected:'%23document-fragment'},
+{name:'5e190a1b4541fcb10e403af111c14ef152fecb0d', input:'%3C0.500', expected:'%23document-fragment'},
+{name:'92b97d3497836259e0b9305e27f2b91ea1dc9b31', input:'%3C0%3A00.500', expected:'%23document-fragment'},
+{name:'47fa4306a695161da88533d456ce94829e53b13d', input:'%3C00%3A00.500', expected:'%23document-fragment%0A%7C%20%3C%3Ftimestamp%2000%3A00%3A00.500%3E'},
+{name:'c1036a4322c1852e02e5a1843a9a81dfca6d7af3', input:'%3C00%3A00%3A00.500', expected:'%23document-fragment%0A%7C%20%3C%3Ftimestamp%2000%3A00%3A00.500%3E'},
+{name:'70ec34d828ca661a583c651207becb968bb41653', input:'test%3C00%3A00%3A00.500%3Etest', expected:'%23document-fragment%0A%7C%20%22test%22%0A%7C%20%3C%3Ftimestamp%2000%3A00%3A00.500%3E%0A%7C%20%22test%22'},
+{name:'66ba641ff047a226fa60fe867fd2479d40f3ff0f', input:'test%3C01%3A00%3A00.000%3Etest', expected:'%23document-fragment%0A%7C%20%22test%22%0A%7C%20%3C%3Ftimestamp%2001%3A00%3A00.000%3E%0A%7C%20%22test%22'},
+{name:'398e8da1aaaf392739ca72057fef58bd5333f74d', input:'test%3C10%3A00%3A00.000%3Etest', expected:'%23document-fragment%0A%7C%20%22test%22%0A%7C%20%3C%3Ftimestamp%2010%3A00%3A00.000%3E%0A%7C%20%22test%22'},
+{name:'391fce67644cf4dd9967e1436d1449ef5baf675f', input:'test%3C100%3A00%3A00.000%3Etest', expected:'%23document-fragment%0A%7C%20%22test%22%0A%7C%20%3C%3Ftimestamp%20100%3A00%3A00.000%3E%0A%7C%20%22test%22'}
+]);
+</script>
diff --git a/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/tree-building.html b/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/tree-building.html
new file mode 100644
index 000000000..98062f830
--- /dev/null
+++ b/testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/tree-building.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<title>WebVTT cue data parser test tree-building</title>
+<style>video { display:none }</style>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=/html/syntax/parsing/template.js></script>
+<script src=/html/syntax/parsing/common.js></script>
+<script src=../common.js></script>
+<div id=log></div>
+<script>
+runTests([
+{name:'4e1243bd22c66e76c2ba9eddc1f91394e57f9f83', input:'test', expected:'%23document-fragment%0A%7C%20%22test%22'},
+{name:'6ceded63b53eeab3681a0fc540e959ca88f7dce9', input:'%3Cc%3Etest', expected:'%23document-fragment%0A%7C%20%3Cspan%3E%0A%7C%20%20%20%22test%22'},
+{name:'71de37451e7d5524eacc8a190d21cd64c4304e14', input:'%3Ci%3Etest', expected:'%23document-fragment%0A%7C%20%3Ci%3E%0A%7C%20%20%20%22test%22'},
+{name:'985284b688a09f1f55e3c9aab49d7e4ca11f870a', input:'%3Cb%3Etest', expected:'%23document-fragment%0A%7C%20%3Cb%3E%0A%7C%20%20%20%22test%22'},
+{name:'fa6993eaa94404648d8b52e2830e53369404fdcb', input:'%3Cu%3Etest', expected:'%23document-fragment%0A%7C%20%3Cu%3E%0A%7C%20%20%20%22test%22'},
+{name:'e4d351e1a6b40a7dace801b722efaa200c4895f2', input:'%3Cruby%3Etest', expected:'%23document-fragment%0A%7C%20%3Cruby%3E%0A%7C%20%20%20%22test%22'},
+{name:'68e1d0376f827ebe0c047751a2067594ff41b612', input:'%3Crt%3Etest', expected:'%23document-fragment%0A%7C%20%22test%22'},
+{name:'2564487cfc7e317428fb437ef8de8de4f4963426', input:'%3Cruby%3Etest%3Crt%3Etest', expected:'%23document-fragment%0A%7C%20%3Cruby%3E%0A%7C%20%20%20%22test%22%0A%7C%20%20%20%3Crt%3E%0A%7C%20%20%20%20%20%22test%22'},
+{name:'9b1902c975558eeaff4afbaf0a6dc100e1978769', input:'%3Cruby%3Etest%3Crt%3Etest%3C/rt%3Etest', expected:'%23document-fragment%0A%7C%20%3Cruby%3E%0A%7C%20%20%20%22test%22%0A%7C%20%20%20%3Crt%3E%0A%7C%20%20%20%20%20%22test%22%0A%7C%20%20%20%22test%22'},
+{name:'119c596ea09649d3bd03934485e3067e89377412', input:'%3Cruby%3Etest%3Crt%3Etest%3C/rt%3E%3C/ruby%3Etest', expected:'%23document-fragment%0A%7C%20%3Cruby%3E%0A%7C%20%20%20%22test%22%0A%7C%20%20%20%3Crt%3E%0A%7C%20%20%20%20%20%22test%22%0A%7C%20%22test%22'},
+{name:'c94512b045699cb72f730e46b2a0a3bed2c939f9', input:'%3Cruby%3Etest%3Crt%3Etest%3C/ruby%3Etest', expected:'%23document-fragment%0A%7C%20%3Cruby%3E%0A%7C%20%20%20%22test%22%0A%7C%20%20%20%3Crt%3E%0A%7C%20%20%20%20%20%22test%22%0A%7C%20%22test%22'},
+{name:'325c1e590e74f1ff33ca5b4838c04cf6b6dd71ba', input:'%3Cruby%3Etest%3Crt%3E%3Cb%3Etest%3C/rt%3E%3C/ruby%3Etest', expected:'%23document-fragment%0A%7C%20%3Cruby%3E%0A%7C%20%20%20%22test%22%0A%7C%20%20%20%3Crt%3E%0A%7C%20%20%20%20%20%3Cb%3E%0A%7C%20%20%20%20%20%20%20%22test%22%0A%7C%20%20%20%20%20%20%20%22test%22'},
+{name:'92847ed2694c9639ba96f4cc61e2215362a74904', input:'%3Cruby%3Etest%3Crt%3E%3Cb%3Etest%3C/ruby%3Etest', expected:'%23document-fragment%0A%7C%20%3Cruby%3E%0A%7C%20%20%20%22test%22%0A%7C%20%20%20%3Crt%3E%0A%7C%20%20%20%20%20%3Cb%3E%0A%7C%20%20%20%20%20%20%20%22test%22%0A%7C%20%20%20%20%20%20%20%22test%22'},
+{name:'c0da62d1c8716ca544c96799f06ac7e4664500fb', input:'%3Cruby%3Etest%3Crt%3E%3Cb%3Etest%3C/rt%3E%3C/ruby%3E%3C/b%3Etest', expected:'%23document-fragment%0A%7C%20%3Cruby%3E%0A%7C%20%20%20%22test%22%0A%7C%20%20%20%3Crt%3E%0A%7C%20%20%20%20%20%3Cb%3E%0A%7C%20%20%20%20%20%20%20%22test%22%0A%7C%20%20%20%20%20%22test%22'},
+{name:'b85bd616672eba0591718182ef32e3307d223bb0', input:'%3Cruby%3Etest%3Crt%3E%3Cb%3Etest%3C/rt%3E%3C/b%3E%3C/ruby%3Etest', expected:'%23document-fragment%0A%7C%20%3Cruby%3E%0A%7C%20%20%20%22test%22%0A%7C%20%20%20%3Crt%3E%0A%7C%20%20%20%20%20%3Cb%3E%0A%7C%20%20%20%20%20%20%20%22test%22%0A%7C%20%22test%22'},
+{name:'ab2024b4e65ed64a751adbe8aae1e84ee61bf3e6', input:'%3Cv%3Etest', expected:'%23document-fragment%0A%7C%20%3Cspan%3E%0A%7C%20%20%20title%3D%22%22%0A%7C%20%20%20%22test%22'},
+{name:'10f4823ffb17c71654c4602bc45c58300e3ecbcc', input:'%3Cv%20a%3Etest', expected:'%23document-fragment%0A%7C%20%3Cspan%3E%0A%7C%20%20%20title%3D%22a%22%0A%7C%20%20%20%22test%22'},
+{name:'909924ef392fb20c9526acfa4f18f891eda61a0c', input:'%3Cv%20a%20b%3Etest', expected:'%23document-fragment%0A%7C%20%3Cspan%3E%0A%7C%20%20%20title%3D%22a%20b%22%0A%7C%20%20%20%22test%22'},
+{name:'e5ca35cc29404efc0ebd58aa5f6efefc86fc5287', input:'%3Cv.a%3Etest', expected:'%23document-fragment%0A%7C%20%3Cspan%3E%0A%7C%20%20%20class%3D%22a%22%0A%7C%20%20%20title%3D%22%22%0A%7C%20%20%20%22test%22'},
+{name:'e535c486dac7dc571463b150adc55fd841bc3008', input:'%3Cv.a.b%3Etest', expected:'%23document-fragment%0A%7C%20%3Cspan%3E%0A%7C%20%20%20class%3D%22a%20b%22%0A%7C%20%20%20title%3D%22%22%0A%7C%20%20%20%22test%22'}
+]);
+</script>