summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/encoding/resources/parser-tests.js
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-06 11:45:16 +0100
committerSteve Block <steveblock@google.com>2011-05-12 13:44:10 +0100
commitcad810f21b803229eb11403f9209855525a25d57 (patch)
tree29a6fd0279be608e0fe9ffe9841f722f0f4e4269 /LayoutTests/fast/encoding/resources/parser-tests.js
parent121b0cf4517156d0ac5111caf9830c51b69bae8f (diff)
downloadexternal_webkit-cad810f21b803229eb11403f9209855525a25d57.zip
external_webkit-cad810f21b803229eb11403f9209855525a25d57.tar.gz
external_webkit-cad810f21b803229eb11403f9209855525a25d57.tar.bz2
Merge WebKit at r75315: Initial merge by git.
Change-Id: I570314b346ce101c935ed22a626b48c2af266b84
Diffstat (limited to 'LayoutTests/fast/encoding/resources/parser-tests.js')
-rw-r--r--LayoutTests/fast/encoding/resources/parser-tests.js64
1 files changed, 64 insertions, 0 deletions
diff --git a/LayoutTests/fast/encoding/resources/parser-tests.js b/LayoutTests/fast/encoding/resources/parser-tests.js
new file mode 100644
index 0000000..fb55af9
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/parser-tests.js
@@ -0,0 +1,64 @@
+document.write('<p>This test suite was converted from http://www.hixie.ch/tests/adhoc/html/parsing/encoding/all.html</p>' +
+ '<p>The suite has been broken up to run the tests in smaller batches.</p>' +
+ '<ul>Expected failures:' +
+ '<li>56, 57, 58, 59 - we do not run scripts during encoding detection phase and parser treats meta inside a script as text, not a tag.</li>' +
+ '<li>60 - parser treats meta inside style as text, not a tag.</li>' +
+ '<li>97, 99, 102 - we do not run scripts during encoding detection.</li>' +
+ '</ul>' +
+ '<p>Status: <span id="status">Tests did not run.</span></p>' +
+ '<p>Serious failures:</p>' +
+ '<ol id="failures">' +
+ '</ol>' +
+ '<p>(Tests are considered to pass even if they treat Win1254 and ISO-8859-4 as separate.)</p>' +
+ '<p><iframe id="test"></iframe></p>');
+
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+var frame = document.getElementById('test');
+var current = 0;
+var max = 0;
+
+function dotest() {
+ var s = current + '';
+ while (s.length < 3) s = '0' + s;
+ frame.src = 'resources/' + s + '.html';
+ window.receivedResults = function () {
+ var want = frame.contentWindow.document.getElementById('expected').firstChild.data;
+ var have = frame.contentWindow.document.getElementById('encoding').firstChild.data;
+ if (have == 'ISO-8859-9')
+ have = 'Windows-1254';
+ if (want != have) {
+ var li = document.createElement('li');
+ var a = document.createElement('a');
+ a.appendChild(document.createTextNode('test ' + s));
+ a.href = s + '.html';
+ li.appendChild(a);
+ li.appendChild(document.createTextNode(': expected ' + want + '; used ' + have));
+ var pre = document.createElement('pre');
+ pre.appendChild(document.createTextNode(frame.contentWindow.document.getElementsByTagName('pre')[0].firstChild.data));
+ li.appendChild(pre);
+ li.value = current;
+ document.getElementById('failures').appendChild(li);
+ }
+ current += 1;
+ if (current <= max)
+ dotest();
+ else {
+ frame.parentNode.removeChild(frame);
+ document.getElementById('status').innerText = "Tests ran.";
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }
+ };
+}
+
+function runtests(c, m) {
+ current = c;
+ max = m;
+ dotest();
+}
+
+function alert() { }