| <!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(); |
| } |
| |
| var outstandingScripts = 2; |
| function runTest() |
| { |
| if (testRunner.runUIScript) { |
| var uiScript = document.getElementById('ui-script1').text; |
| testRunner.runUIScript(uiScript, function(result) { |
| document.getElementById('results').textContent += 'Script 1:\n' + result; |
| --outstandingScripts; |
| checkIfScriptsComplete(); |
| }); |
| |
| var uiScript2 = document.getElementById('ui-script2').text; |
| testRunner.runUIScript(uiScript2, function(result) { |
| document.getElementById('results').textContent += 'Script 2:\n' + result; |
| --outstandingScripts; |
| checkIfScriptsComplete(); |
| }); |
| } |
| } |
| |
| function checkIfScriptsComplete(remaining) |
| { |
| if (outstandingScripts) |
| return; |
| |
| testRunner.notifyDone(); |
| } |
| |
| window.addEventListener('load', runTest, false); |
| </script> |
| </head> |
| <body> |
| |
| <pre id="results"></pre> |
| |
| </body> |
| </html> |
| . |