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

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 Nirnimesh's most recent comments. Created 8 years, 9 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
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | chrome/test/functional/PYAUTO_TESTS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 This example webapp uses explicitly raised events in a simulated
6 asyncronous login flow. -->
7 <html>
8
9 <head>
10 <title>AppTest Example</title>
11 <script type="text/javascript">
12 var globalTimeout;
13
14 function write(str) {
15 document.getElementById("console").innerHTML += "> " + str + "<br \>";
16 }
17
18 /* Calls a function after a specified number of miliseconds. */
19 function delayedCallback(f, ms) {
20 globalTimeout = setTimeout(f, ms);
21 }
22
23 /* Adds an event with the given name to the AutomationEventQueue. */
24 function raiseEvent(str) {
25 if (window.domAutomationController) {
26 window.domAutomationController.setAutomationId(424242)
27 window.domAutomationController.send(str);
28 }
29 }
30
31 function init() {
32 write("Initializing...");
33 delayedCallback(createLoginLink, 2000);
34 raiseEvent("init");
35 }
36
37 function createLoginLink() {
38 write("<a id='login' href='' onclick='return login();'>Log In</a>");
39 raiseEvent("login ready");
40 }
41
42 function login() {
43 write("Logging in...");
44 delayedCallback(loginSuccess, 2000);
45 raiseEvent("login start");
46 return false;
47 }
48
49 function loginSuccess() {
50 write("Login succeeded!");
51 raiseEvent("login done");
52 }
53
54 function fail() {
55 clearTimeout(globalTimeout);
56 write("App failed!");
57 raiseEvent("error");
58 return false;
59 }
60 </script>
61 </head>
62
63 <body onload="init()">
64 <div id="s-1">
65 [ <a id='fail' href='' onclick='return fail();'>Fail Test</a> ]
66 <br /><br />
67 </div>
68
69 <div id="console">
70 </div>
71
72 </body>
73
74 </html>
OLDNEW
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | chrome/test/functional/PYAUTO_TESTS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698