OLD | NEW |
---|---|
(Empty) | |
1 <html> | |
dennis_jeffrey
2012/02/23 19:26:36
I recommend adding a comment at the top of this fi
craigdh
2012/02/24 01:30:02
Done.
| |
2 | |
3 <head> | |
4 <title>AppTest Example</title> | |
5 <script type="text/javascript"> | |
6 var globalTimeout; | |
7 | |
8 function write(str) { | |
9 document.getElementById("console").innerHTML += "> " + str + "<br \>"; | |
10 } | |
11 | |
12 function delay(f, ms) { | |
13 globalTimeout = setTimeout(f, ms); | |
14 } | |
15 | |
16 function raiseEvent(str) { | |
17 if (window.domAutomationController) { | |
18 window.domAutomationController.setAutomationId(424242) | |
19 window.domAutomationController.send(str); | |
20 } | |
21 } | |
22 | |
23 function init() { | |
24 write("Initializing..."); | |
25 delay(loginReady, 2000); | |
26 raiseEvent("init"); | |
27 } | |
28 | |
29 function loginReady() { | |
30 write("<a id='login' href='' onclick='return login();'>Log In</a>"); | |
31 raiseEvent("login ready"); | |
32 } | |
33 | |
34 function login() { | |
35 write("Logging in..."); | |
36 delay(loginSuccess, 2000); | |
37 raiseEvent("login start"); | |
38 return false; | |
39 } | |
40 | |
41 function loginSuccess() { | |
42 write("Login succeeded!"); | |
43 raiseEvent("login done"); | |
44 } | |
45 | |
46 function fail() { | |
47 clearTimeout(globalTimeout); | |
48 write("App failed!"); | |
49 raiseEvent("error"); | |
50 return false; | |
51 } | |
52 </script> | |
53 </head> | |
54 | |
55 <body onload="init()"> | |
56 <div id="s-1"> | |
57 [ <a id='fail' href='' onclick='return fail();'>Fail Test</a> ] | |
58 <br /><br /> | |
59 </div> | |
60 | |
61 <div id="console"> | |
62 </div> | |
63 | |
64 </body> | |
65 | |
66 </html> | |
OLD | NEW |