Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chrome / test / data / apptest / dom_mutations.html
blobc03a9e49d548dfeefd0c0587be031c620e73b6fe
1 <!DOCTYPE html>
2 <!-- This is an example app used by chrome/functional/apptest.py to demonstrate
3 use of the Automation Event Queue for testing webapps using DomMutation
4 observers.
6 This example webapp simulates an asyncronous login flow. -->
7 <html>
9 <head>
10 <title>AppTest Example</title>
11 <script type="text/javascript">
12 var globalTimeout;
14 function write(str) {
15 document.getElementById("console").innerHTML += "> " + str + "<br \>";
18 /* Calls a function after a specified number of miliseconds. */
19 function delayedCallback(f, ms) {
20 globalTimeout = setTimeout(f, ms);
23 function init() {
24 write("Initializing...");
25 delayedCallback(createLoginLink, 2000);
28 function createLoginLink() {
29 write("<a id='login' href='' onclick='return login();'>Log In</a>");
32 function login() {
33 write("Logging in...");
34 delayedCallback(loginSuccess, 2000);
35 return false;
38 function loginSuccess() {
39 write("Login succeeded!");
40 document.getElementById("fail").innerHTML = "";
43 function fail() {
44 clearTimeout(globalTimeout);
45 write("App failed!");
46 return false;
48 </script>
49 </head>
51 <body onload="init()">
52 <div id="fail">
53 [ <a href='' onclick='return fail();'>Fail Test</a> ]
54 <br /><br />
55 </div>
57 <div id="console">
58 </div>
60 </body>
62 </html>