Chromium Code Reviews| Index: chrome/test/data/apptest_basic.html |
| diff --git a/chrome/test/data/apptest_basic.html b/chrome/test/data/apptest_basic.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bedfa91e37dbe8d4a0d2c37e04e8386568d9dfaf |
| --- /dev/null |
| +++ b/chrome/test/data/apptest_basic.html |
| @@ -0,0 +1,69 @@ |
| +<!DOCTYPE html> |
|
Nirnimesh
2012/02/24 23:18:09
I recommend moving this file a dir 'apptest' so th
|
| +<!-- This is an example app used by chrome/functional/apptest.py to demonstrate |
| + 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
|
| +<html> |
| + |
| + <head> |
| + <title>AppTest Example</title> |
| + <script type="text/javascript"> |
| + var globalTimeout; |
| + |
| + function write(str) { |
| + document.getElementById("console").innerHTML += "> " + str + "<br \>"; |
| + } |
| + |
| + 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.
|
| + globalTimeout = setTimeout(f, ms); |
| + } |
| + |
| + function raiseEvent(str) { |
| + if (window.domAutomationController) { |
| + window.domAutomationController.setAutomationId(424242) |
| + window.domAutomationController.send(str); |
| + } |
| + } |
| + |
| + function init() { |
| + write("Initializing..."); |
| + delay(loginReady, 2000); |
| + raiseEvent("init"); |
| + } |
| + |
| + function loginReady() { |
|
Nirnimesh
2012/02/24 23:18:09
createLoginLink
craigdh
2012/02/27 22:43:38
Done.
|
| + write("<a id='login' href='' onclick='return login();'>Log In</a>"); |
| + raiseEvent("login ready"); |
| + } |
| + |
| + function login() { |
| + write("Logging in..."); |
| + delay(loginSuccess, 2000); |
| + raiseEvent("login start"); |
| + 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
|
| + } |
| + |
| + function loginSuccess() { |
| + write("Login succeeded!"); |
| + raiseEvent("login done"); |
| + } |
| + |
| + function fail() { |
| + clearTimeout(globalTimeout); |
| + write("App failed!"); |
| + raiseEvent("error"); |
| + return false; |
| + } |
| + </script> |
| + </head> |
| + |
| + <body onload="init()"> |
| + <div id="s-1"> |
| + [ <a id='fail' href='' onclick='return fail();'>Fail Test</a> ] |
| + <br /><br /> |
| + </div> |
| + |
| + <div id="console"> |
| + </div> |
| + |
| + </body> |
| + |
| +</html> |