OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
Nirnimesh
2012/02/24 23:18:09
I recommend moving this file a dir 'apptest' so th
| |
2 <!-- This is an example app used by chrome/functional/apptest.py to demonstrate | |
3 use of the Automation Event Queue for testing. --> | |
Nirnimesh
2012/02/24 23:18:09
testing -> testing webapps
Nirnimesh
2012/02/24 23:18:09
Describe a little what this app does.
"Simulates a
| |
4 <html> | |
5 | |
6 <head> | |
7 <title>AppTest Example</title> | |
8 <script type="text/javascript"> | |
9 var globalTimeout; | |
10 | |
11 function write(str) { | |
12 document.getElementById("console").innerHTML += "> " + str + "<br \>"; | |
13 } | |
14 | |
15 function delay(f, ms) { | |
Nirnimesh
2012/02/24 23:18:09
Add doc
Nirnimesh
2012/02/24 23:18:09
rename: delayedCallback
craigdh
2012/02/27 22:43:38
Done.
craigdh
2012/02/27 22:43:38
Done.
| |
16 globalTimeout = setTimeout(f, ms); | |
17 } | |
18 | |
19 function raiseEvent(str) { | |
20 if (window.domAutomationController) { | |
21 window.domAutomationController.setAutomationId(424242) | |
22 window.domAutomationController.send(str); | |
23 } | |
24 } | |
25 | |
26 function init() { | |
27 write("Initializing..."); | |
28 delay(loginReady, 2000); | |
29 raiseEvent("init"); | |
30 } | |
31 | |
32 function loginReady() { | |
Nirnimesh
2012/02/24 23:18:09
createLoginLink
craigdh
2012/02/27 22:43:38
Done.
| |
33 write("<a id='login' href='' onclick='return login();'>Log In</a>"); | |
34 raiseEvent("login ready"); | |
35 } | |
36 | |
37 function login() { | |
38 write("Logging in..."); | |
39 delay(loginSuccess, 2000); | |
40 raiseEvent("login start"); | |
41 return false; | |
Nirnimesh
2012/02/24 23:18:09
why?
craigdh
2012/02/27 22:43:38
If I remember my JS correctly, doesn't the onclick
| |
42 } | |
43 | |
44 function loginSuccess() { | |
45 write("Login succeeded!"); | |
46 raiseEvent("login done"); | |
47 } | |
48 | |
49 function fail() { | |
50 clearTimeout(globalTimeout); | |
51 write("App failed!"); | |
52 raiseEvent("error"); | |
53 return false; | |
54 } | |
55 </script> | |
56 </head> | |
57 | |
58 <body onload="init()"> | |
59 <div id="s-1"> | |
60 [ <a id='fail' href='' onclick='return fail();'>Fail Test</a> ] | |
61 <br /><br /> | |
62 </div> | |
63 | |
64 <div id="console"> | |
65 </div> | |
66 | |
67 </body> | |
68 | |
69 </html> | |
OLD | NEW |