Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Side by Side Diff: chrome/test/data/apptest_basic.html

Issue 9372120: Implementation of AutomationEventQueue and associated framework to support generic non-blocking aut… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Dennis' comments. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698