blob: 43a392fb53985ce2763c61375be0c00dbc3fc97a [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script id="ui-script1" type="text/plain">
(function() {
var completions = 'Running UI-side script 1\n';
uiController.doAsyncTask(function() {
completions += 'Completed async task 1.1.\n';
uiController.doAsyncTask(function() {
completions += 'Completed async task 1.2.\n';
uiController.doAsyncTask(function() {
completions += 'Completed async task 1.3. Script done.\n';
uiController.uiScriptComplete(completions);
});
});
});
})();
</script>
<script id="ui-script2" type="text/plain">
(function() {
var completions2 = 'Running UI-side script 2\n';
uiController.doAsyncTask(function() {
completions2 += 'Completed async task 2.1. Script done.\n';
uiController.uiScriptComplete(completions2);
});
})();
</script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
let script1Result;
let script2Result;
var outstandingScripts = 2;
function runTest()
{
if (testRunner.runUIScript) {
var uiScript = document.getElementById('ui-script1').text;
testRunner.runUIScript(uiScript, function(result) {
script1Result = result;
--outstandingScripts;
checkIfScriptsComplete();
});
var uiScript2 = document.getElementById('ui-script2').text;
testRunner.runUIScript(uiScript2, function(result) {
script2Result = result;
--outstandingScripts;
checkIfScriptsComplete();
});
}
}
function checkIfScriptsComplete(remaining)
{
if (outstandingScripts)
return;
document.getElementById('results').textContent += 'Script 1:\n' + script1Result + 'Script 2:\n' + script2Result;
testRunner.notifyDone();
}
window.addEventListener('load', runTest, false);
</script>
</head>
<body>
<pre id="results"></pre>
</body>
</html>
.