Commit 1d193ea0 authored by Dong Hwi Lee's avatar Dong Hwi Lee Committed by Commit Bot

Update tests with testharness.js testing framework for xmlviewer.

Change-Id: I8bbfa6893179d4c713b79852400d0f77d1754b1a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2071294
Commit-Queue: Kent Tamura <tkent@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#744401}
parent dc7bb093
<html> <html>
<head> <head>
<script> <script src="../resources/testharness.js"></script>
if (window.testRunner) { <script src="../resources/testharnessreport.js"></script>
testRunner.dumpAsText(); <script>
testRunner.setCanOpenWindows(); async_test((t) => {
testRunner.waitUntilDone(); let xmlWindow;
}
var xmlWindow; t.add_cleanup(() => { xmlWindow.close(); });
function print(str) function checkSourceXML() {
{ var sourceXML = xmlWindow.document.getElementById('webkit-xml-viewer-source-xml');
document.getElementById('output').textContent = str; assert_equals(typeof(sourceXML), 'object');
xmlWindow.close(); assert_equals(sourceXML.firstChild.nodeName, 'root', 'Content of source XML.');
testRunner.notifyDone();
}
function checkSourceXML() t.done();
{ }
var sourceXML = xmlWindow.document.getElementById('webkit-xml-viewer-source-xml');
if (sourceXML && sourceXML.firstChild.nodeName == 'root')
print('SUCCESS');
else
print('FAIL');
}
function onload() window.addEventListener("load", (e) => {
{ xmlWindow = window.open('resources/sample.xml',
xmlWindow = window.open('resources/sample.xml', "XMLViewerTestWindow"); 'XMLViewerTestWindow');
xmlWindow.onload = checkSourceXML; xmlWindow.onload = t.step_func(checkSourceXML);
} });
}, 'XMLTreeConverted');
</script> </script>
</head> </head>
<body onload="onload();"> <body>
<p>Tests extensions hooks in xml viewer.</p>
<div id='output'></div>
</body> </body>
</html> </html>
<html> <html>
<head> <head>
<script> <script src="../resources/testharness.js"></script>
if (window.testRunner) { <script src="../resources/testharnessreport.js"></script>
testRunner.dumpAsText(); <script>
testRunner.setCanOpenWindows(); async_test((t) => {
testRunner.waitUntilDone(); let xmlWindow;
}
var xmlWindow; t.add_cleanup(() => { xmlWindow.close(); });
function print(str) function checkWhitespaces() {
{ var sourcePretty = xmlWindow.document.getElementsByClassName('pretty-print')[0];
document.getElementById('output').textContent = str;
xmlWindow.close();
testRunner.notifyDone();
}
function checkWhiteSpaces() if (!sourcePretty || !sourcePretty.innerText) {
{ requestAnimationFrame(t.step_func(checkWhitespaces));
var sourcePretty = xmlWindow.document.getElementsByClassName("pretty-print")[0]; return;
}
if (!sourcePretty || !sourcePretty.innerText) { assert_true(sourcePretty.innerText.includes(' bar '));
requestAnimationFrame(checkWhiteSpaces);
return;
}
if (sourcePretty.innerText.includes(" bar ")) t.done();
print('SUCCESS'); }
else
print('FAIL');
}
function onload() window.addEventListener("load", (e) => {
{ xmlWindow = window.open('resources/leading-and-trailing-whitespaces.xml',
xmlWindow = window.open('resources/leading-and-trailing-whitespaces.xml', "XMLViewerTestWindow"); 'XMLViewerTestWindow');
xmlWindow.onload = checkWhiteSpaces; xmlWindow.onload = t.step_func(checkWhitespaces);
} });
}, 'XMLTreeConverted');
</script> </script>
</head> </head>
<body onload="onload();"> <body>
<p>Tests leading and trailing whitespaces in xml viewer.</p>
<div id='output'></div>
</body> </body>
</html> </html>
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